game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
runner_manager_dialog.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// ==============================================================================
3// runner_manager_dialog.h
4// ==============================================================================
5// Runner Management Dialog - Download, install, and manage Proton/Wine versions
6// ==============================================================================
7// Provides a unified interface for:
8// - Viewing installed runners with version info
9// - Downloading new runner versions from GitHub (GE-Proton, Wine-GE)
10// - Installing/extracting downloaded runners
11// - Removing old runner versions
12//
13// Leverages existing FileDownloadService and ArchiveExtractService.
14// ==============================================================================
15
16#pragma once
17
19
20#include <QDateTime>
21#include <QDialog>
22#include <QFuture>
23#include <QFutureWatcher>
24#include <QListWidget>
25#include <QProgressBar>
26#include <QPushButton>
27#include <QTabWidget>
28#include <QTextEdit>
29
30class QLabel;
31class QComboBox;
32class QGroupBox;
33class QLineEdit;
34class QProcess;
35class ThemeManager;
36
37// ==============================================================================
38// Available Runner Info (from GitHub API)
39// ==============================================================================
40
42{
43 QString name; // e.g., "GE-Proton9-4"
44 QString version; // e.g., "9-4"
45 QString type; // "proton-ge", "wine-ge", "proton-cachyos"
46 QString downloadUrl; // Direct download URL
47 qint64 fileSizeBytes; // File size
48 QString releaseNotes; // Release notes/changelog
49 QDateTime releaseDate; // Release timestamp
50 bool isPrerelease; // Pre-release flag
51 QString source; // "github"
52};
53
54// ==============================================================================
55// Runner Manager Dialog
56// ==============================================================================
57
58class RunnerManagerDialog : public QDialog
59{
60 Q_OBJECT
61
62 public:
63 explicit RunnerManagerDialog(QWidget* parent = nullptr, ThemeManager* themeManager = nullptr);
64 ~RunnerManagerDialog() override;
65
66 private slots:
67 void onRefreshInstalled();
68 void onRefreshAvailable();
69 void onDownloadSelected();
70 void onRemoveSelected();
71 void onInstalledSelectionChanged();
72 void onAvailableSelectionChanged();
73 void applyTheme();
74
75 private:
76 void setupUI();
77 void setupInstalledTab(QWidget* tab);
78 void setupAvailableTab(QWidget* tab);
79 void setupDownloadsTab(QWidget* tab);
80
81 void populateInstalledRunners();
82 void fetchAvailableRunners();
83 void parseGitHubReleases(const QString& jsonData, const QString& source);
84
85 void startDownload(const AvailableRunner& runner);
86 void installRunner(const QString& archivePath, const QString& runnerName);
87 void appendLog(const QString& message);
88
89 QString getInstallPath() const;
90 QString formatSize(qint64 bytes) const;
91
92 // UI Components
93 QTabWidget* tabWidget_ = nullptr;
94
95 // Installed tab
96 QListWidget* installedList_ = nullptr;
97 QLabel* installedInfoLabel_ = nullptr;
98 QPushButton* removeBtn_ = nullptr;
99 QPushButton* refreshInstalledBtn_ = nullptr;
100
101 // Available tab
102 QListWidget* availableList_ = nullptr;
103 QLabel* availableInfoLabel_ = nullptr;
104 QTextEdit* releaseNotesText_ = nullptr;
105 QPushButton* downloadBtn_ = nullptr;
106 QPushButton* refreshAvailableBtn_ = nullptr;
107 QComboBox* sourceFilter_ = nullptr;
108
109 // Downloads tab
110 QListWidget* downloadsList_ = nullptr;
111 QProgressBar* currentProgress_ = nullptr;
112 QLabel* downloadStatusLabel_ = nullptr;
113 QTextEdit* logText_ = nullptr;
114 QPushButton* cancelDownloadBtn_ = nullptr;
115
116 // State
117 QList<AvailableRunner> availableRunners_;
118 QFutureWatcher<QString>* fetchWatcher_ = nullptr;
119 bool isDownloading_ = false;
120 QString currentDownloadPath_;
121 QProcess* downloadProcess_ = nullptr; // active download process (for cancellation)
122
123 ThemeManager* themeManager_;
124};
RunnerManagerDialog(QWidget *parent=nullptr, ThemeManager *themeManager=nullptr)