game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
gameconfigdialog.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// ==============================================================================
3// qt/gameconfigdialog.h
4// ==============================================================================
5// Advanced game configuration dialog with transparent optimization settings
6// Redesigned with modern UI/UX, Performance Profile integration, and
7// clear visual hierarchy for power users.
8// ==============================================================================
9
10#pragma once
11
12#include "models/game.h"
15
16#include <QCheckBox>
17#include <QComboBox>
18#include <QDialog>
19#include <QGroupBox>
20#include <QLabel>
21#include <QLineEdit>
22#include <QListWidget>
23#include <QPushButton>
24#include <QSpinBox>
25#include <QSplitter>
26#include <QStringList>
27#include <QTableWidget>
28#include <QTextEdit>
29#include <QWidget>
30
31// Forward declarations
32class QTabWidget;
33class QScrollArea;
36class ThemeManager;
38
39// ==============================================================================
40// Configuration Preset Definitions
41// ==============================================================================
42
43enum class ConfigPreset
44{
45 Balanced, // Good balance of performance and quality
46 MaxPerformance, // Prioritize FPS over everything
47 MaxQuality, // HDR, upscaling, visual enhancements
48 Compatibility, // Maximum compatibility, minimal tweaks
49 Custom // User has modified settings
50};
51
52// ==============================================================================
53// Game Configuration Dialog
54// ==============================================================================
55
56class GameConfigDialog : public QDialog
57{
58 Q_OBJECT
59
60 public:
61 explicit GameConfigDialog(Game* game, QWidget* parent = nullptr,
62 ThemeManager* themeManager = nullptr);
63 ~GameConfigDialog() override;
64
65 private slots:
66 // Navigation
67 void onBrowseExecutable();
68 void onBrowseWorkingDir();
69 void onBrowseWinePrefix();
70
71 // Environment variables
72 void onAddEnvVar();
73 void onRemoveEnvVar();
74
75 // Runner
76 void onRunnerTypeChanged(int index);
77
78 // Presets
79 void onPresetChanged(int index);
80 void onAnySettingChanged();
81
82 // Recommendations (unified)
83 void onApplyRecommendations(const GameSuggestions& suggestions);
84
85 // Actions
86 void onApply();
87 void onAccept();
88
89 // Launch preview
90 void updateLaunchPreview();
91
92 // Steam integration
93 void onFetchSteamOptions();
94 void onWriteSteamOptions();
95 void updateSteamGroup();
96
97 // Configuration templates
98 void onTemplateChanged(int index);
99 void onSaveTemplate();
100 void onDeleteTemplate();
101 void updateTemplateCombo();
102
103 // Performance profiles
104 void onProfileSelected(QListWidgetItem* current, QListWidgetItem* previous);
105 void onApplyProfile();
106 void onSaveAsProfile();
107 void onManageProfiles();
108 void refreshProfileList();
109
110 private:
111 // Setup methods
112 void setupUI();
113 void setupGameTab(QWidget* tab);
114 void setupPerformanceTab(QWidget* tab);
115 void setupGraphicsTab(QWidget* tab);
116 void setupEnvironmentTab(QWidget* tab);
117 void setupLaunchPreviewPanel();
118
119 // Helper methods
120 void loadFromGame();
121 void saveToGame();
122 void applyPreset(ConfigPreset preset);
123 ConfigPreset detectCurrentPreset() const;
124 void updatePresetComboSilently(ConfigPreset preset);
125 QString buildEnvironmentString() const;
126 QString buildLaunchCommand() const;
127 QString getGpuVendor() const;
128 void updatePerfWrapperWarning();
129 void showRecommendationPreview(const GameSuggestions& suggestions);
130 void showProfilePreview(const QString& profileId, bool isGlobal);
131 void updateRecommendationsBanner();
132
133 // Create grouped checkbox with env var display
134 EnvVarCheckBox* createEnvVarCheckbox(const QString& label, const QString& envVar,
135 const QString& tooltip = QString());
136
137 Game* game_;
138 bool updatingPreset_ = false; // Prevent recursive preset updates
139
140 // Tab widget
141 QTabWidget* tabWidget_;
142
143 // === General Tab ===
144 QLineEdit* nameEdit_;
145 QLineEdit* executableEdit_;
146 QLineEdit* workingDirEdit_;
147 QLineEdit* argumentsEdit_;
148 QComboBox* sourceCombo_;
149 QTextEdit* excludeProcessesEdit_;
150
151 // === Steam Integration (in General Tab) ===
152 QGroupBox* steamGroup_ = nullptr;
153 QLabel* steamAppIdLabel_ = nullptr;
154 QLineEdit* steamLaunchOptionsEdit_ = nullptr;
155 QCheckBox* steamSyncLaunchOptionsCheck_ = nullptr;
156 QPushButton* steamFetchOptionsBtn_ = nullptr;
157 QPushButton* steamWriteOptionsBtn_ = nullptr;
158
159 // === Configuration Templates (in header area) ===
160 QComboBox* templateCombo_ = nullptr;
161 QPushButton* saveTemplateBtn_ = nullptr;
162 QPushButton* deleteTemplateBtn_ = nullptr;
163
164 // === Runner Tab ===
165 QComboBox* runnerTypeCombo_;
166 QComboBox* runnerVersionCombo_;
167 QLineEdit* winePrefixEdit_;
168 QLineEdit* winePathEdit_;
169 QLineEdit* wineDllEdit_;
170 QCheckBox* virtualDesktopCheck_;
171 QSpinBox* desktopWidthSpin_;
172 QSpinBox* desktopHeightSpin_;
173
174 // === Performance Tab ===
175 QComboBox* presetCombo_;
176 QLabel* presetDescLabel_;
177
178 // Synchronization group
179 EnvVarCheckBox* ntSyncCheck_;
180 EnvVarCheckBox* fsyncCheck_;
181
182 // Shader compilation group
183 EnvVarCheckBox* localShaderCacheCheck_;
184 EnvVarCheckBox* skipShaderCleanupCheck_;
185 EnvVarCheckBox* dxvkAsyncCheck_;
186
187 // Performance wrappers group
188 EnvVarCheckBox* mangoHudCheck_;
189 EnvVarCheckBox* gameModeCheck_;
190 EnvVarCheckBox* gamePerformanceCheck_;
191 EnvVarCheckBox* vkBasaltCheck_;
192 QLabel* perfWrapperWarning_ = nullptr; // Warning for GameMode + game-performance conflict
193
194 // === Graphics Tab ===
195 QLabel* gpuInfoLabel_;
196
197 // NVIDIA group
198 QGroupBox* nvidiaGroup_;
199 EnvVarCheckBox* dlssUpgradeCheck_;
200 EnvVarCheckBox* dlssIndicatorCheck_;
201 EnvVarCheckBox* nvidiaLibsCheck_;
202 EnvVarCheckBox* nvidia4000FixCheck_;
203
204 // AMD group
205 QGroupBox* amdGroup_;
206 EnvVarCheckBox* fsr4UpgradeCheck_;
207 EnvVarCheckBox* fsr4Rdna3Check_;
208 EnvVarCheckBox* fsrCheck_;
209
210 // Intel group
211 QGroupBox* intelGroup_;
212 EnvVarCheckBox* xessUpgradeCheck_;
213
214 // Display group
215 EnvVarCheckBox* hdrCheck_;
216 EnvVarCheckBox* dxvkHdrCheck_;
217 EnvVarCheckBox* gamescopeCheck_;
218 EnvVarCheckBox* waylandCheck_;
219
220 // === Environment Tab ===
221 QTableWidget* envVarTable_;
222 QCheckBox* useSteamDefaultsCheck_;
223 QCheckBox* useSteamLaunchCheck_;
224
225 // === Debug Options (in Performance tab) ===
226 EnvVarCheckBox* protonLogCheck_;
227 EnvVarCheckBox* dxvkHudCheck_;
228
229 // === Launch Preview Panel ===
230 QGroupBox* launchPreviewGroup_;
231 QTextEdit* envVarsPreview_;
232 QTextEdit* commandPreview_;
233
234 // === System Capabilities Panel (in Performance tab) ===
235 QLabel* syncCapabilitiesLabel_ = nullptr;
236
237 // === Unified Recommendations Widget (in Runner & Compatibility tab) ===
238 RecommendationsWidget* recommendationsWidget_ = nullptr;
239
240 // === Performance Profiles (in Performance tab) ===
241 QListWidget* profileList_ = nullptr;
242 QPushButton* applyProfileBtn_ = nullptr;
243 QPushButton* saveAsProfileBtn_ = nullptr;
244 QPushButton* manageProfilesBtn_ = nullptr;
245 PerformanceProfileService* profileService_ = nullptr;
246
247 // === Settings Preview Panel (shows profile/recommendation effects) ===
248 QWidget* settingsPreviewPanel_ = nullptr;
249 QLabel* previewTitleLabel_ = nullptr;
250 QTextEdit* previewSettingsText_ = nullptr;
251 QLabel* previewComparisonLabel_ = nullptr;
252
253 ThemeManager* themeManager_;
254};
Checkbox that shows the associated environment variable.
GameConfigDialog(Game *game, QWidget *parent=nullptr, ThemeManager *themeManager=nullptr)
~GameConfigDialog() override
Complete representation of a game in the library.
Definition game.h:767
Service for managing per-game performance profiles.
Unified widget for displaying game compatibility and recommendations.
ConfigPreset
Collection of suggestions for a game.
Complete performance profile for a game.