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 75155738a5
commit 879e7561cc
2 changed files with 8 additions and 1 deletions

View File

@ -12,6 +12,7 @@ Other fixes:
Misc:
- GB Serialize: Add missing savestate support for MBC6 and NT (newer)
- 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()) {