all repos — mgba @ bbe10619efaf5c691e57747101029b3d194add3b

mGBA Game Boy Advance Emulator

src/platform/qt/GBAApp.h (view raw)

 1/* Copyright (c) 2013-2014 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef QGBA_APP_H
 7#define QGBA_APP_H
 8
 9#include <QApplication>
10#include <QFileDialog>
11
12#include "ConfigController.h"
13#include "MultiplayerController.h"
14
15struct NoIntroDB;
16
17extern "C" {
18#include "gba/sio.h"
19}
20
21namespace QGBA {
22
23class GameController;
24class Window;
25
26class GBAApp : public QApplication {
27Q_OBJECT
28
29public:
30	GBAApp(int& argc, char* argv[]);
31	static GBAApp* app();
32
33	static QString dataDir();
34
35	Window* newWindow();
36
37	QString getOpenFileName(QWidget* owner, const QString& title, const QString& filter = QString());
38	QString getSaveFileName(QWidget* owner, const QString& title, const QString& filter = QString());
39
40	QFileDialog* getOpenFileDialog(QWidget* owner, const QString& title, const QString& filter = QString());
41	QFileDialog* getSaveFileDialog(QWidget* owner, const QString& title, const QString& filter = QString());
42
43	const NoIntroDB* gameDB() const { return m_db; }
44	bool reloadGameDB();
45
46public slots:
47	void interruptAll();
48	void continueAll();
49
50protected:
51	bool event(QEvent*);
52
53private:
54	class FileDialog : public QFileDialog {
55	public:
56		FileDialog(GBAApp* app, QWidget* parent = nullptr, const QString& caption = QString(),
57		           const QString& filter = QString());
58		virtual int exec() override;
59
60	private:
61		GBAApp* m_app;
62	};
63
64	Window* newWindowInternal();
65
66	ConfigController m_configController;
67	Window* m_windows[MAX_GBAS];
68	MultiplayerController m_multiplayer;
69	NoIntroDB* m_db;
70};
71
72}
73
74#endif