1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00
OpenMW/apps/launcher/main.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.6 KiB
C++
Raw Normal View History

#include <iostream>
2013-02-20 18:29:12 +00:00
#include <QDir>
#include <QTranslator>
2013-06-26 08:09:26 +00:00
2021-12-20 19:40:04 +00:00
#include <components/debug/debugging.hpp>
#include <components/platform/platform.hpp>
2021-12-20 19:40:04 +00:00
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
#undef MAC_OS_X_VERSION_MIN_REQUIRED
// We need to do this because of Qt: https://bugreports.qt-project.org/browse/QTBUG-22154
#define MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
#endif // MAC_OS_X_VERSION_MIN_REQUIRED
#include "maindialog.hpp"
2011-03-28 23:36:26 +00:00
2021-12-20 19:40:04 +00:00
int runLauncher(int argc, char* argv[])
2011-03-28 23:36:26 +00:00
{
Platform::init();
try
2013-06-23 18:45:24 +00:00
{
QApplication app(argc, argv);
2011-03-28 23:36:26 +00:00
// Internationalization
QString locale = QLocale::system().name().section('_', 0, 0);
QTranslator appTranslator;
appTranslator.load(":/translations/" + locale + ".qm");
app.installTranslator(&appTranslator);
// Now we make sure the current dir is set to application path
QDir dir(QCoreApplication::applicationDirPath());
QDir::setCurrent(dir.absolutePath());
Launcher::MainDialog mainWin;
Launcher::FirstRunDialogResult result = mainWin.showFirstRunDialog();
if (result == Launcher::FirstRunDialogResultFailure)
return 0;
if (result == Launcher::FirstRunDialogResultContinue)
mainWin.show();
int exitCode = app.exec();
return exitCode;
}
catch (std::exception& e)
{
std::cerr << "ERROR: " << e.what() << std::endl;
return 0;
}
}
2021-12-20 19:40:04 +00:00
int main(int argc, char* argv[])
{
return wrapApplication(runLauncher, argc, argv, "Launcher");
}