From 65bca654895c94e83ef25008dc1c44cc822cfbab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 17 Feb 2018 00:00:06 +0100 Subject: GH-2150 Split out custom commands into a custom widget Now it is used from a global page and from a sub-page in the instance settings. --- application/pages/InstanceSettingsPage.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'application/pages/InstanceSettingsPage.cpp') diff --git a/application/pages/InstanceSettingsPage.cpp b/application/pages/InstanceSettingsPage.cpp index b146ffd8..71e90a32 100644 --- a/application/pages/InstanceSettingsPage.cpp +++ b/application/pages/InstanceSettingsPage.cpp @@ -12,6 +12,7 @@ #include #include #include +#include InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent) : QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst) @@ -130,13 +131,13 @@ void InstanceSettingsPage::applySettings() m_settings->reset("OverrideJava"); // Custom Commands - bool custcmd = ui->customCommandsGroupBox->isChecked(); + bool custcmd = ui->customCommands->checked(); m_settings->set("OverrideCommands", custcmd); if (custcmd) { - m_settings->set("PreLaunchCommand", ui->preLaunchCmdTextBox->text()); - m_settings->set("WrapperCommand", ui->wrapperCmdTextBox->text()); - m_settings->set("PostExitCommand", ui->postExitCmdTextBox->text()); + m_settings->set("PreLaunchCommand", ui->customCommands->prelaunchCommand()); + m_settings->set("WrapperCommand", ui->customCommands->wrapperCommand()); + m_settings->set("PostExitCommand", ui->customCommands->postexitCommand()); } else { @@ -187,11 +188,14 @@ void InstanceSettingsPage::loadSettings() ui->javaArgumentsGroupBox->setChecked(overrideArgs); ui->jvmArgsTextBox->setPlainText(m_settings->get("JvmArgs").toString()); - // Custom Commands - ui->customCommandsGroupBox->setChecked(m_settings->get("OverrideCommands").toBool()); - ui->preLaunchCmdTextBox->setText(m_settings->get("PreLaunchCommand").toString()); - ui->wrapperCmdTextBox->setText(m_settings->get("WrapperCommand").toString()); - ui->postExitCmdTextBox->setText(m_settings->get("PostExitCommand").toString()); + // Custom commands + ui->customCommands->initialize( + true, + m_settings->get("OverrideCommands").toBool(), + m_settings->get("PreLaunchCommand").toString(), + m_settings->get("WrapperCommand").toString(), + m_settings->get("PostExitCommand").toString() + ); } void InstanceSettingsPage::on_javaDetectBtn_clicked() -- cgit v1.2.3