kima2/src/gui/kima2.cpp
2018-08-01 09:37:11 +02:00

51 lines
1.6 KiB
C++

#include "mainwindow.h"
#include "settingsdialog.h"
#include <QApplication>
#include <QMessageBox>
#include <QSettings>
#include <QTranslator>
#include <QLibraryInfo>
int main(int argc, char* argv[])
{
// Q_INIT_RESOURCE(application);
// Set the locale to german, so that currency is correct
// std::locale german("de_DE.utf-8");
std::locale myLocale("");
std::locale::global(myLocale);
QApplication kimaApp{argc, argv};
QCoreApplication::setOrganizationName("RustySoft");
QCoreApplication::setOrganizationDomain("rustysoft.de");
QCoreApplication::setApplicationName("KIMA2");
QTranslator qTranslator;
QLocale german(QLocale::German);
#ifdef __linux__
qTranslator.load("qt_" + german.name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
#endif
#ifdef _WIN32
qTranslator.load("qt_" + german.name(),
QApplication::applicationDirPath() + QDir::separator() + "translations");
#endif
kimaApp.installTranslator(&qTranslator);
QSettings settings{};
while (!settings.contains("global/cashPointNo")) {
QMessageBox(QMessageBox::Icon::Information, "Erster Start von KIMA2",
"Es wurden keine Einstellungen gefunden. Vermutlich starteten Sie KIMA2 zum "
"ersten Mal. Bitte legen Sie nun die Einstellungen fest.",
QMessageBox::StandardButton::Ok)
.exec();
SettingsDialog().exec();
}
auto mainWin = std::make_unique<MainWindow>();
mainWin->show();
return kimaApp.exec();
}