mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-18 07:17:53 +00:00
game_list: Mark games as favorite to make them appear at the top.
Icons are from Icons8.
This commit is contained in:
parent
514490a4da
commit
886fdb2687
15 changed files with 152 additions and 5 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue