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


C++ QDBusVariant函数代码示例

本文整理汇总了C++中QDBusVariant函数的典型用法代码示例。如果您正苦于以下问题:C++ QDBusVariant函数的具体用法?C++ QDBusVariant怎么用?C++ QDBusVariant使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: switch

void MorseTextChannel::sentMessageDeliveryStatusChanged(const QString &phone, quint64 messageId, TelegramNamespace::MessageDeliveryStatus status)
{
    // We are connected to broadcast signal, so have to select only needed calls
    if (phone != m_targetID) {
        return;
    }

    Tp::DeliveryStatus statusFlag;

    switch (status) {
    case TelegramNamespace::MessageDeliveryStatusSent:
        statusFlag = Tp::DeliveryStatusAccepted;
        break;
    case TelegramNamespace::MessageDeliveryStatusRead:
        statusFlag = Tp::DeliveryStatusRead;
        break;
    default:
        return;
    }

    const QString token = QString::number(messageId);

    Tp::MessagePartList partList;

    Tp::MessagePart header;
    header[QLatin1String("message-sender")]    = QDBusVariant(m_targetHandle);
    header[QLatin1String("message-sender-id")] = QDBusVariant(m_targetID);
    header[QLatin1String("message-type")]      = QDBusVariant(Tp::ChannelTextMessageTypeDeliveryReport);
    header[QLatin1String("delivery-status")]   = QDBusVariant(statusFlag);
    header[QLatin1String("delivery-token")]    = QDBusVariant(token);
    partList << header;

    addReceivedMessage(partList);
}
开发者ID:KDE,项目名称:telepathy-morse,代码行数:34,代码来源:textchannel.cpp

示例2: switch

void QBluetoothLocalDevice::setHostMode(QBluetoothLocalDevice::HostMode mode)
{
    if (!d_ptr || !d_ptr->adapter)
        return;

    switch (mode) {
    case HostDiscoverableLimitedInquiry:
    case HostDiscoverable:
        if (hostMode() == HostPoweredOff) {
            //We first have to wait for BT to be powered on,
            //then we can set the host mode correctly
            d_ptr->pendingHostModeChange = (int) HostDiscoverable;
            d_ptr->adapter->SetProperty(QStringLiteral("Powered"),
                                        QDBusVariant(QVariant::fromValue(true)));
        } else {
            d_ptr->adapter->SetProperty(QStringLiteral("Discoverable"),
                                        QDBusVariant(QVariant::fromValue(true)));
        }
        break;
    case HostConnectable:
        if (hostMode() == HostPoweredOff) {
            d_ptr->pendingHostModeChange = (int) HostConnectable;
            d_ptr->adapter->SetProperty(QStringLiteral("Powered"),
                                        QDBusVariant(QVariant::fromValue(true)));
        } else {
            d_ptr->adapter->SetProperty(QStringLiteral("Discoverable"),
                                        QDBusVariant(QVariant::fromValue(false)));
        }
        break;
    case HostPoweredOff:
        d_ptr->adapter->SetProperty(QLatin1String("Powered"),
                                    QDBusVariant(QVariant::fromValue(false)));
        break;
    }
}
开发者ID:kobolabs,项目名称:qtconnectivity,代码行数:35,代码来源:qbluetoothlocaldevice_bluez.cpp

示例3: Q_UNUSED

void QBluetoothLocalDevicePrivate::PropertyChanged(QString property, QDBusVariant value)
{
    Q_UNUSED(value);

    if (property != QLatin1String("Powered") &&
            property != QLatin1String("Discoverable"))
        return;

    Q_Q(QBluetoothLocalDevice);
    QBluetoothLocalDevice::HostMode mode;

    QDBusPendingReply<QVariantMap> reply = adapter->GetProperties();
    reply.waitForFinished();
    if (reply.isError()) {
        qWarning() << "Failed to get bluetooth properties for mode change";
        return;
    }

    QVariantMap map = reply.value();

    if(!map.value(QLatin1String("Powered")).toBool()) {
        mode = QBluetoothLocalDevice::HostPoweredOff;
    }
    else {
        if (map.value(QLatin1String("Discoverable")).toBool())
            mode = QBluetoothLocalDevice::HostDiscoverable;
        else
            mode = QBluetoothLocalDevice::HostConnectable;

        if (pendingHostModeChange != -1) {
            if ((int)mode != pendingHostModeChange) {
                if (property == QStringLiteral("Powered"))
                    return;
                if (pendingHostModeChange == (int)QBluetoothLocalDevice::HostDiscoverable) {
                    adapter->SetProperty(QStringLiteral("Discoverable"),
                                         QDBusVariant(QVariant::fromValue(true)));
                } else {
                    adapter->SetProperty(QStringLiteral("Discoverable"),
                                         QDBusVariant(QVariant::fromValue(false)));
                }
                pendingHostModeChange = -1;
                return;
            }
        }
    }

    if(mode != currentMode)
        emit q->hostModeStateChanged(mode);

    currentMode = mode;
}
开发者ID:kobolabs,项目名称:qtconnectivity,代码行数:51,代码来源:qbluetoothlocaldevice_bluez.cpp

