src/platform/qt/main.cpp (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
7// This must be defined before anything else is included.
8#define SDL_MAIN_HANDLED
9
10#include "GBAApp.h"
11#include "Window.h"
12
13#include <QLibraryInfo>
14#include <QTranslator>
15
16#include <mgba/core/version.h>
17
18#ifdef QT_STATIC
19#include <QtPlugin>
20#ifdef _WIN32
21Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
22#ifdef BUILD_QT_MULTIMEDIA
23Q_IMPORT_PLUGIN(QWindowsAudioPlugin);
24#endif
25#endif
26#endif
27
28int main(int argc, char* argv[]) {
29#ifdef BUILD_SDL
30 SDL_SetMainReady();
31#endif
32 QGBA::GBAApp application(argc, argv);
33
34 QLocale locale = QLocale::system();
35
36 QTranslator qtTranslator;
37 qtTranslator.load(locale, "qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath));
38 application.installTranslator(&qtTranslator);
39
40 QTranslator langTranslator;
41 langTranslator.load(locale, binaryName, "-", ":/translations/");
42 application.installTranslator(&langTranslator);
43
44 return application.exec();
45}