all repos — mgba @ 686380b6c4d8acf219a704a8932668b11efc47c2

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
42class GBAApp : public QApplication {
43Q_OBJECT
44
45public:
46	GBAApp(int& argc, char* argv[]);
47	~GBAApp();
48	static GBAApp* app();
49
50	static QString dataDir();
51
52	Window* newWindow();
53
54	QString getOpenFileName(QWidget* owner, const QString& title, const QString& filter = QString());
55	QString getSaveFileName(QWidget* owner, const QString& title, const QString& filter = QString());
56	QString getOpenDirectoryName(QWidget* owner, const QString& title);
57
58	const NoIntroDB* gameDB() const { return m_db; }
59	bool reloadGameDB();
60
61protected:
62	bool event(QEvent*);
63
64private:
65	Window* newWindowInternal();
66
67	void pauseAll(QList<Window*>* paused);
68	void continueAll(const QList<Window*>& paused);
69
70	ConfigController m_configController;
71	QList<Window*> m_windows;
72	MultiplayerController m_multiplayer;
73
74	NoIntroDB* m_db;
75#ifdef USE_SQLITE3
76	QThread m_parseThread;
77#endif
78};
79
80}
81
82#endif