diff options
Diffstat (limited to '')
| -rw-r--r-- | src/yuzu/game_list_p.h | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 0cd0054c8..92779a9c7 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h | |||
| @@ -49,10 +49,10 @@ class GameListItem : public QStandardItem { | |||
| 49 | 49 | ||
| 50 | public: | 50 | public: |
| 51 | // used to access type from item index | 51 | // used to access type from item index |
| 52 | static const int TypeRole = Qt::UserRole + 1; | 52 | static constexpr int TypeRole = Qt::UserRole + 1; |
| 53 | static const int SortRole = Qt::UserRole + 2; | 53 | static constexpr int SortRole = Qt::UserRole + 2; |
| 54 | GameListItem() = default; | 54 | GameListItem() = default; |
| 55 | GameListItem(const QString& string) : QStandardItem(string) { | 55 | explicit GameListItem(const QString& string) : QStandardItem(string) { |
| 56 | setData(string, SortRole); | 56 | setData(string, SortRole); |
| 57 | } | 57 | } |
| 58 | }; | 58 | }; |
| @@ -65,10 +65,10 @@ public: | |||
| 65 | */ | 65 | */ |
| 66 | class GameListItemPath : public GameListItem { | 66 | class GameListItemPath : public GameListItem { |
| 67 | public: | 67 | public: |
| 68 | static const int TitleRole = SortRole + 1; | 68 | static constexpr int TitleRole = SortRole + 1; |
| 69 | static const int FullPathRole = SortRole + 2; | 69 | static constexpr int FullPathRole = SortRole + 2; |
| 70 | static const int ProgramIdRole = SortRole + 3; | 70 | static constexpr int ProgramIdRole = SortRole + 3; |
| 71 | static const int FileTypeRole = SortRole + 4; | 71 | static constexpr int FileTypeRole = SortRole + 4; |
| 72 | 72 | ||
| 73 | GameListItemPath() = default; | 73 | GameListItemPath() = default; |
| 74 | GameListItemPath(const QString& game_path, const std::vector<u8>& picture_data, | 74 | GameListItemPath(const QString& game_path, const std::vector<u8>& picture_data, |
| @@ -110,18 +110,22 @@ public: | |||
| 110 | const auto& row1 = row_data.at(UISettings::values.row_1_text_id); | 110 | const auto& row1 = row_data.at(UISettings::values.row_1_text_id); |
| 111 | const int row2_id = UISettings::values.row_2_text_id; | 111 | const int row2_id = UISettings::values.row_2_text_id; |
| 112 | 112 | ||
| 113 | if (role == SortRole) | 113 | if (role == SortRole) { |
| 114 | return row1.toLower(); | 114 | return row1.toLower(); |
| 115 | } | ||
| 115 | 116 | ||
| 116 | if (row2_id == 4) // None | 117 | // None |
| 118 | if (row2_id == 4) { | ||
| 117 | return row1; | 119 | return row1; |
| 120 | } | ||
| 118 | 121 | ||
| 119 | const auto& row2 = row_data.at(row2_id); | 122 | const auto& row2 = row_data.at(row2_id); |
| 120 | 123 | ||
| 121 | if (row1 == row2) | 124 | if (row1 == row2) { |
| 122 | return row1; | 125 | return row1; |
| 126 | } | ||
| 123 | 127 | ||
| 124 | return QString(row1 + QStringLiteral("\n ") + row2); | 128 | return QStringLiteral("%1\n %2").arg(row1, row2); |
| 125 | } | 129 | } |
| 126 | 130 | ||
| 127 | return GameListItem::data(role); | 131 | return GameListItem::data(role); |
| @@ -131,7 +135,7 @@ public: | |||
| 131 | class GameListItemCompat : public GameListItem { | 135 | class GameListItemCompat : public GameListItem { |
| 132 | Q_DECLARE_TR_FUNCTIONS(GameListItemCompat) | 136 | Q_DECLARE_TR_FUNCTIONS(GameListItemCompat) |
| 133 | public: | 137 | public: |
| 134 | static const int CompatNumberRole = SortRole; | 138 | static constexpr int CompatNumberRole = SortRole; |
| 135 | GameListItemCompat() = default; | 139 | GameListItemCompat() = default; |
| 136 | explicit GameListItemCompat(const QString& compatibility) { | 140 | explicit GameListItemCompat(const QString& compatibility) { |
| 137 | setData(type(), TypeRole); | 141 | setData(type(), TypeRole); |
| @@ -181,7 +185,7 @@ public: | |||
| 181 | */ | 185 | */ |
| 182 | class GameListItemSize : public GameListItem { | 186 | class GameListItemSize : public GameListItem { |
| 183 | public: | 187 | public: |
| 184 | static const int SizeRole = SortRole; | 188 | static constexpr int SizeRole = SortRole; |
| 185 | 189 | ||
| 186 | GameListItemSize() = default; | 190 | GameListItemSize() = default; |
| 187 | explicit GameListItemSize(const qulonglong size_bytes) { | 191 | explicit GameListItemSize(const qulonglong size_bytes) { |
| @@ -217,7 +221,7 @@ public: | |||
| 217 | 221 | ||
| 218 | class GameListDir : public GameListItem { | 222 | class GameListDir : public GameListItem { |
| 219 | public: | 223 | public: |
| 220 | static const int GameDirRole = Qt::UserRole + 2; | 224 | static constexpr int GameDirRole = Qt::UserRole + 2; |
| 221 | 225 | ||
| 222 | explicit GameListDir(UISettings::GameDir& directory, | 226 | explicit GameListDir(UISettings::GameDir& directory, |
| 223 | GameListItemType dir_type = GameListItemType::CustomDir) | 227 | GameListItemType dir_type = GameListItemType::CustomDir) |