store sort option in settings as QComboBox index instead of enum value (#5207)

* rename config property

* change default

* functional changes
This commit is contained in:
RickyRister 2024-11-29 19:46:16 -08:00 committed by GitHub
parent 1d8651bc00
commit 5ef1ca06f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 29 additions and 23 deletions

View file

@ -125,8 +125,8 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
connect(&sortBySelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&ZoneViewWidget::processSortBy);
connect(&pileViewCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &ZoneViewWidget::processSetPileView);
groupBySelector.setCurrentIndex(groupBySelector.findData(SettingsCache::instance().getZoneViewGroupBy()));
sortBySelector.setCurrentIndex(sortBySelector.findData(SettingsCache::instance().getZoneViewSortBy()));
groupBySelector.setCurrentIndex(SettingsCache::instance().getZoneViewGroupByIndex());
sortBySelector.setCurrentIndex(SettingsCache::instance().getZoneViewSortByIndex());
pileViewCheckBox.setChecked(SettingsCache::instance().getZoneViewPileView());
if (CardList::NoSort == static_cast<CardList::SortOption>(groupBySelector.currentData().toInt())) {
@ -154,7 +154,7 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
void ZoneViewWidget::processGroupBy(int index)
{
auto option = static_cast<CardList::SortOption>(groupBySelector.itemData(index).toInt());
SettingsCache::instance().setZoneViewGroupBy(option);
SettingsCache::instance().setZoneViewGroupByIndex(index);
zone->setGroupBy(option);
// disable pile view checkbox if we're not grouping by anything
@ -178,7 +178,7 @@ void ZoneViewWidget::processSortBy(int index)
return;
}
SettingsCache::instance().setZoneViewSortBy(option);
SettingsCache::instance().setZoneViewSortByIndex(index);
zone->setSortBy(option);
}