all repos — mgba @ c8d5219212667aebe4797171665b361830e653bd

mGBA Game Boy Advance Emulator

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