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


C++ QDBusObjectPath类代码示例

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


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

示例1: interfaceError

QList<QVariantMap> TrackListInterfaceTest::testGetTracksMetadata(const QList<QDBusObjectPath>& trackIds)
{
    QDBusReply<QList<QVariantMap> > reply = iface->call("GetTracksMetadata");
    if (!reply.isValid()) {
        emit interfaceError(Method, "GetTracksMetadata", "Call to GetTracksMetadata failed with error " + reply.error().message());
    } else {
        QList<QVariantMap> metadataList = reply.value();
        QMap<QDBusObjectPath,QVariantMap> metadataMap;
        int i = 0;
        Q_FOREACH (const QVariantMap& metadata, metadataList) {
            if (metadata.isEmpty()) {
                emit interfaceWarning(Method, "GetTracksMetadata",
                        "Got an empty entry at position " + QString::number(i));
            } else if (!metadata.contains("mpris:trackid")) {
                emit interfaceError(Method, "GetTracksMetadata",
                        "No mpris:trackid entry at position " + QString::number(i));
            } else if (metadata.value("mpris:trackid").userType() != qMetaTypeId<QDBusObjectPath>()) {
                emit interfaceError(Method, "GetTracksMetadata",
                        "mpris:trackid entry was not sent as a D-Bus object path (D-Bus type 'o') at position " + QString::number(i));
            } else {
                QDBusObjectPath trackid = metadata.value("mpris:trackid").value<QDBusObjectPath>();
                if (trackid.path().isEmpty()) {
                    emit interfaceError(Method, "GetTracksMetadata",
                            "mpris:trackid entry is an empty path at position " + QString::number(i));
                } else if (!trackIds.contains(trackid)) {
                    emit interfaceWarning(Method, "GetTracksMetadata",
                            "Entry " + trackid.path() + " was not requested at position " + QString::number(i));
                } else {
                    metadataMap.put(trackid, metadata);
                }
            }
            ++i;
        }
    }
}
开发者ID:andyhelp,项目名称:pkg-mpristester,代码行数:35,代码来源:tracklistinterfacetest.cpp

示例2: QLatin1String

