on xenial help sign in
Make sure the alerting-wiggle gets correctly triggered by changes to count and countVisible at runtime.
commitccb786e70d033a4c7e73172584774dfe233ac812 authorMirco Müller <mirco.mueller@ubuntu.com> dateWed 8 Jul 2015, 17:37 (11 years ago) parent39a2c4a
3 files changed+16
plugins/Unity/Launcher/dbusinterface.cpp+9 plugins/Unity/Launcher/dbusinterface.h+1 qml/Launcher/LauncherDelegate.qml+6
plugins/Unity/Launcher/dbusinterface.cpp+9
@@ -66,6 +66,7 @@ QString DBusInterface::introspect(const QString &path) const
6666 "<interface name=\"com.canonical.Unity.Launcher.Item\">"
6767 "<property name=\"count\" type=\"i\" access=\"readwrite\" />"
6868 "<property name=\"countVisible\" type=\"b\" access=\"readwrite\" />"
69+ "<property name=\"alerting\" type=\"b\" access=\"readwrite\" />"
6970 "</interface>";
7071 return nodeiface;
7172}
@@ -168,6 +169,8 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
168169 retval.append(QVariant::fromValue(QDBusVariant(item->count())));
169170 } else if (message.arguments()[1].toString() == "countVisible") {
170171 retval.append(QVariant::fromValue(QDBusVariant(item->countVisible())));
172+ } else if (message.arguments()[1].toString() == "alerting") {
173+ retval.append(QVariant::fromValue(QDBusVariant(item->alerting())));
171174 }
172175 } else if (message.member() == "Set") {
173176 if (message.arguments()[1].toString() == "count") {
@@ -182,6 +185,12 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
182185 Q_EMIT countVisibleChanged(appid, newVisible);
183186 notifyPropertyChanged("com.canonical.Unity.Launcher.Item", encodeAppId(appid), "countVisible", newVisible);
184187 }
188+ } else if (message.arguments()[1].toString() == "alerting") {
189+ bool newAlerting = message.arguments()[2].value<QDBusVariant>().variant().toBool();
190+ if (!item || newAlerting != item->alerting()) {
191+ Q_EMIT alertingChanged(appid, newAlerting);
192+ notifyPropertyChanged("com.canonical.Unity.Launcher.Item", encodeAppId(appid), "alerting", newAlerting);
193+ }
185194 }
186195 } else if (message.member() == "GetAll") {
187196 if (item) {
plugins/Unity/Launcher/dbusinterface.h+1
@@ -36,6 +36,7 @@ public:
3636Q_SIGNALS:
3737 void countChanged(const QString &appId, int count);
3838 void countVisibleChanged(const QString &appId, bool countVisible);
39+ void alertingChanged(const QString &appId, bool alerting);
3940 void refreshCalled();
4041
4142private:
qml/Launcher/LauncherDelegate.qml+6
@@ -181,6 +181,12 @@ Item {
181181 duration: privWiggleAnim.duration
182182 easing.type: Easing.OutQuad
183183 }
184+
185+ UbuntuNumberAnimation {
186+ target: privWiggleAnim.target
187+ property: "alerting"
188+ to: 0
189+ }
184190 }
185191
186192 Item {