mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 03:28:49 -07:00
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:
parent
1d8651bc00
commit
5ef1ca06f5
5 changed files with 29 additions and 23 deletions
|
|
@ -125,8 +125,8 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
|
||||||
connect(&sortBySelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
connect(&sortBySelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
&ZoneViewWidget::processSortBy);
|
&ZoneViewWidget::processSortBy);
|
||||||
connect(&pileViewCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &ZoneViewWidget::processSetPileView);
|
connect(&pileViewCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &ZoneViewWidget::processSetPileView);
|
||||||
groupBySelector.setCurrentIndex(groupBySelector.findData(SettingsCache::instance().getZoneViewGroupBy()));
|
groupBySelector.setCurrentIndex(SettingsCache::instance().getZoneViewGroupByIndex());
|
||||||
sortBySelector.setCurrentIndex(sortBySelector.findData(SettingsCache::instance().getZoneViewSortBy()));
|
sortBySelector.setCurrentIndex(SettingsCache::instance().getZoneViewSortByIndex());
|
||||||
pileViewCheckBox.setChecked(SettingsCache::instance().getZoneViewPileView());
|
pileViewCheckBox.setChecked(SettingsCache::instance().getZoneViewPileView());
|
||||||
|
|
||||||
if (CardList::NoSort == static_cast<CardList::SortOption>(groupBySelector.currentData().toInt())) {
|
if (CardList::NoSort == static_cast<CardList::SortOption>(groupBySelector.currentData().toInt())) {
|
||||||
|
|
@ -154,7 +154,7 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
|
||||||
void ZoneViewWidget::processGroupBy(int index)
|
void ZoneViewWidget::processGroupBy(int index)
|
||||||
{
|
{
|
||||||
auto option = static_cast<CardList::SortOption>(groupBySelector.itemData(index).toInt());
|
auto option = static_cast<CardList::SortOption>(groupBySelector.itemData(index).toInt());
|
||||||
SettingsCache::instance().setZoneViewGroupBy(option);
|
SettingsCache::instance().setZoneViewGroupByIndex(index);
|
||||||
zone->setGroupBy(option);
|
zone->setGroupBy(option);
|
||||||
|
|
||||||
// disable pile view checkbox if we're not grouping by anything
|
// disable pile view checkbox if we're not grouping by anything
|
||||||
|
|
@ -178,7 +178,7 @@ void ZoneViewWidget::processSortBy(int index)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsCache::instance().setZoneViewSortBy(option);
|
SettingsCache::instance().setZoneViewSortByIndex(index);
|
||||||
zone->setSortBy(option);
|
zone->setSortBy(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -252,8 +252,8 @@ SettingsCache::SettingsCache()
|
||||||
chatMentionColor = settings->value("chat/mentioncolor", "A6120D").toString();
|
chatMentionColor = settings->value("chat/mentioncolor", "A6120D").toString();
|
||||||
chatHighlightColor = settings->value("chat/highlightcolor", "A6120D").toString();
|
chatHighlightColor = settings->value("chat/highlightcolor", "A6120D").toString();
|
||||||
|
|
||||||
zoneViewGroupBy = settings->value("zoneview/groupby", 2).toInt();
|
zoneViewGroupByIndex = settings->value("zoneview/groupby", 1).toInt();
|
||||||
zoneViewSortBy = settings->value("zoneview/sortby", 1).toInt();
|
zoneViewSortByIndex = settings->value("zoneview/sortby", 1).toInt();
|
||||||
zoneViewPileView = settings->value("zoneview/pileview", true).toBool();
|
zoneViewPileView = settings->value("zoneview/pileview", true).toBool();
|
||||||
|
|
||||||
soundEnabled = settings->value("sound/enabled", false).toBool();
|
soundEnabled = settings->value("sound/enabled", false).toBool();
|
||||||
|
|
@ -582,16 +582,16 @@ void SettingsCache::setChatHighlightColor(const QString &_chatHighlightColor)
|
||||||
settings->setValue("chat/highlightcolor", chatHighlightColor);
|
settings->setValue("chat/highlightcolor", chatHighlightColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsCache::setZoneViewGroupBy(int _zoneViewGroupBy)
|
void SettingsCache::setZoneViewGroupByIndex(int _zoneViewGroupByIndex)
|
||||||
{
|
{
|
||||||
zoneViewGroupBy = _zoneViewGroupBy;
|
zoneViewGroupByIndex = _zoneViewGroupByIndex;
|
||||||
settings->setValue("zoneview/groupby", zoneViewGroupBy);
|
settings->setValue("zoneview/groupby", zoneViewGroupByIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsCache::setZoneViewSortBy(int _zoneViewSortBy)
|
void SettingsCache::setZoneViewSortByIndex(int _zoneViewSortByIndex)
|
||||||
{
|
{
|
||||||
zoneViewSortBy = _zoneViewSortBy;
|
zoneViewSortByIndex = _zoneViewSortByIndex;
|
||||||
settings->setValue("zoneview/sortby", zoneViewSortBy);
|
settings->setValue("zoneview/sortby", zoneViewSortByIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsCache::setZoneViewPileView(QT_STATE_CHANGED_T _zoneViewPileView)
|
void SettingsCache::setZoneViewPileView(QT_STATE_CHANGED_T _zoneViewPileView)
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ private:
|
||||||
QString chatHighlightColor;
|
QString chatHighlightColor;
|
||||||
bool chatMentionForeground;
|
bool chatMentionForeground;
|
||||||
bool chatHighlightForeground;
|
bool chatHighlightForeground;
|
||||||
int zoneViewSortBy, zoneViewGroupBy;
|
int zoneViewSortByIndex, zoneViewGroupByIndex;
|
||||||
bool zoneViewPileView;
|
bool zoneViewPileView;
|
||||||
bool soundEnabled;
|
bool soundEnabled;
|
||||||
QString soundThemeName;
|
QString soundThemeName;
|
||||||
|
|
@ -328,13 +328,19 @@ public:
|
||||||
{
|
{
|
||||||
return chatHighlightForeground;
|
return chatHighlightForeground;
|
||||||
}
|
}
|
||||||
int getZoneViewGroupBy() const
|
/**
|
||||||
|
* Currently selected index for the `Group by X` QComboBox
|
||||||
|
*/
|
||||||
|
int getZoneViewGroupByIndex() const
|
||||||
{
|
{
|
||||||
return zoneViewGroupBy;
|
return zoneViewGroupByIndex;
|
||||||
}
|
}
|
||||||
int getZoneViewSortBy() const
|
/**
|
||||||
|
* Currently selected index for the `Sort by X` QComboBox
|
||||||
|
*/
|
||||||
|
int getZoneViewSortByIndex() const
|
||||||
{
|
{
|
||||||
return zoneViewSortBy;
|
return zoneViewSortByIndex;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
Returns if the view should be sorted into pile view.
|
Returns if the view should be sorted into pile view.
|
||||||
|
|
@ -564,8 +570,8 @@ public slots:
|
||||||
void setChatMentionCompleter(QT_STATE_CHANGED_T _chatMentionCompleter);
|
void setChatMentionCompleter(QT_STATE_CHANGED_T _chatMentionCompleter);
|
||||||
void setChatMentionForeground(QT_STATE_CHANGED_T _chatMentionForeground);
|
void setChatMentionForeground(QT_STATE_CHANGED_T _chatMentionForeground);
|
||||||
void setChatHighlightForeground(QT_STATE_CHANGED_T _chatHighlightForeground);
|
void setChatHighlightForeground(QT_STATE_CHANGED_T _chatHighlightForeground);
|
||||||
void setZoneViewGroupBy(const int _zoneViewGroupBy);
|
void setZoneViewGroupByIndex(const int _zoneViewGroupByIndex);
|
||||||
void setZoneViewSortBy(const int _zoneViewSortBy);
|
void setZoneViewSortByIndex(const int _zoneViewSortByIndex);
|
||||||
void setZoneViewPileView(QT_STATE_CHANGED_T _zoneViewPileView);
|
void setZoneViewPileView(QT_STATE_CHANGED_T _zoneViewPileView);
|
||||||
void setSoundEnabled(QT_STATE_CHANGED_T _soundEnabled);
|
void setSoundEnabled(QT_STATE_CHANGED_T _soundEnabled);
|
||||||
void setSoundThemeName(const QString &_soundThemeName);
|
void setSoundThemeName(const QString &_soundThemeName);
|
||||||
|
|
|
||||||
|
|
@ -184,10 +184,10 @@ void SettingsCache::setChatMentionColor(const QString & /* _chatMentionColor */)
|
||||||
void SettingsCache::setChatHighlightColor(const QString & /* _chatHighlightColor */)
|
void SettingsCache::setChatHighlightColor(const QString & /* _chatHighlightColor */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void SettingsCache::setZoneViewGroupBy(int /* _zoneViewSortByName */)
|
void SettingsCache::setZoneViewGroupByIndex(int /* _zoneViewGroupByIndex */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void SettingsCache::setZoneViewSortBy(int /* _zoneViewSortByType */)
|
void SettingsCache::setZoneViewSortByIndex(int /* _zoneViewSortByIndex */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void SettingsCache::setZoneViewPileView(QT_STATE_CHANGED_T /* _zoneViewPileView */)
|
void SettingsCache::setZoneViewPileView(QT_STATE_CHANGED_T /* _zoneViewPileView */)
|
||||||
|
|
|
||||||
|
|
@ -188,10 +188,10 @@ void SettingsCache::setChatMentionColor(const QString & /* _chatMentionColor */)
|
||||||
void SettingsCache::setChatHighlightColor(const QString & /* _chatHighlightColor */)
|
void SettingsCache::setChatHighlightColor(const QString & /* _chatHighlightColor */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void SettingsCache::setZoneViewGroupBy(int /* _zoneViewGroupBy */)
|
void SettingsCache::setZoneViewGroupByIndex(int /* _zoneViewGroupByIndex */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void SettingsCache::setZoneViewSortBy(int /* _zoneViewSortBy */)
|
void SettingsCache::setZoneViewSortByIndex(int /* _zoneViewSortByIndex */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void SettingsCache::setZoneViewPileView(QT_STATE_CHANGED_T /* _zoneViewPileView */)
|
void SettingsCache::setZoneViewPileView(QT_STATE_CHANGED_T /* _zoneViewPileView */)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue