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
47public slots:
48 void interruptAll();
49 void continueAll();
50
51protected:
52 bool event(QEvent*);
53
54private:
55 class FileDialog : public QFileDialog {
56 public:
57 FileDialog(GBAApp* app, QWidget* parent = nullptr, const QString& caption = QString(),
58 const QString& filter = QString());
59 virtual int exec() override;
60
61 private:
62 GBAApp* m_app;
63 };
64
65 Window* newWindowInternal();
66
67 ConfigController m_configController;
68 Window* m_windows[MAX_GBAS];
69 MultiplayerController m_multiplayer;
70 NoIntroDB* m_db;
71};
72
73}
74
75#endif