GameList: Add status bar with game count
The status bar shows the number of games in your collection. If any games are hidden by the platform, region, or search filters it will also show how many games are visible and how many are filtered. The visibility of the status bar can be toggled from the menu by selecting `View`->`Show Game Count`. Implements https://bugs.dolphin-emu.org/issues/9517.
This commit is contained in:
1 parent
49d5299f1e
commit
7209cf87cb
11 files changed
+119
No files matched your search
@@ -139,6 +139,8 @@ GameList::GameList(QWidget* parent) : QStackedWidget(parent), m_model(this)
|
||||
connect(m_grid, &QListView::doubleClicked, this, &GameList::GameSelected);
|
||||
connect(&m_model, &QAbstractItemModel::rowsInserted, this, &GameList::ConsiderViewChange);
|
||||
connect(&m_model, &QAbstractItemModel::rowsRemoved, this, &GameList::ConsiderViewChange);
|
||||
connect(&m_model, &QAbstractItemModel::rowsInserted, this, &GameList::UpdateGameCount);
|
||||
connect(&m_model, &QAbstractItemModel::rowsRemoved, this, &GameList::UpdateGameCount);
|
||||
|
||||
addWidget(m_list);
|
||||
addWidget(m_grid);
|
||||
@@ -1043,6 +1045,8 @@ void GameList::OnGameListVisibilityChanged()
|
||||
{
|
||||
m_list_proxy->invalidate();
|
||||
m_grid_proxy->invalidate();
|
||||
|
||||
UpdateGameCount();
|
||||
}
|
||||
|
||||
void GameList::OnSectionResized(int index, int, int)
|
||||
@@ -1171,6 +1175,15 @@ void GameList::SetSearchTerm(const QString& term)
|
||||
m_grid_proxy->invalidate();
|
||||
|
||||
UpdateColumnVisibility();
|
||||
UpdateGameCount();
|
||||
}
|
||||
|
||||
void GameList::UpdateGameCount() const
|
||||
{
|
||||
const int total_games = m_model.rowCount(QModelIndex{});
|
||||
const int visible_games = m_list_proxy->rowCount();
|
||||
|
||||
emit GameCountUpdated(total_games, visible_games);
|
||||
}
|
||||
|
||||
void GameList::ZoomIn()
|
||||
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
void OnColumnVisibilityToggled(const QString& row, bool visible);
|
||||
void OnGameListVisibilityChanged();
|
||||
|
||||
void UpdateGameCount() const;
|
||||
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
|
||||
void PurgeCache();
|
||||
@@ -51,6 +53,7 @@ public:
|
||||
|
||||
signals:
|
||||
void GameSelected();
|
||||
void GameCountUpdated(int total_games, int visible_games) const;
|
||||
void OnStartWithRiivolution(const UICommon::GameFile& game);
|
||||
void NetPlayHost(const UICommon::GameFile& game);
|
||||
void SelectionChanged(std::shared_ptr<const UICommon::GameFile> game_file);
|
||||
|
||||
Reference in new issue
Block a user