mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-27 21:49:10 +02:00
Replaced checkboxes in settings with togglable buttons
This commit is contained in:
parent
7041836087
commit
1b8111ebae
@ -71,6 +71,20 @@ void CSettingsView::setDisplayList()
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingsView::setCheckbuttonState(QToolButton * button, bool checked)
|
||||
{
|
||||
button->setChecked(checked);
|
||||
updateCheckbuttonText(button);
|
||||
}
|
||||
|
||||
void CSettingsView::updateCheckbuttonText(QToolButton * button)
|
||||
{
|
||||
if (button->isChecked())
|
||||
button->setText(tr("On"));
|
||||
else
|
||||
button->setText(tr("Off"));
|
||||
}
|
||||
|
||||
void CSettingsView::loadSettings()
|
||||
{
|
||||
ui->comboBoxShowIntro->setCurrentIndex(settings["video"]["showIntro"].Bool());
|
||||
@ -97,7 +111,7 @@ void CSettingsView::loadSettings()
|
||||
ui->spinBoxInterfaceScaling->setValue(settings["video"]["resolution"]["scaling"].Float());
|
||||
ui->spinBoxFramerateLimit->setValue(settings["video"]["targetfps"].Float());
|
||||
ui->spinBoxFramerateLimit->setDisabled(settings["video"]["vsync"].Bool());
|
||||
ui->comboBoxVSync->setCurrentIndex(settings["video"]["vsync"].Bool());
|
||||
setCheckbuttonState(ui->buttonVSync, settings["video"]["vsync"].Bool());
|
||||
ui->sliderReservedArea->setValue(std::round(settings["video"]["reservedWidth"].Float() * 100));
|
||||
|
||||
ui->comboBoxFriendlyAI->setCurrentText(QString::fromStdString(settings["server"]["friendlyAI"].String()));
|
||||
@ -109,7 +123,7 @@ void CSettingsView::loadSettings()
|
||||
|
||||
ui->spinBoxNetworkPort->setValue(settings["server"]["localPort"].Integer());
|
||||
|
||||
ui->comboBoxAutoCheck->setCurrentIndex(settings["launcher"]["autoCheckRepositories"].Bool());
|
||||
setCheckbuttonState(ui->buttonAutoCheck, settings["launcher"]["autoCheckRepositories"].Bool());
|
||||
|
||||
ui->lineEditRepositoryDefault->setText(QString::fromStdString(settings["launcher"]["defaultRepositoryURL"].String()));
|
||||
ui->lineEditRepositoryExtra->setText(QString::fromStdString(settings["launcher"]["extraRepositoryURL"].String()));
|
||||
@ -117,16 +131,16 @@ void CSettingsView::loadSettings()
|
||||
ui->lineEditRepositoryDefault->setEnabled(settings["launcher"]["defaultRepositoryEnabled"].Bool());
|
||||
ui->lineEditRepositoryExtra->setEnabled(settings["launcher"]["extraRepositoryEnabled"].Bool());
|
||||
|
||||
ui->checkBoxRepositoryDefault->setChecked(settings["launcher"]["defaultRepositoryEnabled"].Bool());
|
||||
ui->checkBoxRepositoryExtra->setChecked(settings["launcher"]["extraRepositoryEnabled"].Bool());
|
||||
setCheckbuttonState(ui->buttonRepositoryDefault, settings["launcher"]["defaultRepositoryEnabled"].Bool());
|
||||
setCheckbuttonState(ui->buttonRepositoryExtra, settings["launcher"]["extraRepositoryEnabled"].Bool());
|
||||
|
||||
ui->checkBoxIgnoreSslErrors->setChecked(settings["launcher"]["ignoreSslErrors"].Bool());
|
||||
setCheckbuttonState(ui->buttonIgnoreSslErrors, settings["launcher"]["ignoreSslErrors"].Bool());
|
||||
|
||||
ui->comboBoxAutoSave->setCurrentIndex(settings["general"]["saveFrequency"].Integer() > 0 ? 1 : 0);
|
||||
|
||||
ui->spinBoxAutoSaveLimit->setValue(settings["general"]["autosaveCountLimit"].Integer());
|
||||
|
||||
ui->checkBoxAutoSavePrefix->setChecked(settings["general"]["useSavePrefix"].Bool());
|
||||
setCheckbuttonState(ui->buttonAutoSavePrefix, settings["general"]["useSavePrefix"].Bool());
|
||||
|
||||
ui->lineEditAutoSavePrefix->setText(QString::fromStdString(settings["general"]["savePrefix"].String()));
|
||||
ui->lineEditAutoSavePrefix->setEnabled(settings["general"]["useSavePrefix"].Bool());
|
||||
@ -502,18 +516,20 @@ void CSettingsView::on_pushButtonTranslation_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingsView::on_checkBoxRepositoryDefault_stateChanged(int arg1)
|
||||
void CSettingsView::on_buttonRepositoryDefault_stateChanged(int arg1)
|
||||
{
|
||||
Settings node = settings.write["launcher"]["defaultRepositoryEnabled"];
|
||||
node->Bool() = arg1;
|
||||
ui->lineEditRepositoryDefault->setEnabled(arg1);
|
||||
updateCheckbuttonText(ui->buttonRepositoryDefault);
|
||||
}
|
||||
|
||||
void CSettingsView::on_checkBoxRepositoryExtra_stateChanged(int arg1)
|
||||
void CSettingsView::on_buttonRepositoryExtra_stateChanged(int arg1)
|
||||
{
|
||||
Settings node = settings.write["launcher"]["extraRepositoryEnabled"];
|
||||
node->Bool() = arg1;
|
||||
ui->lineEditRepositoryExtra->setEnabled(arg1);
|
||||
updateCheckbuttonText(ui->buttonRepositoryExtra);
|
||||
}
|
||||
|
||||
void CSettingsView::on_lineEditRepositoryExtra_textEdited(const QString &arg1)
|
||||
@ -545,11 +561,12 @@ void CSettingsView::on_spinBoxFramerateLimit_valueChanged(int arg1)
|
||||
node->Float() = arg1;
|
||||
}
|
||||
|
||||
void CSettingsView::on_checkBoxVSync_stateChanged(int arg1)
|
||||
void CSettingsView::on_buttonVSync_stateChanged(int arg1)
|
||||
{
|
||||
Settings node = settings.write["video"]["vsync"];
|
||||
node->Bool() = arg1;
|
||||
ui->spinBoxFramerateLimit->setDisabled(settings["video"]["vsync"].Bool());
|
||||
updateCheckbuttonText(ui->buttonVSync);
|
||||
}
|
||||
|
||||
void CSettingsView::on_comboBoxEnemyPlayerAI_currentTextChanged(const QString &arg1)
|
||||
@ -564,11 +581,12 @@ void CSettingsView::on_comboBoxAlliedPlayerAI_currentTextChanged(const QString &
|
||||
node->String() = arg1.toUtf8().data();
|
||||
}
|
||||
|
||||
void CSettingsView::on_checkBoxAutoSavePrefix_stateChanged(int arg1)
|
||||
void CSettingsView::on_buttonAutoSavePrefix_stateChanged(int arg1)
|
||||
{
|
||||
Settings node = settings.write["general"]["useSavePrefix"];
|
||||
node->Bool() = arg1;
|
||||
ui->lineEditAutoSavePrefix->setEnabled(arg1);
|
||||
updateCheckbuttonText(ui->buttonAutoSavePrefix);
|
||||
}
|
||||
|
||||
void CSettingsView::on_spinBoxAutoSaveLimit_valueChanged(int arg1)
|
||||
@ -595,10 +613,11 @@ void CSettingsView::on_comboBoxRendererType_currentTextChanged(const QString &ar
|
||||
node->String() = arg1.toStdString();
|
||||
}
|
||||
|
||||
void CSettingsView::on_checkBoxIgnoreSslErrors_clicked(bool checked)
|
||||
void CSettingsView::on_buttonIgnoreSslErrors_clicked(bool checked)
|
||||
{
|
||||
Settings node = settings.write["launcher"]["ignoreSslErrors"];
|
||||
node->Bool() = checked;
|
||||
updateCheckbuttonText(ui->buttonIgnoreSslErrors);
|
||||
}
|
||||
|
||||
void CSettingsView::on_comboBoxUpscalingFilter_currentIndexChanged(int index)
|
||||
|
@ -28,6 +28,9 @@ public:
|
||||
void changeEvent(QEvent *event) override;
|
||||
void showEvent(QShowEvent * event) override;
|
||||
|
||||
void setCheckbuttonState(QToolButton * button, bool checked);
|
||||
void updateCheckbuttonText(QToolButton * button);
|
||||
|
||||
public slots:
|
||||
void fillValidResolutions();
|
||||
|
||||
@ -45,22 +48,22 @@ private slots:
|
||||
void on_comboBoxLanguage_currentIndexChanged(int index);
|
||||
void on_comboBoxCursorType_currentIndexChanged(int index);
|
||||
void on_pushButtonTranslation_clicked();
|
||||
void on_checkBoxRepositoryDefault_stateChanged(int arg1);
|
||||
void on_checkBoxRepositoryExtra_stateChanged(int arg1);
|
||||
void on_buttonRepositoryDefault_stateChanged(int arg1);
|
||||
void on_buttonRepositoryExtra_stateChanged(int arg1);
|
||||
void on_lineEditRepositoryExtra_textEdited(const QString &arg1);
|
||||
void on_spinBoxInterfaceScaling_valueChanged(int arg1);
|
||||
void on_refreshRepositoriesButton_clicked();
|
||||
void on_spinBoxFramerateLimit_valueChanged(int arg1);
|
||||
void on_checkBoxVSync_stateChanged(int arg1);
|
||||
void on_buttonVSync_stateChanged(int arg1);
|
||||
void on_comboBoxEnemyPlayerAI_currentTextChanged(const QString &arg1);
|
||||
void on_comboBoxAlliedPlayerAI_currentTextChanged(const QString &arg1);
|
||||
void on_checkBoxAutoSavePrefix_stateChanged(int arg1);
|
||||
void on_buttonAutoSavePrefix_stateChanged(int arg1);
|
||||
void on_spinBoxAutoSaveLimit_valueChanged(int arg1);
|
||||
void on_lineEditAutoSavePrefix_textEdited(const QString &arg1);
|
||||
void on_spinBoxReservedArea_valueChanged(int arg1);
|
||||
void on_comboBoxRendererType_currentTextChanged(const QString &arg1);
|
||||
|
||||
void on_checkBoxIgnoreSslErrors_clicked(bool checked);
|
||||
void on_buttonIgnoreSslErrors_clicked(bool checked);
|
||||
void on_comboBoxUpscalingFilter_currentIndexChanged(int index);
|
||||
void on_sliderMusicVolume_valueChanged(int value);
|
||||
void on_sliderSoundVolume_valueChanged(int value);
|
||||
|
@ -47,9 +47,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-616</y>
|
||||
<y>0</y>
|
||||
<width>729</width>
|
||||
<height>1322</height>
|
||||
<height>1335</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="2,0,1,1,1">
|
||||
@ -95,26 +95,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="48" column="3" colspan="2">
|
||||
<widget class="QPushButton" name="refreshRepositoriesButton">
|
||||
<property name="text">
|
||||
<string>Refresh now</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="49" column="1">
|
||||
<widget class="QCheckBox" name="checkBoxRepositoryDefault">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="0">
|
||||
<widget class="QLabel" name="labelRendererType">
|
||||
<property name="text">
|
||||
@ -201,23 +181,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="48" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="comboBoxAutoCheck">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Off</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>On</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="45" column="0">
|
||||
<widget class="QLabel" name="labelEnemyAI">
|
||||
<property name="text">
|
||||
@ -462,16 +425,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="49" column="2" colspan="3">
|
||||
<widget class="QLineEdit" name="lineEditRepositoryDefault">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1" colspan="4">
|
||||
<widget class="QSpinBox" name="spinBoxFramerateLimit">
|
||||
<property name="minimum">
|
||||
@ -485,16 +438,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="50" column="1">
|
||||
<widget class="QCheckBox" name="checkBoxRepositoryExtra">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="52" column="1" colspan="4">
|
||||
<widget class="QSpinBox" name="spinBoxNetworkPortLobby">
|
||||
<property name="minimum">
|
||||
@ -569,13 +512,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="checkBoxAutoSavePrefix">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="26" column="1" colspan="4">
|
||||
<widget class="QSlider" name="sliderSoundVolume">
|
||||
<property name="maximum">
|
||||
@ -613,23 +549,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1" colspan="4">
|
||||
<widget class="QComboBox" name="comboBoxVSync">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Off</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>On</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="labelAutoSaveLimit">
|
||||
<property name="text">
|
||||
@ -914,13 +833,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2" colspan="3">
|
||||
<widget class="QLineEdit" name="lineEditAutoSavePrefix">
|
||||
<property name="placeholderText">
|
||||
<string>empty = map name prefix</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="26" column="0">
|
||||
<widget class="QLabel" name="labelSoundVolume">
|
||||
<property name="text">
|
||||
@ -955,19 +867,6 @@
|
||||
<item row="1" column="1" colspan="4">
|
||||
<widget class="QComboBox" name="comboBoxLanguage"/>
|
||||
</item>
|
||||
<item row="47" column="1">
|
||||
<widget class="QCheckBox" name="checkBoxIgnoreSslErrors">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="4">
|
||||
<widget class="QComboBox" name="comboBoxFullScreen">
|
||||
<property name="toolTip">
|
||||
@ -1026,13 +925,6 @@ Fullscreen Exclusive Mode - game will cover entirety of your screen and will use
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="50" column="2" colspan="3">
|
||||
<widget class="QLineEdit" name="lineEditRepositoryExtra">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QLabel" name="labelTranslationStatus">
|
||||
<property name="text">
|
||||
@ -1103,6 +995,154 @@ Fullscreen Exclusive Mode - game will cover entirety of your screen and will use
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="47" column="1" colspan="4">
|
||||
<widget class="QToolButton" name="buttonIgnoreSslErrors">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="49" column="1">
|
||||
<widget class="QToolButton" name="buttonRepositoryDefault">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="50" column="1">
|
||||
<widget class="QToolButton" name="buttonRepositoryExtra">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QToolButton" name="buttonAutoSavePrefix">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2" colspan="3">
|
||||
<widget class="QLineEdit" name="lineEditAutoSavePrefix">
|
||||
<property name="placeholderText">
|
||||
<string>empty = map name prefix</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="48" column="1">
|
||||
<widget class="QToolButton" name="buttonAutoCheck">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="48" column="2" colspan="3">
|
||||
<widget class="QPushButton" name="refreshRepositoriesButton">
|
||||
<property name="text">
|
||||
<string>Refresh now</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="49" column="2" colspan="3">
|
||||
<widget class="QLineEdit" name="lineEditRepositoryDefault">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="50" column="2" colspan="3">
|
||||
<widget class="QLineEdit" name="lineEditRepositoryExtra">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1" colspan="4">
|
||||
<widget class="QToolButton" name="buttonVSync">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user