game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
details_panel_manager.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// ==============================================================================
3// ui/qt/details_panel_manager.h
4// ==============================================================================
5// Owner of the right-hand "details panel" widget tree and the code that
6// populates it from a Game*. Extracted from MainWindow in the MED-7 pass.
7// ==============================================================================
8// Responsibilities:
9// - Construct all widgets inside the details panel (hero image, info labels,
10// stats, collapsible sections, action buttons, frame-metrics embed, etc.).
11// - Respond to `update(gameId)` by re-rendering every section from data
12// pulled via the library controller, launch controller, image cache,
13// system info service, and frame-metrics service.
14// - Maintain the lightweight `updateRunningInfo(gameId)` path driven by a
15// 500ms timer in MainWindow, which only refreshes FPS/frametime without
16// the full rebuild.
17// - Maintain `updateLaunchButton(gameId)` which flips button text/state
18// based on the launch controller's state machine.
19//
20// Dependencies (injected via constructor):
21// - core::GameLibraryController — read/write of the Game model
22// - core::LaunchController — running state + button state
23// - GameThumbnailCache — hero image + cover fallback
24//
25// Signals (handled by MainWindow):
26// - launchRequested / stopRequested — user clicked Launch/Stop
27// - configureRequested — user clicked Configure
28// - gameChanged — user edited model data inline
29// (completion status, notes, preset)
30//
31// Notes:
32// - Preserves the exact rendering behaviour of the old MainWindow code.
33// - Selection state (selectedGameId_) remains owned by MainWindow; the
34// panel is stateless except for the widget tree + cached layout.
35// ==============================================================================
36
37#pragma once
38
39#include <QObject>
40#include <memory>
41#include <string>
42
43class ThemeManager;
44class QWidget;
45class QLabel;
46class QProgressBar;
47class QPushButton;
48class QPixmap;
49class QString;
53
54namespace core
55{
58} // namespace core
59
60class DetailsPanelManager : public QObject
61{
62 Q_OBJECT
63
64 public:
65 DetailsPanelManager(QWidget* parent, core::GameLibraryController* libCtrl,
66 core::LaunchController* launchCtrl, GameThumbnailCache* imgCache,
67 ThemeManager* themeManager, QObject* qparent = nullptr);
69
70 /// The root widget — slot into MainWindow's splitter.
71 QWidget* widget() const;
72
73 /// Full refresh for a new selection. Safe with empty string (empty state).
74 void update(const std::string& gameId);
75
76 /// Lightweight refresh driven by the running-game timer; only touches
77 /// FPS/frametime sections.
78 void updateRunningInfo(const std::string& gameId);
79
80 /// Refresh only the Launch/Stop button state based on the launch state
81 /// machine.
82 void updateLaunchButton(const std::string& gameId);
83
84 /// Re-read theme colours and restyle.
85 void applyTheme();
86
87 /// Optional embed handle so MainWindow can wire the frame metrics timer.
89
90 // -------------------------------------------------------------------------
91 // Widget accessors used by MainWindow callbacks/slots that live outside
92 // the panel's own update path (download progress, async image loading,
93 // direct launch-button tweaks during install flows). Keeping these as raw
94 // pointers lets the existing call sites migrate with minimal churn while
95 // the panel internals remain pimpl-hidden.
96 // -------------------------------------------------------------------------
97 QLabel* heroImageLabel() const;
98 QWidget* downloadProgressWidget() const;
99 QProgressBar* downloadProgressBar() const;
100 QLabel* downloadProgressLabel() const;
101 QPushButton* launchButton() const;
102
103 signals:
104 void launchRequested(const std::string& gameId);
105 void stopRequested(const std::string& gameId);
106 void configureRequested(const std::string& gameId);
107 void gameChanged(const std::string& gameId);
108
109 private:
110 class Impl;
111 std::unique_ptr<Impl> impl_;
112};
QWidget * widget() const
The root widget — slot into MainWindow's splitter.
void gameChanged(const std::string &gameId)
QProgressBar * downloadProgressBar() const
void update(const std::string &gameId)
Full refresh for a new selection. Safe with empty string (empty state).
~DetailsPanelManager() override
void updateRunningInfo(const std::string &gameId)
Lightweight refresh driven by the running-game timer; only touches FPS/frametime sections.
void applyTheme()
Re-read theme colours and restyle.
void stopRequested(const std::string &gameId)
void configureRequested(const std::string &gameId)
FrameMetricsWidget * frameMetricsWidget() const
Optional embed handle so MainWindow can wire the frame metrics timer.
QPushButton * launchButton() const
QLabel * downloadProgressLabel() const
void launchRequested(const std::string &gameId)
QWidget * downloadProgressWidget() const
DetailsPanelManager(QWidget *parent, core::GameLibraryController *libCtrl, core::LaunchController *launchCtrl, GameThumbnailCache *imgCache, ThemeManager *themeManager, QObject *qparent=nullptr)
void updateLaunchButton(const std::string &gameId)
Refresh only the Launch/Stop button state based on the launch state machine.