Play-/Source/ui_qt/mainwindow.h

172 lines
4.2 KiB
C
Raw Permalink Normal View History

2016-09-06 00:12:56 +01:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QLabel>
#include <QKeyEvent>
#include <QDir>
#include "AppConfig.h"
2016-07-02 03:12:06 +03:00
#include "PS2VM.h"
2017-03-25 21:53:28 +00:00
#include "ElidedLabel.h"
#include "ContinuationChecker.h"
#include "InputProviderQtKey.h"
2023-04-20 19:03:13 -04:00
#include "InputProviderQtMouse.h"
#include "ScreenShotUtils.h"
2018-04-30 21:01:23 +01:00
namespace Ui
{
class MainWindow;
2016-09-06 00:12:56 +01:00
}
2020-11-13 17:00:58 -05:00
class OutputWindow;
#ifdef DEBUGGER_INCLUDED
class QtDebugger;
2020-02-02 19:46:03 +00:00
class QtFramedebugger;
namespace Ui
{
class DebugDockMenu;
class DebugMenu;
}
#endif
2016-09-06 00:12:56 +01:00
class MainWindow : public QMainWindow
{
2018-04-30 21:01:23 +01:00
Q_OBJECT
2016-09-06 00:12:56 +01:00
public:
2018-08-01 13:05:47 -04:00
explicit MainWindow(QWidget* parent = nullptr);
2018-04-30 21:01:23 +01:00
~MainWindow();
2016-07-01 05:28:39 +03:00
2019-10-16 20:51:11 -04:00
void BootElf(fs::path);
2018-10-08 02:43:23 +01:00
void BootCDROM();
2019-10-16 20:51:11 -04:00
void LoadCDROM(fs::path filePath);
2022-10-08 16:33:19 -04:00
void BootArcadeMachine(fs::path);
void loadState(int);
#ifdef DEBUGGER_INCLUDED
void ShowMainWindow();
void ShowDebugger();
void ShowFrameDebugger();
2019-10-16 20:51:11 -04:00
fs::path GetFrameDumpDirectoryPath();
2019-03-25 12:41:48 -04:00
void DumpNextFrame();
void ToggleGsDraw();
#endif
2018-10-08 02:43:23 +01:00
2016-07-01 05:28:39 +03:00
private:
enum class BootType
2019-03-04 22:20:04 -05:00
{
CD,
2022-10-08 16:33:19 -04:00
ELF,
ARCADE,
2019-03-04 22:20:04 -05:00
};
struct LastOpenCommand
{
LastOpenCommand() = default;
2019-10-16 20:51:11 -04:00
LastOpenCommand(BootType type, fs::path path)
2019-03-04 22:20:04 -05:00
: type(type)
, path(path)
{
}
BootType type = BootType::CD;
2019-10-16 20:51:11 -04:00
fs::path path;
2019-03-04 22:20:04 -05:00
};
void SetOutputWindowSize();
2018-04-30 21:01:23 +01:00
void CreateStatusBar();
void InitVirtualMachine();
void SetupGsHandler();
2018-04-30 21:01:23 +01:00
void SetupSoundHandler();
void SetupSaveLoadStateSlots();
2019-03-13 12:30:21 -04:00
QString GetSaveStateInfo(int);
void EmitOnExecutableChange();
bool IsExecutableLoaded() const;
2018-04-30 21:01:23 +01:00
void UpdateUI();
void UpdateCpuUsageLabel();
2018-04-30 21:01:23 +01:00
void RegisterPreferences();
void saveState(int);
void buildResizeWindowMenu();
void resizeWindow(unsigned int, unsigned int);
2024-10-20 12:52:46 +01:00
void UpdateGSHandlerLabel();
2022-01-13 23:58:16 +00:00
void SetupBootableView();
void SetupDebugger();
2016-07-01 05:21:58 +03:00
Ui::MainWindow* ui = nullptr;
2020-11-13 17:00:58 -05:00
OutputWindow* m_outputwindow = nullptr;
QLabel* m_fpsLabel = nullptr;
2024-10-20 14:18:00 +01:00
QLabel* m_scaleFactorLabel = nullptr;
QLabel* m_cpuUsageLabel = nullptr;
QLabel* m_gsLabel = nullptr;
#ifdef PROFILE
QLabel* m_profileStatsLabel = nullptr;
#endif
ElidedLabel* m_msgLabel = nullptr;
2018-08-07 19:17:28 -04:00
QTimer* m_fpsTimer = nullptr;
CContinuationChecker* m_continuationChecker = nullptr;
2018-08-01 12:59:11 -04:00
CPS2VM* m_virtualMachine = nullptr;
2018-04-30 21:01:23 +01:00
bool m_deactivatePause = false;
bool m_pauseFocusLost = true;
std::shared_ptr<CInputProviderQtKey> m_qtKeyInputProvider;
2023-04-20 19:03:13 -04:00
std::shared_ptr<CInputProviderQtMouse> m_qtMouseInputProvider;
LastOpenCommand m_lastOpenCommand;
2019-10-16 20:51:11 -04:00
fs::path m_lastPath;
2018-04-30 21:01:23 +01:00
Framework::CSignal<void()>::Connection m_OnExecutableChangeConnection;
CPS2VM::NewFrameEvent::Connection m_OnNewFrameConnection;
CGSHandler::NewFrameEvent::Connection m_OnGsNewFrameConnection;
CScreenShotUtils::Connection m_screenShotCompleteConnection;
2022-01-14 15:03:27 +00:00
CVirtualMachine::RunningStateChangeEvent::Connection m_onRunningStateChangeConnection;
2019-06-20 00:40:28 +01:00
#ifdef DEBUGGER_INCLUDED
std::unique_ptr<QtDebugger> m_debugger;
2020-02-02 19:46:03 +00:00
std::unique_ptr<QtFramedebugger> m_frameDebugger;
Ui::DebugDockMenu* debugDockMenuUi = nullptr;
Ui::DebugMenu* debugMenuUi = nullptr;
#endif
2016-07-01 05:28:39 +03:00
protected:
2018-04-30 21:01:23 +01:00
void closeEvent(QCloseEvent*) Q_DECL_OVERRIDE;
void changeEvent(QEvent*) Q_DECL_OVERRIDE;
signals:
void onExecutableChange();
2019-04-04 19:32:48 -04:00
public slots:
void outputWindow_resized();
2019-07-24 19:35:46 -04:00
void updateStats();
private slots:
2018-09-28 08:17:24 -04:00
void on_actionBoot_DiscImage_triggered();
void on_actionBoot_DiscImage_S3_triggered();
2018-09-28 12:00:02 -04:00
void on_actionBoot_cdrom0_triggered();
2018-04-30 21:01:23 +01:00
void on_actionBoot_ELF_triggered();
void on_actionExit_triggered();
2018-07-30 13:25:08 -04:00
void keyPressEvent(QKeyEvent*) Q_DECL_OVERRIDE;
void keyReleaseEvent(QKeyEvent*) Q_DECL_OVERRIDE;
2018-04-30 21:01:23 +01:00
void on_actionSettings_triggered();
void on_actionPause_Resume_triggered();
void on_actionAbout_triggered();
void focusOutEvent(QFocusEvent*) Q_DECL_OVERRIDE;
void focusInEvent(QFocusEvent*) Q_DECL_OVERRIDE;
2023-04-20 19:03:13 -04:00
void outputWindow_doubleClickEvent(QMouseEvent*);
void outputWindow_mouseMoveEvent(QMouseEvent*);
void outputWindow_mousePressEvent(QMouseEvent*);
void outputWindow_mouseReleaseEvent(QMouseEvent*);
2018-04-30 21:01:23 +01:00
void on_actionPause_when_focus_is_lost_triggered(bool checked);
void on_actionReset_triggered();
void on_actionMemory_Card_Manager_triggered();
void on_actionVFS_Manager_triggered();
void on_actionController_Manager_triggered();
void on_actionToggleFullscreen_triggered();
2018-04-30 21:01:23 +01:00
void on_actionCapture_Screen_triggered();
void HandleOnExecutableChange();
2019-01-16 20:00:10 +00:00
void on_actionList_Bootables_triggered();
2016-09-06 00:12:56 +01:00
};
#endif // MAINWINDOW_H