2014-06-18 23:44:46 +00:00
|
|
|
#include "mainscreen.h"
|
|
|
|
#include <QApplication>
|
2014-06-27 22:22:44 +00:00
|
|
|
#include <QTranslator>
|
2014-06-28 03:36:10 +00:00
|
|
|
#include <QDebug>
|
2014-09-08 17:07:42 +00:00
|
|
|
#include "../src/appDatabase/savedata.h"
|
2014-09-22 22:26:37 +00:00
|
|
|
#include "../src/appDatabase/jce_logger.h"
|
2014-09-08 17:07:42 +00:00
|
|
|
|
2014-10-12 04:03:34 +00:00
|
|
|
//TODO: Project todo list
|
2014-10-17 11:18:04 +00:00
|
|
|
//update update site spelling
|
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
|
2014-10-04 00:54:27 +00:00
|
|
|
qDebug() << Q_FUNC_INFO << "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.
|
2014-09-23 02:57:35 +00:00
|
|
|
// qDebug() << "Running a release build";
|
2014-09-17 13:14:05 +00:00
|
|
|
qInstallMessageHandler(jce_logger::customMessageHandler);
|
|
|
|
#endif
|
|
|
|
|
2014-10-04 00:54:27 +00:00
|
|
|
qDebug() << Q_FUNC_INFO << "Start : JCE Manager Launched";
|
2014-09-17 16:52:21 +00:00
|
|
|
|
2014-06-18 23:44:46 +00:00
|
|
|
QApplication a(argc, argv);
|
2014-06-28 03:36:10 +00:00
|
|
|
QTranslator translator;
|
2014-09-08 17:07:42 +00:00
|
|
|
SaveData data;
|
2014-09-17 16:52:21 +00:00
|
|
|
//Loading Local (From Settings file (SaveData.cpp)
|
2014-10-13 23:45:11 +00:00
|
|
|
if(data.getLocale() == "en")
|
2014-09-08 17:07:42 +00:00
|
|
|
{
|
2014-10-13 23:45:11 +00:00
|
|
|
translator.load("jce_" + data.getLocale() , a.applicationDirPath());
|
2014-10-13 14:11:57 +00:00
|
|
|
qDebug() << Q_FUNC_INFO << "Locale : English Local Loaded";
|
2014-10-13 23:45:11 +00:00
|
|
|
}else if(data.getLocale() == "he"){
|
|
|
|
translator.load("jce_" + data.getLocale() , a.applicationDirPath());
|
2014-10-04 00:54:27 +00:00
|
|
|
qDebug() << Q_FUNC_INFO << "Local : Hebrew Local Loaded";
|
2014-09-16 21:08:29 +00:00
|
|
|
}else{
|
2014-09-08 17:07:42 +00:00
|
|
|
translator.load("jce_en" , a.applicationDirPath());
|
2014-10-13 14:11:57 +00:00
|
|
|
data.reset();
|
2014-10-13 14:35:55 +00:00
|
|
|
qCritical() << Q_FUNC_INFO << "save data corrupted, reset file.";
|
2014-09-16 21:08:29 +00:00
|
|
|
}
|
2014-09-17 16:52:21 +00:00
|
|
|
a.installTranslator(&translator); //Setting local
|
2014-10-01 13:38:57 +00:00
|
|
|
a.setApplicationVersion(APP_VERSION);
|
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
|
2014-09-16 21:08:29 +00:00
|
|
|
int returnCode = a.exec();
|
|
|
|
if(returnCode == 0)
|
2014-10-04 00:54:27 +00:00
|
|
|
qDebug() << Q_FUNC_INFO << "End : JCE Manager Ended Successfully With A Return Code: " << returnCode;
|
2014-09-16 21:08:29 +00:00
|
|
|
else
|
2014-10-04 00:54:27 +00:00
|
|
|
qCritical() << Q_FUNC_INFO << "End : JCE Manager Ended Unusccessfully With A Return Code: " << returnCode;
|
2014-09-16 21:08:29 +00:00
|
|
|
return returnCode;
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|