diff options
author | zheng_wenlong <wenlong_zheng@nexty-ele.com> | 2018-07-10 18:11:51 +0900 |
---|---|---|
committer | zheng_wenlong <wenlong_zheng@nexty-ele.com> | 2018-07-10 18:21:05 +0900 |
commit | 85392e71f90a0322fdc08359ef1d829cdcf67381 (patch) | |
tree | dfe40b0d945a671af3a9dd60b691cef6a664ad46 /sampleapptimedate/src | |
parent | 69be38c5d975c96eee7adab238ffd608b99d8514 (diff) |
Copy source code from homescreen-2017flounder_5.99.2flounder/5.99.25.99.2
We decide to use homescreen instead of homescreen-2017.
Copy the source code from homescreen-2017 and delete word "-2017".
Revision: b4db06287bc997ded71deab50ff0ff5889b09e1f
Bug-AGL: SPEC-1549
Change-Id: Id77226b7ce35bbc29c868281c37b76ea3f930ad5
Signed-off-by: zheng_wenlong <wenlong_zheng@nexty-ele.com>
Diffstat (limited to 'sampleapptimedate/src')
-rw-r--r-- | sampleapptimedate/src/main.cpp | 36 | ||||
-rw-r--r-- | sampleapptimedate/src/timedateprovider.cpp | 76 | ||||
-rw-r--r-- | sampleapptimedate/src/timedateprovider.hpp | 27 |
3 files changed, 0 insertions, 139 deletions
diff --git a/sampleapptimedate/src/main.cpp b/sampleapptimedate/src/main.cpp deleted file mode 100644 index 5140b48..0000000 --- a/sampleapptimedate/src/main.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include <QCoreApplication> -#include <QCommandLineParser> -#include "timedateprovider.hpp" - -void noOutput(QtMsgType, const QMessageLogContext &, const QString &) -{ -} - -int main(int argc, char *argv[]) -{ - QCoreApplication a(argc, argv); - - QCoreApplication::setOrganizationDomain("LinuxFoundation"); - QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); - QCoreApplication::setApplicationName("SampleAppTimeDate"); - QCoreApplication::setApplicationVersion("0.7.0"); - - QCommandLineParser parser; - parser.setApplicationDescription("AGL Sample app for StatusBar interface - see wwww... for more details"); - parser.addHelpOption(); - parser.addVersionOption(); - QCommandLineOption quietOption(QStringList() << "q" << "quiet", - QCoreApplication::translate("main", "Be quiet. No outputs.")); - parser.addOption(quietOption); - parser.process(a); - - if (parser.isSet(quietOption)) - { - qInstallMessageHandler(noOutput); - } - - TimeDateProvider *tdp = new TimeDateProvider(); - tdp->start(); - - return a.exec(); -} diff --git a/sampleapptimedate/src/timedateprovider.cpp b/sampleapptimedate/src/timedateprovider.cpp deleted file mode 100644 index 2511432..0000000 --- a/sampleapptimedate/src/timedateprovider.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "timedateprovider.hpp" -#include <QTimerEvent> - -TimeDateProvider::TimeDateProvider(QObject *parent) : - QObject(parent), - m_secondsTimerId(-1), - mp_dBusStatusBarProxy(0), - m_statusBarPlaceholder(-1) -{ - qDebug("D-Bus: register as org.agl.SampleAppTimeDate"); - // dbus setup - QDBusConnection dbus = QDBusConnection::sessionBus(); - - dbus.registerObject("/", this); - dbus.registerService("org.agl.sampleapptimedate"); - - - qDebug("D-Bus: connect to org.agl.homescreen /StatusBar"); - mp_dBusStatusBarProxy = new org::agl::statusbar("org.agl.homescreen", - "/StatusBar", - QDBusConnection::sessionBus(), - 0); -} - -TimeDateProvider::~TimeDateProvider() -{ - stop(); - - if (0 != mp_dBusStatusBarProxy) - { - mp_dBusStatusBarProxy->setStatusText(1, ""); - delete mp_dBusStatusBarProxy; - } -} - -void TimeDateProvider::start() -{ - qDebug("trying to start timer (if this lasts long, maybe the Home Screen Application is not launched."); - if ((-1 == m_statusBarPlaceholder) && (0 != mp_dBusStatusBarProxy)) - { - QList<int> availablePlaceholder = mp_dBusStatusBarProxy->getAvailablePlaceholders(); - if (availablePlaceholder.size() > 0) - { - // just take the first available placeholder - m_statusBarPlaceholder = availablePlaceholder[0]; - qDebug("- using statusbar placeholder %d", m_statusBarPlaceholder); - - qDebug("- timer started"); - // callback every second - m_secondsTimerId = startTimer(1000); - } - } -} - -void TimeDateProvider::stop() -{ - if (-1 != m_secondsTimerId) - { - killTimer(m_secondsTimerId); - m_secondsTimerId = -1; - m_statusBarPlaceholder = -1; - } -} - -void TimeDateProvider::timerEvent(QTimerEvent *e) -{ - if (e->timerId() == m_secondsTimerId) - { - if (0 != mp_dBusStatusBarProxy) - { - QString toDisplay = QDateTime::currentDateTime().toString("hh:mm"); - qDebug("%s", toDisplay.toStdString().c_str()); - mp_dBusStatusBarProxy->setStatusText(m_statusBarPlaceholder, toDisplay); - } - } -} diff --git a/sampleapptimedate/src/timedateprovider.hpp b/sampleapptimedate/src/timedateprovider.hpp deleted file mode 100644 index 5ff663f..0000000 --- a/sampleapptimedate/src/timedateprovider.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef TIMEDATEPROVIDER_HPP -#define TIMEDATEPROVIDER_HPP - -#include <QObject> -#include "statusbar_proxy.h" - -class TimeDateProvider : public QObject -{ - Q_OBJECT -public: - explicit TimeDateProvider(QObject *parent = 0); - ~TimeDateProvider(); - void start(); - void stop(); -protected: - void timerEvent(QTimerEvent *e); -private: - int m_secondsTimerId; - org::agl::statusbar *mp_dBusStatusBarProxy; - int m_statusBarPlaceholder; -signals: - -public slots: - -}; - -#endif // TIMEDATEPROVIDER_HPP |