本文整理汇总了C++中QDBusMessage::path方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusMessage::path方法的具体用法?C++ QDBusMessage::path怎么用?C++ QDBusMessage::path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusMessage
的用法示例。
在下文中一共展示了QDBusMessage::path方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotPropertiesChanged
void QNmDBusHelper::slotPropertiesChanged(QMap<QString,QVariant> map)
{
QDBusMessage msg = this->message();
QMapIterator<QString, QVariant> i(map);
while (i.hasNext()) {
i.next();
if( i.key() == "State") { //state only applies to device interfaces
quint32 state = i.value().toUInt();
if( state == NM_DEVICE_STATE_ACTIVATED
|| state == NM_DEVICE_STATE_DISCONNECTED
|| state == NM_DEVICE_STATE_UNAVAILABLE
|| state == NM_DEVICE_STATE_FAILED) {
emit pathForPropertiesChanged( msg.path(), map);
}
} else if( i.key() == "ActiveAccessPoint") {
emit pathForPropertiesChanged(msg.path(), map);
// qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().value<QDBusObjectPath>().path();
// } else if( i.key() == "Strength")
// qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().toUInt();
// else
// qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value();
} else if (i.key() == "ActiveConnections") {
emit pathForPropertiesChanged(msg.path(), map);
}
}
}
示例2: slotAccessPointRemoved
void QNmDBusHelper::slotAccessPointRemoved(QDBusObjectPath path)
{
if(path.path().length() > 2) {
QDBusMessage msg = this->message();
emit pathForAccessPointRemoved(msg.path(), path);
}
}
示例3: interfaceNotFoundError
static inline QDBusMessage interfaceNotFoundError(const QDBusMessage &msg, const QString &interface_name)
{
return msg.createErrorReply(QDBusError::UnknownInterface,
QString::fromLatin1("Interface %1 was not found in object %2")
.arg(interface_name)
.arg(msg.path()));
}
示例4: slotPropertiesChanged
void QNmDBusHelper::slotPropertiesChanged(QMap<QString,QVariant> map)
{
QDBusMessage msg = this->message();
QMapIterator<QString, QVariant> i(map);
while (i.hasNext()) {
i.next();
if( i.key() == "State") { //state only applies to device interfaces
quint32 state = i.value().toUInt();
if( state == NM_DEVICE_STATE_ACTIVATED
|| state == NM_DEVICE_STATE_DISCONNECTED
|| state == NM_DEVICE_STATE_UNAVAILABLE
|| state == NM_DEVICE_STATE_FAILED) {
emit pathForPropertiesChanged( msg.path(), map);
}
}
}
emit pathForPropertiesChanged( msg.path(), map);
}
示例5: asyncCall
QDBusPendingCall QDBusConnection::asyncCall(const QDBusMessage &message, int) const
{
qDBusConnectionAsyncCallService = message.service();
qDBusConnectionAsyncCallPath = message.path();
qDBusConnectionAsyncCallInterface = message.interface();
qDBusConnectionAsyncCallMember = message.member();
qDBusConnectionAsyncCallArguments = message.arguments();
return QDBusPendingCall::fromCompletedCall(QDBusMessage());
}
示例6: deviceStateChanged
void QNmDBusHelper::deviceStateChanged(quint32 state)
{
QDBusMessage msg = this->message();
if(state == NM_DEVICE_STATE_ACTIVATED
|| state == NM_DEVICE_STATE_DISCONNECTED
|| state == NM_DEVICE_STATE_UNAVAILABLE
|| state == NM_DEVICE_STATE_FAILED) {
emit pathForStateChanged(msg.path(), state);
}
}
示例7:
static inline QDBusMessage
propertyNotFoundError(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name)
{
return msg.createErrorReply(QDBusError::UnknownProperty,
QString::fromLatin1("Property %1%2%3 was not found in object %4")
.arg(interface_name,
QString::fromLatin1(interface_name.isEmpty() ? "" : "."),
QString::fromLatin1(property_name),
msg.path()));
}
示例8: dumpMessage
void QDBusViewer::dumpMessage(const QDBusMessage &message)
{
QList<QVariant> args = message.arguments();
QString out = QLatin1String("Received ");
switch (message.type()) {
case QDBusMessage::SignalMessage:
out += QLatin1String("signal ");
break;
case QDBusMessage::ErrorMessage:
out += QLatin1String("error message ");
break;
case QDBusMessage::ReplyMessage:
out += QLatin1String("reply ");
break;
default:
out += QLatin1String("message ");
break;
}
out += QLatin1String("from ");
out += message.service();
if (!message.path().isEmpty())
out += QLatin1String(", path ") + message.path();
if (!message.interface().isEmpty())
out += QLatin1String(", interface <i>") + message.interface() + QLatin1String("</i>");
if (!message.member().isEmpty())
out += QLatin1String(", member ") + message.member();
out += QLatin1String("<br>");
if (args.isEmpty()) {
out += QLatin1String(" (no arguments)");
} else {
out += QLatin1String(" Arguments: ");
foreach (QVariant arg, args) {
QString str = Qt::escape(QDBusUtil::argumentToString(arg));
// turn object paths into clickable links
str.replace(objectPathRegExp, QLatin1String("[ObjectPath: <a href=\"qdbus://bus\\1\">\\1</a>]"));
out += str;
out += QLatin1String(", ");
}
out.chop(2);
}
示例9: debugVariantList
QDebug operator<<(QDebug dbg, const QDBusMessage &msg)
{
dbg.nospace() << "QDBusMessage(type=" << msg.type()
<< ", service=" << msg.service();
if (msg.type() == QDBusMessage::MethodCallMessage ||
msg.type() == QDBusMessage::SignalMessage)
dbg.nospace() << ", path=" << msg.path()
<< ", interface=" << msg.interface()
<< ", member=" << msg.member();
if (msg.type() == QDBusMessage::ErrorMessage)
dbg.nospace() << ", error name=" << msg.errorName()
<< ", error message=" << msg.errorMessage();
dbg.nospace() << ", signature=" << msg.signature()
<< ", contents=(";
debugVariantList(dbg, msg.arguments());
dbg.nospace() << ") )";
return dbg.space();
}
示例10: onHeadsetButtonPressed
void MissionControl::onHeadsetButtonPressed(QDBusMessage msg)
{
if (msg.arguments()[0] == "ButtonPressed") {
if (msg.arguments()[1] == "play-cd" || msg.arguments()[1] == "pause-cd")
togglePlayback();
else if (msg.arguments()[1] == "stop-cd")
mafwRenderer->stop();
else if (msg.arguments()[1] == "next-song")
mafwRenderer->next();
else if (msg.arguments()[1] == "previous-song")
mafwRenderer->previous();
else if (msg.arguments()[1] == "fast-forward")
mafwRenderer->setPosition(SeekRelative, 3);
else if (msg.arguments()[1] == "rewind")
mafwRenderer->setPosition(SeekRelative, -3);
else if (msg.arguments()[1] == "phone")
handlePhoneButton();
else if (msg.arguments()[1] == "jack_insert" && msg.path() == HAL_PATH_RX51_JACK) // wired headset was connected or disconnected
updateWiredHeadset();
}
}
示例11: messageToScriptValue
static QScriptValue messageToScriptValue(QScriptEngine *engine, const QDBusMessage &message)
{
QScriptValue v = engine->newVariant(QVariant::fromValue(message));
v.setProperty(QLatin1String("service"), QScriptValue(engine, message.service()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("path"), QScriptValue(engine, message.path()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("interface"), QScriptValue(engine, message.interface()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("member"), QScriptValue(engine, message.member()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("type"), QScriptValue(engine, message.type()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("signature"), QScriptValue(engine, message.signature()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("isReplyRequired"), QScriptValue(engine, message.isReplyRequired()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("delayedReply"), QScriptValue(engine, message.isDelayedReply()));
QScriptValue argValue = engine->newArray();
const QList<QVariant> args = message.arguments();
for (int i = 0; i < args.count(); ++i)
argValue.setProperty(QScriptValue(engine, i).toString(),
engine->newVariant(args.at(i)));
v.setProperty(QLatin1String("arguments"), argValue);
return v;
}
示例12: slotSettingsRemoved
void QNmDBusHelper::slotSettingsRemoved()
{
QDBusMessage msg = this->message();
emit pathForSettingsRemoved(msg.path());
}
示例13: dumpPropertyMessage
void SHALDeviceNotifier::dumpPropertyMessage( const QDBusMessage & dmsg )
{
if( dmsg.type() == QDBusMessage::SignalMessage )
this->detect( dmsg.path() );
}
示例14: handleMessage
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 {
//.........这里部分代码省略.........
示例15: propertyChanged
void QSystemInfoDBusHelper::propertyChanged(const QString &item, const QDBusVariant &var)
{
QDBusMessage msg = this->message();
Q_EMIT propertyChangedContext(msg.path() ,item, var);
}