all repos — mgba @ ccaec37867d2a54d5cd5a56a43df48206d729741

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	Window* newWindow();
34
35	QString getOpenFileName(QWidget* owner, const QString& title, const QString& filter = QString());
36	QString getSaveFileName(QWidget* owner, const QString& title, const QString& filter = QString());
37
38	QFileDialog* getOpenFileDialog(QWidget* owner, const QString& title, const QString& filter = QString());
39	QFileDialog* getSaveFileDialog(QWidget* owner, const QString& title, const QString& filter = QString());
40
41	const NoIntroDB* gameDB() const { return m_db; }
42	bool reloadGameDB();
43
44public slots:
45	void interruptAll();
46	void continueAll();
47
48protected:
49	bool event(QEvent*);
50
51private:
52	class FileDialog : public QFileDialog {
53	public:
54		FileDialog(GBAApp* app, QWidget* parent = nullptr, const QString& caption = QString(),
55		           const QString& filter = QString());
56		virtual int exec() override;
57
58	private:
59		GBAApp* m_app;
60	};
61
62	Window* newWindowInternal();
63
64	ConfigController m_configController;
65	Window* m_windows[MAX_GBAS];
66	MultiplayerController m_multiplayer;
67	NoIntroDB* m_db;
68};
69
70}
71
72#endif