Making "start default character at" field enabled or disabled by the previous checkbox

pull/456/head
Thunderforge 7 years ago
parent da74ca5ce0
commit 082e166fae

@ -177,28 +177,6 @@ void Launcher::SettingsPage::on_browseButton_clicked()
}
}
void Launcher::SettingsPage::on_runScriptAfterStartupBrowseButton_clicked()
{
QString scriptFile = QFileDialog::getOpenFileName(
this,
QObject::tr("Select script file"),
QDir::currentPath(),
QString(tr("Text file (*.txt)")));
if (scriptFile.isEmpty())
return;
QFileInfo info(scriptFile);
if (!info.exists() || !info.isReadable())
return;
const QString path(QDir::toNativeSeparators(info.absoluteFilePath()));
runScriptAfterStartupField->setText(path);
}
void Launcher::SettingsPage::wizardStarted()
{
mMain->hide(); // Hide the launcher
@ -269,6 +247,33 @@ void Launcher::SettingsPage::updateOkButton(const QString &text)
: mProfileDialog->setOkButtonEnabled(true);
}
void Launcher::SettingsPage::on_skipMenuCheckBox_stateChanged(int state) {
startDefaultCharacterAtLabel->setEnabled(state == Qt::Checked);
startDefaultCharacterAtField->setEnabled(state == Qt::Checked);
}
void Launcher::SettingsPage::on_runScriptAfterStartupBrowseButton_clicked()
{
QString scriptFile = QFileDialog::getOpenFileName(
this,
QObject::tr("Select script file"),
QDir::currentPath(),
QString(tr("Text file (*.txt)")));
if (scriptFile.isEmpty())
return;
QFileInfo info(scriptFile);
if (!info.exists() || !info.isReadable())
return;
const QString path(QDir::toNativeSeparators(info.absoluteFilePath()));
runScriptAfterStartupField->setText(path);
}
void Launcher::SettingsPage::saveSettings()
{
QString language(languageComboBox->currentText());
@ -307,8 +312,12 @@ bool Launcher::SettingsPage::loadSettings()
languageComboBox->setCurrentIndex(index);
// Testing
if (mGameSettings.value("skip-menu").toInt() == 1)
bool skipMenu = mGameSettings.value("skip-menu").toInt() == Qt::Checked;
if (skipMenu) {
skipMenuCheckBox->setCheckState(Qt::Checked);
}
startDefaultCharacterAtLabel->setEnabled(skipMenu);
startDefaultCharacterAtField->setEnabled(skipMenu);
startDefaultCharacterAtField->setText(mGameSettings.value("start"));
runScriptAfterStartupField->setText(mGameSettings.value("script-run"));

@ -38,7 +38,6 @@ namespace Launcher
void on_wizardButton_clicked();
void on_importerButton_clicked();
void on_browseButton_clicked();
void on_runScriptAfterStartupBrowseButton_clicked();
void wizardStarted();
void wizardFinished(int exitCode, QProcess::ExitStatus exitStatus);
@ -48,6 +47,9 @@ namespace Launcher
void updateOkButton(const QString &text);
void on_skipMenuCheckBox_stateChanged(int state);
void on_runScriptAfterStartupBrowseButton_clicked();
private:
Process::ProcessInvoker *mWizardInvoker;

Loading…
Cancel
Save