forked from RPCS3/rpcs3
/
main_window.h
202 lines (163 loc) · 5.45 KB
/
main_window.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#pragma once
#ifdef _WIN32
#include <QWinTHumbnailToolbar>
#include <QWinTHumbnailToolbutton>
#endif
#include <QActionGroup>
#include <QMainWindow>
#include <QIcon>
#include <QList>
#include <QUrl>
#include <QMimeData>
#include "update_manager.h"
#include "settings.h"
#include "shortcut_handler.h"
#include "Emu/config_mode.h"
#include <memory>
class log_frame;
class debugger_frame;
class game_list_frame;
class gui_settings;
class emu_settings;
class persistent_settings;
class kernel_explorer;
class system_cmd_dialog;
struct gui_game_info;
enum class game_boot_result : u32;
namespace compat
{
struct package_info;
}
namespace Ui
{
class main_window;
}
class main_window : public QMainWindow
{
Q_OBJECT
std::unique_ptr<Ui::main_window> ui;
bool m_is_list_mode = true;
bool m_save_slider_pos = false;
bool m_requested_show_logs_on_exit = false;
int m_other_slider_pos = 0;
QIcon m_app_icon;
QIcon m_icon_play;
QIcon m_icon_pause;
QIcon m_icon_restart;
QIcon m_icon_fullscreen_on;
QIcon m_icon_fullscreen_off;
#ifdef _WIN32
QIcon m_icon_thumb_play;
QIcon m_icon_thumb_pause;
QIcon m_icon_thumb_stop;
QIcon m_icon_thumb_restart;
QWinThumbnailToolBar *m_thumb_bar = nullptr;
QWinThumbnailToolButton *m_thumb_playPause = nullptr;
QWinThumbnailToolButton *m_thumb_stop = nullptr;
QWinThumbnailToolButton *m_thumb_restart = nullptr;
#endif
enum class drop_type
{
drop_error,
drop_rap_edat_pkg,
drop_pup,
drop_psf,
drop_dir,
drop_game,
drop_rrc
};
public:
explicit main_window(std::shared_ptr<gui_settings> gui_settings, std::shared_ptr<emu_settings> emu_settings, std::shared_ptr<persistent_settings> persistent_settings, QWidget *parent = nullptr);
~main_window();
bool Init(bool with_cli_boot);
QIcon GetAppIcon() const;
bool OnMissingFw();
bool InstallPackages(QStringList file_paths = {}, bool from_boot = false);
void InstallPup(QString file_path = "");
Q_SIGNALS:
void RequestLanguageChange(const QString& language);
void RequestGlobalStylesheetChange();
void RequestTrophyManagerRepaint();
void NotifyEmuSettingsChange();
void NotifyWindowCloseEvent(bool closed);
public Q_SLOTS:
void OnEmuStop();
void OnEmuRun(bool start_playtime) const;
void OnEmuResume() const;
void OnEmuPause() const;
void OnEmuReady() const;
void OnEnableDiscEject(bool enabled) const;
void OnEnableDiscInsert(bool enabled) const;
void RepaintGui();
void RetranslateUI(const QStringList& language_codes, const QString& language);
private Q_SLOTS:
void OnPlayOrPause();
void Boot(const std::string& path, const std::string& title_id = "", bool direct = false, bool refresh_list = false, cfg_mode config_mode = cfg_mode::custom, const std::string& config_path = "");
void BootElf();
void BootTest();
void BootGame();
void BootVSH();
void BootSavestate();
void BootRsxCapture(std::string path = "");
void DecryptSPRXLibraries();
static void show_boot_error(game_boot_result status);
void SaveWindowState() const;
void SetIconSizeActions(int idx) const;
void ResizeIcons(int index);
void RemoveDiskCache();
void RemoveFirmwareCache();
void CreateFirmwareCache();
void handle_shortcut(gui::shortcuts::shortcut shortcut_key, const QKeySequence& key_sequence);
protected:
void closeEvent(QCloseEvent *event) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
void dropEvent(QDropEvent* event) override;
void dragEnterEvent(QDragEnterEvent* event) override;
void dragMoveEvent(QDragMoveEvent* event) override;
void dragLeaveEvent(QDragLeaveEvent* event) override;
private:
void ConfigureGuiFromSettings();
void RepaintToolBarIcons();
void RepaintThumbnailIcons();
void CreateActions();
void CreateConnects();
void CreateDockWindows();
void EnableMenus(bool enabled) const;
void ShowTitleBars(bool show) const;
static bool InstallFileInExData(const std::string& extension, const QString& path, const std::string& filename);
bool HandlePackageInstallation(QStringList file_paths, bool from_boot);
void HandlePupInstallation(const QString& file_path, const QString& dir_path = "");
void ExtractPup();
void ExtractTar();
void ExtractMSELF();
QList<QUrl> m_drop_file_url_list;
u64 m_drop_file_timestamp = umax;
drop_type m_drop_file_cached_drop_type = drop_type::drop_error;
drop_type IsValidFile(const QMimeData& md, QStringList* drop_paths = nullptr);
static void AddGamesFromDir(const QString& path);
QAction* CreateRecentAction(const q_string_pair& entry, const uint& sc_idx);
void BootRecentAction(const QAction* act);
void AddRecentAction(const q_string_pair& entry);
void UpdateLanguageActions(const QStringList& language_codes, const QString& language);
void UpdateFilterActions();
static QString GetCurrentTitle();
q_pair_list m_rg_entries;
QList<QAction*> m_recent_game_acts;
std::shared_ptr<gui_game_info> m_selected_game;
QActionGroup* m_icon_size_act_group = nullptr;
QActionGroup* m_list_mode_act_group = nullptr;
QActionGroup* m_category_visible_act_group = nullptr;
// Dockable widget frames
QMainWindow *m_mw = nullptr;
log_frame* m_log_frame = nullptr;
debugger_frame* m_debugger_frame = nullptr;
game_list_frame* m_game_list_frame = nullptr;
kernel_explorer* m_kernel_explorer = nullptr;
system_cmd_dialog* m_system_cmd_dialog = nullptr;
std::shared_ptr<gui_settings> m_gui_settings;
std::shared_ptr<emu_settings> m_emu_settings;
std::shared_ptr<persistent_settings> m_persistent_settings;
update_manager m_updater;
QAction* m_download_menu_action = nullptr;
shortcut_handler* m_shortcut_handler = nullptr;
};