void CMakeGifDoc::handlePropertyChanged(const PropertyContainer *source, int id, const void *oldValue, const void *newValue) { if(source == &m_rawPrArray) { notifyPropertyChanged(RAW_IMAGE_LIST , oldValue, newValue); } else if(source == &m_scaledPrArray) { notifyPropertyChanged(SCALED_IMAGE_LIST , oldValue, newValue); } else if(source == &m_quantizedPrArray) { notifyPropertyChanged(QUANTIZED_IMAGE_LIST, oldValue, newValue); } }
// InfoPlugin Methods void MprisPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData ) { bool isPlayingInfo = false; switch ( pushData.type ) { case InfoNowPlaying: isPlayingInfo = true; audioStarted( pushData.infoPair.second ); break; case InfoNowPaused: isPlayingInfo = true; audioPaused(); break; case InfoNowResumed: isPlayingInfo = true; audioResumed( pushData.infoPair.second ); break; case InfoNowStopped: isPlayingInfo = true; audioStopped(); break; default: break; } if ( isPlayingInfo ) notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "PlaybackStatus" ); }
void CMakeGifDoc::setSaveTime(const Timestamp &t) { if(t != m_lastSave) { const Timestamp oldSave = m_lastSave; m_lastSave = t; notifyPropertyChanged(SAVE_TIME, &oldSave, &m_lastSave); } }
void CExpressionTreeDlg::setSelectedNode(const ExpressionNode *selectedNode) { // property const ExpressionNode *oldSelected = m_selectedNode; if(selectedNode != oldSelected) { m_selectedNode = (ExpressionNode*)selectedNode; notifyPropertyChanged(TREE_SELECTEDNODE, oldSelected, m_selectedNode); } }
static void testNotifierCallback(KplTimeCallback cb, const KplTime time, void *param) { UInt32 propertyID = (UInt32)param; KplTimeRecord when; notifyPropertyChanged(propertyID); KplTimeGetNow(&when); when.seconds += 1; KplTimeCallbackSet(gTimeCB, &when, testNotifierCallback, (void*)propertyID); }
/** Audio state slots */ void MprisPlugin::audioStarted( const QVariant& input ) { if ( !input.canConvert< QVariantMap >() ) return; QVariantMap map = input.toMap(); if ( !map.contains( "trackinfo" ) || !map[ "trackinfo" ].canConvert< Tomahawk::InfoSystem::InfoStringHash >() ) return; InfoStringHash hash = map[ "trackinfo" ].value< Tomahawk::InfoSystem::InfoStringHash >(); if ( !hash.contains( "title" ) || !hash.contains( "artist" ) || !hash.contains( "album" ) ) return; m_playbackStatus = "Playing"; if ( map.contains( "coveruri" ) ) m_coverTempFile = map[ "coveruri" ].toString(); notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "Metadata" ); }
void DBusGreeter::isActiveChangedHandler() { notifyPropertyChanged(QStringLiteral("IsActive"), isActive()); Q_EMIT isActiveChanged(); }
void MprisPlugin::onVolumeChanged( int volume ) { Q_UNUSED( volume ); notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "Volume" ); }
bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnection& connection) { /* Check to make sure we're getting properties on our interface */ if (message.type() != QDBusMessage::MessageType::MethodCallMessage) { return false; } /* Break down the path to just the app id */ bool validpath = true; QString pathtemp = message.path(); if (!pathtemp.startsWith(QLatin1String("/com/canonical/Unity/Launcher/"))) { validpath = false; } pathtemp.remove(QStringLiteral("/com/canonical/Unity/Launcher/")); if (pathtemp.indexOf('/') >= 0) { validpath = false; } /* Find ourselves an appid */ QString appid = decodeAppId(pathtemp); // First handle methods of the Launcher interface if (message.interface() == QLatin1String("com.canonical.Unity.Launcher")) { if (message.member() == QLatin1String("Refresh")) { QDBusMessage reply = message.createReply(); Q_EMIT refreshCalled(); return connection.send(reply); } } else if (message.interface() == QLatin1String("com.canonical.Unity.Launcher.Item")) { // Handle methods of the Launcher-Item interface if (message.member() == QLatin1String("Alert") && validpath) { QDBusMessage reply = message.createReply(); Q_EMIT alertCalled(appid); return connection.send(reply); } } // Now handle dynamic properties (for launcher emblems) if (message.interface() != QLatin1String("org.freedesktop.DBus.Properties")) { return false; } if (message.member() == QLatin1String("Get") && (message.arguments().count() != 2 || message.arguments()[0].toString() != QLatin1String("com.canonical.Unity.Launcher.Item"))) { return false; } if (message.member() == QLatin1String("Set") && (message.arguments().count() != 3 || message.arguments()[0].toString() != QLatin1String("com.canonical.Unity.Launcher.Item"))) { return false; } if (!validpath) { return false; } int index = m_launcherModel->findApplication(appid); LauncherItem *item = static_cast<LauncherItem*>(m_launcherModel->get(index)); QVariantList retval; if (message.member() == QLatin1String("Get")) { QString cachedString = message.arguments()[1].toString(); if (!item) { return false; } if (cachedString == QLatin1String("count")) { retval.append(QVariant::fromValue(QDBusVariant(item->count()))); } else if (cachedString == QLatin1String("countVisible")) { retval.append(QVariant::fromValue(QDBusVariant(item->countVisible()))); } else if (cachedString == QLatin1String("progress")) { retval.append(QVariant::fromValue(QDBusVariant(item->progress()))); } } else if (message.member() == QLatin1String("Set")) { QString cachedString = message.arguments()[1].toString(); if (cachedString == QLatin1String("count")) { int newCount = message.arguments()[2].value<QDBusVariant>().variant().toInt(); if (!item || newCount != item->count()) { Q_EMIT countChanged(appid, newCount); notifyPropertyChanged(QStringLiteral("com.canonical.Unity.Launcher.Item"), encodeAppId(appid), QStringLiteral("count"), QVariant(newCount)); } } else if (cachedString == QLatin1String("countVisible")) { bool newVisible = message.arguments()[2].value<QDBusVariant>().variant().toBool(); if (!item || newVisible != item->countVisible()) { Q_EMIT countVisibleChanged(appid, newVisible); notifyPropertyChanged(QStringLiteral("com.canonical.Unity.Launcher.Item"), encodeAppId(appid), QStringLiteral("countVisible"), newVisible); } } else if (cachedString == QLatin1String("progress")) { int newProgress = message.arguments()[2].value<QDBusVariant>().variant().toInt(); if (!item || newProgress != item->progress()) { Q_EMIT progressChanged(appid, newProgress); notifyPropertyChanged(QStringLiteral("com.canonical.Unity.Launcher.Item"), encodeAppId(appid), QStringLiteral("progress"), QVariant(newProgress)); } } } else if (message.member() == QLatin1String("GetAll")) { if (item) { QVariantMap all; all.insert(QStringLiteral("count"), item->count()); all.insert(QStringLiteral("countVisible"), item->countVisible()); all.insert(QStringLiteral("progress"), item->progress()); retval.append(all); } } else { return false; } QDBusMessage reply = message.createReply(retval); return connection.send(reply); }
void DBusGreeterList::promptlessChangedHandler() { notifyPropertyChanged(QStringLiteral("EntryIsLocked"), entryIsLocked()); Q_EMIT entryIsLockedChanged(); }
void DBusGreeterList::authenticationUserChangedHandler(const QString &user) { notifyPropertyChanged(QStringLiteral("ActiveEntry"), user); Q_EMIT EntrySelected(user); }
void CMakeGifDoc::updateTimestamp() { const Timestamp &oldUpdate = m_lastUpdate; m_lastUpdate = Timestamp(); notifyPropertyChanged(UPDATE_TIME, &oldUpdate, &m_lastUpdate); }
void PixRectArray::incrUpdateCount() { unsigned int oldCounter = m_updateCounter; m_updateCounter++; notifyPropertyChanged(UPDATECOUNTER, &oldCounter, &m_updateCounter); }