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 "Display.h"
12#include "LoadSaveState.h"
13
14struct StartupOptions;
15
16namespace QGBA {
17
18class GameController;
19class GDBController;
20class LogView;
21
22class Window : public QMainWindow {
23Q_OBJECT
24
25public:
26 Window(QWidget* parent = nullptr);
27 virtual ~Window();
28
29 static GBAKey mapKey(int qtKey);
30
31 void optionsPassed(StartupOptions*);
32
33signals:
34 void startDrawing(const uint32_t*, GBAThread*);
35 void shutdown();
36 void audioBufferSamplesChanged(int samples);
37 void fpsTargetChanged(float target);
38
39public slots:
40 void selectROM();
41 void selectBIOS();
42 void toggleFullScreen();
43
44#ifdef USE_GDB_STUB
45 void gdbOpen();
46#endif
47
48protected:
49 virtual void keyPressEvent(QKeyEvent* event) override;
50 virtual void keyReleaseEvent(QKeyEvent* event) override;
51 virtual void resizeEvent(QResizeEvent*) override;
52 virtual void closeEvent(QCloseEvent*) override;
53
54private slots:
55 void gameStarted(GBAThread*);
56 void gameStopped();
57 void redoLogo();
58
59private:
60 void setupMenu(QMenuBar*);
61 void openStateWindow(LoadSave);
62
63 void attachWidget(QWidget* widget);
64 void detachWidget(QWidget* widget);
65
66 GameController* m_controller;
67 Display* m_display;
68 QList<QAction*> m_gameActions;
69 LogView* m_logView;
70 LoadSaveState* m_stateWindow;
71 QLabel* m_screenWidget;
72 QPixmap m_logo;
73
74#ifdef USE_GDB_STUB
75 GDBController* m_gdbController;
76#endif
77};
78
79}
80
81#endif