jce-manager/main/main.cpp

50 lines
1.7 KiB
C++
Raw Normal View History

2014-06-18 23:44:46 +00:00
#include "mainscreen.h"
#include <QApplication>
2014-06-27 22:22:44 +00:00
#include <QTranslator>
#include <QDebug>
#include "../src/appDatabase/savedata.h"
#include "../src/jce_logger.h"
2014-06-18 23:44:46 +00:00
int main(int argc, char *argv[])
{
2014-09-17 16:52:21 +00:00
#ifdef QT_DEBUG // Incase QtCreator is in Debug mode all qDebug messages will go to terminal
qDebug() << "Running a debug build";
2014-09-17 16:52:21 +00:00
#else // If QtCreator is on Release mode , qDebug messages will be logged in a log file.
qDebug() << "Running a release build";
qInstallMessageHandler(jce_logger::customMessageHandler);
#endif
2014-09-17 16:52:21 +00:00
qDebug() << "Start : JCE Manager Launched";
2014-06-18 23:44:46 +00:00
QApplication a(argc, argv);
QTranslator translator;
QString loco;
SaveData data;
loco = data.getLocal();
2014-09-17 16:52:21 +00:00
//Loading Local (From Settings file (SaveData.cpp)
if(loco == "default")
{
QString locale = QLocale::system().name();
translator.load("jce_"+locale , a.applicationDirPath());
qDebug() << "Local : Default Local Loaded";
}else if(loco == "he"){
translator.load("jce_he" , a.applicationDirPath());
qDebug() << "Local : Hebrew Local Loaded";
}else{
translator.load("jce_en" , a.applicationDirPath());
qDebug() << "Local : English Local Loaded";
}
2014-09-17 16:52:21 +00:00
a.installTranslator(&translator); //Setting local
2014-06-18 23:44:46 +00:00
MainScreen w;
w.show();
2014-09-17 16:52:21 +00:00
//Getting the exit code from QApplication. for debug reasons
int returnCode = a.exec();
if(returnCode == 0)
qDebug() << "End : JCE Manager Ended Successfully With A Return Code: " << returnCode;
else
qCritical() << "End : JCE Manager Ended Unusccessfully With A Return Code: " << returnCode;
return returnCode;
2014-06-18 23:44:46 +00:00
}