示例4: lock

void Transaction::setErrorDetails(const QString &errorDetails)
{
    QMutexLocker lock(&m_dataMutex);

    m_errorDetails = errorDetails;
    emit propertyChanged(QApt::ErrorDetailsProperty, QDBusVariant(errorDetails));
}
开发者ID:KDE,项目名称:libqapt,代码行数:7,代码来源:transaction.cpp

示例5: QFETCH

void tst_QDBusPerformance::oneWayVariant()
{
    QFETCH(QVariant, data);
    QFETCH(int, size);

    QVERIFY(executeTest("size", size, qVariantFromValue(QDBusVariant(data))));
}
开发者ID:mpvader,项目名称:qt,代码行数:7,代码来源:tst_qdbusperformance.cpp

示例6: setProperty

void gprsBusinessLogic::setProperty(const QString& property, const QVariant& apn)
{
    QDBusMessage request;
    request = QDBusMessage::createMethodCall("org.ofono",
                                            m_contextPath, DBUS_GPRS_CONTEXT_INTERFACE,
                                            "SetProperty");
    QVariantList arguments;
    arguments << property << QVariant::fromValue(QDBusVariant(apn));

    //if (!apn.isNull())
     //arguments << QVariant(apn);
    request.setArguments(arguments);

    bool result = QDBusConnection::systemBus().callWithCallback(request, this,
                                        SLOT(setPropertyResp()),
                                        SLOT(DBusMessagingFailure (QDBusError)),
                                        SET_PROPERTY_TIMEOUT);
/*
    if (!result) {

        // FIXME: should indicate that sending a message failed
        setError(QString(), QString("Sending a message failed"));
        emit setPropertyFailed(name);

        return;
       }
       */
}
开发者ID:deztructor,项目名称:meegotouch-controlpanelapplets,代码行数:28,代码来源:gprsbusinesslogic.cpp

示例7: QDBusVariant

void Ofono::setPowerOff(){
    if(m_ofonoModemInterface != NULL){
        m_ofonoModemInterface->SetProperty("Powered", QDBusVariant(false));
    }else{
        qDebug() << "[ERROR] Ofono::setPowerOff(): member var is NULL!";
    }
}
开发者ID:NoUsername,项目名称:McmMosLinuxPhone,代码行数:7,代码来源:ofono.cpp

示例8: QDBusVariant

void QBluetoothLocalDevice::powerOn()
{
    if (!d_ptr || !d_ptr->adapter)
        return;

    d_ptr->adapter->SetProperty(QLatin1String("Powered"), QDBusVariant(QVariant::fromValue(true)));
}
开发者ID:kobolabs,项目名称:qtconnectivity,代码行数:7,代码来源:qbluetoothlocaldevice_bluez.cpp

示例9: iface

void QDBusViewer::setProperty(const BusSignature &sig)
{
    QDBusInterface iface(sig.mService, sig.mPath, sig.mInterface, c);
    QMetaProperty prop = iface.metaObject()->property(iface.metaObject()->indexOfProperty(sig.mName.toLatin1()));

    bool ok;
    QString input = QInputDialog::getText(this, tr("Arguments"),
                    tr("Please enter the value of the property %1 (type %2)").arg(
                        sig.mName, QString::fromLatin1(prop.typeName())),
                    QLineEdit::Normal, QString(), &ok);
    if (!ok)
        return;

    QVariant value = input;
    if (!value.convert(prop.type())) {
        QMessageBox::warning(this, tr("Unable to marshall"),
                tr("Value conversion failed, unable to set property"));
        return;
    }

    QDBusMessage message = QDBusMessage::createMethodCall(sig.mService, sig.mPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("Set"));
    QList<QVariant> arguments;
    arguments << sig.mInterface << sig.mName << qVariantFromValue(QDBusVariant(value));
    message.setArguments(arguments);
    c.callWithCallback(message, this, SLOT(dumpMessage(QDBusMessage)));

}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:27,代码来源:qdbusviewer.cpp

示例10: SIGNAL

