当前位置: 首页>>代码示例>>C++>>正文


C++ QDBusPendingReply::value方法代码示例

本文整理汇总了C++中QDBusPendingReply::value方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusPendingReply::value方法的具体用法?C++ QDBusPendingReply::value怎么用?C++ QDBusPendingReply::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDBusPendingReply的用法示例。


在下文中一共展示了QDBusPendingReply::value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: findEventsTest

void LogTest::findEventsTest()
{
    QZeitgeist::DataModel::Event event;
    QZeitgeist::DataModel::EventList events;

    // Set the template to search for.
    event.setActor("app://firefox.desktop");
    event.setSubjects(QZeitgeist::DataModel::SubjectList());

    // Add to the event list.
    events << event;

    // Query for all events since Epoch.
    QZeitgeist::DataModel::TimeRange timeRange =
        QZeitgeist::DataModel::TimeRange::timeRangeToNow();

    // Search on Zeitgeist.
    QDBusPendingReply<QZeitgeist::DataModel::EventList> reply =
        m_log->findEvents(timeRange, events,
                QZeitgeist::Log::Any, 10,
                QZeitgeist::Log::MostRecentEvents);

    // Block and wait for reply.
    reply.waitForFinished();

    // Check if the return is valid.
    QVERIFY (reply.isValid() == true);

    // Check if the return is not empty
    QVERIFY (reply.value().size() > 0);

    // Check if the id is 0;
    for (uint i = 0; i < reply.value().size(); ++i)
        QVERIFY(reply.value()[i].id() != 0);
}
开发者ID:KDE,项目名称:libqzeitgeist,代码行数:35,代码来源:test-log.cpp

示例2: request

int QOfonoLocationReporting::request()
{
    if (d_ptr->ofonoLocationReporting) {
        QDBusPendingReply<QDBusUnixFileDescriptor> reply = d_ptr->ofonoLocationReporting->Request();
        if (!reply.isError() && reply.value().isValid()) {
            return dup(reply.value().fileDescriptor()); //pass on fd
        } else {
            qDebug() << Q_FUNC_INFO << reply.error().message();
        }
    }
    return 0;
}
开发者ID:SamuelNevala,项目名称:libqofono,代码行数:12,代码来源:qofonolocationreporting.cpp

示例3: findAdapterForAddress

