summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Rowe <jroweboy@gmail.com>2018-08-11 04:25:00 +0200
committerGitHub <noreply@github.com>2018-08-11 04:25:00 +0200
commit4f0818144ee8a2ec91c0be5a414808ac3870b32c (patch)
tree0d077fd2f4a58e492c1a42b91c58e26fc14ecce9
parentMerge pull request #1007 from MerryMage/dynarmic (diff)
parentqt/game_list: Resolve truncation warning within GameListItemPath's constructor (diff)
downloadyuzu-4f0818144ee8a2ec91c0be5a414808ac3870b32c.tar
yuzu-4f0818144ee8a2ec91c0be5a414808ac3870b32c.tar.gz
yuzu-4f0818144ee8a2ec91c0be5a414808ac3870b32c.tar.bz2
yuzu-4f0818144ee8a2ec91c0be5a414808ac3870b32c.tar.lz
yuzu-4f0818144ee8a2ec91c0be5a414808ac3870b32c.tar.xz
yuzu-4f0818144ee8a2ec91c0be5a414808ac3870b32c.tar.zst
yuzu-4f0818144ee8a2ec91c0be5a414808ac3870b32c.zip
-rw-r--r--src/yuzu/game_list_p.h25
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 @@
#pragma once
+#include <array>
#include <atomic>
#include <utility>
#include <QImage>
@@ -39,7 +40,6 @@ public:
* If this class receives valid SMDH data, it will also display game icons and titles.
*/
class GameListItemPath : public GameListItem {
-
public:
static const int FullPathRole = Qt::UserRole + 1;
static const int TitleRole = Qt::UserRole + 2;
@@ -48,18 +48,18 @@ public:
GameListItemPath() = default;
GameListItemPath(const QString& game_path, const std::vector<u8>& picture_data,
- const QString& game_name, const QString& game_type, u64 program_id)
- : GameListItem() {
+ const QString& game_name, const QString& game_type, u64 program_id) {
setData(game_path, FullPathRole);
setData(game_name, TitleRole);
setData(qulonglong(program_id), ProgramIdRole);
setData(game_type, FileTypeRole);
+ const u32 size = UISettings::values.icon_size;
+
QPixmap picture;
- u32 size = UISettings::values.icon_size;
- if (!picture.loadFromData(picture_data.data(), picture_data.size()))
+ if (!picture.loadFromData(picture_data.data(), static_cast<u32>(picture_data.size()))) {
picture = GetDefaultIcon(size);
-
+ }
picture = picture.scaled(size, size);
setData(picture, Qt::DecorationRole);
@@ -70,17 +70,16 @@ public:
std::string filename;
Common::SplitPath(data(FullPathRole).toString().toStdString(), nullptr, &filename,
nullptr);
- QString title = data(TitleRole).toString();
- std::vector<QString> row_data{
+ const std::array<QString, 4> row_data{{
QString::fromStdString(filename),
data(FileTypeRole).toString(),
QString::fromStdString(fmt::format("0x{:016X}", data(ProgramIdRole).toULongLong())),
data(TitleRole).toString(),
- };
+ }};
- auto row1 = row_data.at(UISettings::values.row_1_text_id);
- auto row2 = row_data.at(UISettings::values.row_2_text_id);
+ const auto& row1 = row_data.at(UISettings::values.row_1_text_id);
+ const auto& row2 = row_data.at(UISettings::values.row_2_text_id);
if (row1.isEmpty() || row1 == row2)
return row2;
@@ -88,9 +87,9 @@ public:
return row1;
return row1 + "\n " + row2;
- } else {
- return GameListItem::data(role);
}
+
+ return GameListItem::data(role);
}
};