mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-20 01:12:15 -07:00
Persist sort options and change default to 'preference'.
This commit is contained in:
parent
af75cfcd89
commit
3059637838
4 changed files with 25 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "printing_selector_card_sorting_widget.h"
|
||||
|
||||
#include "../../../../settings/cache_settings.h"
|
||||
#include "../../../../utility/card_set_comparator.h"
|
||||
|
||||
const QString PrintingSelectorCardSortingWidget::SORT_OPTIONS_ALPHABETICAL = tr("Alphabetical");
|
||||
|
|
@ -18,7 +19,9 @@ PrintingSelectorCardSortingWidget::PrintingSelectorCardSortingWidget(PrintingSel
|
|||
|
||||
sortOptionsSelector = new QComboBox(this);
|
||||
sortOptionsSelector->addItems(SORT_OPTIONS);
|
||||
sortOptionsSelector->setCurrentIndex(2);
|
||||
sortOptionsSelector->setCurrentIndex(SettingsCache::instance().getPrintingSelectorSortOrder());
|
||||
connect(sortOptionsSelector, &QComboBox::currentTextChanged, this,
|
||||
&PrintingSelectorCardSortingWidget::updateSortSetting);
|
||||
connect(sortOptionsSelector, &QComboBox::currentTextChanged, parent, &PrintingSelector::updateDisplay);
|
||||
sortToolBar->addWidget(sortOptionsSelector);
|
||||
|
||||
|
|
@ -40,6 +43,11 @@ void PrintingSelectorCardSortingWidget::updateSortOrder()
|
|||
parent->updateDisplay();
|
||||
}
|
||||
|
||||
void PrintingSelectorCardSortingWidget::updateSortSetting()
|
||||
{
|
||||
SettingsCache::instance().setPrintingSelectorSortOrder(sortOptionsSelector->currentIndex());
|
||||
}
|
||||
|
||||
QList<CardInfoPerSet> PrintingSelectorCardSortingWidget::sortSets(CardInfoPerSetMap cardInfoPerSets)
|
||||
{
|
||||
QList<CardSetPtr> sortedSets;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void updateSortOrder();
|
||||
void updateSortSetting();
|
||||
|
||||
private:
|
||||
PrintingSelector *parent;
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ SettingsCache::SettingsCache()
|
|||
overrideAllCardArtWithPersonalPreference =
|
||||
settings->value("cards/overrideallcardartwithpersonalpreference", false).toBool();
|
||||
bumpSetsWithCardsInDeckToTop = settings->value("cards/bumpsetswithcardsindecktotop", true).toBool();
|
||||
printingSelectorSortOrder = settings->value("cards/printingselectorsortorder", 1).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();
|
||||
|
|
@ -544,6 +545,13 @@ void SettingsCache::setBumpSetsWithCardsInDeckToTop(QT_STATE_CHANGED_T _bumpSets
|
|||
emit bumpSetsWithCardsInDeckToTopChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setPrintingSelectorSortOrder(int _printingSelectorSortOrder)
|
||||
{
|
||||
printingSelectorSortOrder = _printingSelectorSortOrder;
|
||||
settings->setValue("cards/printingselectorsortorder", printingSelectorSortOrder);
|
||||
emit printingSelectorSortOrderChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand)
|
||||
{
|
||||
horizontalHand = static_cast<bool>(_horizontalHand);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ signals:
|
|||
void displayCardNamesChanged();
|
||||
void overrideAllCardArtWithPersonalPreferenceChanged();
|
||||
void bumpSetsWithCardsInDeckToTopChanged();
|
||||
void printingSelectorSortOrderChanged();
|
||||
void horizontalHandChanged();
|
||||
void handJustificationChanged();
|
||||
void invertVerticalCoordinateChanged();
|
||||
|
|
@ -103,6 +104,7 @@ private:
|
|||
bool displayCardNames;
|
||||
bool overrideAllCardArtWithPersonalPreference;
|
||||
bool bumpSetsWithCardsInDeckToTop;
|
||||
int printingSelectorSortOrder;
|
||||
bool horizontalHand;
|
||||
bool invertVerticalCoordinate;
|
||||
int minPlayersForMultiColumnLayout;
|
||||
|
|
@ -311,6 +313,10 @@ public:
|
|||
{
|
||||
return bumpSetsWithCardsInDeckToTop;
|
||||
}
|
||||
int getPrintingSelectorSortOrder() const
|
||||
{
|
||||
return printingSelectorSortOrder;
|
||||
}
|
||||
bool getHorizontalHand() const
|
||||
{
|
||||
return horizontalHand;
|
||||
|
|
@ -592,6 +598,7 @@ public slots:
|
|||
void setDisplayCardNames(QT_STATE_CHANGED_T _displayCardNames);
|
||||
void setOverrideAllCardArtWithPersonalPreference(QT_STATE_CHANGED_T _overrideAllCardArt);
|
||||
void setBumpSetsWithCardsInDeckToTop(QT_STATE_CHANGED_T _bumpSetsWithCardsInDeckToTop);
|
||||
void setPrintingSelectorSortOrder(int _printingSelectorSortOrder);
|
||||
void setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand);
|
||||
void setInvertVerticalCoordinate(QT_STATE_CHANGED_T _invertVerticalCoordinate);
|
||||
void setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue