all repos — mgba @ 4c38f769565e8ddd7d3a8eef1a41975206c129a0

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 "core/log.h"
19}
20
21mLOG_DECLARE_CATEGORY(QT);
22
23namespace QGBA {
24
25class GameController;
26class Window;
27
28class GBAApp : public QApplication {
29Q_OBJECT
30
31public:
32	GBAApp(int& argc, char* argv[]);
33	static GBAApp* app();
34
35	static QString dataDir();
36
37	Window* newWindow();
38
39	QString getOpenFileName(QWidget* owner, const QString& title, const QString& filter = QString());
40	QString getSaveFileName(QWidget* owner, const QString& title, const QString& filter = QString());
41	QString getOpenDirectoryName(QWidget* owner, const QString& title);
42
43	QFileDialog* getOpenFileDialog(QWidget* owner, const QString& title, const QString& filter = QString());
44	QFileDialog* getSaveFileDialog(QWidget* owner, const QString& title, const QString& filter = QString());
45
46	const NoIntroDB* gameDB() const { return m_db; }
47	bool reloadGameDB();
48
49protected:
50	bool event(QEvent*);
51
52private:
53	class FileDialog : public QFileDialog {
54	public:
55		FileDialog(GBAApp* app, QWidget* parent = nullptr, const QString& caption = QString(),
56		           const QString& filter = QString());
57		virtual int exec() override;
58
59	private:
60		GBAApp* m_app;
61	};
62
63	Window* newWindowInternal();
64
65	void pauseAll(QList<int>* paused);
66	void continueAll(const QList<int>* paused);
67
68	ConfigController m_configController;
69	Window* m_windows[MAX_GBAS];
70	MultiplayerController m_multiplayer;
71	NoIntroDB* m_db;
72};
73
74}
75
76#endif