Index: sources/maintimer.cpp =================================================================== diff -u -rde2f87e15fa05b1c45581cfedd8f1af0c47c2b48 -r56d00a82669a7a2c00ab90109a89dbec8db27527 --- sources/maintimer.cpp (.../maintimer.cpp) (revision de2f87e15fa05b1c45581cfedd8f1af0c47c2b48) +++ sources/maintimer.cpp (.../maintimer.cpp) (revision 56d00a82669a7a2c00ab90109a89dbec8db27527) @@ -1,6 +1,6 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2019-2019 Diality Inc. - All Rights Reserved. * \copyright \n * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n * IN PART OR IN WHOLE, \n @@ -14,38 +14,42 @@ #include "maintimer.h" //Qt -#include //Project +#include "logger.h" -// Singleton -SINGLETON_INIT(MainTimer) - /*! * \brief MainTimer Constructor * \param parent */ -MainTimer::MainTimer(QObject *parent) : QObject(parent) -{ - _timer = new QTimer(this); -} +MainTimer::MainTimer(QObject *parent) : QObject(parent) { } -void MainTimer::init() +/*! + * \brief MainTimer::init + * \details starts the timer ans sets the timer interval + * \return + */ +bool MainTimer::init() { - connect(_timer, SIGNAL(timeout()), this, SLOT(onTimeout())); - connect(_timer, SIGNAL(timeout()), this, SIGNAL(timeout())); - _timer->start(_timeout); + startTimer(_interval); + LOG_EVENT(QObject::tr("Main Timer Initialized")); + return true; } -void MainTimer::quit() -{ - _timer->stop(); - delete _timer; - _timer = nullptr; -} +/*! + * \brief MainTimer::quit + * \details Does nothing for now + */ +void MainTimer::quit() { } -void MainTimer::onTimeout() +/*! + * \brief MainTimer::timerEvent + * \details This event handler has been re-implemented in here + * to receive timer events for the object + * for the timer which has been set to _checkInterval + * Emits the didTimeout signal on each interval. + */ +void MainTimer::timerEvent(QTimerEvent *) { - // no op yet + emit didTimeout(); } -