mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 00:42:14 -07:00
Add a setting to remember last used sorting order for visual deck storage widget.
This commit is contained in:
parent
6423fbcdb1
commit
fa6f3e50bf
3 changed files with 16 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ VisualDeckStorageWidget::VisualDeckStorageWidget(QWidget *parent) : QWidget(pare
|
|||
sortComboBox = new QComboBox(this);
|
||||
sortComboBox->addItem("Sort Alphabetically (Filename)", Alphabetical);
|
||||
sortComboBox->addItem("Sort by Last Modified", ByLastModified);
|
||||
sortComboBox->setCurrentIndex(SettingsCache::instance().getVisualDeckStorageSortingOrder());
|
||||
|
||||
searchWidget = new VisualDeckStorageSearchWidget(this);
|
||||
|
||||
|
|
@ -43,12 +44,13 @@ VisualDeckStorageWidget::VisualDeckStorageWidget(QWidget *parent) : QWidget(pare
|
|||
void VisualDeckStorageWidget::showEvent(QShowEvent *event)
|
||||
{
|
||||
QWidget::showEvent(event);
|
||||
refreshBannerCards();
|
||||
updateSortOrder();
|
||||
}
|
||||
|
||||
void VisualDeckStorageWidget::updateSortOrder()
|
||||
{
|
||||
sortOrder = static_cast<SortOrder>(sortComboBox->currentData().toInt());
|
||||
SettingsCache::instance().setVisualDeckStorageSortingOrder(sortComboBox->currentData().toInt());
|
||||
refreshBannerCards(); // Refresh the banner cards with the new sort order
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -261,6 +261,7 @@ SettingsCache::SettingsCache()
|
|||
settings->value("cards/printingselectornavigationbuttonsvisible", true).toBool();
|
||||
visualDeckStorageCardSize = settings->value("cards/visualdeckstoragecardsize", 100).toInt();
|
||||
visualDeckStorageShowOnLoad = settings->value("interface/visualdeckstorageshowonload", true).toBool();
|
||||
visualDeckStorageSortingOrder = settings->value("interface/visualdeckstoragesortingorder", 0).toInt();
|
||||
horizontalHand = settings->value("hand/horizontal", true).toBool();
|
||||
invertVerticalCoordinate = settings->value("table/invert_vertical", false).toBool();
|
||||
minPlayersForMultiColumnLayout = settings->value("interface/min_players_multicolumn", 4).toInt();
|
||||
|
|
@ -611,6 +612,12 @@ void SettingsCache::setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED
|
|||
emit printingSelectorNavigationButtonsVisibleChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setVisualDeckStorageSortingOrder(int _visualDeckStorageSortingOrder)
|
||||
{
|
||||
visualDeckStorageSortingOrder = _visualDeckStorageSortingOrder;
|
||||
settings->setValue("interface/visualdeckstoragesortingorder", visualDeckStorageSortingOrder);
|
||||
}
|
||||
|
||||
void SettingsCache::setVisualDeckStorageCardSize(int _visualDeckStorageCardSize)
|
||||
{
|
||||
visualDeckStorageCardSize = _visualDeckStorageCardSize;
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ private:
|
|||
bool printingSelectorSearchBarVisible;
|
||||
bool printingSelectorCardSizeSliderVisible;
|
||||
bool printingSelectorNavigationButtonsVisible;
|
||||
int visualDeckStorageSortingOrder;
|
||||
int visualDeckStorageCardSize;
|
||||
bool visualDeckStorageShowOnLoad;
|
||||
bool horizontalHand;
|
||||
|
|
@ -372,6 +373,10 @@ public:
|
|||
{
|
||||
return printingSelectorNavigationButtonsVisible;
|
||||
}
|
||||
int getVisualDeckStorageSortingOrder() const
|
||||
{
|
||||
return visualDeckStorageSortingOrder;
|
||||
}
|
||||
int getVisualDeckStorageCardSize() const
|
||||
{
|
||||
return visualDeckStorageCardSize;
|
||||
|
|
@ -688,6 +693,7 @@ public slots:
|
|||
void setPrintingSelectorSearchBarVisible(QT_STATE_CHANGED_T _searchBarVisible);
|
||||
void setPrintingSelectorCardSizeSliderVisible(QT_STATE_CHANGED_T _cardSizeSliderVisible);
|
||||
void setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED_T _navigationButtonsVisible);
|
||||
void setVisualDeckStorageSortingOrder(int _visualDeckStorageSortingOrder);
|
||||
void setVisualDeckStorageCardSize(int _visualDeckStorageCardSize);
|
||||
void setVisualDeckStorageShowOnLoad(QT_STATE_CHANGED_T _visualDeckStorageShowOnLoad);
|
||||
void setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue