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