bbbbac1c6733fd1c5faf8aeaf1b1ed68b968bf5e
[staging/HomeScreen.git] / HomeScreen / src2 / usermanagement.cpp
1 #include "usermanagement.h"
2 #include <QApplication>
3 #include <QDebug>
4 UserManagement::UserManagement(QObject *home, QObject *shortcutArea, QObject *statusArea) : QObject()
5 {
6     this->home = home;
7     this->appModel = home->findChild<ApplicationModel *>("ApplicationModel");
8     this->shortcutArea = shortcutArea;
9     this->statusArea = statusArea;
10     this->currentLanguage = "en";
11     connect(&timerTest, SIGNAL(timeout()), this, SLOT(slot_timerTest()));
12     timerTest.setSingleShot(false);
13     timerTest.start(5000);
14 }
15 void UserManagement::slot_timerTest()
16 {
17     if(currentLanguage == "fr")
18         currentLanguage = "en";
19     else
20         currentLanguage = "fr";
21     appModel->changeLanguage(currentLanguage);
22     QMetaObject::invokeMethod(home, "languageChanged");
23     QMetaObject::invokeMethod(shortcutArea, "languageChanged", Q_ARG(QVariant, currentLanguage));
24     QMetaObject::invokeMethod(statusArea, "languageChanged", Q_ARG(QVariant, currentLanguage));
25     if(currentLanguage == "fr") {
26         QLocale::setDefault(QLocale("fr_FR"));
27         QMetaObject::invokeMethod(home, "showSign90", Q_ARG(QVariant, true));
28         QMetaObject::invokeMethod(home, "showHello", Q_ARG(QVariant, "Bonjour José!"));
29     } else {
30         QLocale::setDefault(QLocale("en_US"));
31         QMetaObject::invokeMethod(home, "showSign90", Q_ARG(QVariant, false));
32         QMetaObject::invokeMethod(home, "showHello", Q_ARG(QVariant, "Hello José!"));
33     }
34 }