mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 09:33:57 -07:00
Adding Long Name Sorting Options To Set List
Updating Dialog To Sort Options
This commit is contained in:
parent
2e1f5332db
commit
27b8cc5526
3 changed files with 14 additions and 0 deletions
|
|
@ -58,11 +58,22 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class SetList::CompareName {
|
||||
public:
|
||||
inline bool operator()(CardSet *a, CardSet *b) const {
|
||||
return a->getLongName() < b->getLongName();
|
||||
}
|
||||
};
|
||||
|
||||
void SetList::sortByKey()
|
||||
{
|
||||
qSort(begin(), end(), CompareFunctor());
|
||||
}
|
||||
|
||||
void SetList::sortByName() {
|
||||
qSort(begin(), end(), CompareName());
|
||||
}
|
||||
|
||||
PictureToLoad::PictureToLoad(CardInfo *_card, bool _stripped, bool _hq)
|
||||
: card(_card), stripped(_stripped), setIndex(0), hq(_hq)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,8 +36,10 @@ public:
|
|||
class SetList : public QList<CardSet *> {
|
||||
private:
|
||||
class CompareFunctor;
|
||||
class CompareName;
|
||||
public:
|
||||
void sortByKey();
|
||||
void sortByName();
|
||||
};
|
||||
|
||||
class PictureToLoad {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ DlgCardSearch::DlgCardSearch(QWidget *parent)
|
|||
cboSetList = new QComboBox();
|
||||
cboSetList->addItem("");
|
||||
SetList setList = db->getSetList();
|
||||
setList.sortByName();
|
||||
for (int intLoop = 0; intLoop < setList.size(); ++intLoop) {
|
||||
//Adding Translated Set Name, Just In Case
|
||||
cboSetList->addItem(tr("%1").arg(setList.at(intLoop)->getLongName()), setList.at(intLoop)->getShortName());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue