game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
addgamedialog.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// ==============================================================================
3// qt/addgamedialog.h
4// ==============================================================================
5// Dialog for adding new games to the library
6// ==============================================================================
7
8#pragma once
9
10#include "models/game.h"
11
12#include <QCheckBox>
13#include <QComboBox>
14#include <QDialog>
15#include <QGroupBox>
16#include <QLabel>
17#include <QLineEdit>
18#include <QPushButton>
19#include <QSpinBox>
20#include <QTabWidget>
21
22class ThemeManager;
23
24class AddGameDialog : public QDialog
25{
26 Q_OBJECT
27
28 public:
29 explicit AddGameDialog(QWidget* parent = nullptr, ThemeManager* themeManager = nullptr);
30 ~AddGameDialog() override = default;
31
32 // Get the configured game (call after exec() returns Accepted)
33 Game getGame() const;
34
35 // Set game for editing mode
36 void setGame(const Game& game);
37 void setEditMode(bool editing);
38
39 private slots:
40 void onBrowseExecutable();
41 void onBrowseWorkingDir();
42 void onBrowseWinePrefix();
43 void onBrowseCoverArt();
44 void onExecutableChanged(const QString& path);
45 void onRunnerChanged(int index);
46 void onAutoDetect();
47 void onAccept();
48 void applyTheme();
49
50 private:
51 void setupUI();
52 void setupBasicTab(QWidget* tab);
53 void setupRunnerTab(QWidget* tab);
54 void setupAdvancedTab(QWidget* tab);
55 void updateUIFromGame();
56 void updateGameFromUI();
57 void autoDetectFromPath(const QString& path);
58
59 // Game being configured
60 Game game_;
61 bool editMode_ = false;
62
63 // Basic tab
64 QLineEdit* nameEdit_;
65 QLineEdit* executableEdit_;
66 QLineEdit* workingDirEdit_;
67 QLineEdit* argumentsEdit_;
68 QComboBox* sourceCombo_;
69 QComboBox* runnerCombo_;
70
71 // Runner tab
72 QLineEdit* winePrefixEdit_;
73 QComboBox* protonVersionCombo_;
74 QCheckBox* virtualDesktopCheck_;
75 QSpinBox* desktopWidthSpin_;
76 QSpinBox* desktopHeightSpin_;
77
78 // Advanced tab
79 QLineEdit* coverArtEdit_;
80 QLineEdit* descriptionEdit_;
81
82 // Buttons
83 QPushButton* autoDetectButton_;
84 QPushButton* okButton_;
85 QPushButton* cancelButton_;
86
87 // Tab widget (for theming)
88 QTabWidget* tabWidget_ = nullptr;
89
90 // Group boxes (for theming)
91 QGroupBox* vdGroup_ = nullptr;
92
93 ThemeManager* themeManager_;
94};
Game getGame() const
void setGame(const Game &game)
AddGameDialog(QWidget *parent=nullptr, ThemeManager *themeManager=nullptr)
~AddGameDialog() override=default
void setEditMode(bool editing)
Complete representation of a game in the library.
Definition game.h:767