all repos — mgba @ f7ac90d74eba6bc556b609bb788e5a9d84926968

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
17#include "core/log.h"
18#include "gba/sio.h"
19
20mLOG_DECLARE_CATEGORY(QT);
21
22namespace QGBA {
23
24class GameController;
25class Window;
26
27class GBAApp : public QApplication {
28Q_OBJECT
29
30public:
31	GBAApp(int& argc, char* argv[]);
32	static GBAApp* app();
33
34	static QString dataDir();
35
36	Window* newWindow();
37
38	QString getOpenFileName(QWidget* owner, const QString& title, const QString& filter = QString());
39	QString getSaveFileName(QWidget* owner, const QString& title, const QString& filter = QString());
40	QString getOpenDirectoryName(QWidget* owner, const QString& title);
41
42	QFileDialog* getOpenFileDialog(QWidget* owner, const QString& title, const QString& filter = QString());
43	QFileDialog* getSaveFileDialog(QWidget* owner, const QString& title, const QString& filter = QString());
44
45	const NoIntroDB* gameDB() const { return m_db; }
46	bool reloadGameDB();
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	void pauseAll(QList<int>* paused);
65	void continueAll(const QList<int>* paused);
66
67	ConfigController m_configController;
68	Window* m_windows[MAX_GBAS];
69	MultiplayerController m_multiplayer;
70	NoIntroDB* m_db;
71};
72
73}
74
75#endif