mirror of
https://github.com/Rosalie241/RMG.git
synced 2026-10-21 01:38:49 +02:00
RMG: slightly refactor MainWindow.{cpp,hpp}
This commit is contained in:
1 parent
ea01c86821
commit
12bf158398
2 files changed
+81
-139
No files matched your search
@@ -328,7 +328,7 @@ void MainWindow::configureTheme(QApplication* app)
|
||||
QIcon::setFallbackThemeName(fallbackThemeName);
|
||||
}
|
||||
|
||||
void MainWindow::showErrorMessage(QString text, QString details = "")
|
||||
void MainWindow::showErrorMessage(QString text, QString details)
|
||||
{
|
||||
QMessageBox msgBox(this);
|
||||
msgBox.setIcon(QMessageBox::Icon::Critical);
|
||||
@@ -519,11 +519,6 @@ void MainWindow::launchEmulationThread(QString cartRom, QString diskRom)
|
||||
this->emulationThread->start();
|
||||
}
|
||||
|
||||
void MainWindow::launchEmulationThread(QString file)
|
||||
{
|
||||
this->launchEmulationThread(file, "");
|
||||
}
|
||||
|
||||
void MainWindow::updateActions(bool inEmulation, bool isPaused)
|
||||
{
|
||||
QString keyBinding;
|
||||
@@ -655,51 +650,10 @@ void MainWindow::addActions(void)
|
||||
return;
|
||||
}
|
||||
|
||||
this->addAction(this->action_System_StartRom);
|
||||
this->addAction(this->action_System_OpenCombo);
|
||||
this->addAction(this->action_System_Shutdown);
|
||||
this->addAction(this->action_System_SoftReset);
|
||||
this->addAction(this->action_System_HardReset);
|
||||
this->addAction(this->action_System_Pause);
|
||||
this->addAction(this->action_System_Screenshot);
|
||||
this->addAction(this->action_System_LimitFPS);
|
||||
this->addAction(this->actionSpeed25);
|
||||
this->addAction(this->actionSpeed50);
|
||||
this->addAction(this->actionSpeed75);
|
||||
this->addAction(this->actionSpeed100);
|
||||
this->addAction(this->actionSpeed125);
|
||||
this->addAction(this->actionSpeed150);
|
||||
this->addAction(this->actionSpeed175);
|
||||
this->addAction(this->actionSpeed200);
|
||||
this->addAction(this->actionSpeed225);
|
||||
this->addAction(this->actionSpeed250);
|
||||
this->addAction(this->actionSpeed275);
|
||||
this->addAction(this->actionSpeed300);
|
||||
this->addAction(this->action_System_SaveState);
|
||||
this->addAction(this->action_System_SaveAs);
|
||||
this->addAction(this->action_System_LoadState);
|
||||
this->addAction(this->action_System_Load);
|
||||
this->addAction(this->actionSlot_0);
|
||||
this->addAction(this->actionSlot_1);
|
||||
this->addAction(this->actionSlot_2);
|
||||
this->addAction(this->actionSlot_3);
|
||||
this->addAction(this->actionSlot_4);
|
||||
this->addAction(this->actionSlot_5);
|
||||
this->addAction(this->actionSlot_6);
|
||||
this->addAction(this->actionSlot_7);
|
||||
this->addAction(this->actionSlot_8);
|
||||
this->addAction(this->actionSlot_9);
|
||||
this->addAction(this->action_System_Cheats);
|
||||
this->addAction(this->action_System_GSButton);
|
||||
this->addAction(this->action_System_Exit);
|
||||
this->addAction(this->action_Settings_Graphics);
|
||||
this->addAction(this->action_Settings_Audio);
|
||||
this->addAction(this->action_Settings_Rsp);
|
||||
this->addAction(this->action_Settings_Input);
|
||||
this->addAction(this->action_Settings_Settings);
|
||||
this->addAction(this->action_View_Fullscreen);
|
||||
this->addAction(this->action_Help_Github);
|
||||
this->addAction(this->action_Help_About);
|
||||
for (QAction* action : this->ui_Actions)
|
||||
{
|
||||
this->addAction(action);
|
||||
}
|
||||
|
||||
this->ui_AddedActions = true;
|
||||
}
|
||||
@@ -711,57 +665,45 @@ void MainWindow::removeActions(void)
|
||||
return;
|
||||
}
|
||||
|
||||
this->removeAction(this->action_System_StartRom);
|
||||
this->removeAction(this->action_System_OpenCombo);
|
||||
this->removeAction(this->action_System_Shutdown);
|
||||
this->removeAction(this->action_System_SoftReset);
|
||||
this->removeAction(this->action_System_HardReset);
|
||||
this->removeAction(this->action_System_Pause);
|
||||
this->removeAction(this->action_System_Screenshot);
|
||||
this->removeAction(this->action_System_LimitFPS);
|
||||
this->removeAction(this->actionSpeed25);
|
||||
this->removeAction(this->actionSpeed50);
|
||||
this->removeAction(this->actionSpeed75);
|
||||
this->removeAction(this->actionSpeed100);
|
||||
this->removeAction(this->actionSpeed125);
|
||||
this->removeAction(this->actionSpeed150);
|
||||
this->removeAction(this->actionSpeed175);
|
||||
this->removeAction(this->actionSpeed200);
|
||||
this->removeAction(this->actionSpeed225);
|
||||
this->removeAction(this->actionSpeed250);
|
||||
this->removeAction(this->actionSpeed275);
|
||||
this->removeAction(this->actionSpeed300);
|
||||
this->removeAction(this->action_System_SaveState);
|
||||
this->removeAction(this->action_System_SaveAs);
|
||||
this->removeAction(this->action_System_LoadState);
|
||||
this->removeAction(this->action_System_Load);
|
||||
this->removeAction(this->actionSlot_0);
|
||||
this->removeAction(this->actionSlot_1);
|
||||
this->removeAction(this->actionSlot_2);
|
||||
this->removeAction(this->actionSlot_3);
|
||||
this->removeAction(this->actionSlot_4);
|
||||
this->removeAction(this->actionSlot_5);
|
||||
this->removeAction(this->actionSlot_6);
|
||||
this->removeAction(this->actionSlot_7);
|
||||
this->removeAction(this->actionSlot_8);
|
||||
this->removeAction(this->actionSlot_9);
|
||||
this->removeAction(this->action_System_Cheats);
|
||||
this->removeAction(this->action_System_GSButton);
|
||||
this->removeAction(this->action_System_Exit);
|
||||
this->removeAction(this->action_Settings_Graphics);
|
||||
this->removeAction(this->action_Settings_Audio);
|
||||
this->removeAction(this->action_Settings_Rsp);
|
||||
this->removeAction(this->action_Settings_Input);
|
||||
this->removeAction(this->action_Settings_Settings);
|
||||
this->removeAction(this->action_View_Fullscreen);
|
||||
this->removeAction(this->action_Help_Github);
|
||||
this->removeAction(this->action_Help_About);
|
||||
for (QAction* action : this->ui_Actions)
|
||||
{
|
||||
this->removeAction(action);
|
||||
}
|
||||
|
||||
this->ui_AddedActions = false;
|
||||
}
|
||||
|
||||
void MainWindow::configureActions(void)
|
||||
{
|
||||
// configure actions list
|
||||
this->ui_Actions.append(
|
||||
{
|
||||
// System actions
|
||||
this->action_System_StartRom, this->action_System_OpenCombo,
|
||||
this->action_System_Shutdown, this->action_System_SoftReset,
|
||||
this->action_System_HardReset, this->action_System_Pause,
|
||||
this->action_System_Screenshot, this->action_System_LimitFPS,
|
||||
this->actionSpeed25, this->actionSpeed50, this->actionSpeed75,
|
||||
this->actionSpeed100, this->actionSpeed125, this->actionSpeed150,
|
||||
this->actionSpeed175, this->actionSpeed200, this->actionSpeed225,
|
||||
this->actionSpeed250, this->actionSpeed275, this->actionSpeed300,
|
||||
this->action_System_SaveState, this->action_System_SaveAs,
|
||||
this->action_System_LoadState, this->action_System_Load,
|
||||
this->actionSlot_0, this->actionSlot_1, this->actionSlot_2,
|
||||
this->actionSlot_3, this->actionSlot_4, this->actionSlot_5,
|
||||
this->actionSlot_6, this->actionSlot_7, this->actionSlot_8,
|
||||
this->actionSlot_9, this->action_System_Cheats,
|
||||
this->action_System_GSButton, this->action_System_Exit,
|
||||
// Settings actions
|
||||
this->action_Settings_Graphics, this->action_Settings_Audio,
|
||||
this->action_Settings_Rsp, this->action_Settings_Input,
|
||||
this->action_Settings_Settings,
|
||||
// View actions
|
||||
this->action_View_Fullscreen, this->action_Help_Github,
|
||||
// Help actions
|
||||
this->action_Help_About,
|
||||
});
|
||||
|
||||
// configure emulation speed actions
|
||||
QActionGroup* speedActionGroup = new QActionGroup(this);
|
||||
QAction* speedActions[] =
|
||||
|
||||
@@ -47,19 +47,19 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
MainWindow(void);
|
||||
~MainWindow(void);
|
||||
|
||||
bool Init(QApplication*, bool);
|
||||
void OpenROM(QString, QString, bool, bool);
|
||||
bool Init(QApplication* app, bool showUI);
|
||||
void OpenROM(QString file, QString disk, bool fullscreen, bool quitAfterEmulation);
|
||||
|
||||
private:
|
||||
Thread::EmulationThread *emulationThread;
|
||||
Thread::EmulationThread *emulationThread = nullptr;
|
||||
|
||||
CoreCallbacks* coreCallBacks;
|
||||
CoreCallbacks* coreCallBacks = nullptr;
|
||||
|
||||
QStackedWidget *ui_Widgets;
|
||||
Widget::OGLWidget *ui_Widget_OpenGL;
|
||||
Widget::RomBrowserWidget *ui_Widget_RomBrowser;
|
||||
EventFilter *ui_EventFilter;
|
||||
QLabel *ui_StatusBar_Label;
|
||||
QStackedWidget *ui_Widgets = nullptr;
|
||||
Widget::OGLWidget *ui_Widget_OpenGL = nullptr;
|
||||
Widget::RomBrowserWidget *ui_Widget_RomBrowser = nullptr;
|
||||
EventFilter *ui_EventFilter = nullptr;
|
||||
QLabel *ui_StatusBar_Label = nullptr;
|
||||
|
||||
QByteArray ui_Geometry;
|
||||
bool ui_Geometry_Maximized = false;
|
||||
@@ -80,6 +80,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
|
||||
bool ui_ManuallyPaused = true;
|
||||
|
||||
QList<QAction*> ui_Actions;
|
||||
bool ui_AddedActions = false;
|
||||
|
||||
bool ui_SilentUpdateCheck = false;
|
||||
@@ -97,43 +98,42 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
void closeEvent(QCloseEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
void initializeUI();
|
||||
|
||||
void configureUI(QApplication*, bool);
|
||||
void configureTheme(QApplication*);
|
||||
|
||||
void showErrorMessage(QString, QString);
|
||||
|
||||
void updateUI(bool, bool);
|
||||
void configureUI(QApplication* app, bool showUI);
|
||||
void configureTheme(QApplication* app);
|
||||
|
||||
void showErrorMessage(QString text, QString details = "");
|
||||
|
||||
void updateUI(bool inEmulation, bool isPaused);
|
||||
|
||||
void storeGeometry(void);
|
||||
void loadGeometry(void);
|
||||
|
||||
void initializeEmulationThread(void);
|
||||
void connectEmulationThreadSignals(void);
|
||||
void launchEmulationThread(QString, QString);
|
||||
void launchEmulationThread(QString);
|
||||
void launchEmulationThread(QString cartRom, QString diskRom = "");
|
||||
|
||||
void configureActions(void);
|
||||
void connectActionSignals(void);
|
||||
void updateActions(bool, bool);
|
||||
void updateActions(bool inEmulation, bool isPaused);
|
||||
|
||||
void addActions(void);
|
||||
void removeActions(void);
|
||||
|
||||
#ifdef UPDATER
|
||||
void checkForUpdates(bool, bool);
|
||||
void checkForUpdates(bool silent, bool force);
|
||||
#endif // UPDATER
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
|
||||
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void on_EventFilter_KeyPressed(QKeyEvent *);
|
||||
void on_EventFilter_KeyReleased(QKeyEvent *);
|
||||
void on_EventFilter_KeyPressed(QKeyEvent *event);
|
||||
void on_EventFilter_KeyReleased(QKeyEvent *event);
|
||||
|
||||
void on_QGuiApplication_applicationStateChanged(Qt::ApplicationState);
|
||||
void on_QGuiApplication_applicationStateChanged(Qt::ApplicationState state);
|
||||
|
||||
#ifdef UPDATER
|
||||
void on_networkAccessManager_Finished(QNetworkReply *);
|
||||
void on_networkAccessManager_Finished(QNetworkReply *reply);
|
||||
#endif // UPDATER
|
||||
|
||||
void on_Action_System_OpenRom(void);
|
||||
@@ -144,12 +144,12 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
void on_Action_System_Pause(void);
|
||||
void on_Action_System_Screenshot(void);
|
||||
void on_Action_System_LimitFPS(void);
|
||||
void on_Action_System_SpeedFactor(int);
|
||||
void on_Action_System_SpeedFactor(int factor);
|
||||
void on_Action_System_SaveState(void);
|
||||
void on_Action_System_SaveAs(void);
|
||||
void on_Action_System_LoadState(void);
|
||||
void on_Action_System_Load(void);
|
||||
void on_Action_System_CurrentSaveState(int);
|
||||
void on_Action_System_CurrentSaveState(int slot);
|
||||
void on_Action_System_Cheats(void);
|
||||
void on_Action_System_GSButton(void);
|
||||
void on_Action_System_Exit(void);
|
||||
@@ -160,11 +160,11 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
void on_Action_Settings_Input(void);
|
||||
void on_Action_Settings_Settings(void);
|
||||
|
||||
void on_Action_View_Toolbar(bool);
|
||||
void on_Action_View_StatusBar(bool);
|
||||
void on_Action_View_GameList(bool);
|
||||
void on_Action_View_GameGrid(bool);
|
||||
void on_Action_View_UniformSize(bool);
|
||||
void on_Action_View_Toolbar(bool checked);
|
||||
void on_Action_View_StatusBar(bool checked);
|
||||
void on_Action_View_GameList(bool checked);
|
||||
void on_Action_View_GameGrid(bool checked);
|
||||
void on_Action_View_UniformSize(bool checked);
|
||||
void on_Action_View_Fullscreen(void);
|
||||
void on_Action_View_RefreshRoms(void);
|
||||
void on_Action_View_ClearRomCache(void);
|
||||
@@ -175,25 +175,25 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
void on_Action_Help_Update(void);
|
||||
|
||||
void on_Emulation_Started(void);
|
||||
void on_Emulation_Finished(bool);
|
||||
void on_Emulation_Finished(bool ret);
|
||||
|
||||
void on_RomBrowser_PlayGame(QString);
|
||||
void on_RomBrowser_PlayGameWith(CoreRomType, QString);
|
||||
void on_RomBrowser_PlayGame(QString file);
|
||||
void on_RomBrowser_PlayGameWith(CoreRomType type, QString file);
|
||||
void on_RomBrowser_ChangeRomDirectory(void);
|
||||
void on_RomBrowser_RomInformation(QString);
|
||||
void on_RomBrowser_EditGameSettings(QString);
|
||||
void on_RomBrowser_Cheats(QString);
|
||||
void on_RomBrowser_RomInformation(QString file);
|
||||
void on_RomBrowser_EditGameSettings(QString file);
|
||||
void on_RomBrowser_Cheats(QString file);
|
||||
|
||||
public slots:
|
||||
|
||||
void on_VidExt_Init(void);
|
||||
void on_VidExt_SetupOGL(QSurfaceFormat, QThread *);
|
||||
void on_VidExt_SetWindowedMode(int, int, int, int);
|
||||
void on_VidExt_SetFullscreenMode(int, int, int, int);
|
||||
void on_VidExt_ResizeWindow(int, int);
|
||||
void on_VidExt_ToggleFS(bool);
|
||||
void on_VidExt_SetupOGL(QSurfaceFormat format, QThread *thread);
|
||||
void on_VidExt_SetWindowedMode(int width, int height, int bps, int flags);
|
||||
void on_VidExt_SetFullscreenMode(int width, int height, int bps, int flags);
|
||||
void on_VidExt_ResizeWindow(int width, int height);
|
||||
void on_VidExt_ToggleFS(bool fullscreen);
|
||||
|
||||
void on_Core_DebugCallback(CoreDebugMessageType, QString, QString);
|
||||
void on_Core_DebugCallback(CoreDebugMessageType type, QString context, QString message);
|
||||
};
|
||||
} // namespace UserInterface
|
||||
|
||||
|
||||
Reference in new issue
Block a user