all repos — mgba @ e4d3aefb4abe52e2aed7a77bb962ff91560908e7

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#include <QThread>
12
13#include "ConfigController.h"
14#include "MultiplayerController.h"
15
16struct NoIntroDB;
17
18#include <mgba/core/log.h>
19
20mLOG_DECLARE_CATEGORY(QT);
21
22namespace QGBA {
23
24class GameController;
25class Window;
26
27#ifdef USE_SQLITE3
28class GameDBParser : public QObject {
29Q_OBJECT
30
31public:
32	GameDBParser(NoIntroDB* db, QObject* parent = nullptr);
33
34public slots:
35	void parseNoIntroDB();
36
37private:
38	NoIntroDB* m_db;
39};
40#endif
41
42
43class GBAApp : public QApplication {
44Q_OBJECT
45
46public:
47	GBAApp(int& argc, char* argv[]);
48	~GBAApp();
49	static GBAApp* app();
50
51	static QString dataDir();
52
53	Window* newWindow();
54
55	QString getOpenFileName(QWidget* owner, const QString& title, const QString& filter = QString());
56	QString getSaveFileName(QWidget* owner, const QString& title, const QString& filter = QString());
57	QString getOpenDirectoryName(QWidget* owner, const QString& title);
58
59	QFileDialog* getOpenFileDialog(QWidget* owner, const QString& title, const QString& filter = QString());
60	QFileDialog* getSaveFileDialog(QWidget* owner, const QString& title, const QString& filter = QString());
61
62	const NoIntroDB* gameDB() const { return m_db; }
63	bool reloadGameDB();
64
65protected:
66	bool event(QEvent*);
67
68private:
69	class FileDialog : public QFileDialog {
70	public:
71		FileDialog(GBAApp* app, QWidget* parent = nullptr, const QString& caption = QString(),
72		           const QString& filter = QString());
73		virtual int exec() override;
74
75	private:
76		GBAApp* m_app;
77	};
78
79	Window* newWindowInternal();
80
81	void pauseAll(QList<int>* paused);
82	void continueAll(const QList<int>* paused);
83
84	ConfigController m_configController;
85	Window* m_windows[MAX_GBAS];
86	MultiplayerController m_multiplayer;
87
88	NoIntroDB* m_db;
89#ifdef USE_SQLITE3
90	QThread m_parseThread;
91#endif
92};
93
94}
95
96#endif