void QLlcpSocketPrivate::initializeRequestor()
{
    if (m_socketRequestor)
        return;

    if (m_requestorPath.isEmpty()) {
        m_requestorPath = QLatin1String(requestorBasePath) +
                          QString::number(requestorId.fetchAndAddOrdered(1));
    }

    Manager manager(QLatin1String("com.nokia.nfc"), QLatin1String("/"), m_connection);
    QDBusObjectPath defaultAdapterPath = manager.DefaultAdapter();

    if (!m_socketRequestor) {
        m_socketRequestor = new SocketRequestor(defaultAdapterPath.path(), this);

        connect(m_socketRequestor, SIGNAL(accessFailed(QDBusObjectPath,QString,QString)),
                this, SLOT(AccessFailed(QDBusObjectPath,QString,QString)));
        connect(m_socketRequestor, SIGNAL(accessGranted(QDBusObjectPath,QString)),
                this, SLOT(AccessGranted(QDBusObjectPath,QString)));
        connect(m_socketRequestor, SIGNAL(accept(QDBusVariant,QDBusVariant,int,QVariantMap)),
                this, SLOT(Accept(QDBusVariant,QDBusVariant,int,QVariantMap)));
        connect(m_socketRequestor, SIGNAL(connect(QDBusVariant,QDBusVariant,int,QVariantMap)),
                this, SLOT(Connect(QDBusVariant,QDBusVariant,int,QVariantMap)));
        connect(m_socketRequestor, SIGNAL(socket(QDBusVariant,int,QVariantMap)),
                this, SLOT(Socket(QDBusVariant,int,QVariantMap)));
    }
开发者ID:Koi-foo,项目名称:qt-mobility,代码行数:27,代码来源:qllcpsocket_maemo6_p.cpp

示例3: Q_D

/*!
    Finds a user by \a userName.
    Sync blocking API.

    \param userName The user name to look up.
    \return the corresponding UserAccount object.
*/
UserAccount *AccountsManager::findUserByName(const QString &userName)
{
    Q_D(AccountsManager);

    QDBusPendingReply<QDBusObjectPath> reply = d->interface->FindUserByName(userName);
    reply.waitForFinished();

    if (reply.isError()) {
        QDBusError error = reply.error();
        qWarning("Couldn't find user by user name %s: %s",
                 userName.toUtf8().constData(),
                 error.errorString(error.type()).toUtf8().constData());
        return 0;
    }

    QDBusObjectPath path = reply.argumentAt<0>();
    if (path.path().isEmpty())
        return Q_NULLPTR;

    UserAccount *account = d->usersCache.value(path.path(), Q_NULLPTR);
    if (!account) {
        account = new UserAccount(path.path(), d->interface->connection());
        d->usersCache[path.path()] = account;
    }
    return account;
}
开发者ID:AOSC-Dev,项目名称:qtaccountsservice,代码行数:33,代码来源:accountsmanager.cpp

示例4: listCachedUsers

/*!
    Caches a user account, so that it shows up in listCachedUsers() output.
    The user name may be a remote user, but the system must be able to lookup
    the user name and resolve the user information.

    A userCached() signal with a UserAccount pointer will be emitted as soon
    as the user account has been cached by AccountsService.

    \param userName The user name for the user.
*/
void AccountsManager::cacheUser(const QString &userName)
{
    Q_D(AccountsManager);

    QDBusPendingCall call = d->interface->CacheUser(userName);
    QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
    connect(watcher, &QDBusPendingCallWatcher::finished, this, [=](QDBusPendingCallWatcher *w) {
        QDBusPendingReply<QDBusObjectPath> reply = *w;
        w->deleteLater();
        if (reply.isError()) {
            QDBusError error = reply.error();
            qWarning("Couldn't cache user %s: %s",
                     userName.toUtf8().constData(),
                     error.errorString(error.type()).toUtf8().constData());
        } else {
            QDBusObjectPath path = reply.argumentAt<0>();
            if (path.path().isEmpty())
                return;

            UserAccount *account = d->usersCache.value(path.path(), Q_NULLPTR);
            if (!account) {
                account = new UserAccount(path.path(), d->interface->connection());
                d->usersCache[path.path()] = account;
            }
            Q_EMIT userCached(account);
        }
    });
}
开发者ID:AOSC-Dev,项目名称:qtaccountsservice,代码行数:38,代码来源:accountsmanager.cpp

示例5:

void
MainWindow::deviceRemoved(QDBusMessage message)
{
    int index;
    QString devicePath;
#ifdef USEHAL
    devicePath = message.arguments().at(0).toString();
    if (devicePath.startsWith("/org/freedesktop/Hal/devices/storage_serial"))
#else
    QDBusObjectPath path = message.arguments().at(0).value<QDBusObjectPath>();
    devicePath = path.path();
    if (devicePath.startsWith("/org/freedesktop/UDisks/devices/"))
#endif
    {
        QLinkedList<DeviceItem *> list = pPlatform->getDeviceList();
        QLinkedList<DeviceItem *>::iterator i;
        for (i = list.begin(); i != list.end(); ++i)
        {
            if ((*i)->getUDI() == devicePath)
            {
                if (removeMenuItem((*i)->getDisplayString()) != -1)
                {
                    pPlatform->removeDeviceFromList(devicePath);
                    break;
                }
            }
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:kiwi,代码行数:29,代码来源:MainWindow.cpp

示例6: qCWarning

void QBluetoothTransferReplyBluez::sessionStarted(QDBusPendingCallWatcher *watcher)
{
    QDBusPendingReply<QDBusObjectPath, QVariantMap> reply = *watcher;
    if (reply.isError()) {
        qCWarning(QT_BT_BLUEZ) << "Failed to start obex session:"
                               << reply.error().name() << reply.reply().errorMessage();

        m_errorStr = QBluetoothTransferReply::tr("Push session cannot be started");
        m_error = QBluetoothTransferReply::SessionError;
        m_finished = true;
        m_running = false;

        cleanupSession();

        emit QBluetoothTransferReply::error(m_error);
        emit finished(this);

        watcher->deleteLater();
        return;
    }

    const QDBusObjectPath path = reply.argumentAt<0>();
    const QVariantMap map = reply.argumentAt<1>();
    m_transfer_path = path.path();

    //watch the transfer
    OrgFreedesktopDBusPropertiesInterface *properties = new OrgFreedesktopDBusPropertiesInterface(
                            QStringLiteral("org.bluez.obex"), path.path(),
                            QDBusConnection::sessionBus(), this);
    connect(properties, SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)),
            SLOT(sessionChanged(QString,QVariantMap,QStringList)));

    watcher->deleteLater();
}
开发者ID:vitiruiz,项目名称:dbus,代码行数:34,代码来源:qbluetoothtransferreply_bluez.cpp

示例7: activeMprisTrackId

void MediaPlayer2Player::SetPosition( const QDBusObjectPath& TrackId, qlonglong position ) const
{
    QDBusObjectPath activeTrackId = activeMprisTrackId();
    if( TrackId == activeTrackId )
        The::engineController()->seek( position / 1000 );
    else
        debug() << "SetPosition() called with a trackId (" << TrackId.path() << ") which is not for the active track (" << activeTrackId.path() << ")";
}
开发者ID:phalgun,项目名称:amarok-nepomuk,代码行数:8,代码来源:MediaPlayer2Player.cpp

示例8: activeMprisTrackId

 void Mpris2DBusHandler::SetPosition( const QDBusObjectPath &trackId, qlonglong position )
 {
     QDBusObjectPath activeTrackId = activeMprisTrackId();
     if( trackId == activeTrackId )
         The::engineController()->seek( position / 1000 );
     else
         warning() << "SetPosition() called with a trackId (" << trackId.path() << ") which is not for the active track (" << activeTrackId.path() << ")";
 }
开发者ID:saurabhsood91,项目名称:Amarok,代码行数:8,代码来源:Mpris2DBusHandler.cpp

示例9: QString

CreationResult *AccountsWorker::createAccountInternal(const User *user)
{
    CreationResult *result = new CreationResult;

    // validate username
    QDBusPendingReply<bool, QString, int> reply = m_accountsInter->IsUsernameValid(user->name());
    reply.waitForFinished();
    if (reply.isError()) {
        result->setType(CreationResult::UserNameError);
        result->setMessage(reply.error().message());

        return result;
    }
    bool validation = reply.argumentAt(0).toBool();
    if (!validation) {
        result->setType(CreationResult::UserNameError);
        result->setMessage(dgettext("dde-daemon", reply.argumentAt(1).toString().toUtf8().data()));
        return result;
    }

    // validate password
    if (user->password() != user->repeatPassword()) {
        result->setType(CreationResult::PasswordMatchError);
        result->setMessage(tr("Password not match"));
        return result;
    }

    // default FullName is empty string
    QDBusObjectPath path = m_accountsInter->CreateUser(user->name(), QString(), 1);
    const QString userPath = path.path();
    if (userPath.isEmpty() || userPath.isNull()) {
        result->setType(CreationResult::UnknownError);
        result->setMessage("no method call result on CreateUser");
        return result;
    }

    AccountsUser *userDBus = new AccountsUser("com.deepin.daemon.Accounts", userPath, QDBusConnection::systemBus(), this);
    if (!userDBus->isValid()) {
        result->setType(CreationResult::UnknownError);
        result->setMessage("user dbus is still not valid.");

        return result;
    }

    //TODO(hualet): better to check all the call results.
    bool sifResult = !userDBus->SetIconFile(user->currentAvatar()).isError();
    bool spResult = !userDBus->SetPassword(cryptUserPassword(user->password())).isError();

    if (!sifResult || !spResult) {
        result->setType(CreationResult::UnknownError);
        if (!sifResult) result->setMessage("set icon file for new created user failed.");
        if (!spResult) result->setMessage("set password for new created user failed");

        return result;
    }

    return result;
}
开发者ID:linuxdeepin,项目名称:dde-control-center,代码行数:58,代码来源:accountsworker.cpp

示例10: InterfacesRemoved

void QtBluezDiscoveryManager::InterfacesRemoved(const QDBusObjectPath &object_path,
                                                const QStringList &interfaces)
{
    if (!d->references.contains(object_path.path())
            || !interfaces.contains(QStringLiteral("org.bluez.Adapter1")))
        return;

    removeAdapterFromMonitoring(object_path.path());
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:9,代码来源:bluez5_helper.cpp

示例11: _q_userDeleted

void AccountsManagerPrivate::_q_userDeleted(const QDBusObjectPath &path)
{
    Q_Q(AccountsManager);

    UserAccount *account = usersCache.value(path.path(), Q_NULLPTR);
    usersCache.remove(path.path());
    Q_EMIT q->userDeleted(account->userId());
    account->deleteLater();
}
开发者ID:AOSC-Dev,项目名称:qtaccountsservice,代码行数:9,代码来源:accountsmanager.cpp

示例12: interfacesRemoved

void NeardHelper::interfacesRemoved(const QDBusObjectPath &path, const QStringList &list)
{
    if (list.contains(QStringLiteral("org.neard.Record"))) {
        qCDebug(QT_NFC_NEARD) << "record removed" << path.path();
        emit recordRemoved(path);
    } else if (list.contains(QStringLiteral("org.neard.Tag"))) {
        qCDebug(QT_NFC_NEARD) << "tag removed" << path.path();
        emit tagRemoved(path);
    }
}
开发者ID:OniLink,项目名称:Qt5-Rehost,代码行数:10,代码来源:neard_helper.cpp

示例13: RazorMountDevice

UDiskMountDevice::UDiskMountDevice(const QDBusObjectPath &path):
    RazorMountDevice(),
    mUdiskPath(path.path())
{
    mDbus = new QDBusInterface("org.freedesktop.UDisks",
                               path.path(),
                               "org.freedesktop.UDisks.Device",
                               QDBusConnection::systemBus(),
                               this);
    update();
}
开发者ID:PeterJespersen,项目名称:razor-qt,代码行数:11,代码来源:rzmountproviders.cpp

示例14: defaultSinkChanged

void SoundApplet::defaultSinkChanged()
{
    delete m_defSinkInter;

    const QDBusObjectPath defSinkPath = m_audioInter->GetDefaultSink();
    m_defSinkInter = new DBusSink(defSinkPath.path(), this);

    connect(m_defSinkInter, &DBusSink::VolumeChanged, this, &SoundApplet::onVolumeChanged);
    connect(m_defSinkInter, &DBusSink::MuteChanged, this, &SoundApplet::onVolumeChanged);

    emit defaultSinkChanged(m_defSinkInter);
}
开发者ID:linuxdeepin,项目名称:dde-dock,代码行数:12,代码来源:soundapplet.cpp

示例15: _q_userAdded

void AccountsManagerPrivate::_q_userAdded(const QDBusObjectPath &path)
{
    Q_Q(AccountsManager);

    if (usersCache.contains(path.path())) {
        Q_EMIT q->userAdded(usersCache[path.path()]);
        return;
    }

    UserAccount *account = new UserAccount(path.path(), interface->connection());
    usersCache[path.path()] = account;
    Q_EMIT q->userAdded(account);
}
开发者ID:AOSC-Dev,项目名称:qtaccountsservice,代码行数:13,代码来源:accountsmanager.cpp


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