ui: Disable add-on voodoo when main voodoo is selected

This commit is contained in:
cold-brewed
2024-03-21 08:00:02 -04:00
parent 57b064c412
commit 3cf3865980
2 changed files with 27 additions and 7 deletions

View File

@@ -139,6 +139,7 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index)
if (index < 0) {
return;
}
static QRegularExpression voodooRegex("3dfx|voodoo|banshee", QRegularExpression::CaseInsensitiveOption);
auto curVideoCard_2 = videoCard[1];
videoCard[0] = ui->comboBoxVideo->currentData().toInt();
if (videoCard[0] == VID_INTERNAL)
@@ -207,6 +208,25 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index)
ui->comboBoxVideoSecondary->setCurrentIndex(0);
ui->pushButtonConfigureSecondary->setEnabled(false);
}
// Is the currently selected video card a voodoo?
if (ui->comboBoxVideo->currentText().contains(voodooRegex)) {
// Get the name of the video card currently in use
const device_t *video_dev = video_card_getdevice(gfxcard[0]);
const QString currentVideoName = DeviceConfig::DeviceName(video_dev, video_get_internal_name(gfxcard[0]), 1);
// Is it a voodoo?
const bool currentCardIsVoodoo = currentVideoName.contains(voodooRegex);
// Don't uncheck if
// * Current card is voodoo
// * Add-on voodoo was manually overridden in config
if (ui->checkBoxVoodoo->isChecked() && !currentCardIsVoodoo) {
// Otherwise, uncheck the add-on voodoo when a main voodoo is selected
ui->checkBoxVoodoo->setCheckState(Qt::Unchecked);
}
ui->checkBoxVoodoo->setDisabled(true);
} else {
ui->checkBoxVoodoo->setDisabled(false);
}
}
void

View File

@@ -61,15 +61,15 @@
</item>
<item row="1" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxVideo">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="4" column="2">
@@ -102,7 +102,7 @@
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxVoodoo">
<property name="text">
<string>Voodoo Graphics</string>
<string>Voodoo 1 or 2 Graphics</string>
</property>
</widget>
</item>
@@ -122,15 +122,15 @@
</item>
<item row="3" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxVideoSecondary">
<property name="maxVisibleItems">
<number>30</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">