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