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