src/platform/qt/Window.h (view raw)
1#ifndef QGBA_WINDOW
2#define QGBA_WINDOW
3
4#include <QAudioOutput>
5#include <QMainWindow>
6
7extern "C" {
8#include "gba.h"
9}
10
11#include "GDBController.h"
12#include "Display.h"
13#include "InputController.h"
14#include "LoadSaveState.h"
15
16struct GBAOptions;
17struct GBAArguments;
18
19namespace QGBA {
20
21class ConfigController;
22class GameController;
23class LogView;
24class VideoView;
25class WindowBackground;
26
27class Window : public QMainWindow {
28Q_OBJECT
29
30public:
31 Window(ConfigController* config, QWidget* parent = nullptr);
32 virtual ~Window();
33
34 GameController* controller() { return m_controller; }
35
36 void setConfig(ConfigController*);
37 void argumentsPassed(GBAArguments*);
38
39signals:
40 void startDrawing(const uint32_t*, GBAThread*);
41 void shutdown();
42 void audioBufferSamplesChanged(int samples);
43 void fpsTargetChanged(float target);
44
45public slots:
46 void selectROM();
47 void selectBIOS();
48 void selectPatch();
49 void toggleFullScreen();
50 void loadConfig();
51 void saveConfig();
52
53#ifdef USE_FFMPEG
54 void openVideoWindow();
55#endif
56
57#ifdef USE_GDB_STUB
58 void gdbOpen();
59#endif
60
61protected:
62 virtual void keyPressEvent(QKeyEvent* event) override;
63 virtual void keyReleaseEvent(QKeyEvent* event) override;
64 virtual void resizeEvent(QResizeEvent*) override;
65 virtual void closeEvent(QCloseEvent*) override;
66
67private slots:
68 void gameStarted(GBAThread*);
69 void gameStopped();
70 void redoLogo();
71
72private:
73 void setupMenu(QMenuBar*);
74 void openStateWindow(LoadSave);
75
76 void attachWidget(QWidget* widget);
77 void detachWidget(QWidget* widget);
78
79 GameController* m_controller;
80 Display* m_display;
81 QList<QAction*> m_gameActions;
82 LogView* m_logView;
83 LoadSaveState* m_stateWindow;
84 WindowBackground* m_screenWidget;
85 QPixmap m_logo;
86 ConfigController* m_config;
87 InputController m_inputController;
88
89#ifdef USE_FFMPEG
90 VideoView* m_videoView;
91#endif
92
93#ifdef USE_GDB_STUB
94 GDBController* m_gdbController;
95#endif
96};
97
98class WindowBackground : public QLabel {
99Q_OBJECT
100
101public:
102 WindowBackground(QWidget* parent = 0);
103
104 void setSizeHint(const QSize& size);
105 virtual QSize sizeHint() const override;
106
107private:
108 QSize m_sizeHint;
109};
110
111}
112
113#endif