From 10a8d5ac7325666b3a9a72f7882fedcb4d49f38c Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Thu, 15 Oct 2015 14:23:15 +0300 Subject: [PATCH] Emit profile change signal directly on setter --- src/profilecontrol.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/profilecontrol.cpp b/src/profilecontrol.cpp index facec9a..90a65f0 100644 --- a/src/profilecontrol.cpp +++ b/src/profilecontrol.cpp @@ -120,6 +120,7 @@ void ProfileControl::setProfile(const QString &profile) { if (profile != m_profile) { m_profile = profile; + emit profileChanged(profile); profile_set_profile(profile.toUtf8().constData()); } } @@ -523,8 +524,10 @@ void ProfileControl::setClockAlarmToneEnabled(bool enabled) void ProfileControl::currentProfileChangedCallback(const char *name, ProfileControl *profileControl) { QString newProfile = QString::fromUtf8(name); - profileControl->m_profile = newProfile; - emit profileControl->profileChanged(newProfile); + if (profileControl->m_profile != newProfile) { + profileControl->m_profile = newProfile; + emit profileControl->profileChanged(newProfile); + } } void ProfileControl::updateStateCallBack(const char *profile, const char *key, const char *val, const char *type)