Favorites in the game list (#2649) (#3071)
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / windows-qt (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / macos-qt (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-qt (push) Has been cancelled
Build and Release / linux-sdl-gcc (push) Has been cancelled
Build and Release / linux-qt-gcc (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled

* Favorites in the game list (#2649)

Changed how favorites are saved to match PR #2984. Adjusted the favorite
icon size. Fixed bug where favorites were inconsistent when changing to
list mode. Instantly sort list when adding or removing a favorite.

Co-authored-by: David Antunes <david.f.antunes@tecnico.ulisboa.pt>

* fix formatting

* Favorites in the game list (#2649)

Fixed issue where background change was inconsistent while adding
favorites, unselect row when adding favorites, cleaned code, changed
right click menu options to match the game's favorite status.

* fixed right click bug

* keep row selection when adding favorites

* fixed sorting on game grid after using search bar

* change the way favorites are saved to match #3119
This commit is contained in:
davidantunes23 2025-06-22 10:53:47 +01:00 committed by GitHub
parent 669b19c2f3
commit 4bfa8c9fc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 203 additions and 31 deletions

View file

@ -42,11 +42,13 @@ public Q_SLOTS:
private:
void SetTableItem(int row, int column, QString itemStr);
void SetRegionFlag(int row, int column, QString itemStr);
void SetFavoriteIcon(int row, int column);
void SetCompatibilityItem(int row, int column, CompatibilityEntry entry);
QString GetPlayTime(const std::string& serial);
QList<QAction*> m_columnActs;
GameInfoClass* game_inf_get = nullptr;
bool ListSortedAsc = true;
int sortColumn = 1;
QTableWidgetItem* m_current_item = nullptr;
int m_last_opacity = -1; // Track last opacity to avoid unnecessary recomputation
std::filesystem::path m_current_game_path; // Track current game path to detect changes
@ -55,6 +57,7 @@ private:
public:
void PopulateGameList(bool isInitialPopulation = true);
void ResizeIcons(int iconSize);
void ApplyLastSorting(bool isInitialPopulation);
QTableWidgetItem* GetCurrentItem();
QImage backgroundImage;
GameListUtils m_game_list_utils;
@ -63,6 +66,7 @@ public:
std::shared_ptr<CompatibilityInfoClass> m_compat_info;
int icon_size;
std::string last_favorite;
static float parseAsFloat(const std::string& str, const int& offset) {
return std::stof(str.substr(0, str.size() - offset));
@ -130,4 +134,6 @@ public:
return false;
}
}
bool CompareWithFavorite(GameInfo a, GameInfo b, int columnIndex, bool ascending);
};