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


C++ QDBusMessage::arguments方法代码示例

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


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

示例1: refreshMasterVolume

void KMixVolumeConfigurationPlugin::refreshMasterVolume()
{
    QDBusMessage message = QDBusMessage::createMethodCall("org.kde.kmix", "/Mixer0", "org.kde.KMix", "masterVolume");
    QDBusMessage reply = dbus.call(message, QDBus::Block);
    int newVolume = reply.arguments().at(0).toInt();
    if(newVolume != masterVolume.getValue().toInt())
    {
        masterVolume.setValue(newVolume);
    }
}
开发者ID:bzar,项目名称:qml-configuration-plugin-prototype,代码行数:10,代码来源:kmixvolume.cpp

示例2: launchCommand

bool ProcessRunner::launchCommand(const QString &command)
{
    const QDBusConnection bus = QDBusConnection::sessionBus();
    QDBusInterface interface(QStringLiteral("io.liri.Session"),
                             QStringLiteral("/ProcessLauncher"),
                             QStringLiteral("io.liri.ProcessLauncher"),
                             bus);
    QDBusMessage msg = interface.call(QStringLiteral("launchCommand"), command);
    return msg.arguments().at(0).toBool();
}
开发者ID:qmlos,项目名称:shell,代码行数:10,代码来源:processrunner.cpp

示例3: registerService

