Index: main.cpp =================================================================== diff -u -r563e34706a5c39070a603725bc021fcdc3424cac -rd9b9df9b23da89b4c27f4672ff6e7f570adcc48a --- main.cpp (.../main.cpp) (revision 563e34706a5c39070a603725bc021fcdc3424cac) +++ main.cpp (.../main.cpp) (revision d9b9df9b23da89b4c27f4672ff6e7f570adcc48a) @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -54,12 +53,15 @@ #include "WifiInterface.h" #include "BluetoothInterface.h" #include "CloudSyncController.h" +//AMIR +#include "Settings.h" #include "Threads.h" // kernel #include + /*! * \brief signalhandler * \details When application terminates it quits gracefully. @@ -546,24 +548,32 @@ // SYSTEM TEST FOR INSTRUCTIONS WHEN THERE IS NO PORT AVAILABLE // Storage::FileHandler::copyFolder(QString(Storage::USB_Mount_Point) + "Instructions", QString(Storage::Settings_Path())); - //! - Translation initialization - QTranslator translator; - bool trLoaded = translator.load(QLocale(), app.applicationName(), QLatin1String("_"), QLatin1String(":/translations")); - if (trLoaded) { - app.installTranslator(&translator); - } //! - Initializing required thread types Threads::registerTypes(); - bool guiStarted = startGui(); - //! - Initializing Logger if(_Logger.init(Threads::_Logger_Thread)) { _Logger.enableConsoleOut(gConsoleoutLogs); } _Logger.postInit(); + // That is enough to call to the I function here to create the object in the thread that Settings is leaving in, + // which currently is Application_Thread, since the Settings is created in that thread. + _Settings; + QTranslator translator; + { // on-shot use of settings to load the translation only + // Storage::Settings settings; + //! - Reading localization + if ( ! Storage::Settings::readLocale() ) { + //! - Translation initialization + Storage::Settings::loadTranslation(translator); + } + } + + //! - Starting the application interface + bool guiStarted = startGui(); + if (gFakeInterval) { QString msg = " ~~ !!!!! APPLICATION RUNNING IN THE TEST MODE !!!!! ~~ "; qDebug() << msg;