From fd40d55a4ff2b02bf79e86b5c996cc1b520ba6ac Mon Sep 17 00:00:00 2001 From: Kewlan Date: Sat, 10 Apr 2021 11:09:01 +0200 Subject: game_list: Mark games as favorite to make them appear at the top. Icons are from Icons8. --- src/yuzu/game_list_p.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/yuzu/game_list_p.h') 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(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(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(); -- cgit v1.2.3