/*!
    Releases the claim on the bus service name \a serviceName, that
    had been previously registered with registerService(). If this
    application had ownership of the name, it will be released for
    other applications to claim. If it only had the name queued, it
    gives up its position in the queue.
*/
QDBusReply<bool>
QDBusConnectionInterface::unregisterService(const QString &serviceName)
{
    QDBusMessage reply = call(QLatin1String("ReleaseName"), serviceName);
    if (reply.type() == QDBusMessage::ReplyMessage) {
        bool success = reply.arguments().at(0).toUInt() == DBUS_RELEASE_NAME_REPLY_RELEASED;
        reply.setArguments(QVariantList() << success);
    }
    return reply;
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:17,代码来源:qdbusconnectioninterface.cpp

示例4: handleMessage

bool DeclarativeDBusAdaptor::handleMessage(const QDBusMessage &message, const QDBusConnection &connection)
{
    QVariant variants[10];
    QGenericArgument arguments[10];

    const QMetaObject * const meta = metaObject();
    const QVariantList dbusArguments = message.arguments();

    QString member = message.member();
    QString interface = message.interface();

    // Don't try to handle introspect call. It will be handled
    // internally for QDBusVirtualObject derived classes.
    if (interface == QLatin1String("org.freedesktop.DBus.Introspectable")) {
        return false;
    } else if (interface == QLatin1String("org.freedesktop.DBus.Properties")) {
        if (member == QLatin1String("Get")) {
            interface = dbusArguments.value(0).toString();
            member = dbusArguments.value(1).toString();

            const QMetaObject * const meta = metaObject();
            if (!member.isEmpty() && member.at(0).isUpper())
                member = "rc" + member;

            for (int propertyIndex = meta->propertyOffset();
                    propertyIndex < meta->propertyCount();
                    ++propertyIndex) {
                QMetaProperty property = meta->property(propertyIndex);

                if (QLatin1String(property.name()) != member)
                    continue;

                QVariant value = property.read(this);
                if (value.userType() == qMetaTypeId<QJSValue>())
                    value = value.value<QJSValue>().toVariant();

                if (value.userType() == QVariant::List) {
                    QVariantList variantList = value.toList();
                    if (variantList.count() > 0) {

                        QDBusArgument list;
                        list.beginArray(variantList.first().userType());
                        foreach (const QVariant &listValue, variantList) {
                            list << listValue;
                        }
                        list.endArray();
                        value = QVariant::fromValue(list);
                    }
                }

                QDBusMessage reply = message.createReply(QVariantList() << value);
                connection.call(reply, QDBus::NoBlock);

                return true;
            }
开发者ID:jlehtoranta,项目名称:nemo-qml-plugin-dbus,代码行数:55,代码来源:declarativedbusadaptor.cpp

示例5: if

int
PlatformUdisks2::open(DeviceItem* item)
{
    int ret = -1;

    QDBusConnection connection = QDBusConnection::systemBus();
    QList<QVariant> args;
    QVariantMap map;
    args << map;

    QString udi = QString("/org/freedesktop/UDisks2/block_devices/%1").arg(item->getUDI());
    QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.UDisks2", udi, "org.freedesktop.UDisks2.Block", "OpenForRestore");
    message.setArguments(args);
    QDBusMessage reply = connection.call(message);

    if (reply.type() == QDBusMessage::ErrorMessage)
    {
        QMessageBox msgBox;
        msgBox.setText(QString("DBUS error (%1): %2").arg(item->getUDI()).arg(reply.errorMessage()));
        msgBox.exec();
        ret = -1;
    }
    else if (reply.arguments().empty() || reply.arguments()[0].userType() != qMetaTypeId<QDBusUnixFileDescriptor>())
    {
        QMessageBox msgBox;
        msgBox.setText(QString("got empty or invalid reply!?"));
        msgBox.exec();
	errno = EINVAL;
    }
    else
    {
	QDBusUnixFileDescriptor fd(qvariant_cast<QDBusUnixFileDescriptor>(reply.arguments()[0]));
	if (fd.isValid())
	{
	    ret = ::dup(fd.fileDescriptor());
	}
    }

    qDebug() << "ret" << ret;

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

示例6:

QList<QVariant> TestNetctlAuto::sendDBusRequest(const QString path, const QString cmd, const QList<QVariant> args)
{
    QDBusConnection bus = QDBusConnection::systemBus();
    QDBusMessage request = QDBusMessage::createMethodCall(DBUS_HELPER_SERVICE, path,
                                                          DBUS_HELPER_INTERFACE, cmd);
    if (!args.isEmpty()) request.setArguments(args);
    QDBusMessage response = bus.call(request);
    QList<QVariant> arguments = response.arguments();

    return arguments;
}
开发者ID:arcan1s,项目名称:netctl-gui,代码行数:11,代码来源:testnetctlauto.cpp

示例7: dispatchEvent

	//Callback (slot) used to retrieve subscribed event information
	void DBusInterface::dispatchEvent(const QDBusMessage& message)
	{
		// unpack event
		QString eventReceivedName= message.arguments().at(1).value<QString>();
		Values eventReceivedValues = dBusMessagetoValues(message,2);
		// find and trigger matching callback
		if( callbacks.count(eventReceivedName) > 0)
		{
			callbacks[eventReceivedName](eventReceivedValues);
		}
	}
开发者ID:antoinealb,项目名称:aseba,代码行数:12,代码来源:dbusinterface.cpp

示例8: restoreExistSession

bool restoreExistSession()
{
    QDBusConnection bus = QDBusConnection::sessionBus();
    QDBusMessage request = QDBusMessage::createMethodCall(QString(DBUS_SERVICE),
                                                          QString(DBUS_OBJECT_PATH),
                                                          QString(DBUS_INTERFACE),
                                                          QString("Restore"));
    QDBusMessage response = bus.call(request);
    QList<QVariant> arguments = response.arguments();
    return ((arguments.size() == 1) && arguments[0].toBool());
}
开发者ID:sx9,项目名称:netctl-gui,代码行数:11,代码来源:main.cpp

示例9: waitForReply

QVariant DBusResponseWaiter::waitForReply(QVariant variant) const
{
    if (QDBusPendingCall* call = const_cast<QDBusPendingCall*>(extractPendingCall(variant)))
    {
        call->waitForFinished();
        
        if (call->isError())
        {
            return QVariant("error");
        }
        
        QDBusMessage reply = call->reply();

        if (reply.arguments().count() > 0)
        {
            return reply.arguments().first();
        }
    }
    return QVariant();
}
开发者ID:netrunner-debian-kde-extras,项目名称:kdeconnect,代码行数:20,代码来源:responsewaiter.cpp

示例10: call

QVariant DBusHandler::call(QDBusInterface *interface,
                           const QString &query,
                           const QVariant &arg1,
                           const QVariant &arg2,
                           const QVariant &arg3,
                           const QVariant &arg4,
                           const QVariant &arg5,
                           const QVariant &arg6,
                           const QVariant &arg7,
                           const QVariant &arg8) const
{
    QDBusMessage reply = interface->call(query, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
    if (reply.arguments().length() > 1) {
        return QVariant(reply.arguments());
    } else if (reply.arguments().length() > 0) {
        return reply.arguments().at(0);
    } else {
        return QVariant();
    }
}
开发者ID:KDE,项目名称:wicd-kde,代码行数:20,代码来源:dbushandler.cpp

示例11: implementorName

/// Returns the name of the current implementor of an interface. If an error
/// occurs (e.g., we cannot connect to the Meego service mapper), returns an
/// empty string.
QString ServiceResolver::implementorName(const QString& interface)
{
    if (resolved.contains(interface))
        return resolved[interface];

    if (!mapperProxy->isValid()) {
        LCA_WARNING << "cannot connect to service mapper";
        return "";
    }

    // A blocking call
    QDBusMessage reply = mapperProxy->call("serviceName", interface);
    if (reply.type() != QDBusMessage::ReplyMessage || reply.arguments().size() == 0) {
        LCA_WARNING << "invalid reply from service mapper" << reply.errorName();
        return "";
    }
    QString service = reply.arguments()[0].toString();
    resolved.insert(interface, service);
    return service;
}
开发者ID:dudochkin-victor,项目名称:libcontentaction,代码行数:23,代码来源:service.cpp

示例12: serviceRegistered

/*!
    Requests to register the service name \a serviceName on the
    bus. The \a qoption flag specifies how the D-Bus server should behave
    if \a serviceName is already registered. The \a roption flag
    specifies if the server should allow another application to
    replace our registered name.

    If the service registration succeeds, the serviceRegistered()
    signal will be emitted. If we are placed in queue, the signal will
    be emitted when we obtain the name. If \a roption is
    AllowReplacement, the serviceUnregistered() signal will be emitted
    if another application replaces this one.

    \sa unregisterService()
*/
QDBusReply<QDBusConnectionInterface::RegisterServiceReply>
QDBusConnectionInterface::registerService(const QString &serviceName,
                                          ServiceQueueOptions qoption,
                                          ServiceReplacementOptions roption)
{
    // reconstruct the low-level flags
    uint flags = 0;
    switch (qoption) {
    case DontQueueService:
        flags = DBUS_NAME_FLAG_DO_NOT_QUEUE;
        break;
    case QueueService:
        flags = 0;
        break;
    case ReplaceExistingService:
        flags = DBUS_NAME_FLAG_DO_NOT_QUEUE | DBUS_NAME_FLAG_REPLACE_EXISTING;
        break;
    }

    switch (roption) {
    case DontAllowReplacement:
        break;
    case AllowReplacement:
        flags |= DBUS_NAME_FLAG_ALLOW_REPLACEMENT;
        break;
    }

    QDBusMessage reply = call(QLatin1String("RequestName"), serviceName, flags);
//    qDebug() << "QDBusConnectionInterface::registerService" << serviceName << "Reply:" << reply;

    // convert the low-level flags to something that we can use
    if (reply.type() == QDBusMessage::ReplyMessage) {
        uint code = 0;

        switch (reply.arguments().at(0).toUInt()) {
        case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
        case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
            code = uint(ServiceRegistered);
            break;

        case DBUS_REQUEST_NAME_REPLY_EXISTS:
            code = uint(ServiceNotRegistered);
            break;

        case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
            code = uint(ServiceQueued);
            break;
        }

        reply.setArguments(QVariantList() << code);
    }

    return reply;
}
开发者ID:Afreeca,项目名称:qt,代码行数:69,代码来源:qdbusconnectioninterface.cpp

示例13: dbusCall

/************************************************
 Helper func
 ************************************************/
static bool dbusCall(const QString &service,
              const QString &path,
              const QString &interface,
              const QDBusConnection &connection,
              const QString & method,
              PowerProvider::DbusErrorCheck errorCheck = PowerProvider::CheckDBUS
              )
{
    QDBusInterface dbus(service, path, interface, connection);
    if (!dbus.isValid())
    {
        qWarning() << "dbusCall: QDBusInterface is invalid" << service << path << interface << method;
        if (errorCheck == PowerProvider::CheckDBUS)
        {
            Notification::notify(
                                    QObject::tr("Power Manager Error"),
                                    QObject::tr("QDBusInterface is invalid")+ "\n\n" + service + " " + path + " " + interface + " " + method,
                                    "lxqt-logo.png");
        }
        return false;
    }

    QDBusMessage msg = dbus.call(method);

    if (!msg.errorName().isEmpty())
    {
        printDBusMsg(msg);
        if (errorCheck == PowerProvider::CheckDBUS)
        {
            Notification::notify(
                                    QObject::tr("Power Manager Error (D-BUS call)"),
                                    msg.errorName() + "\n\n" + msg.errorMessage(),
                                    "lxqt-logo.png");
        }
    }

    // If the method no returns value, we believe that it was successful.
    return msg.arguments().isEmpty() ||
           msg.arguments().first().isNull() ||
           msg.arguments().first().toBool();
}
开发者ID:siduction-upstream,项目名称:liblxqt,代码行数:44,代码来源:lxqtpowerproviders.cpp

示例14: initObjects

bool DbusPopupHandler::initObjects()
{
	if (!initNotifyInterface())
		return false;

	FServerInfo = new ServerInfo;

	QDBusMessage replyCaps = FNotifyInterface->call(QDBus::Block, "GetCapabilities");
	if (replyCaps.type() != QDBusMessage::ErrorMessage)
	{
		for (int i=0; i<replyCaps.arguments().at(0).toStringList().count(); i++)
			LOG_INFO(QString("Capabilities: %1").arg(replyCaps.arguments().at(0).toStringList().at(i)));
		FServerInfo->capabilities = replyCaps.arguments().at(0).toStringList();
		FAllowActions = FServerInfo->capabilities.contains("actions");
	}
	else
		LOG_WARNING(QString("Capabilities: DBus Error: %1").arg(replyCaps.errorMessage()));

	QDBusMessage replyInfo = FNotifyInterface->call(QDBus::Block, "GetServerInformation");
	if (replyInfo.type() != QDBusMessage::ErrorMessage)
	{
		for (int i=0; i<replyInfo.arguments().count(); i++)
			LOG_INFO(QString("Server Information: %1").arg(replyInfo.arguments().at(i).toString()));

		FServerInfo->name = replyInfo.arguments().at(0).toString();
		FServerInfo->vendor = replyInfo.arguments().at(1).toString();
		FServerInfo->version = replyInfo.arguments().at(2).toString();
		FServerInfo->spec_version = replyInfo.arguments().at(3).toString();

	}
	else
		LOG_WARNING(QString("Server Information: DBus Error: %1").arg(replyInfo.errorMessage()));

	if (FAllowActions)
	{
		connect(FNotifyInterface,SIGNAL(ActionInvoked(uint,QString)),this,SLOT(onActionInvoked(uint,QString)));
		connect(FNotifyInterface,SIGNAL(NotificationClosed(uint,uint)),this,SLOT(onNotificationClosed(uint,uint)));
		LOG_INFO(QLatin1String("Actions supported."));
	}
	else
		LOG_INFO(QLatin1String("Actions not supported."));

	FNotifications->insertNotificationHandler(NHO_DBUSPOPUP, this);

	return true;
}
开发者ID:Vacuum-IM,项目名称:dbusnotifications,代码行数:46,代码来源:dbuspopuphandler.cpp

示例15: 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();
    }
}
开发者ID:Rusto,项目名称:openmediaplayer,代码行数:21,代码来源:missioncontrol.cpp


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