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:
Dentomologist
2026-03-04 15:24:30 -08:00
parent 49d5299f1e
commit 7209cf87cb
11 changed files with 119 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
// Copyright 2026 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "DolphinQt/GameCount.h"
#include <QFontMetrics>
#include <QLayout>
#include <QStatusBar>
GameCount::GameCount(QWidget* const parent) : QStatusBar(parent)
{
setSizeGripEnabled(false);
QFontMetrics font_metrics(font());
const int margin = font_metrics.height() / 5;
layout()->setContentsMargins(margin, margin, margin, margin);
}
void GameCount::OnGameCountUpdated(const int total_games, const int visible_games)
{
const int filtered_games = total_games - visible_games;
if (filtered_games > 0)
{
showMessage(tr("%1 game(s) in your collection (%2 visible, %3 filtered)")
.arg(total_games)
.arg(visible_games)
.arg(filtered_games));
}
else
{
showMessage(tr("%1 game(s) in your collection").arg(total_games));
}
}