void QBluetoothDeviceDiscoveryAgentPrivate::startBluez5()
{
    Q_Q(QBluetoothDeviceDiscoveryAgent);


    bool ok = false;
    const QString adapterPath = findAdapterForAddress(m_adapterAddress, &ok);
    if (!ok || adapterPath.isEmpty()) {
        qCWarning(QT_BT_BLUEZ) << "Cannot find Bluez 5 adapter for device search" << ok;
        lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
        errorString = QBluetoothDeviceDiscoveryAgent::tr("Cannot find valid Bluetooth adapter.");
        q->error(lastError);
        return;
    }

    adapterBluez5 = new OrgBluezAdapter1Interface(QStringLiteral("org.bluez"),
                                                  adapterPath,
                                                  QDBusConnection::systemBus());

    if (!adapterBluez5->powered()) {
        qCDebug(QT_BT_BLUEZ) << "Aborting device discovery due to offline Bluetooth Adapter";
        lastError = QBluetoothDeviceDiscoveryAgent::PoweredOffError;
        errorString = QBluetoothDeviceDiscoveryAgent::tr("Device is powered off");
        delete adapterBluez5;
        adapterBluez5 = 0;
        emit q->error(lastError);
        return;
    }


    QtBluezDiscoveryManager::instance()->registerDiscoveryInterest(adapterBluez5->path());
    QObject::connect(QtBluezDiscoveryManager::instance(), SIGNAL(discoveryInterrupted(QString)),
            q, SLOT(_q_discoveryInterrupted(QString)));

    // collect initial set of information
    QDBusPendingReply<ManagedObjectList> reply = managerBluez5->GetManagedObjects();
    reply.waitForFinished();
    if (!reply.isError()) {
        foreach (const QDBusObjectPath &path, reply.value().keys()) {
            const InterfaceList ifaceList = reply.value().value(path);
            foreach (const QString &iface, ifaceList.keys()) {
                if (iface == QStringLiteral("org.bluez.Device1")) {

                    if (path.path().indexOf(adapterBluez5->path()) != 0)
                        continue; //devices whose path doesn't start with same path we skip

                    deviceFoundBluez5(path.path());
                }
            }
        }
    }
开发者ID:RobinWuDev,项目名称:Qt,代码行数:51,代码来源:qbluetoothdevicediscoveryagent_bluez.cpp

示例4: peerName

QString QBluetoothSocketPrivate::peerName() const
{
    quint64 bdaddr;

    if (socketType == QBluetoothServiceInfo::RfcommProtocol) {
        sockaddr_rc addr;
        socklen_t addrLength = sizeof(addr);

        if (::getpeername(socket, reinterpret_cast<sockaddr *>(&addr), &addrLength) < 0)
            return QString();

        convertAddress(addr.rc_bdaddr.b, bdaddr);
    } else if (socketType == QBluetoothServiceInfo::L2capProtocol) {
        sockaddr_l2 addr;
        socklen_t addrLength = sizeof(addr);

        if (::getpeername(socket, reinterpret_cast<sockaddr *>(&addr), &addrLength) < 0)
            return QString();

        convertAddress(addr.l2_bdaddr.b, bdaddr);
    } else {
        qCWarning(QT_BT_BLUEZ) << "peerName() called on socket of unknown type";
        return QString();
    }

    const QString peerAddress = QBluetoothAddress(bdaddr).toString();
    const QString localAdapter = localAddress().toString();

    if (isBluez5()) {
        OrgFreedesktopDBusObjectManagerInterface manager(QStringLiteral("org.bluez"),
                                                         QStringLiteral("/"),
                                                         QDBusConnection::systemBus());
        QDBusPendingReply<ManagedObjectList> reply = manager.GetManagedObjects();
        reply.waitForFinished();
        if (reply.isError())
            return QString();

        foreach (const QDBusObjectPath &path, reply.value().keys()) {
            const InterfaceList ifaceList = reply.value().value(path);
            foreach (const QString &iface, ifaceList.keys()) {
                if (iface == QStringLiteral("org.bluez.Device1")) {
                    if (ifaceList.value(iface).value(QStringLiteral("Address")).toString()
                            == peerAddress)
                        return ifaceList.value(iface).value(QStringLiteral("Alias")).toString();
                }
            }
        }
        return QString();
    } else {
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:49,代码来源:qbluetoothsocket_bluez.cpp

示例5: image

void  SnorePlugin::Freedesktop::slotNotify(Snore::Notification noti)
{
    if (noti.data()->sourceAndTargetAreSimilar(this)) {
        return;
    }

    QStringList actions;
    foreach(int k, noti.actions().keys()) {
        actions << QString::number(k) << noti.actions()[k].name();
    }
    QVariantMap hints;

    FreedesktopImageHint image(noti.icon().pixmap(QSize(128, 128)).toImage());
    hints.insert(QStringLiteral("image_data"), QVariant::fromValue(image));

    char urgency = 1;
    if (noti.priority() < 0) {
        urgency = 0;
    } else if (noti.priority() > 2) {
        urgency = 2;
    }
    hints.insert(QStringLiteral("urgency"), urgency);

    if (noti.application().constHints().contains("desktop-entry")) {
        hints.insert(QStringLiteral("desktop-entry"), noti.application().constHints().value("desktop-entry"));
    }

    hints.insert(QStringLiteral("suppress-sound"), noti.constHints().value("silent").toBool());

    uint updateId = 0;
    if (noti.isUpdate()) {
        updateId = noti.old().hints().privateValue(this, "id").toUInt();
        m_dbusIdMap.take(updateId);
    }

    QString title = noti.application().name() + QLatin1String(" - ") + noti.title(m_supportsRichtext ? Snore::Utils::AllMarkup : Snore::Utils::NoMarkup);
    QString body(noti.text(m_supportsRichtext ? Snore::Utils::AllMarkup : Snore::Utils::NoMarkup));
    //TODO: add app icon hint?
    QDBusPendingReply<uint>  id = m_interface->Notify(noti.application().name(), updateId, QString(), title,
                                  body, actions, hints, noti.isSticky() ? -1 : noti.timeout() * 1000);

    id.waitForFinished();
    noti.hints().setPrivateValue(this, "id", id.value());
    m_dbusIdMap[id.value()] = noti;
    slotNotificationDisplayed(noti);

    qCDebug(SNORE) << noti.id() << "|" << id.value();
}
开发者ID:KDE,项目名称:snorenotify,代码行数:48,代码来源:freedesktopnotification_backend.cpp

示例6: initializeAdapter

void QBluetoothLocalDevicePrivate::initializeAdapter()
{
    if (adapter)
        return;

    OrgBluezManagerInterface manager(QLatin1String("org.bluez"), QLatin1String("/"), QDBusConnection::systemBus());

    if (localAddress == QBluetoothAddress()) {
        QDBusPendingReply<QDBusObjectPath> reply = manager.DefaultAdapter();
        reply.waitForFinished();
        if (reply.isError())
            return;

        adapter = new OrgBluezAdapterInterface(QLatin1String("org.bluez"), reply.value().path(), QDBusConnection::systemBus());
    } else {
        QDBusPendingReply<QList<QDBusObjectPath> > reply = manager.ListAdapters();
        reply.waitForFinished();
        if (reply.isError())
            return;

        foreach (const QDBusObjectPath &path, reply.value()) {
            OrgBluezAdapterInterface *tmpAdapter = new OrgBluezAdapterInterface(QLatin1String("org.bluez"), path.path(), QDBusConnection::systemBus());

            QDBusPendingReply<QVariantMap> reply = tmpAdapter->GetProperties();
            reply.waitForFinished();
            if (reply.isError())
                continue;

            QBluetoothAddress path_address(reply.value().value(QLatin1String("Address")).toString());

            if (path_address == localAddress) {
                adapter = tmpAdapter;
                break;
            } else {
                delete tmpAdapter;
            }
        }
    }

    currentMode = static_cast<QBluetoothLocalDevice::HostMode>(-1);
    if (adapter) {
        connect(adapter, SIGNAL(PropertyChanged(QString,QDBusVariant)), SLOT(PropertyChanged(QString,QDBusVariant)));

        qsrand(QTime::currentTime().msec());
        agent_path = agentPath;
        agent_path.append(QString::fromLatin1("/%1").arg(qrand()));
    }
}
开发者ID:kobolabs,项目名称:qtconnectivity,代码行数:48,代码来源:qbluetoothlocaldevice_bluez.cpp

示例7: deviceModemPropertiesInterface

QNetworkManagerInterfaceDeviceModem::QNetworkManagerInterfaceDeviceModem(const QString &ifaceDevicePath, QObject *parent)
    : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
                             ifaceDevicePath,
                             NM_DBUS_INTERFACE_DEVICE_MODEM,
                             QDBusConnection::systemBus(), parent)
{
    if (!isValid()) {
        return;
    }
    PropertiesDBusInterface deviceModemPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
                                                  ifaceDevicePath,
                                                  QLatin1String("org.freedesktop.DBus.Properties"),
                                                  QDBusConnection::systemBus(),parent);

    QList<QVariant> argumentList;
    argumentList << QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM);
    QDBusPendingReply<QVariantMap> propsReply
            = deviceModemPropertiesInterface.callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
                                                                       argumentList);
    if (!propsReply.isError()) {
        propertyMap = propsReply.value();
    }

    QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
                                  ifaceDevicePath,
                                  QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM),
                                  QLatin1String("PropertiesChanged"),
                                  this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
}
开发者ID:James-intern,项目名称:Qt,代码行数:29,代码来源:qnetworkmanagerservice.cpp