void KUiServerJobTracker::registerJob(KJob *job)
{
    // Already registered job?
    if (d->progressJobView.contains(job)) {
        return;
    }

    KComponentData componentData = KGlobal::mainComponent();
    QString programIconName = componentData.aboutData()->programIconName();

    if (programIconName.isEmpty()) {
        programIconName = componentData.aboutData()->appName();
    }

    QWeakPointer<KJob> jobWatch = job;
    QDBusReply<QDBusObjectPath> reply = serverProxy->uiserver().requestView(componentData.aboutData()->programName(),
                                                                            programIconName,
                                                                            job->capabilities());

    // If we got a valid reply, register the interface for later usage.
    if (reply.isValid()) {
        org::kde::JobViewV2 *jobView = new org::kde::JobViewV2("org.kde.JobViewServer",
                                                           reply.value().path(),
                                                           QDBusConnection::sessionBus());
        if (!jobWatch) {
            //kDebug() << "deleted out from under us when asking the server proxy for the view";
            jobView->terminate(QString());
            delete jobView;
            return;
        }

        QObject::connect(jobView, SIGNAL(cancelRequested()), this,
                         SLOT(_k_killJob()));
        QObject::connect(jobView, SIGNAL(suspendRequested()), job,
                         SLOT(suspend()));
        QObject::connect(jobView, SIGNAL(resumeRequested()), job,
                         SLOT(resume()));

        QVariant destUrl = job->property("destUrl");
        if (destUrl.isValid()) {
            jobView->setDestUrl(QDBusVariant(destUrl));
        }

        if (!jobWatch) {
            //kDebug() << "deleted out from under us when creating the dbus interface";
            jobView->terminate(QString());
            delete jobView;
            return;
        }

        d->progressJobView.insert(job, jobView);
    } else if (!jobWatch) {
        qWarning() << "Uh-oh...KUiServerJobTracker was trying to forward a job, but it was deleted from under us."
        << "kuiserver *may* have a stranded job. we can't do anything about it because the returned objectPath is invalid.";
        return;
    }

    KJobTrackerInterface::registerJob(job);
}
开发者ID:vasi,项目名称:kdelibs,代码行数:59,代码来源:kuiserverjobtracker.cpp

示例11: Q_FOREACH

void Service::setIpv4Settings(const QVariantMap &map)
{
    StringMap settings;
    Q_FOREACH (const QString &key, map.keys())
        settings.insert(key, map.value(key).toString());

    m_service->SetProperty("IPv4.Configuration", QDBusVariant(qVariantFromValue(settings)));
}
开发者ID:gustavosbarreto,项目名称:qconnman,代码行数:8,代码来源:service.cpp

示例12: QVariant

void QOfonoCallMeter::setAccumulatedCallMeterMaximum(quint32 max, const QString &password)
{
    if (d_ptr->callMeter) {
        QVariantList arguments;
        arguments << QVariant(max);
        d_ptr->callMeter->SetProperty("AccumulatedCallMeterMaximum",QDBusVariant(arguments), password);
    }
}
开发者ID:amccarthy,项目名称:libqofono,代码行数:8,代码来源:qofonocallmeter.cpp

示例13: qVariantFromValue

void SessionAgent::setConnectionType(const QString &type)
{
    if (!m_session)
        return;
    QVariantMap map;
    map.insert("ConnectionType",  qVariantFromValue(type));
    m_session->Change("ConnectionType",QDBusVariant(type));
}
开发者ID:ftonello,项目名称:libconnman-qt,代码行数:8,代码来源:sessionagent.cpp

示例14: QDBusVariant

void QOfonoCallSettings::setHideCallerId(const QString &setting)
{
    if (d_ptr->callSettings) {
        QDBusPendingReply<> reply = d_ptr->callSettings->SetProperty("HideCallerId", QDBusVariant(setting));
        QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
        connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
                SLOT(setHideCallerIdComplete(QDBusPendingCallWatcher*)));
    }
}
开发者ID:amccarthy,项目名称:libqofono,代码行数:9,代码来源:qofonocallsettings.cpp

示例15: setVoiceNoReply

void QOfonoCallForwarding::setVoiceNoReply(const QString &property)
{
    if (d_ptr->callForward) {
        QDBusPendingReply<> reply = d_ptr->callForward->SetProperty("VoiceNoReply",QDBusVariant(property));
        QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
        connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
                SLOT(setVoiceNoReplyComplete(QDBusPendingCallWatcher*)));
    }
}
开发者ID:amtep,项目名称:libqofono,代码行数:9,代码来源:qofonocallforwarding.cpp


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