| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <memory> |
| 7 |
|
| 8 |
#include <QStackedWidget> |
| 9 |
|
| 10 |
#include "DolphinQt/GameList/GameListModel.h" |
| 11 |
|
| 12 |
class QAbstractItemView; |
| 13 |
class QLabel; |
| 14 |
class QListView; |
| 15 |
class QSortFilterProxyModel; |
| 16 |
class QTableView; |
| 17 |
|
| 18 |
namespace UICommon |
| 19 |
{ |
| 20 |
class GameFile; |
| 21 |
} |
| 22 |
|
| 23 |
class GameList final : public QStackedWidget |
| 24 |
{ |
| 25 |
Q_OBJECT |
| 26 |
|
| 27 |
public: |
| 28 |
explicit GameList(QWidget* parent = nullptr); |
| 29 |
~GameList() override; |
| 30 |
|
| 31 |
std::shared_ptr<const UICommon::GameFile> GetSelectedGame() const; |
| 32 |
QList<std::shared_ptr<const UICommon::GameFile>> GetSelectedGames() const; |
| 33 |
bool HasMultipleSelected() const; |
| 34 |
std::shared_ptr<const UICommon::GameFile> FindGame(const std::string& path) const; |
| 35 |
std::shared_ptr<const UICommon::GameFile> FindSecondDisc(const UICommon::GameFile& game) const; |
| 36 |
std::string GetNetPlayName(const UICommon::GameFile& game) const; |
| 37 |
|
| 38 |
void SetListView() { SetPreferredView(true); } |
| 39 |
void SetGridView() { SetPreferredView(false); } |
| 40 |
void SetViewColumn(int col, bool view); |
| 41 |
void SetSearchTerm(const QString& term); |
| 42 |
|
| 43 |
void OnColumnVisibilityToggled(const QString& row, bool visible); |
| 44 |
void OnGameListVisibilityChanged(); |
| 45 |
|
| 46 |
void UpdateGameCount() const; |
| 47 |
|
| 48 |
void resizeEvent(QResizeEvent* event) override; |
| 49 |
|
| 50 |
void PurgeCache(); |
| 51 |
|
| 52 |
const GameListModel& GetGameListModel() const { return m_model; } |
| 53 |
|
| 54 |
signals: |
| 55 |
void GameSelected(); |
| 56 |
void GameCountUpdated(int total_games, int visible_games) const; |
| 57 |
void OnStartWithRiivolution(const UICommon::GameFile& game); |
| 58 |
void NetPlayHost(const UICommon::GameFile& game); |
| 59 |
void SelectionChanged(const std::shared_ptr<const UICommon::GameFile>& game_file); |
| 60 |
void OpenGeneralSettings(); |
| 61 |
void OpenGraphicsSettings(); |
| 62 |
#ifdef USE_RETRO_ACHIEVEMENTS |
| 63 |
void OpenAchievementSettings(); |
| 64 |
#endif |
| 65 |
|
| 66 |
private: |
| 67 |
void ShowHeaderContextMenu(const QPoint& pos); |
| 68 |
void ShowContextMenu(const QPoint&); |
| 69 |
void OpenContainingFolder(); |
| 70 |
void OpenProperties(); |
| 71 |
void OpenWiiSaveFolder(); |
| 72 |
void OpenGCSaveFolder(); |
| 73 |
void OpenWiki(); |
| 74 |
void StartWithRiivolution(); |
| 75 |
void SetDefaultISO(); |
| 76 |
void DeleteFile(); |
| 77 |
#ifdef _WIN32 |
| 78 |
bool AddShortcutToDesktop(); |
| 79 |
#endif |
| 80 |
void InstallWAD(); |
| 81 |
void UninstallWAD(); |
| 82 |
void ExportWiiSave(); |
| 83 |
void ConvertFile(); |
| 84 |
void ChangeDisc(); |
| 85 |
void NewTag(); |
| 86 |
void DeleteTag(); |
| 87 |
void UpdateColumnVisibility(); |
| 88 |
|
| 89 |
void ZoomIn(); |
| 90 |
void ZoomOut(); |
| 91 |
|
| 92 |
void OnHeaderViewChanged(); |
| 93 |
void OnSectionResized(int index, int, int); |
| 94 |
|
| 95 |
void MakeListView(); |
| 96 |
void MakeGridView(); |
| 97 |
void MakeEmptyView(); |
| 98 |
|
| 99 |
void SetPreferredView(bool list); |
| 100 |
QAbstractItemView* GetActiveView() const; |
| 101 |
QSortFilterProxyModel* GetActiveProxyModel() const; |
| 102 |
void ConsiderViewChange(); |
| 103 |
void UpdateFont(); |
| 104 |
|
| 105 |
GameListModel m_model; |
| 106 |
QSortFilterProxyModel* m_list_proxy; |
| 107 |
QSortFilterProxyModel* m_grid_proxy; |
| 108 |
|
| 109 |
QListView* m_grid; |
| 110 |
QTableView* m_list; |
| 111 |
QLabel* m_empty; |
| 112 |
bool m_prefer_list; |
| 113 |
|
| 114 |
protected: |
| 115 |
void keyPressEvent(QKeyEvent* event) override; |
| 116 |
}; |