game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
performance_profile_dialog.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// ==============================================================================
3// performance_profile_dialog.h
4// ==============================================================================
5// Dialog for managing per-game performance profiles
6// ==============================================================================
7// Provides a UI for creating, editing, and switching between performance
8// profiles that control MangoHud, GameMode, Gamescope, and other settings.
9// ==============================================================================
10
11#pragma once
12
13#include <QCheckBox>
14#include <QComboBox>
15#include <QDialog>
16#include <QGroupBox>
17#include <QLabel>
18#include <QLineEdit>
19#include <QListWidget>
20#include <QPushButton>
21#include <QSpinBox>
22#include <QTextEdit>
23#include <functional>
24#include <memory>
25#include <optional>
26#include <string>
27
28// Forward declarations
31class Game;
32class ThemeManager;
33
34namespace core
35{
37}
38
39// ==============================================================================
40// PerformanceProfileDialog
41// ==============================================================================
42
43/**
44 * @class PerformanceProfileDialog
45 * @brief Dialog for managing performance profiles for a game
46 *
47 * Features:
48 * - List of existing profiles with quick-select
49 * - Create/Edit/Delete profiles
50 * - Profile settings: MangoHud, GameMode, Gamescope, DXVK options
51 * - Preset templates (Default, High Performance, Battery Saver, etc.)
52 * - Apply profile to game
53 */
54class PerformanceProfileDialog : public QDialog
55{
56 Q_OBJECT
57
58 public:
59 /**
60 * @brief Construct a profile dialog for a specific game
61 * @param game Game to manage profiles for
62 * @param profileService Service for profile management
63 * @param parent Parent widget
64 * @param themeManager Theme provider; pass nullptr to use ThemeManager::instance()
65 */
66 explicit PerformanceProfileDialog(const Game* game, PerformanceProfileService* profileService,
67 QWidget* parent = nullptr,
68 ThemeManager* themeManager = nullptr);
69
70 /**
71 * @brief Construct a global profile manager dialog
72 * @param profileService Service for profile management
73 * @param libraryController Library controller for game list
74 * @param parent Parent widget
75 * @param themeManager Theme provider; pass nullptr to use ThemeManager::instance()
76 */
78 core::GameLibraryController* libraryController,
79 QWidget* parent = nullptr,
80 ThemeManager* themeManager = nullptr);
81
83
84 /**
85 * @brief Get the currently selected profile ID
86 * @return Profile ID or empty if none selected
87 */
88 std::string getSelectedProfileId() const;
89
90 signals:
91 /**
92 * @brief Emitted when a profile is applied to a game
93 * @param gameId Game ID
94 * @param profileId Profile ID that was applied
95 */
96 void profileApplied(const std::string& gameId, const std::string& profileId);
97
98 private slots:
99 void onProfileSelected(QListWidgetItem* current, QListWidgetItem* previous);
100 void onCreateProfile();
101 void onDeleteProfile();
102 void onApplyProfile();
103 void onPresetSelected(int index);
104 void onSettingsChanged();
105 void onGameSelected(int index);
106
107 private:
108 void setupUI();
109 void setupProfileList();
110 void setupProfileEditor();
111 void refreshProfileList();
112 void loadProfileSettings(const std::string& profileId);
113 void saveCurrentProfile();
114 void updateButtonStates();
115 void applyTheme();
116 PerformanceProfile buildProfileFromUI() const;
117
118 // Data
119 const Game* game_ = nullptr;
120 std::string gameId_;
121 PerformanceProfileService* profileService_ = nullptr;
122 core::GameLibraryController* libraryController_ = nullptr;
123 std::string currentProfileId_;
124 bool isGlobalMode_ = false;
125 bool isDirty_ = false;
126
127 // UI - Left panel (profile list)
128 QListWidget* profileList_ = nullptr;
129 QPushButton* createBtn_ = nullptr;
130 QPushButton* deleteBtn_ = nullptr;
131 QComboBox* gameCombo_ = nullptr; // For global mode
132
133 // UI - Right panel (profile editor)
134 QWidget* editorPanel_ = nullptr;
135 QLineEdit* nameEdit_ = nullptr;
136 QTextEdit* descEdit_ = nullptr;
137 QComboBox* presetCombo_ = nullptr;
138
139 // Display settings
140 QGroupBox* displayGroup_ = nullptr;
141 QCheckBox* mangoHudCheck_ = nullptr;
142 QCheckBox* gameModCheck_ = nullptr;
143 QCheckBox* gamescopeCheck_ = nullptr;
144 QCheckBox* vkbasaltCheck_ = nullptr;
145
146 // Gamescope settings
147 QGroupBox* gamescopeGroup_ = nullptr;
148 QSpinBox* gamescopeWidthSpin_ = nullptr;
149 QSpinBox* gamescopeHeightSpin_ = nullptr;
150 QCheckBox* gamescopeFullscreenCheck_ = nullptr;
151 QCheckBox* gamescopeBorderlessCheck_ = nullptr;
152 QComboBox* gamescopeScalerCombo_ = nullptr;
153 QSpinBox* gamescopeFpsLimitSpin_ = nullptr;
154
155 // Wine/Proton settings
156 QGroupBox* wineGroup_ = nullptr;
157 QCheckBox* fsyncCheck_ = nullptr;
158 QCheckBox* esyncCheck_ = nullptr;
159 QCheckBox* ntsyncCheck_ = nullptr;
160 QCheckBox* dxvkAsyncCheck_ = nullptr;
161 QCheckBox* dxvkHudCheck_ = nullptr;
162
163 // Environment variables
164 QGroupBox* envGroup_ = nullptr;
165 QTextEdit* envVarsEdit_ = nullptr;
166
167 // Action buttons
168 QPushButton* applyBtn_ = nullptr;
169 QPushButton* closeBtn_ = nullptr;
170
171 ThemeManager* themeManager_;
172};
Complete representation of a game in the library.
Definition game.h:767
~PerformanceProfileDialog() override
void profileApplied(const std::string &gameId, const std::string &profileId)
Emitted when a profile is applied to a game.
PerformanceProfileDialog(const Game *game, PerformanceProfileService *profileService, QWidget *parent=nullptr, ThemeManager *themeManager=nullptr)
Construct a profile dialog for a specific game.
std::string getSelectedProfileId() const
Get the currently selected profile ID.
Service for managing per-game performance profiles.
Complete performance profile for a game.