summaryrefslogtreecommitdiff
path: root/src/yuzu/game_list_p.h
diff options
context:
space:
mode:
authorKewlan <colin_rehn@hotmail.com>2021-04-10 11:09:01 +0200
committerKewlan <colin_rehn@hotmail.com>2021-04-15 07:15:42 +0200
commitfd40d55a4ff2b02bf79e86b5c996cc1b520ba6ac (patch)
tree2ac08a5252670c03867bad2eed47d58523e10d00 /src/yuzu/game_list_p.h
parent62a8505345122ff03c9311a13c40863d9b4f743f (diff)
game_list: Mark games as favorite to make them appear at the top.
Icons are from Icons8.
Diffstat (limited to 'src/yuzu/game_list_p.h')
-rw-r--r--src/yuzu/game_list_p.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h
index f25445f18..7ca8ece23 100644
--- a/src/yuzu/game_list_p.h
+++ b/src/yuzu/game_list_p.h
@@ -29,7 +29,8 @@ enum class GameListItemType {
SdmcDir = QStandardItem::UserType + 3,
UserNandDir = QStandardItem::UserType + 4,
SysNandDir = QStandardItem::UserType + 5,
- AddDir = QStandardItem::UserType + 6
+ AddDir = QStandardItem::UserType + 6,
+ Favorites = QStandardItem::UserType + 7,
};
Q_DECLARE_METATYPE(GameListItemType);
@@ -310,6 +311,28 @@ public:
}
};
+class GameListFavorites : public GameListItem {
+public:
+ explicit GameListFavorites() {
+ setData(type(), TypeRole);
+
+ const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64);
+ setData(QIcon::fromTheme(QStringLiteral("star"))
+ .pixmap(icon_size)
+ .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
+ Qt::DecorationRole);
+ setData(QObject::tr("Favorites"), Qt::DisplayRole);
+ }
+
+ int type() const override {
+ return static_cast<int>(GameListItemType::Favorites);
+ }
+
+ bool operator<(const QStandardItem& other) const override {
+ return false;
+ }
+};
+
class GameList;
class QHBoxLayout;
class QTreeView;
@@ -324,6 +347,7 @@ public:
explicit GameListSearchField(GameList* parent = nullptr);
void setFilterResult(int visible, int total);
+ bool isEmpty() const;
void clear();
void setFocus();