Commit 728f008b authored by Gus Grubba's avatar Gus Grubba

Adding code to actually load localization strings.

parent 64c930d5
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
#include "QGCMapEngine.h" #include "QGCMapEngine.h"
QGCApplication* QGCApplication::_app = NULL; QGCApplication* QGCApplication::_app = nullptr;
const char* QGCApplication::_deleteAllSettingsKey = "DeleteAllSettingsNextBoot"; const char* QGCApplication::_deleteAllSettingsKey = "DeleteAllSettingsNextBoot";
const char* QGCApplication::_settingsVersionKey = "SettingsVersion"; const char* QGCApplication::_settingsVersionKey = "SettingsVersion";
...@@ -150,7 +150,7 @@ static QObject* kmlFileHelperSingletonFactory(QQmlEngine*, QJSEngine*) ...@@ -150,7 +150,7 @@ static QObject* kmlFileHelperSingletonFactory(QQmlEngine*, QJSEngine*)
QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
#ifdef __mobile__ #ifdef __mobile__
: QGuiApplication (argc, argv) : QGuiApplication (argc, argv)
, _qmlAppEngine (NULL) , _qmlAppEngine (nullptr)
#else #else
: QApplication (argc, argv) : QApplication (argc, argv)
#endif #endif
...@@ -161,11 +161,24 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -161,11 +161,24 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
#ifdef QT_DEBUG #ifdef QT_DEBUG
, _testHighDPI (false) , _testHighDPI (false)
#endif #endif
, _toolbox (NULL) , _toolbox (nullptr)
, _bluetoothAvailable (false) , _bluetoothAvailable (false)
{ {
_app = this; _app = this;
QLocale locale = QLocale::system();
//-- Some forced locales for testing
//QLocale locale = QLocale(QLocale::German);
//QLocale locale = QLocale(QLocale::French);
//QLocale locale = QLocale(QLocale::Chinese);
#if defined (__macos__)
locale = QLocale(locale.name());
#endif
//-- Our localization
if(_QGCTranslator.load(locale, "qgc_", "", ":/localization"))
_app->installTranslator(&_QGCTranslator);
// This prevents usage of QQuickWidget to fail since it doesn't support native widget siblings // This prevents usage of QQuickWidget to fail since it doesn't support native widget siblings
#ifndef __android__ #ifndef __android__
setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
...@@ -222,12 +235,12 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -222,12 +235,12 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
QString loggingOptions; QString loggingOptions;
CmdLineOpt_t rgCmdLineOptions[] = { CmdLineOpt_t rgCmdLineOptions[] = {
{ "--clear-settings", &fClearSettingsOptions, NULL }, { "--clear-settings", &fClearSettingsOptions, nullptr },
{ "--logging", &logging, &loggingOptions }, { "--logging", &logging, &loggingOptions },
{ "--fake-mobile", &_fakeMobile, NULL }, { "--fake-mobile", &_fakeMobile, nullptr },
{ "--log-output", &_logOutput, NULL }, { "--log-output", &_logOutput, nullptr },
#ifdef QT_DEBUG #ifdef QT_DEBUG
{ "--test-high-dpi", &_testHighDPI, NULL }, { "--test-high-dpi", &_testHighDPI, nullptr },
#endif #endif
// Add additional command line option flags here // Add additional command line option flags here
}; };
...@@ -344,7 +357,7 @@ void QGCApplication::_shutdown(void) ...@@ -344,7 +357,7 @@ void QGCApplication::_shutdown(void)
QGCApplication::~QGCApplication() QGCApplication::~QGCApplication()
{ {
// Place shutdown code in _shutdown // Place shutdown code in _shutdown
_app = NULL; _app = nullptr;
} }
void QGCApplication::_initCommon(void) void QGCApplication::_initCommon(void)
...@@ -648,10 +661,10 @@ QObject* QGCApplication::_rootQmlObject() ...@@ -648,10 +661,10 @@ QObject* QGCApplication::_rootQmlObject()
return mainWindow->rootQmlObject(); return mainWindow->rootQmlObject();
} else if (runningUnitTests()){ } else if (runningUnitTests()){
// Unit test can run without a main window // Unit test can run without a main window
return NULL; return nullptr;
} else { } else {
qWarning() << "Why is MainWindow missing?"; qWarning() << "Why is MainWindow missing?";
return NULL; return nullptr;
} }
#endif #endif
} }
......
...@@ -177,6 +177,8 @@ private: ...@@ -177,6 +177,8 @@ private:
QGCToolbox* _toolbox; QGCToolbox* _toolbox;
QTranslator _QGCTranslator;
bool _bluetoothAvailable; bool _bluetoothAvailable;
static const char* _settingsVersionKey; ///< Settings key which hold settings version static const char* _settingsVersionKey; ///< Settings key which hold settings version
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment