src/platform/qt/GBAApp.cpp (view raw)
1#include "GBAApp.h"
2
3#include "GameController.h"
4
5#include <QFileOpenEvent>
6
7using namespace QGBA;
8
9GBAApp::GBAApp(int& argc, char* argv[])
10 : QApplication(argc, argv)
11{
12 QApplication::setApplicationName(PROJECT_NAME);
13 QApplication::setApplicationVersion(PROJECT_VERSION);
14
15 if (parseCommandArgs(&m_opts, &m_gbaOpts, argc, argv, 0)) {
16 m_window.setOptions(&m_gbaOpts);
17 m_window.optionsPassed(&m_opts);
18 } else {
19 m_window.setOptions(&m_gbaOpts);
20 }
21
22 m_window.show();
23}
24
25GBAApp::~GBAApp() {
26 freeOptions(&m_opts);
27}
28
29bool GBAApp::event(QEvent* event) {
30 if (event->type() == QEvent::FileOpen) {
31 m_window.controller()->loadGame(static_cast<QFileOpenEvent*>(event)->file());
32 return true;
33 }
34 return QApplication::event(event);
35}