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 "LoadSaveState.h"
14
15struct StartupOptions;
16
17namespace QGBA {
18
19class GameController;
20class LogView;
21class VideoView;
22class WindowBackground;
23
24class Window : public QMainWindow {
25Q_OBJECT
26
27public:
28 Window(QWidget* parent = nullptr);
29 virtual ~Window();
30
31 GameController* controller() { return m_controller; }
32
33 static GBAKey mapKey(int qtKey);
34
35 void optionsPassed(StartupOptions*);
36
37signals:
38 void startDrawing(const uint32_t*, GBAThread*);
39 void shutdown();
40 void audioBufferSamplesChanged(int samples);
41 void fpsTargetChanged(float target);
42
43public slots:
44 void selectROM();
45 void selectBIOS();
46 void selectPatch();
47 void toggleFullScreen();
48
49#ifdef USE_FFMPEG
50 void openVideoWindow();
51#endif
52
53#ifdef USE_GDB_STUB
54 void gdbOpen();
55#endif
56
57protected:
58 virtual void keyPressEvent(QKeyEvent* event) override;
59 virtual void keyReleaseEvent(QKeyEvent* event) override;
60 virtual void resizeEvent(QResizeEvent*) override;
61 virtual void closeEvent(QCloseEvent*) override;
62
63private slots:
64 void gameStarted(GBAThread*);
65 void gameStopped();
66 void redoLogo();
67
68private:
69 void setupMenu(QMenuBar*);
70 void openStateWindow(LoadSave);
71
72 void attachWidget(QWidget* widget);
73 void detachWidget(QWidget* widget);
74
75 GameController* m_controller;
76 Display* m_display;
77 QList<QAction*> m_gameActions;
78 LogView* m_logView;
79 LoadSaveState* m_stateWindow;
80 WindowBackground* m_screenWidget;
81 QPixmap m_logo;
82
83#ifdef USE_FFMPEG
84 VideoView* m_videoView;
85#endif
86
87#ifdef USE_GDB_STUB
88 GDBController* m_gdbController;
89#endif
90};
91
92class WindowBackground : public QLabel {
93Q_OBJECT
94
95public:
96 WindowBackground(QWidget* parent = 0);
97
98 void setSizeHint(const QSize& size);
99 virtual QSize sizeHint() const override;
100
101private:
102 QSize m_sizeHint;
103};
104
105}
106
107#endif