aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/ui/dialogs/CopyInstanceDialog.cpp30
-rw-r--r--launcher/ui/dialogs/CopyInstanceDialog.h9
2 files changed, 21 insertions, 18 deletions
diff --git a/launcher/ui/dialogs/CopyInstanceDialog.cpp b/launcher/ui/dialogs/CopyInstanceDialog.cpp
index 1b8e2aa0..8445f0a9 100644
--- a/launcher/ui/dialogs/CopyInstanceDialog.cpp
+++ b/launcher/ui/dialogs/CopyInstanceDialog.cpp
@@ -138,12 +138,9 @@ void CopyInstanceDialog::checkAllCheckboxes(const bool& b)
ui->copyModsCheckbox->setChecked(b);
}
-// Sets b to true if state is a checked checkbox
-void CopyInstanceDialog::checkBool(bool& b, const int& state)
+// Check the "Select all" checkbox checked if all options are already checked:
+void CopyInstanceDialog::updateSelectAllCheckbox()
{
- b = (state == Qt::Checked);
-
- // Have "Select all" checkbox checked if all options are already checked:
ui->selectAllCheckbox->blockSignals(true);
ui->selectAllCheckbox->setChecked(m_selectedOptions.allTrue());
ui->selectAllCheckbox->blockSignals(false);
@@ -170,42 +167,49 @@ void CopyInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1)
void CopyInstanceDialog::on_selectAllCheckbox_stateChanged(int state)
{
bool checked;
- checkBool(checked, state);
+ checked = (state == Qt::Checked);
checkAllCheckboxes(checked);
}
void CopyInstanceDialog::on_copySavesCheckbox_stateChanged(int state)
{
- checkBool(m_selectedOptions.copySaves, state);
+ m_selectedOptions.copySaves = (state == Qt::Checked);
+ updateSelectAllCheckbox();
}
void CopyInstanceDialog::on_keepPlaytimeCheckbox_stateChanged(int state)
{
- checkBool(m_selectedOptions.keepPlaytime, state);
+ m_selectedOptions.keepPlaytime = (state == Qt::Checked);
+ updateSelectAllCheckbox();
}
void CopyInstanceDialog::on_copyGameOptionsCheckbox_stateChanged(int state)
{
- checkBool(m_selectedOptions.copyGameOptions, state);
+ m_selectedOptions.copyGameOptions = (state == Qt::Checked);
+ updateSelectAllCheckbox();
}
void CopyInstanceDialog::on_copyResPacksCheckbox_stateChanged(int state)
{
- checkBool(m_selectedOptions.copyResourcePacks, state);
+ m_selectedOptions.copyResourcePacks = (state == Qt::Checked);
+ updateSelectAllCheckbox();
}
void CopyInstanceDialog::on_copyShaderPacksCheckbox_stateChanged(int state)
{
- checkBool(m_selectedOptions.copyShaderPacks, state);
+ m_selectedOptions.copyShaderPacks = (state == Qt::Checked);
+ updateSelectAllCheckbox();
}
void CopyInstanceDialog::on_copyServersCheckbox_stateChanged(int state)
{
- checkBool(m_selectedOptions.copyServers, state);
+ m_selectedOptions.copyServers = (state == Qt::Checked);
+ updateSelectAllCheckbox();
}
void CopyInstanceDialog::on_copyModsCheckbox_stateChanged(int state)
{
- checkBool(m_selectedOptions.copyMods, state);
+ m_selectedOptions.copyMods = (state == Qt::Checked);
+ updateSelectAllCheckbox();
}
diff --git a/launcher/ui/dialogs/CopyInstanceDialog.h b/launcher/ui/dialogs/CopyInstanceDialog.h
index 4171c440..94015334 100644
--- a/launcher/ui/dialogs/CopyInstanceDialog.h
+++ b/launcher/ui/dialogs/CopyInstanceDialog.h
@@ -45,11 +45,7 @@ private
slots:
void on_iconButton_clicked();
void on_instNameTextBox_textChanged(const QString &arg1);
-
- // Checkbox options:
- void checkAllCheckboxes(const bool& b);
- void checkBool(bool& b, const int& state);
-
+ // Checkboxes
void on_selectAllCheckbox_stateChanged(int state);
void on_copySavesCheckbox_stateChanged(int state);
void on_keepPlaytimeCheckbox_stateChanged(int state);
@@ -60,6 +56,9 @@ slots:
void on_copyModsCheckbox_stateChanged(int state);
private:
+ void checkAllCheckboxes(const bool& b);
+ void updateSelectAllCheckbox();
+ /* data */
Ui::CopyInstanceDialog *ui;
QString InstIconKey;
InstancePtr m_original;