2016-09-06 00:12:56 +01:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
2016-07-26 15:20:18 +01:00
|
|
|
#include <QLabel>
|
|
|
|
#include <QKeyEvent>
|
2016-09-06 00:23:31 +01:00
|
|
|
#include <QXmlStreamReader>
|
2017-02-25 15:48:49 +00:00
|
|
|
#include <QDir>
|
2016-07-26 15:20:18 +01:00
|
|
|
|
|
|
|
#include "AppConfig.h"
|
2016-07-02 03:12:06 +03:00
|
|
|
#include "PS2VM.h"
|
2016-07-26 15:20:18 +01:00
|
|
|
#include "PS2VM_Preferences.h"
|
2016-08-23 00:54:10 +01:00
|
|
|
#include "StatsManager.h"
|
2016-07-26 00:52:31 +01:00
|
|
|
#include "PH_HidUnix.h"
|
2017-03-25 21:53:28 +00:00
|
|
|
#include "ElidedLabel.h"
|
2016-07-26 15:20:18 +01:00
|
|
|
|
2018-05-23 03:11:24 +03:00
|
|
|
#ifdef HAS_LIBEVDEV
|
2017-06-13 04:51:13 +01:00
|
|
|
#include "GamePad/GamePadInputEventListener.h"
|
|
|
|
#include "GamePad/GamePadDeviceListener.h"
|
2018-05-23 03:11:24 +03:00
|
|
|
#endif
|
2016-09-06 00:12:56 +01:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class MainWindow;
|
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
|
|
|
|
|
|
|
private:
|
2018-04-30 21:01:23 +01:00
|
|
|
void SetOpenGlPanelSize();
|
|
|
|
void CreateStatusBar();
|
2018-08-01 13:05:38 -04:00
|
|
|
void InitVirtualMachine();
|
|
|
|
void SetupGsHandler();
|
2018-04-30 21:01:23 +01:00
|
|
|
void SetupSoundHandler();
|
|
|
|
void Setupfpscounter();
|
|
|
|
void SetupSaveLoadStateSlots();
|
|
|
|
QString SaveStateInfo(int);
|
|
|
|
void OnExecutableChange();
|
|
|
|
void UpdateUI();
|
|
|
|
void RegisterPreferences();
|
|
|
|
void BootElf(const char*);
|
|
|
|
void BootCDROM();
|
|
|
|
void saveState(int);
|
|
|
|
void loadState(int);
|
|
|
|
void toggleFullscreen();
|
2016-07-01 05:21:58 +03:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
Ui::MainWindow* ui;
|
2016-07-26 15:20:18 +01:00
|
|
|
|
2018-08-02 08:56:17 -04:00
|
|
|
QWindow* m_openglpanel = nullptr;
|
2018-08-02 08:56:07 -04:00
|
|
|
QLabel* m_fpsLabel = nullptr;
|
|
|
|
ElidedLabel* m_msgLabel = nullptr;
|
2018-08-01 13:05:47 -04:00
|
|
|
CStatsManager* m_statsManager = nullptr;
|
2018-08-02 08:56:17 -04:00
|
|
|
CInputBindingManager* m_InputBindingManager = nullptr;
|
2018-08-07 19:17:28 -04:00
|
|
|
QTimer* m_fpsTimer = 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;
|
2018-05-23 03:11:24 +03:00
|
|
|
#ifdef HAS_LIBEVDEV
|
2018-04-30 21:01:23 +01:00
|
|
|
std::unique_ptr<CGamePadDeviceListener> m_GPDL;
|
2018-05-23 03:11:24 +03:00
|
|
|
#endif
|
2018-04-30 21:01:23 +01:00
|
|
|
enum BootType
|
|
|
|
{
|
|
|
|
CD,
|
|
|
|
ELF
|
|
|
|
};
|
|
|
|
struct lastOpenCommand
|
|
|
|
{
|
|
|
|
BootType type;
|
2018-04-12 12:30:47 +01:00
|
|
|
std::string filename;
|
|
|
|
lastOpenCommand() = default;
|
2018-04-30 21:01:23 +01:00
|
|
|
lastOpenCommand(BootType m_type, std::string m_filename)
|
|
|
|
: type(m_type)
|
|
|
|
, filename(m_filename)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
2018-04-12 12:30:47 +01:00
|
|
|
lastOpenCommand m_lastOpenCommand;
|
2018-04-30 21:01:23 +01:00
|
|
|
QString m_lastpath = QDir::homePath();
|
|
|
|
|
|
|
|
QString ReadElementValue(QXmlStreamReader& Rxml);
|
2016-07-26 00:52:31 +01:00
|
|
|
|
2016-07-01 05:28:39 +03:00
|
|
|
protected:
|
2018-04-30 21:01:23 +01:00
|
|
|
void closeEvent(QCloseEvent*) Q_DECL_OVERRIDE;
|
|
|
|
void showEvent(QShowEvent*) Q_DECL_OVERRIDE;
|
2016-06-26 23:42:21 -04:00
|
|
|
|
2016-07-26 15:20:18 +01:00
|
|
|
public slots:
|
2018-04-30 21:01:23 +01:00
|
|
|
void openGLWindow_resized();
|
|
|
|
void setFPS();
|
2016-07-26 15:20:18 +01:00
|
|
|
|
|
|
|
private slots:
|
2018-04-30 21:01:23 +01:00
|
|
|
void on_actionOpen_Game_triggered();
|
|
|
|
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;
|
|
|
|
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_actionCapture_Screen_triggered();
|
|
|
|
void doubleClickEvent(QMouseEvent*);
|
2016-09-06 00:12:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|