diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/game_list_p.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 114a0fc7f..8fe5e8b80 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | ||
| 7 | #include <atomic> | 8 | #include <atomic> |
| 8 | #include <utility> | 9 | #include <utility> |
| 9 | #include <QImage> | 10 | #include <QImage> |
| @@ -39,7 +40,6 @@ public: | |||
| 39 | * If this class receives valid SMDH data, it will also display game icons and titles. | 40 | * If this class receives valid SMDH data, it will also display game icons and titles. |
| 40 | */ | 41 | */ |
| 41 | class GameListItemPath : public GameListItem { | 42 | class GameListItemPath : public GameListItem { |
| 42 | |||
| 43 | public: | 43 | public: |
| 44 | static const int FullPathRole = Qt::UserRole + 1; | 44 | static const int FullPathRole = Qt::UserRole + 1; |
| 45 | static const int TitleRole = Qt::UserRole + 2; | 45 | static const int TitleRole = Qt::UserRole + 2; |
| @@ -48,18 +48,18 @@ public: | |||
| 48 | 48 | ||
| 49 | GameListItemPath() = default; | 49 | GameListItemPath() = default; |
| 50 | GameListItemPath(const QString& game_path, const std::vector<u8>& picture_data, | 50 | GameListItemPath(const QString& game_path, const std::vector<u8>& picture_data, |
| 51 | const QString& game_name, const QString& game_type, u64 program_id) | 51 | const QString& game_name, const QString& game_type, u64 program_id) { |
| 52 | : GameListItem() { | ||
| 53 | setData(game_path, FullPathRole); | 52 | setData(game_path, FullPathRole); |
| 54 | setData(game_name, TitleRole); | 53 | setData(game_name, TitleRole); |
| 55 | setData(qulonglong(program_id), ProgramIdRole); | 54 | setData(qulonglong(program_id), ProgramIdRole); |
| 56 | setData(game_type, FileTypeRole); | 55 | setData(game_type, FileTypeRole); |
| 57 | 56 | ||
| 57 | const u32 size = UISettings::values.icon_size; | ||
| 58 | |||
| 58 | QPixmap picture; | 59 | QPixmap picture; |
| 59 | u32 size = UISettings::values.icon_size; | 60 | if (!picture.loadFromData(picture_data.data(), static_cast<u32>(picture_data.size()))) { |
| 60 | if (!picture.loadFromData(picture_data.data(), picture_data.size())) | ||
| 61 | picture = GetDefaultIcon(size); | 61 | picture = GetDefaultIcon(size); |
| 62 | 62 | } | |
| 63 | picture = picture.scaled(size, size); | 63 | picture = picture.scaled(size, size); |
| 64 | 64 | ||
| 65 | setData(picture, Qt::DecorationRole); | 65 | setData(picture, Qt::DecorationRole); |
| @@ -70,17 +70,16 @@ public: | |||
| 70 | std::string filename; | 70 | std::string filename; |
| 71 | Common::SplitPath(data(FullPathRole).toString().toStdString(), nullptr, &filename, | 71 | Common::SplitPath(data(FullPathRole).toString().toStdString(), nullptr, &filename, |
| 72 | nullptr); | 72 | nullptr); |
| 73 | QString title = data(TitleRole).toString(); | ||
| 74 | 73 | ||
| 75 | std::vector<QString> row_data{ | 74 | const std::array<QString, 4> row_data{{ |
| 76 | QString::fromStdString(filename), | 75 | QString::fromStdString(filename), |
| 77 | data(FileTypeRole).toString(), | 76 | data(FileTypeRole).toString(), |
| 78 | QString::fromStdString(fmt::format("0x{:016X}", data(ProgramIdRole).toULongLong())), | 77 | QString::fromStdString(fmt::format("0x{:016X}", data(ProgramIdRole).toULongLong())), |
| 79 | data(TitleRole).toString(), | 78 | data(TitleRole).toString(), |
| 80 | }; | 79 | }}; |
| 81 | 80 | ||
| 82 | auto row1 = row_data.at(UISettings::values.row_1_text_id); | 81 | const auto& row1 = row_data.at(UISettings::values.row_1_text_id); |
| 83 | auto row2 = row_data.at(UISettings::values.row_2_text_id); | 82 | const auto& row2 = row_data.at(UISettings::values.row_2_text_id); |
| 84 | 83 | ||
| 85 | if (row1.isEmpty() || row1 == row2) | 84 | if (row1.isEmpty() || row1 == row2) |
| 86 | return row2; | 85 | return row2; |
| @@ -88,9 +87,9 @@ public: | |||
| 88 | return row1; | 87 | return row1; |
| 89 | 88 | ||
| 90 | return row1 + "\n " + row2; | 89 | return row1 + "\n " + row2; |
| 91 | } else { | ||
| 92 | return GameListItem::data(role); | ||
| 93 | } | 90 | } |
| 91 | |||
| 92 | return GameListItem::data(role); | ||
| 94 | } | 93 | } |
| 95 | }; | 94 | }; |
| 96 | 95 | ||