Play-/Source/ui_unix/mainwindow.h
2018-05-23 03:12:49 +03:00

119 lines
2.7 KiB
C++

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QLabel>
#include <QKeyEvent>
#include <QXmlStreamReader>
#include <QDir>
#include "AppConfig.h"
#include "PS2VM.h"
#include "PS2VM_Preferences.h"
#include "StatsManager.h"
#include "PH_HidUnix.h"
#include "ElidedLabel.h"
#ifdef HAS_LIBEVDEV
#include "GamePad/GamePadInputEventListener.h"
#include "GamePad/GamePadDeviceListener.h"
#endif
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget* parent = 0);
~MainWindow();
private:
void SetOpenGlPanelSize();
void CreateStatusBar();
void InitEmu();
void SetupSoundHandler();
void Setupfpscounter();
void SetupSaveLoadStateSlots();
QString SaveStateInfo(int);
void OnRunningStateChange();
void OnExecutableChange();
void UpdateUI();
void RegisterPreferences();
void BootElf(const char*);
void BootCDROM();
void saveState(int);
void loadState(int);
void toggleFullscreen();
Ui::MainWindow* ui;
QWindow* m_openglpanel;
QLabel* gameIDLabel;
QLabel* fpsLabel;
QLabel* m_dcLabel;
QLabel* m_stateLabel;
ElidedLabel* m_msgLabel;
CStatsManager* StatsManager;
CInputBindingManager* m_InputBindingManager;
QTimer* m_fpstimer = nullptr;
CPS2VM* g_virtualMachine = nullptr;
bool m_deactivatePause = false;
bool m_pauseFocusLost = true;
#ifdef HAS_LIBEVDEV
std::unique_ptr<CGamePadDeviceListener> m_GPDL;
#endif
enum BootType
{
CD,
ELF
};
struct lastOpenCommand
{
BootType type;
std::string filename;
lastOpenCommand() = default;
lastOpenCommand(BootType m_type, std::string m_filename)
: type(m_type)
, filename(m_filename)
{
}
};
lastOpenCommand m_lastOpenCommand;
QString m_lastpath = QDir::homePath();
QString ReadElementValue(QXmlStreamReader& Rxml);
protected:
void closeEvent(QCloseEvent*) Q_DECL_OVERRIDE;
void showEvent(QShowEvent*) Q_DECL_OVERRIDE;
public slots:
void openGLWindow_resized();
void setFPS();
private slots:
void on_actionOpen_Game_triggered();
void on_actionBoot_ELF_triggered();
void on_actionExit_triggered();
void keyPressEvent(QKeyEvent*);
void keyReleaseEvent(QKeyEvent*);
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*);
};
#endif // MAINWINDOW_H