mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-29 11:06:07 +00:00
Fix list sorting for some categories (#1242)
* fix list sorting for serial, firmware version, and game size * bad apple!! * qol
This commit is contained in:
parent
a5968b630d
commit
2b8c2ce423
|
@ -102,7 +102,9 @@ void GameGridFrame::PopulateGameGrid(QVector<GameInfo> m_games_search, bool from
|
|||
|
||||
name_label->setGraphicsEffect(shadowEffect);
|
||||
widget->setLayout(layout);
|
||||
QString tooltipText = QString::fromStdString(m_games_[gameCounter].name);
|
||||
QString tooltipText = QString::fromStdString(m_games_[gameCounter].name + " (" +
|
||||
m_games_[gameCounter].version + ", " +
|
||||
m_games_[gameCounter].region + ")");
|
||||
widget->setToolTip(tooltipText);
|
||||
QString tooltipStyle = QString("QToolTip {"
|
||||
"background-color: #ffffff;"
|
||||
|
|
|
@ -44,18 +44,27 @@ public:
|
|||
|
||||
int icon_size;
|
||||
|
||||
static float parseAsFloat(const std::string& str, const int& offset) {
|
||||
return std::stof(str.substr(0, str.size() - offset));
|
||||
}
|
||||
|
||||
static float parseSizeMB(const std::string& size) {
|
||||
float num = parseAsFloat(size, 3);
|
||||
return (size[size.size() - 2] == 'G') ? num * 1024 : num;
|
||||
}
|
||||
|
||||
static bool CompareStringsAscending(GameInfo a, GameInfo b, int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 1:
|
||||
return a.name < b.name;
|
||||
case 2:
|
||||
return a.serial < b.serial;
|
||||
return a.serial.substr(4) < b.serial.substr(4);
|
||||
case 3:
|
||||
return a.region < b.region;
|
||||
case 4:
|
||||
return a.fw < b.fw;
|
||||
return parseAsFloat(a.fw, 0) < parseAsFloat(b.fw, 0);
|
||||
case 5:
|
||||
return a.size < b.size;
|
||||
return parseSizeMB(b.size) < parseSizeMB(a.size);
|
||||
case 6:
|
||||
return a.version < b.version;
|
||||
case 7:
|
||||
|
@ -70,13 +79,13 @@ public:
|
|||
case 1:
|
||||
return a.name > b.name;
|
||||
case 2:
|
||||
return a.serial > b.serial;
|
||||
return a.serial.substr(4) > b.serial.substr(4);
|
||||
case 3:
|
||||
return a.region > b.region;
|
||||
case 4:
|
||||
return a.fw > b.fw;
|
||||
return parseAsFloat(a.fw, 0) > parseAsFloat(b.fw, 0);
|
||||
case 5:
|
||||
return a.size > b.size;
|
||||
return parseSizeMB(b.size) > parseSizeMB(a.size);
|
||||
case 6:
|
||||
return a.version > b.version;
|
||||
case 7:
|
||||
|
|
Loading…
Reference in a new issue