fix: macos compilation

i forgor macos is cringe with static arrays 💀

edit: WHY DONT MAC LET ME USE STD::ARRAY ;----;
This commit is contained in:
flow 2022-05-15 20:59:07 -03:00
parent ec3c882a44
commit e7bb3b2776
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -153,14 +153,31 @@ void ModpackListModel::refresh()
performPaginatedSearch(); performPaginatedSearch();
} }
static std::array<QString, 5> sorts {"relevance", "downloads", "follows", "newest", "updated"}; static auto sortFromIndex(int index) -> QString
{
switch(index){
default:
case 1:
return "relevance";
case 2:
return "downloads";
case 3:
return "follows";
case 4:
return "newest";
case 5:
return "updated";
}
return {};
}
void ModpackListModel::searchWithTerm(const QString& term, const int sort) void ModpackListModel::searchWithTerm(const QString& term, const int sort)
{ {
if(sort > 5 || sort < 0) if(sort > 5 || sort < 0)
return; return;
auto sort_str = sorts.at(sort); auto sort_str = sortFromIndex(sort);
if (currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull() && currentSort == sort_str) { if (currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull() && currentSort == sort_str) {
return; return;