mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-20 03:24:49 +00:00
* Fix alphabetical sorting bug caused by case-sensitive string comparisons in GameListFrame. * Fix bug with incorrect use of std::tolower. * Fix clang-format error. --------- Co-authored-by: Zaid Ismail <ZaidI@thoroughtec.com>
This commit is contained in:
parent
3a163002d7
commit
19bbbf994c
1 changed files with 15 additions and 4 deletions
|
@ -3,6 +3,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm> // std::transform
|
||||
#include <cctype> // std::tolower
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
|
@ -65,8 +68,12 @@ public:
|
|||
|
||||
static bool CompareStringsAscending(GameInfo a, GameInfo b, int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 1:
|
||||
return a.name < b.name;
|
||||
case 1: {
|
||||
std::string name_a = a.name, name_b = b.name;
|
||||
std::transform(name_a.begin(), name_a.end(), name_a.begin(), ::tolower);
|
||||
std::transform(name_b.begin(), name_b.end(), name_b.begin(), ::tolower);
|
||||
return name_a < name_b;
|
||||
}
|
||||
case 2:
|
||||
return a.compatibility.status < b.compatibility.status;
|
||||
case 3:
|
||||
|
@ -90,8 +97,12 @@ public:
|
|||
|
||||
static bool CompareStringsDescending(GameInfo a, GameInfo b, int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 1:
|
||||
return a.name > b.name;
|
||||
case 1: {
|
||||
std::string name_a = a.name, name_b = b.name;
|
||||
std::transform(name_a.begin(), name_a.end(), name_a.begin(), ::tolower);
|
||||
std::transform(name_b.begin(), name_b.end(), name_b.begin(), ::tolower);
|
||||
return name_a > name_b;
|
||||
}
|
||||
case 2:
|
||||
return a.compatibility.status > b.compatibility.status;
|
||||
case 3:
|
||||
|
|
Loading…
Add table
Reference in a new issue