aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-06-15 11:46:44 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-06-15 11:46:44 +0300
commit5bf091149df363ccea7d6226c7917e03168a5eda (patch)
tree0568758e8ec41e0ab6b6da5b67c4d3109d4c680f /launcher/ui/pages
parentbbd9e4de9b29e7cb58c7ec4e8a827fec59a8fb55 (diff)
parent9908e115aa6bdfcceefd1425406d1b6d1c1bdec4 (diff)
downloadPrismLauncher-5bf091149df363ccea7d6226c7917e03168a5eda.tar.gz
PrismLauncher-5bf091149df363ccea7d6226c7917e03168a5eda.tar.bz2
PrismLauncher-5bf091149df363ccea7d6226c7917e03168a5eda.zip
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into mods_txt
Diffstat (limited to 'launcher/ui/pages')
-rw-r--r--launcher/ui/pages/instance/InstanceSettingsPage.cpp14
-rw-r--r--launcher/ui/pages/instance/InstanceSettingsPage.h2
-rw-r--r--launcher/ui/pages/modplatform/ResourcePage.cpp9
3 files changed, 16 insertions, 9 deletions
diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.cpp b/launcher/ui/pages/instance/InstanceSettingsPage.cpp
index a583ab1d..08977841 100644
--- a/launcher/ui/pages/instance/InstanceSettingsPage.cpp
+++ b/launcher/ui/pages/instance/InstanceSettingsPage.cpp
@@ -60,6 +60,10 @@ InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
m_settings = inst->settings();
ui->setupUi(this);
+ // As the signal will (probably) not be triggered once we click edit, let's update it manually instead.
+ updateRunningStatus(m_instance->isRunning());
+
+ connect(m_instance, &BaseInstance::runningStatusChanged, this, &InstanceSettingsPage::updateRunningStatus);
connect(ui->openGlobalJavaSettingsButton, &QCommandLinkButton::clicked, this, &InstanceSettingsPage::globalSettingsButtonClicked);
connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::applySettings);
connect(APPLICATION, &Application::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings);
@@ -70,11 +74,6 @@ InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
updateThresholds();
}
-bool InstanceSettingsPage::shouldDisplay() const
-{
- return !m_instance->isRunning();
-}
-
InstanceSettingsPage::~InstanceSettingsPage()
{
delete ui;
@@ -524,3 +523,8 @@ void InstanceSettingsPage::updateThresholds()
ui->labelMaxMemIcon->setPixmap(pix);
}
}
+
+void InstanceSettingsPage::updateRunningStatus(bool running)
+{
+ setEnabled(!running);
+}
diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.h b/launcher/ui/pages/instance/InstanceSettingsPage.h
index 043c3e25..0438fe3b 100644
--- a/launcher/ui/pages/instance/InstanceSettingsPage.h
+++ b/launcher/ui/pages/instance/InstanceSettingsPage.h
@@ -75,12 +75,12 @@ public:
{
return "Instance-settings";
}
- virtual bool shouldDisplay() const override;
void retranslate() override;
void updateThresholds();
private slots:
+ void updateRunningStatus(bool running);
void on_javaDetectBtn_clicked();
void on_javaTestBtn_clicked();
void on_javaBrowseBtn_clicked();
diff --git a/launcher/ui/pages/modplatform/ResourcePage.cpp b/launcher/ui/pages/modplatform/ResourcePage.cpp
index 736034ad..1d2509d8 100644
--- a/launcher/ui/pages/modplatform/ResourcePage.cpp
+++ b/launcher/ui/pages/modplatform/ResourcePage.cpp
@@ -240,10 +240,13 @@ void ResourcePage::updateSelectionButton()
}
m_ui->resourceSelectionButton->setEnabled(true);
- if (!getCurrentPack()->isVersionSelected(m_selected_version_index)) {
- m_ui->resourceSelectionButton->setText(tr("Select %1 for download").arg(resourceString()));
+ if (getCurrentPack()) {
+ if (!getCurrentPack()->isVersionSelected(m_selected_version_index))
+ m_ui->resourceSelectionButton->setText(tr("Select %1 for download").arg(resourceString()));
+ else
+ m_ui->resourceSelectionButton->setText(tr("Deselect %1 for download").arg(resourceString()));
} else {
- m_ui->resourceSelectionButton->setText(tr("Deselect %1 for download").arg(resourceString()));
+ qWarning() << "Tried to update the selected button but there is not a pack selected";
}
}