refactor(RD): clear up sorting methods
This refactors the sorting methods to join every bit of it into a single list, easing maintanance. It also removes the weird index contraint on the list of methods by adding an index field to the DS that holds the method. Lastly, it puts the available methods on their respective API, so other resources on the same API can re-use them later on. Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
@ -103,6 +103,17 @@ void ResourcePage::setSearchTerm(QString term)
|
||||
m_ui->searchEdit->setText(term);
|
||||
}
|
||||
|
||||
void ResourcePage::addSortings()
|
||||
{
|
||||
Q_ASSERT(m_model);
|
||||
|
||||
auto sorts = m_model->getSortingMethods();
|
||||
std::sort(sorts.begin(), sorts.end(), [](auto const& l, auto const& r) { return l.index < r.index; });
|
||||
|
||||
for (auto&& sorting : sorts)
|
||||
m_ui->sortByBox->addItem(sorting.readable_name, QVariant(sorting.index));
|
||||
}
|
||||
|
||||
bool ResourcePage::setCurrentPack(ModPlatform::IndexedPack pack)
|
||||
{
|
||||
QVariant v;
|
||||
|
Reference in New Issue
Block a user