示例8: QDBusAbstractInterface

QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent)
        : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
                  dbusPathName,
                  NM_DBUS_INTERFACE_ACCESS_POINT,
                  QDBusConnection::systemBus(),parent)
{
    if (!isValid()) {
        return;
    }
    PropertiesDBusInterface *accessPointPropertiesInterface = new PropertiesDBusInterface(QLatin1String(NM_DBUS_SERVICE),
                                                  dbusPathName,
                                                  DBUS_PROPERTIES_INTERFACE,
                                                  QDBusConnection::systemBus());

    QList<QVariant> argumentList;
    argumentList << QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT);
    QDBusPendingReply<QVariantMap> propsReply
            = accessPointPropertiesInterface->callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
                                                                       argumentList);
    if (!propsReply.isError()) {
        propertyMap = propsReply.value();
    }

    QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
                                  dbusPathName,
                                  QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
                                  QLatin1String("PropertiesChanged"),
                                  this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
}
开发者ID:James-intern,项目名称:Qt,代码行数:29,代码来源:qnetworkmanagerservice.cpp

示例9: refreshNotificationList

void NotificationsModel::refreshNotificationList()
{
    if (!m_dbusInterface) {
        return;
    }

    if (!m_notificationList.isEmpty()) {
        beginRemoveRows(QModelIndex(), 0, m_notificationList.size() - 1);
        qDeleteAll(m_notificationList);
        m_notificationList.clear();
        endRemoveRows();
    }

    if (!m_dbusInterface->isValid()) {
        kDebug(debugArea()) << "dbus interface not valid";
        return;
    }

    QDBusPendingReply<QStringList> pendingNotificationIds = m_dbusInterface->activeNotifications();
    pendingNotificationIds.waitForFinished();
    if (pendingNotificationIds.isError()) {
        kDebug(debugArea()) << pendingNotificationIds.error();
        return;
    }
    const QStringList& notificationIds = pendingNotificationIds.value();

    if (notificationIds.isEmpty()) {
        return;
    }

    beginInsertRows(QModelIndex(), 0, notificationIds.size() - 1);
    Q_FOREACH (const QString& notificationId, notificationIds) {
        NotificationDbusInterface* dbusInterface = new NotificationDbusInterface(m_deviceId, notificationId, this);
        m_notificationList.append(dbusInterface);
    }
开发者ID:achilleas-k,项目名称:kdeconnect-kde,代码行数:35,代码来源:notificationsmodel.cpp

示例10: setModemPath

void QOfonoHandsfreeAudioCard::setModemPath(const QString &path)
{
    if (path == d_ptr->modemPath ||
            path.isEmpty())
        return;

    if (path != modemPath()) {
        if (d_ptr->ofonoHandsfreeAudioCard) {
            delete d_ptr->ofonoHandsfreeAudioCard;
            d_ptr->ofonoHandsfreeAudioCard = 0;
            d_ptr->properties.clear();
        }
        d_ptr->modemPath = path;
        d_ptr->ofonoHandsfreeAudioCard = new OfonoHandsfreeAudioCard("org.ofono", path, QDBusConnection::systemBus(),this);

        if (d_ptr->ofonoHandsfreeAudioCard) {

            QDBusPendingReply<QVariantMap> reply;
            reply = d_ptr->ofonoHandsfreeAudioCard->GetProperties();
            reply.waitForFinished();
            d_ptr->properties = reply.value();
            Q_EMIT modemPathChanged(path);
        }
    }
}
开发者ID:amtep,项目名称:libqofono,代码行数:25,代码来源:qofonohandsfreeaudiocard.cpp

示例11: setModemPath

void QOfonoCallMeter::setModemPath(const QString &path)
{
    if (path == d_ptr->modemPath ||
            path.isEmpty())
        return;

    if (path != modemPath()) {
        if (d_ptr->callMeter) {
            delete d_ptr->callMeter;
            d_ptr->callMeter = 0;
            d_ptr->properties.clear();
        }
        d_ptr->callMeter = new OfonoCallMeter("org.ofono", path, QDBusConnection::systemBus(),this);

        if (d_ptr->callMeter->isValid()) {
            d_ptr->modemPath = path;
            connect(d_ptr->callMeter,SIGNAL(PropertyChanged(QString,QDBusVariant)),
                    this,SLOT(propertyChanged(QString,QDBusVariant)));

            connect(d_ptr->callMeter,SIGNAL(NearMaximumWarning()),this,SIGNAL(nearMaximumWarning()));
            QDBusPendingReply<QVariantMap> reply;
            reply = d_ptr->callMeter->GetProperties();
            reply.waitForFinished();
            d_ptr->properties = reply.value();
            Q_EMIT modemPathChanged(path);
        }
    }
}
开发者ID:amccarthy,项目名称:libqofono,代码行数:28,代码来源:qofonocallmeter.cpp

示例12: connectOfono

void QOfonoMessageWaiting::connectOfono()
{
    bool wasReady = isReady();
    // FIXME: Clearing properties here results in false *Changed signal
    // emissions. Ideally ready() should not be derived from
    // properties.isEmpty(). Also compare with QOfonoSimManager.
    if (d_ptr->messageWaiting) {
        delete d_ptr->messageWaiting;
        d_ptr->messageWaiting = 0;
        d_ptr->properties.clear();
    }

    d_ptr->messageWaiting = new OfonoMessageWaiting("org.ofono", d_ptr->modemPath, QDBusConnection::systemBus(),this);

    if (d_ptr->messageWaiting->isValid()) {
        connect(d_ptr->messageWaiting,SIGNAL(PropertyChanged(QString,QDBusVariant)),
                this,SLOT(propertyChanged(QString,QDBusVariant)));

        QDBusPendingReply<QVariantMap> reply;
        reply = d_ptr->messageWaiting->GetProperties();
        reply.waitForFinished();
        if (reply.isError()) {
            Q_EMIT getPropertiesFailed();
        } else {
            QVariantMap properties = reply.value();
            for (QVariantMap::ConstIterator it = properties.constBegin();
                    it != properties.constEnd(); ++it) {
                updateProperty(it.key(), it.value());
            }
        }
    }

    if (wasReady != isReady())
        Q_EMIT readyChanged();
}
开发者ID:amccarthy,项目名称:libqofono,代码行数:35,代码来源:qofonomessagewaiting.cpp

示例13: call_returned

void request_watcher_t::call_returned(QDBusPendingCallWatcher *w)
{
  log_debug() ;
  log_assert(w==this->w, "oops, somethig is really wrong with qdbus...") ;

  QDBusPendingReply<bool> reply = *w ;

  bool ok = reply.isValid() and reply.value() ;

  abstract_io_state_t *next = machine->state_dlg_user ;

  if (ok)
    log_notice("Voland acknowledge received, moving %d event(s) to DLG_USER", events.size()) ;
  else
  {
    string err = reply.isValid() ? "false returned" : reply.error().message().toStdString() ;
    log_error("Voland call 'create' failed, message: '%s'", err.c_str()) ;
    log_notice("moving %d event(s) to DLG_WAIT", events.size()) ;
    next = machine->state_dlg_wait ;
  }

  for(set<event_t*>::const_iterator it=events.begin(); it!=events.end(); ++it)
    next->go_to(*it) ;

  if (events.size()>0)
    machine->process_transition_queue() ;

  // Don't need the watcher any more
  delete this ;
}
开发者ID:deztructor,项目名称:timed,代码行数:30,代码来源:machine.cpp

示例14: updateStatus

void PowerDevilRunner::updateStatus()
{
    // Profiles and their icons
    {
        KSharedConfigPtr profilesConfig = KSharedConfig::openConfig("powerdevil2profilesrc", KConfig::SimpleConfig);
        // Request profiles to the daemon
        QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement",
                                                           "org.kde.Solid.PowerManagement", "availableProfiles");
        QDBusPendingReply< StringStringMap > reply = QDBusConnection::sessionBus().asyncCall(call);
        reply.waitForFinished();

        if (!reply.isValid()) {
            kDebug() << "Error contacting the daemon!";
            return;
        }

        m_availableProfiles = reply.value();

        if (m_availableProfiles.isEmpty()) {
            kDebug() << "No available profiles!";
            return;
        }

        for (StringStringMap::const_iterator i = m_availableProfiles.constBegin(); i != m_availableProfiles.constEnd(); ++i) {
            KConfigGroup settings(profilesConfig, i.key());
            if (settings.readEntry< QString >("icon", QString()).isEmpty()) {
                m_profileIcon[i.key()] = "preferences-system-power-management";
            } else {
                m_profileIcon[i.key()] = settings.readEntry< QString >("icon", QString());
            }
        }
    }

    updateSyntaxes();
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:35,代码来源:PowerDevilRunner.cpp

示例15: reg

QStringList
PlatformUdisks2::getPartitionList(const QString &devicePath)
{
    QStringList partitionList;
    org::freedesktop::DBus::ObjectManager manager("org.freedesktop.UDisks2", "/org/freedesktop/UDisks2", QDBusConnection::systemBus());
    QDBusPendingReply<DBUSManagerStruct> reply = manager.GetManagedObjects();
    reply.waitForFinished();
    if (reply.isError()) {
        qDebug() << "Failure: " <<  reply.error();
        exit(0);
    }

    QRegExp reg(QString("%1[0-9]+$").arg(devicePath));

    Q_FOREACH(const QDBusObjectPath &path, reply.value().keys()) {
        const QString udi = path.path();
        if (!udi.startsWith("/org/freedesktop/UDisks2/block_devices"))
            continue;

        if (!udi.contains(reg))
            continue;
        partitionList << udi;
    }

    return partitionList;
}
开发者ID:DanrleyAlvesBR,项目名称:imagewriter,代码行数:26,代码来源:PlatformUdisks2.cpp


注:本文中的QDBusPendingReply::value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。