mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-12 10:37:02 +00:00
UI: fix sorting after style switch
This commit is contained in:
parent
3c1f920d6c
commit
522396c1ec
2 changed files with 8 additions and 4 deletions
|
|
@ -514,6 +514,9 @@ std::weak_ordering wxGameList::SortComparator(uint64 titleId1, uint64 titleId2,
|
||||||
return CafeTitleList::GetGameInfo(id).GetRegion();
|
return CafeTitleList::GetGameInfo(id).GetRegion();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!sortData->asc)
|
||||||
|
std::swap(titleId1, titleId2);
|
||||||
|
|
||||||
switch(sortData->column)
|
switch(sortData->column)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
|
@ -542,7 +545,7 @@ std::weak_ordering wxGameList::SortComparator(uint64 titleId1, uint64 titleId2,
|
||||||
int wxGameList::SortFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
|
int wxGameList::SortFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
|
||||||
{
|
{
|
||||||
const auto sort_data = (SortData*)sortData;
|
const auto sort_data = (SortData*)sortData;
|
||||||
return sort_data->dir * order_to_int(sort_data->thisptr->SortComparator((uint64)item1, (uint64)item2, sort_data));
|
return order_to_int(sort_data->thisptr->SortComparator((uint64)item1, (uint64)item2, sort_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGameList::SortEntries(int column)
|
void wxGameList::SortEntries(int column)
|
||||||
|
|
@ -566,7 +569,7 @@ void wxGameList::SortEntries(int column)
|
||||||
case ColumnRegion:
|
case ColumnRegion:
|
||||||
case ColumnTitleID:
|
case ColumnTitleID:
|
||||||
{
|
{
|
||||||
SortData data{this, ItemColumns{column}, ascending ? 1 : -1};
|
SortData data{this, ItemColumns{column}, ascending};
|
||||||
SortItems(SortFunction, (wxIntPtr)&data);
|
SortItems(SortFunction, (wxIntPtr)&data);
|
||||||
ShowSortIndicator(column, ascending);
|
ShowSortIndicator(column, ascending);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1677,7 +1680,8 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo)
|
||||||
hres = shellLinkFile->Save(outputPath.wc_str(), TRUE);
|
hres = shellLinkFile->Save(outputPath.wc_str(), TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!SUCCEEDED(hres)) {
|
if (FAILED(hres))
|
||||||
|
{
|
||||||
auto errorMsg = formatWxString(_("Failed to save shortcut to {}"), outputPath);
|
auto errorMsg = formatWxString(_("Failed to save shortcut to {}"), outputPath);
|
||||||
wxMessageBox(errorMsg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
|
wxMessageBox(errorMsg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ private:
|
||||||
{
|
{
|
||||||
wxGameList* thisptr;
|
wxGameList* thisptr;
|
||||||
ItemColumns column;
|
ItemColumns column;
|
||||||
int dir;
|
bool asc;
|
||||||
};
|
};
|
||||||
|
|
||||||
int FindInsertPosition(TitleId titleId);
|
int FindInsertPosition(TitleId titleId);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue