Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When "window matches image size" changes, enable/disable size controls #626

Merged
merged 1 commit into from
Aug 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 7 additions & 25 deletions src/qvoptionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ QVOptionsDialog::QVOptionsDialog(QWidget *parent) :
#endif

syncSettings(false, true);
connect(ui->windowResizeComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &QVOptionsDialog::windowResizeComboBoxCurrentIndexChanged);
connect(ui->langComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &QVOptionsDialog::languageComboBoxCurrentIndexChanged);
syncShortcuts();
updateButtonBox();
Expand Down Expand Up @@ -136,17 +137,7 @@ void QVOptionsDialog::syncSettings(bool defaults, bool makeConnections)
ui->titlebarRadioButton2, ui->titlebarRadioButton3}, "titlebarmode", defaults, makeConnections);
// windowresizemode
syncComboBox(ui->windowResizeComboBox, "windowresizemode", defaults, makeConnections);
if (ui->windowResizeComboBox->currentIndex() == 0) {
ui->minWindowResizeLabel->setEnabled(false);
ui->minWindowResizeSpinBox->setEnabled(false);
ui->maxWindowResizeLabel->setEnabled(false);
ui->maxWindowResizeSpinBox->setEnabled(false);
} else {
ui->minWindowResizeLabel->setEnabled(true);
ui->minWindowResizeSpinBox->setEnabled(true);
ui->maxWindowResizeLabel->setEnabled(true);
ui->maxWindowResizeSpinBox->setEnabled(true);
}
windowResizeComboBoxCurrentIndexChanged(ui->windowResizeComboBox->currentIndex());
// minwindowresizedpercentage
syncSpinBox(ui->minWindowResizeSpinBox, "minwindowresizedpercentage", defaults, makeConnections);
// maxwindowresizedperecentage
Expand Down Expand Up @@ -445,20 +436,11 @@ void QVOptionsDialog::scalingCheckboxStateChanged(int arg1)

void QVOptionsDialog::windowResizeComboBoxCurrentIndexChanged(int index)
{
if (index == 0)
{
ui->minWindowResizeLabel->setEnabled(false);
ui->minWindowResizeSpinBox->setEnabled(false);
ui->maxWindowResizeLabel->setEnabled(false);
ui->maxWindowResizeSpinBox->setEnabled(false);
}
else
{
ui->minWindowResizeLabel->setEnabled(true);
ui->minWindowResizeSpinBox->setEnabled(true);
ui->maxWindowResizeLabel->setEnabled(true);
ui->maxWindowResizeSpinBox->setEnabled(true);
}
bool enableRelatedControls = index != 0;
ui->minWindowResizeLabel->setEnabled(enableRelatedControls);
ui->minWindowResizeSpinBox->setEnabled(enableRelatedControls);
ui->maxWindowResizeLabel->setEnabled(enableRelatedControls);
ui->maxWindowResizeSpinBox->setEnabled(enableRelatedControls);
}

void QVOptionsDialog::populateLanguages()
Expand Down