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
17extern "C" {
18#include "core/log.h"
19#include "gba/sio.h"
20}
21
22mLOG_DECLARE_CATEGORY(QT);
23
24namespace QGBA {
25
26class GameController;
27class Window;
28
29class GBAApp : public QApplication {
30Q_OBJECT
31
32public:
33 GBAApp(int& argc, char* argv[]);
34 static GBAApp* app();
35
36 static QString dataDir();
37
38 Window* newWindow();
39
40 QString getOpenFileName(QWidget* owner, const QString& title, const QString& filter = QString());
41 QString getSaveFileName(QWidget* owner, const QString& title, const QString& filter = QString());
42 QString getOpenDirectoryName(QWidget* owner, const QString& title);
43
44 QFileDialog* getOpenFileDialog(QWidget* owner, const QString& title, const QString& filter = QString());
45 QFileDialog* getSaveFileDialog(QWidget* owner, const QString& title, const QString& filter = QString());
46
47 const NoIntroDB* gameDB() const { return m_db; }
48 bool reloadGameDB();
49
50protected:
51 bool event(QEvent*);
52
53private:
54 class FileDialog : public QFileDialog {
55 public:
56 FileDialog(GBAApp* app, QWidget* parent = nullptr, const QString& caption = QString(),
57 const QString& filter = QString());
58 virtual int exec() override;
59
60 private:
61 GBAApp* m_app;
62 };
63
64 Window* newWindowInternal();
65
66 void pauseAll(QList<int>* paused);
67 void continueAll(const QList<int>* paused);
68
69 ConfigController m_configController;
70 Window* m_windows[MAX_GBAS];
71 MultiplayerController m_multiplayer;
72 NoIntroDB* m_db;
73};
74
75}
76
77#endif