summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/MainWindow.cpp
diff options
context:
space:
mode:
authorDentomologist <dentomologist@gmail.com>2026-03-04 15:24:30 -0800
committerDentomologist <dentomologist@gmail.com>2026-03-13 11:26:32 -0700
commit7209cf87cb035fa08e06e8705d54a8a8c08c3d03 (patch)
treeaf21340938873b954cbd2186fff5cbcdbb3cd328 /Source/Core/DolphinQt/MainWindow.cpp
parent49d5299f1e41930d31cc83dc28c4c583589ff674 (diff)
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.
Diffstat (limited to 'Source/Core/DolphinQt/MainWindow.cpp')
-rw-r--r--Source/Core/DolphinQt/MainWindow.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp
index 962f75e96c..c3f5b4148c 100644
--- a/Source/Core/DolphinQt/MainWindow.cpp
+++ b/Source/Core/DolphinQt/MainWindow.cpp
@@ -95,6 +95,7 @@
#include "DolphinQt/EmulatedUSB/WiiSpeakWindow.h"
#include "DolphinQt/FIFO/FIFOPlayerWindow.h"
#include "DolphinQt/GCMemcardManager.h"
+#include "DolphinQt/GameCount.h"
#include "DolphinQt/GameList/GameList.h"
#include "DolphinQt/Host.h"
#include "DolphinQt/HotkeyScheduler.h"
@@ -449,6 +450,7 @@ void MainWindow::CreateComponents()
m_menu_bar = new MenuBar(this);
m_tool_bar = new ToolBar(this);
m_search_bar = new SearchBar(this);
+ m_game_count = new GameCount(this);
m_game_list = new GameList(this);
m_render_widget = new RenderWidget;
m_stack = new QStackedWidget(this);
@@ -738,9 +740,30 @@ void MainWindow::ConnectStack()
layout->addWidget(m_game_list);
layout->addWidget(m_search_bar);
+ layout->addWidget(m_game_count);
+ layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
connect(m_search_bar, &SearchBar::Search, m_game_list, &GameList::SetSearchTerm);
+ connect(m_game_list, &GameList::GameCountUpdated, m_game_count, &GameCount::OnGameCountUpdated);
+
+ m_game_list->UpdateGameCount();
+
+ const auto update_spacing = [this](const bool game_count_is_visible) {
+ // The bottom margin of the search bar and the top margin of the game count are both suitable
+ // when the other widget is hidden, but when both are visible the gap created by the combination
+ // is too large. To fix this we set the bottom margin of the search bar to 0 when the game count
+ // is visible and set it to the top margin when the game count is hidden.
+ m_game_count->setVisible(game_count_is_visible);
+ auto* const search_layout = m_search_bar->layout();
+ QMargins search_margins = search_layout->contentsMargins();
+ const int new_bottom_margin = game_count_is_visible ? 0 : search_margins.top();
+ search_margins.setBottom(new_bottom_margin);
+ search_layout->setContentsMargins(search_margins);
+ };
+ update_spacing(Settings::Instance().IsGameCountVisible());
+
+ connect(&Settings::Instance(), &Settings::GameCountVisibilityChanged, update_spacing);
m_stack->addWidget(widget);