rework set prioritization

This commit is contained in:
Cameron McDonald 2024-08-15 11:57:46 -05:00
parent f85faf141d
commit 9f4ac3b28a
13 changed files with 141 additions and 42 deletions

View file

@ -56,6 +56,8 @@ QVariant SetsModel::data(const QModelIndex &index, int role) const
return set->getLongName();
case ReleaseDateCol:
return set->getReleaseDate().toString(Qt::ISODate);
case PriorityCol:
return set->getPriority();
default:
return QVariant();
}
@ -80,6 +82,9 @@ QVariant SetsModel::headerData(int section, Qt::Orientation orientation, int rol
case IsKnownCol:
return QString(
"Is known"); /* no tr() for translations needed, column is just used for sorting --> hidden */
case PriorityCol:
return QString(
"Priority"); /* no tr() for translations needed, column is just used for sorting --> hidden */
case EnabledCol:
return tr("Enabled");
case SetTypeCol:
@ -195,6 +200,13 @@ void SetsModel::swapRows(int oldRow, int newRow)
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}
void SetsModel::restoreOriginalOrder()
{
int numRows = rowCount();
sets.defaultSort();
emit dataChanged(index(0, 0), index(numRows - 1, columnCount() - 1));
}
void SetsModel::sort(int column, Qt::SortOrder order)
{
QMultiMap<QString, CardSetPtr> setMap;