| 1 | // Copyright 2026 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "DolphinQt/GameCount.h" |
| 5 | |
| 6 | #include <QFontMetrics> |
| 7 | #include <QLayout> |
| 8 | #include <QStatusBar> |
| 9 | |
| 10 | GameCount::GameCount(QWidget* const parent) : QStatusBar(parent) |
| 11 | { |
| 12 | setSizeGripEnabled(false); |
| 13 | QFontMetrics font_metrics(font()); |
| 14 | const int margin = font_metrics.height() / 5; |
| 15 | layout()->setContentsMargins(margin, margin, margin, margin); |
| 16 | } |
| 17 | |
| 18 | void GameCount::OnGameCountUpdated(const int total_games, const int visible_games) |
| 19 | { |
| 20 | const int filtered_games = total_games - visible_games; |
| 21 | |
| 22 | if (filtered_games > 0) |
| 23 | { |
| 24 | showMessage(tr("%1 game(s) in your collection (%2 visible, %3 filtered)") |
| 25 | .arg(total_games) |
| 26 | .arg(visible_games) |
| 27 | .arg(filtered_games)); |
| 28 | } |
| 29 | else |
| 30 | { |
| 31 | showMessage(tr("%1 game(s) in your collection").arg(total_games)); |
| 32 | } |
| 33 | } |