all repos — mgba @ 9ba250e9bb85b8ff61f5ebc06006161611d44bda

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