2015-05-13 07:49:49 -07:00
|
|
|
#include "mainwindow.h"
|
2016-10-17 01:00:18 -07:00
|
|
|
#include <QCoreApplication>
|
2015-05-13 07:49:49 -07:00
|
|
|
#include <QApplication>
|
2016-10-17 01:00:18 -07:00
|
|
|
#include <QDebug>
|
2017-01-27 03:15:24 -08:00
|
|
|
#include <QCommandLineParser>
|
2017-03-02 22:02:15 -08:00
|
|
|
#include <QLibraryInfo>
|
2015-05-13 07:49:49 -07:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QApplication a(argc, argv);
|
2016-10-17 01:00:18 -07:00
|
|
|
a.setApplicationName("MinetestMapperGui");
|
|
|
|
a.setApplicationDisplayName("Minetest Mapper GUI");
|
|
|
|
a.setApplicationVersion(GIT_VERSION);
|
|
|
|
a.setOrganizationName("MinetestMapperGui");
|
|
|
|
|
2017-03-02 22:02:15 -08:00
|
|
|
|
|
|
|
// Setup the translators
|
|
|
|
|
|
|
|
const QString translationsPath = "./translations/";
|
|
|
|
QTranslator qtTranslator;
|
|
|
|
if(qtTranslator.load("qt_" + QLocale::system().name(),
|
|
|
|
QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
|
|
|
|
a.installTranslator(&qtTranslator);
|
|
|
|
qDebug()<< QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
qtTranslator.load("qt_" + QLocale::system().name(),
|
|
|
|
translationsPath);
|
|
|
|
a.installTranslator(&qtTranslator);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTranslator translator;
|
|
|
|
if (translator.load("gui_" + QLocale::system().name(), translationsPath))
|
|
|
|
a.installTranslator(&translator);
|
|
|
|
|
|
|
|
|
|
|
|
// Init commandline parser
|
2017-01-27 03:15:24 -08:00
|
|
|
QCommandLineParser parser;
|
|
|
|
parser.setApplicationDescription("This program provides a graphical user interface for minetestmapper. \n"
|
|
|
|
"If you are looking for the command line interface of minetesmapper please execute minetestmapper directly.");
|
|
|
|
parser.addHelpOption();
|
|
|
|
parser.addVersionOption();
|
|
|
|
QCommandLineOption startPortableOption(QStringList() << "p" << "portable",
|
|
|
|
"Starts in portable mode which reads and writes settings and profiles relative to current directory");
|
|
|
|
parser.addOption(startPortableOption);
|
|
|
|
|
|
|
|
parser.process(a.arguments());
|
|
|
|
|
|
|
|
bool portable = parser.isSet(startPortableOption);
|
|
|
|
|
2017-03-02 22:02:15 -08:00
|
|
|
MainWindow w(portable, translationsPath, &translator, &qtTranslator);
|
2015-05-13 07:49:49 -07:00
|
|
|
w.show();
|
|
|
|
|
|
|
|
return a.exec();
|
|
|
|
}
|