Commit abfd1631 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(src/components/core/CoreHandlers): remove useless define `VERSION_UPDATE_CHECK_OBJECT_NAME`

parent 543542bc
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "config.h" #include "config.h"
#define VERSION_UPDATE_CHECK_OBJECT_NAME "version-update-check-timer" #define VERSION_UPDATE_CHECK_OBJECT_NAME "version-update-check-timer"
#define VERSION_UPDATE_CHECK_INTERVAL 86400000 /* 24 hours in milliseconds */ #define VERSION_UPDATE_CHECK_INTERVAL 86400000 /* 24 hours in milliseconds. */
using namespace std; using namespace std;
...@@ -89,16 +89,16 @@ void CoreHandlers::notifyCoreStarted () { ...@@ -89,16 +89,16 @@ void CoreHandlers::notifyCoreStarted () {
qInfo() << QStringLiteral("Core started."); qInfo() << QStringLiteral("Core started.");
emit coreStarted(); emit coreStarted();
#ifdef ENABLE_UPDATE_CHECK #ifdef ENABLE_UPDATE_CHECK
QTimer *timer = new QTimer(this); QTimer *timer = new QTimer(this);
timer->setInterval(VERSION_UPDATE_CHECK_INTERVAL); timer->setInterval(VERSION_UPDATE_CHECK_INTERVAL);
timer->setObjectName(VERSION_UPDATE_CHECK_OBJECT_NAME);
QObject::connect(timer, &QTimer::timeout, this, &App::checkForUpdate); QObject::connect(timer, &QTimer::timeout, this, &App::checkForUpdate);
timer->start(); timer->start();
App::checkForUpdate();
#endif App::checkForUpdate();
} #endif // ifdef ENABLE_UPDATE_CHECK
); });
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -238,7 +238,6 @@ void CoreHandlers::onVersionUpdateCheckResultReceived ( ...@@ -238,7 +238,6 @@ void CoreHandlers::onVersionUpdateCheckResultReceived (
const string &version, const string &version,
const string &url const string &url
) { ) {
if (result == linphone::VersionUpdateCheckResultNewVersionAvailable) { if (result == linphone::VersionUpdateCheckResultNewVersionAvailable)
App::getInstance()->getNotifier()->notifyNewVersionAvailable(version, url); App::getInstance()->getNotifier()->notifyNewVersionAvailable(version, url);
} }
}
\ No newline at end of file
...@@ -118,7 +118,7 @@ private: ...@@ -118,7 +118,7 @@ private:
void onVersionUpdateCheckResultReceived ( void onVersionUpdateCheckResultReceived (
const std::shared_ptr<linphone::Core> &, const std::shared_ptr<linphone::Core> &,
linphone::VersionUpdateCheckResult result, linphone::VersionUpdateCheckResult result,
const std::string &version, const std::string &version,
const std::string &url const std::string &url
) override; ) override;
......
...@@ -184,11 +184,9 @@ void Notifier::showNotification (QObject *notification, int timeout) { ...@@ -184,11 +184,9 @@ void Notifier::showNotification (QObject *notification, int timeout) {
notification->setProperty(NOTIFICATION_PROPERTY_TIMER, QVariant::fromValue(timer)); notification->setProperty(NOTIFICATION_PROPERTY_TIMER, QVariant::fromValue(timer));
// Destroy it after timeout. // Destroy it after timeout.
QObject::connect( QObject::connect(timer, &QTimer::timeout, this, [this, notification]() {
timer, &QTimer::timeout, this, [this, notification]() {
deleteNotification(QVariant::fromValue(notification)); deleteNotification(QVariant::fromValue(notification));
} });
);
// Called explicitly (by a click on notification for example) // Called explicitly (by a click on notification for example)
QObject::connect(notification, SIGNAL(deleteNotification(QVariant)), this, SLOT(deleteNotification(QVariant))); QObject::connect(notification, SIGNAL(deleteNotification(QVariant)), this, SLOT(deleteNotification(QVariant)));
...@@ -261,12 +259,10 @@ void Notifier::notifyReceivedCall (const shared_ptr<linphone::Call> &call) { ...@@ -261,12 +259,10 @@ void Notifier::notifyReceivedCall (const shared_ptr<linphone::Call> &call) {
CallModel *callModel = &call->getData<CallModel>("call-model"); CallModel *callModel = &call->getData<CallModel>("call-model");
QObject::connect( QObject::connect(callModel, &CallModel::statusChanged, notification, [this, notification](CallModel::CallStatus status) {
callModel, &CallModel::statusChanged, notification, [this, notification](CallModel::CallStatus status) {
if (status == CallModel::CallStatusEnded || status == CallModel::CallStatusConnected) if (status == CallModel::CallStatusEnded || status == CallModel::CallStatusConnected)
deleteNotification(QVariant::fromValue(notification)); deleteNotification(QVariant::fromValue(notification));
} });
);
QVariantMap map; QVariantMap map;
map["call"].setValue(callModel); map["call"].setValue(callModel);
...@@ -275,7 +271,7 @@ void Notifier::notifyReceivedCall (const shared_ptr<linphone::Call> &call) { ...@@ -275,7 +271,7 @@ void Notifier::notifyReceivedCall (const shared_ptr<linphone::Call> &call) {
showNotification(notification, NOTIFICATION_TIMEOUT_RECEIVED_CALL); showNotification(notification, NOTIFICATION_TIMEOUT_RECEIVED_CALL);
} }
void Notifier::notifyNewVersionAvailable (const std::string &version, const std::string &url) { void Notifier::notifyNewVersionAvailable (const string &version, const string &url) {
QObject *notification = createNotification(Notifier::NewVersionAvailable); QObject *notification = createNotification(Notifier::NewVersionAvailable);
if (!notification) if (!notification)
return; return;
...@@ -286,4 +282,4 @@ void Notifier::notifyNewVersionAvailable (const std::string &version, const std: ...@@ -286,4 +282,4 @@ void Notifier::notifyNewVersionAvailable (const std::string &version, const std:
::setProperty(*notification, NOTIFICATION_PROPERTY_DATA, map); ::setProperty(*notification, NOTIFICATION_PROPERTY_DATA, map);
showNotification(notification, NOTIFICATION_TIMEOUT_NEW_VERSION_AVAILABLE); showNotification(notification, NOTIFICATION_TIMEOUT_NEW_VERSION_AVAILABLE);
} }
\ No newline at end of file
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