Made java downloader as a build option
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
24fd07861b
commit
9120848278
@ -219,6 +219,9 @@ set(Launcher_SUBREDDIT_URL "https://prismlauncher.org/reddit" CACHE STRING "URL
|
|||||||
set(Launcher_FORCE_BUNDLED_LIBS OFF CACHE BOOL "Prevent using system libraries, if they are available as submodules")
|
set(Launcher_FORCE_BUNDLED_LIBS OFF CACHE BOOL "Prevent using system libraries, if they are available as submodules")
|
||||||
set(Launcher_QT_VERSION_MAJOR "6" CACHE STRING "Major Qt version to build against")
|
set(Launcher_QT_VERSION_MAJOR "6" CACHE STRING "Major Qt version to build against")
|
||||||
|
|
||||||
|
# Java downloader
|
||||||
|
option(ENABLE_JAVA_DOWNLOADER "Build the java downloader feature" ON)
|
||||||
|
|
||||||
# Native libraries
|
# Native libraries
|
||||||
if(UNIX AND APPLE)
|
if(UNIX AND APPLE)
|
||||||
set(Launcher_GLFW_LIBRARY_NAME "libglfw.dylib" CACHE STRING "Name of native glfw library")
|
set(Launcher_GLFW_LIBRARY_NAME "libglfw.dylib" CACHE STRING "Name of native glfw library")
|
||||||
|
@ -81,6 +81,10 @@ Config::Config()
|
|||||||
UPDATER_ENABLED = true;
|
UPDATER_ENABLED = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_JAVA_DOWNLOADER
|
||||||
|
JAVA_DOWNLOADER_ENABLED = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
GIT_COMMIT = "@Launcher_GIT_COMMIT@";
|
GIT_COMMIT = "@Launcher_GIT_COMMIT@";
|
||||||
GIT_TAG = "@Launcher_GIT_TAG@";
|
GIT_TAG = "@Launcher_GIT_TAG@";
|
||||||
GIT_REFSPEC = "@Launcher_GIT_REFSPEC@";
|
GIT_REFSPEC = "@Launcher_GIT_REFSPEC@";
|
||||||
|
@ -67,6 +67,7 @@ class Config {
|
|||||||
QString VERSION_CHANNEL;
|
QString VERSION_CHANNEL;
|
||||||
|
|
||||||
bool UPDATER_ENABLED = false;
|
bool UPDATER_ENABLED = false;
|
||||||
|
bool JAVA_DOWNLOADER_ENABLED = false;
|
||||||
|
|
||||||
/// A short string identifying this build's platform or distribution.
|
/// A short string identifying this build's platform or distribution.
|
||||||
QString BUILD_PLATFORM;
|
QString BUILD_PLATFORM;
|
||||||
|
@ -1320,6 +1320,10 @@ if(DEFINED Launcher_APP_BINARY_DEFS)
|
|||||||
target_compile_definitions(Launcher_logic PRIVATE ${Launcher_APP_BINARY_DEFS})
|
target_compile_definitions(Launcher_logic PRIVATE ${Launcher_APP_BINARY_DEFS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_JAVA_DOWNLOADER)
|
||||||
|
target_compile_definitions(Launcher_logic PUBLIC ENABLE_JAVA_DOWNLOADER)
|
||||||
|
endif()
|
||||||
|
|
||||||
install(TARGETS ${Launcher_Name}
|
install(TARGETS ${Launcher_Name}
|
||||||
BUNDLE DESTINATION "." COMPONENT Runtime
|
BUNDLE DESTINATION "." COMPONENT Runtime
|
||||||
LIBRARY DESTINATION ${LIBRARY_DEST_DIR} COMPONENT Runtime
|
LIBRARY DESTINATION ${LIBRARY_DEST_DIR} COMPONENT Runtime
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "JavaPage.h"
|
#include "JavaPage.h"
|
||||||
|
#include "BuildConfig.h"
|
||||||
#include "JavaCommon.h"
|
#include "JavaCommon.h"
|
||||||
#include "java/JavaInstall.h"
|
#include "java/JavaInstall.h"
|
||||||
#include "ui/dialogs/CustomMessageBox.h"
|
#include "ui/dialogs/CustomMessageBox.h"
|
||||||
@ -62,15 +63,21 @@ JavaPage::JavaPage(QWidget* parent) : QWidget(parent), ui(new Ui::JavaPage)
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->managedJavaList->initialize(new JavaInstallList(this, true));
|
if (BuildConfig.JAVA_DOWNLOADER_ENABLED) {
|
||||||
ui->managedJavaList->selectCurrent();
|
ui->managedJavaList->initialize(new JavaInstallList(this, true));
|
||||||
ui->managedJavaList->setEmptyString(tr("No java versions are currently available in the meta"));
|
ui->managedJavaList->selectCurrent();
|
||||||
ui->managedJavaList->setEmptyErrorString(tr("Couldn't load or download the java version lists!"));
|
ui->managedJavaList->setEmptyString(tr("No java versions are currently available in the meta"));
|
||||||
connect(ui->autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this] {
|
ui->managedJavaList->setEmptyErrorString(tr("Couldn't load or download the java version lists!"));
|
||||||
ui->autodownloadCheckBox->setEnabled(ui->autodetectJavaCheckBox->isChecked());
|
connect(ui->autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this] {
|
||||||
if (!ui->autodetectJavaCheckBox->isChecked())
|
ui->autodownloadCheckBox->setEnabled(ui->autodetectJavaCheckBox->isChecked());
|
||||||
ui->autodownloadCheckBox->setChecked(false);
|
if (!ui->autodetectJavaCheckBox->isChecked())
|
||||||
});
|
ui->autodownloadCheckBox->setChecked(false);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ui->autodownloadCheckBox->setHidden(true);
|
||||||
|
ui->javaDownloadBtn->setHidden(true);
|
||||||
|
ui->tabWidget->tabBar()->hide();
|
||||||
|
}
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
updateThresholds();
|
updateThresholds();
|
||||||
|
@ -64,6 +64,8 @@ InstanceSettingsPage::InstanceSettingsPage(BaseInstance* inst, QWidget* parent)
|
|||||||
m_settings = inst->settings();
|
m_settings = inst->settings();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
ui->javaDownloadBtn->setHidden(!BuildConfig.JAVA_DOWNLOADER_ENABLED);
|
||||||
|
|
||||||
connect(ui->openGlobalJavaSettingsButton, &QCommandLinkButton::clicked, this, &InstanceSettingsPage::globalSettingsButtonClicked);
|
connect(ui->openGlobalJavaSettingsButton, &QCommandLinkButton::clicked, this, &InstanceSettingsPage::globalSettingsButtonClicked);
|
||||||
connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::applySettings);
|
connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::applySettings);
|
||||||
connect(APPLICATION, &Application::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings);
|
connect(APPLICATION, &Application::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings);
|
||||||
|
@ -129,8 +129,10 @@ void JavaSettingsWidget::setupUi()
|
|||||||
m_horizontalBtnLayout = new QHBoxLayout();
|
m_horizontalBtnLayout = new QHBoxLayout();
|
||||||
m_horizontalBtnLayout->setObjectName(QStringLiteral("horizontalBtnLayout"));
|
m_horizontalBtnLayout->setObjectName(QStringLiteral("horizontalBtnLayout"));
|
||||||
|
|
||||||
m_javaDownloadBtn = new QPushButton(tr("Download Java"), this);
|
if (BuildConfig.JAVA_DOWNLOADER_ENABLED) {
|
||||||
m_horizontalBtnLayout->addWidget(m_javaDownloadBtn);
|
m_javaDownloadBtn = new QPushButton(tr("Download Java"), this);
|
||||||
|
m_horizontalBtnLayout->addWidget(m_javaDownloadBtn);
|
||||||
|
}
|
||||||
|
|
||||||
m_verticalLayout->addLayout(m_horizontalBtnLayout);
|
m_verticalLayout->addLayout(m_horizontalBtnLayout);
|
||||||
|
|
||||||
@ -143,15 +145,17 @@ void JavaSettingsWidget::setupUi()
|
|||||||
m_autodetectJavaCheckBox->setObjectName("autodetectJavaCheckBox");
|
m_autodetectJavaCheckBox->setObjectName("autodetectJavaCheckBox");
|
||||||
m_veriticalJavaLayout->addWidget(m_autodetectJavaCheckBox);
|
m_veriticalJavaLayout->addWidget(m_autodetectJavaCheckBox);
|
||||||
|
|
||||||
m_autodownloadCheckBox = new QCheckBox(m_autoJavaGroupBox);
|
if (BuildConfig.JAVA_DOWNLOADER_ENABLED) {
|
||||||
m_autodownloadCheckBox->setObjectName("autodownloadCheckBox");
|
m_autodownloadCheckBox = new QCheckBox(m_autoJavaGroupBox);
|
||||||
m_autodownloadCheckBox->setEnabled(false);
|
m_autodownloadCheckBox->setObjectName("autodownloadCheckBox");
|
||||||
m_veriticalJavaLayout->addWidget(m_autodownloadCheckBox);
|
m_autodownloadCheckBox->setEnabled(false);
|
||||||
connect(m_autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this] {
|
m_veriticalJavaLayout->addWidget(m_autodownloadCheckBox);
|
||||||
m_autodownloadCheckBox->setEnabled(m_autodetectJavaCheckBox->isChecked());
|
connect(m_autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this] {
|
||||||
if (!m_autodetectJavaCheckBox->isChecked())
|
m_autodownloadCheckBox->setEnabled(m_autodetectJavaCheckBox->isChecked());
|
||||||
m_autodownloadCheckBox->setChecked(false);
|
if (!m_autodetectJavaCheckBox->isChecked())
|
||||||
});
|
m_autodownloadCheckBox->setChecked(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
m_verticalLayout->addWidget(m_autoJavaGroupBox);
|
m_verticalLayout->addWidget(m_autoJavaGroupBox);
|
||||||
|
|
||||||
retranslate();
|
retranslate();
|
||||||
|
Loading…
Reference in New Issue
Block a user