X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=HomeScreen%2Fsrc2%2Fusermanagement.cpp;fp=HomeScreen%2Fsrc2%2Fusermanagement.cpp;h=bbbbac1c6733fd1c5faf8aeaf1b1ed68b968bf5e;hb=c5f5ce84f3991b02bdd9472d63b56fdbaf1a6c65;hp=0000000000000000000000000000000000000000;hpb=4f911d73e2a9a18c3d273b5deb3f1fc952ee68d2;p=staging%2FHomeScreen.git diff --git a/HomeScreen/src2/usermanagement.cpp b/HomeScreen/src2/usermanagement.cpp new file mode 100644 index 0000000..bbbbac1 --- /dev/null +++ b/HomeScreen/src2/usermanagement.cpp @@ -0,0 +1,34 @@ +#include "usermanagement.h" +#include +#include +UserManagement::UserManagement(QObject *home, QObject *shortcutArea, QObject *statusArea) : QObject() +{ + this->home = home; + this->appModel = home->findChild("ApplicationModel"); + this->shortcutArea = shortcutArea; + this->statusArea = statusArea; + this->currentLanguage = "en"; + connect(&timerTest, SIGNAL(timeout()), this, SLOT(slot_timerTest())); + timerTest.setSingleShot(false); + timerTest.start(5000); +} +void UserManagement::slot_timerTest() +{ + if(currentLanguage == "fr") + currentLanguage = "en"; + else + currentLanguage = "fr"; + appModel->changeLanguage(currentLanguage); + QMetaObject::invokeMethod(home, "languageChanged"); + QMetaObject::invokeMethod(shortcutArea, "languageChanged", Q_ARG(QVariant, currentLanguage)); + QMetaObject::invokeMethod(statusArea, "languageChanged", Q_ARG(QVariant, currentLanguage)); + if(currentLanguage == "fr") { + QLocale::setDefault(QLocale("fr_FR")); + QMetaObject::invokeMethod(home, "showSign90", Q_ARG(QVariant, true)); + QMetaObject::invokeMethod(home, "showHello", Q_ARG(QVariant, "Bonjour José!")); + } else { + QLocale::setDefault(QLocale("en_US")); + QMetaObject::invokeMethod(home, "showSign90", Q_ARG(QVariant, false)); + QMetaObject::invokeMethod(home, "showHello", Q_ARG(QVariant, "Hello José!")); + } +}