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 GIFView;
24class LogView;
25class VideoView;
26class WindowBackground;
27
28class Window : public QMainWindow {
29Q_OBJECT
30
31public:
32 Window(ConfigController* config, QWidget* parent = nullptr);
33 virtual ~Window();
34
35 GameController* controller() { return m_controller; }
36
37 void setConfig(ConfigController*);
38 void argumentsPassed(GBAArguments*);
39
40signals:
41 void startDrawing(const uint32_t*, GBAThread*);
42 void shutdown();
43 void audioBufferSamplesChanged(int samples);
44 void fpsTargetChanged(float target);
45
46public slots:
47 void selectROM();
48 void selectBIOS();
49 void selectPatch();
50 void toggleFullScreen();
51 void loadConfig();
52 void saveConfig();
53
54 void openKeymapWindow();
55
56#ifdef USE_FFMPEG
57 void openVideoWindow();
58#endif
59
60#ifdef USE_MAGICK
61 void openGIFWindow();
62#endif
63
64#ifdef USE_GDB_STUB
65 void gdbOpen();
66#endif
67
68protected:
69 virtual void keyPressEvent(QKeyEvent* event) override;
70 virtual void keyReleaseEvent(QKeyEvent* event) override;
71 virtual void resizeEvent(QResizeEvent*) override;
72 virtual void closeEvent(QCloseEvent*) override;
73
74private slots:
75 void gameStarted(GBAThread*);
76 void gameStopped();
77 void redoLogo();
78
79private:
80 void setupMenu(QMenuBar*);
81 void openStateWindow(LoadSave);
82
83 void attachWidget(QWidget* widget);
84 void detachWidget(QWidget* widget);
85
86 GameController* m_controller;
87 Display* m_display;
88 QList<QAction*> m_gameActions;
89 LogView* m_logView;
90 LoadSaveState* m_stateWindow;
91 WindowBackground* m_screenWidget;
92 QPixmap m_logo;
93 ConfigController* m_config;
94 InputController m_inputController;
95
96#ifdef USE_FFMPEG
97 VideoView* m_videoView;
98#endif
99
100#ifdef USE_MAGICK
101 GIFView* m_gifView;
102#endif
103
104#ifdef USE_GDB_STUB
105 GDBController* m_gdbController;
106#endif
107};
108
109class WindowBackground : public QLabel {
110Q_OBJECT
111
112public:
113 WindowBackground(QWidget* parent = 0);
114
115 void setSizeHint(const QSize& size);
116 virtual QSize sizeHint() const override;
117
118private:
119 QSize m_sizeHint;
120};
121
122}
123
124#endif