Merge pull request #1067 from RedsonBr140/feat/dont-hide-settings

feat: Don't hide the settings tab when an instance is running
This commit is contained in:
seth 2023-06-15 02:20:00 -04:00 committed by GitHub
commit 9908e115aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -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);
}

View File

@ -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();