Skip to content

Commit

Permalink
Merge pull request #12794 from ronso0/pref-multi-sampling
Browse files Browse the repository at this point in the history
Preferences: touch multi-sampling option only with QML enabled
  • Loading branch information
Swiftb0y authored Feb 12, 2024
2 parents b3bf898 + 45d9ec8 commit 55ace25
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
43 changes: 27 additions & 16 deletions src/preferences/dialog/dlgprefinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,26 +182,26 @@ DlgPrefInterface::DlgPrefInterface(
// Multi-Sampling
#ifdef MIXXX_USE_QML
if (CmdlineArgs::Instance().isQml()) {
mulitSamplingComboBox->clear();
mulitSamplingComboBox->addItem(tr("Disabled"), 0);
mulitSamplingComboBox->addItem(tr("2x MSAA"), 2);
mulitSamplingComboBox->addItem(tr("4x MSAA"), 4);
mulitSamplingComboBox->addItem(tr("8x MSAA"), 8);
mulitSamplingComboBox->addItem(tr("16x MSAA"), 16);
multiSamplingComboBox->clear();
multiSamplingComboBox->addItem(tr("Disabled"), 0);
multiSamplingComboBox->addItem(tr("2x MSAA"), 2);
multiSamplingComboBox->addItem(tr("4x MSAA"), 4);
multiSamplingComboBox->addItem(tr("8x MSAA"), 8);
multiSamplingComboBox->addItem(tr("16x MSAA"), 16);

m_multiSampling = m_pConfig->getValue(ConfigKey(kPreferencesGroup, kMultiSamplingKey), 4);
int mulitSamplingIndex = mulitSamplingComboBox->findData(m_multiSampling);
if (mulitSamplingIndex != -1) {
mulitSamplingComboBox->setCurrentIndex(mulitSamplingIndex);
int multiSamplingIndex = multiSamplingComboBox->findData(m_multiSampling);
if (multiSamplingIndex != -1) {
multiSamplingComboBox->setCurrentIndex(multiSamplingIndex);
} else {
mulitSamplingComboBox->setCurrentIndex(0);
multiSamplingComboBox->setCurrentIndex(0);
m_pConfig->set(ConfigKey(kPreferencesGroup, kMultiSamplingKey), ConfigValue(0));
}
} else
#endif
{
mulitSamplingLabel->hide();
mulitSamplingComboBox->hide();
multiSamplingLabel->hide();
multiSamplingComboBox->hide();
}

// Tooltip configuration
Expand Down Expand Up @@ -325,6 +325,10 @@ void DlgPrefInterface::slotResetToDefaults() {
comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData(
static_cast<int>(mixxx::ScreenSaverPreference::PREVENT_ON)));

#ifdef MIXXX_USE_QML
multiSamplingComboBox->setCurrentIndex(4); // 4x MSAA
#endif

#ifdef Q_OS_IOS
// Tooltips off everywhere.
radioButtonTooltipsOff->setChecked(true);
Expand Down Expand Up @@ -446,18 +450,25 @@ void DlgPrefInterface::slotApply() {
static_cast<mixxx::ScreenSaverPreference>(screensaverComboBoxState));
}

int multiSampling = mulitSamplingComboBox->itemData(
mulitSamplingComboBox->currentIndex())
#ifdef MIXXX_USE_QML
int multiSampling = multiSamplingComboBox->itemData(
multiSamplingComboBox->currentIndex())
.toInt();
m_pConfig->set(ConfigKey(kPreferencesGroup, kMultiSamplingKey), ConfigValue(multiSampling));
#endif

if (locale != m_localeOnUpdate || scaleFactor != m_dScaleFactor ||
multiSampling != m_multiSampling) {
if (locale != m_localeOnUpdate || scaleFactor != m_dScaleFactor
#ifdef MIXXX_USE_QML
|| multiSampling != m_multiSampling
#endif
) {
notifyRebootNecessary();
// hack to prevent showing the notification when pressing "Okay" after "Apply"
m_localeOnUpdate = locale;
m_dScaleFactor = scaleFactor;
#ifdef MIXXX_USE_QML
m_multiSampling = multiSampling;
#endif
}

// load skin/scheme if necessary
Expand Down
5 changes: 3 additions & 2 deletions src/preferences/dialog/dlgprefinterfacedlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@
<widget class="QComboBox" name="comboBoxScreensaver"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="mulitSamplingLabel">
<widget class="QLabel" name="multiSamplingLabel">
<property name="text">
<string>Multi-Sampling</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QComboBox" name="mulitSamplingComboBox"/>
<widget class="QComboBox" name="multiSamplingComboBox"/>
</item>
</layout>
</widget>
Expand All @@ -294,6 +294,7 @@
<tabstop>radioButtonTooltipsOff</tabstop>
<tabstop>radioButtonTooltipsLibrary</tabstop>
<tabstop>radioButtonTooltipsLibraryAndSkin</tabstop>
<tabstop>multiSamplingComboBox</tabstop>
</tabstops>
<resources/>
<connections/>
Expand Down

0 comments on commit 55ace25

Please sign in to comment.