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