all repos — mgba @ 2ddb074bda2e0b5a2501e282d94d92ff056b3933

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