2015-01-01 17:15:05 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
2011-03-28 23:36:26 +00:00
|
|
|
#include <QApplication>
|
2013-02-24 02:14:19 +00:00
|
|
|
#include <QTextCodec>
|
2013-02-20 18:29:12 +00:00
|
|
|
#include <QDir>
|
2013-06-26 08:09:26 +00:00
|
|
|
#include <QDebug>
|
|
|
|
|
2013-11-10 16:58:57 +00:00
|
|
|
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
|
|
|
|
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
2013-09-01 19:17:41 +00:00
|
|
|
// 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__
|
2013-11-10 16:58:57 +00:00
|
|
|
#endif // MAC_OS_X_VERSION_MIN_REQUIRED
|
|
|
|
|
2011-04-07 21:57:03 +00:00
|
|
|
#include "maindialog.hpp"
|
2018-08-07 18:57:16 +00:00
|
|
|
#include "sdlinit.hpp"
|
2011-03-28 23:36:26 +00:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2014-12-18 02:24:10 +00:00
|
|
|
try
|
2013-06-23 18:45:24 +00:00
|
|
|
{
|
2018-08-07 18:57:16 +00:00
|
|
|
// Note: we should init SDL2 before Qt4 to avoid crashes on Linux,
|
|
|
|
// but we should init SDL2 after Qt5 to avoid input issues on MacOS X.
|
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
|
|
initSDL();
|
|
|
|
#endif
|
|
|
|
|
2014-12-18 02:24:10 +00:00
|
|
|
QApplication app(argc, argv);
|
2011-03-28 23:36:26 +00:00
|
|
|
|
2014-12-18 02:24:10 +00:00
|
|
|
// Now we make sure the current dir is set to application path
|
|
|
|
QDir dir(QCoreApplication::applicationDirPath());
|
2011-05-10 20:47:08 +00:00
|
|
|
|
2014-12-18 02:24:10 +00:00
|
|
|
QDir::setCurrent(dir.absolutePath());
|
2011-05-10 20:47:08 +00:00
|
|
|
|
2014-12-18 02:24:10 +00:00
|
|
|
Launcher::MainDialog mainWin;
|
2013-01-26 17:19:04 +00:00
|
|
|
|
2015-05-16 10:18:04 +00:00
|
|
|
Launcher::FirstRunDialogResult result = mainWin.showFirstRunDialog();
|
|
|
|
if (result == Launcher::FirstRunDialogResultFailure)
|
2014-12-18 02:24:10 +00:00
|
|
|
return 0;
|
2014-05-30 00:12:48 +00:00
|
|
|
|
2015-05-16 10:18:04 +00:00
|
|
|
if (result == Launcher::FirstRunDialogResultContinue)
|
|
|
|
mainWin.show();
|
2013-01-26 17:19:04 +00:00
|
|
|
|
2018-08-07 18:57:16 +00:00
|
|
|
int exitCode = app.exec();
|
|
|
|
|
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
|
|
// Disconnect from SDL processes
|
|
|
|
quitSDL();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return exitCode;
|
2014-12-18 02:24:10 +00:00
|
|
|
}
|
|
|
|
catch (std::exception& e)
|
|
|
|
{
|
|
|
|
std::cerr << "ERROR: " << e.what() << std::endl;
|
|
|
|
return 0;
|
|
|
|
}
|
2018-08-07 18:57:16 +00:00
|
|
|
}
|