Qt: Keep track of current pslette preset name (fixes #2680)

This commit is contained in:
Vicki Pfau 2022-10-19 04:15:41 -07:00
parent 3f39bd2536
commit 455525e3b6
2 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,7 @@ Other fixes:
- Res: Fix species name location in Ruby/Sapphire revs 1/2 (fixes mgba.io/i/2685)
Misc:
- macOS: Add category to plist (closes mgba.io/i/2691)
- Qt: Keep track of current pslette preset name (fixes mgba.io/i/2680)
0.10.0: (2022-10-11)
Features:

View File

@ -296,9 +296,14 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
}
const GBColorPreset* colorPresets;
QString usedPreset = m_controller->getQtOption("gb.pal").toString();
size_t nPresets = GBColorPresetList(&colorPresets);
for (size_t i = 0; i < nPresets; ++i) {
m_ui.colorPreset->addItem(QString(colorPresets[i].name));
QString presetName(colorPresets[i].name);
m_ui.colorPreset->addItem(presetName);
if (usedPreset == presetName) {
m_ui.colorPreset->setCurrentIndex(i);
}
}
connect(m_ui.colorPreset, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this, colorPresets](int n) {
const GBColorPreset* preset = &colorPresets[n];
@ -640,6 +645,7 @@ void SettingsView::updateConfig() {
m_controller->setOption(color.toUtf8().constData(), m_gbColors[colorId] & ~0xFF000000);
}
m_controller->setQtOption("gb.pal", m_ui.colorPreset->currentText());
int gbColors = GB_COLORS_CGB;
if (m_ui.gbColor->isChecked()) {