all repos — mgba @ 6afa678a41545ab0ab4255e10fe25cb56dbbcd37

mGBA Game Boy Advance Emulator

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 (parseArguments(&m_args, &m_opts, argc, argv, 0)) {
16		m_window.setOptions(&m_opts);
17		m_window.argumentsPassed(&m_args);
18	} else {
19		m_window.setOptions(&m_opts);
20	}
21
22    m_window.show();
23}
24
25GBAApp::~GBAApp() {
26	freeArguments(&m_args);
27	GBAConfigFreeOpts(&m_opts);
28}
29
30bool GBAApp::event(QEvent* event) {
31	if (event->type() == QEvent::FileOpen) {
32		m_window.controller()->loadGame(static_cast<QFileOpenEvent*>(event)->file());
33		return true;
34	}
35	return QApplication::event(event);
36}