mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 16:32:16 -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()
|
void SetList::sortByKey()
|
||||||
{
|
{
|
||||||
qSort(begin(), end(), CompareFunctor());
|
qSort(begin(), end(), CompareFunctor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetList::sortByName() {
|
||||||
|
qSort(begin(), end(), CompareName());
|
||||||
|
}
|
||||||
|
|
||||||
PictureToLoad::PictureToLoad(CardInfo *_card, bool _stripped, bool _hq)
|
PictureToLoad::PictureToLoad(CardInfo *_card, bool _stripped, bool _hq)
|
||||||
: card(_card), stripped(_stripped), setIndex(0), hq(_hq)
|
: card(_card), stripped(_stripped), setIndex(0), hq(_hq)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,10 @@ public:
|
||||||
class SetList : public QList<CardSet *> {
|
class SetList : public QList<CardSet *> {
|
||||||
private:
|
private:
|
||||||
class CompareFunctor;
|
class CompareFunctor;
|
||||||
|
class CompareName;
|
||||||
public:
|
public:
|
||||||
void sortByKey();
|
void sortByKey();
|
||||||
|
void sortByName();
|
||||||
};
|
};
|
||||||
|
|
||||||
class PictureToLoad {
|
class PictureToLoad {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ DlgCardSearch::DlgCardSearch(QWidget *parent)
|
||||||
cboSetList = new QComboBox();
|
cboSetList = new QComboBox();
|
||||||
cboSetList->addItem("");
|
cboSetList->addItem("");
|
||||||
SetList setList = db->getSetList();
|
SetList setList = db->getSetList();
|
||||||
|
setList.sortByName();
|
||||||
for (int intLoop = 0; intLoop < setList.size(); ++intLoop) {
|
for (int intLoop = 0; intLoop < setList.size(); ++intLoop) {
|
||||||
//Adding Translated Set Name, Just In Case
|
//Adding Translated Set Name, Just In Case
|
||||||
cboSetList->addItem(tr("%1").arg(setList.at(intLoop)->getLongName()), setList.at(intLoop)->getShortName());
|
cboSetList->addItem(tr("%1").arg(setList.at(intLoop)->getLongName()), setList.at(intLoop)->getShortName());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue