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


C++ QDBusArgument::endArray方法代码示例

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


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

示例1: error

UdisksManager::UdisksManager(QObject *parent)
    : QObject(parent)
{
    QDBusConnection system = QDBusConnection::systemBus();

    if (!system.isConnected())
    {
        emit error(tr("Cannot connect to Udisks daemon"));
    }

    system.connect("org.freedesktop.UDisks",
                    "/org/freedesktop/UDisks",
                    "org.freedesktop.UDisks",
                    "DeviceAdded",
                    this,
                    SLOT(onDeviceAdded(QDBusObjectPath)));
    system.connect("org.freedesktop.UDisks",
                    "/org/freedesktop/UDisks",
                    "org.freedesktop.UDisks",
                    "DeviceRemoved",
                    this,
                    SLOT(onDeviceRemoved(QDBusObjectPath)));
    system.connect("org.freedesktop.UDisks",
                    "/org/freedesktop/UDisks",
                    "org.freedesktop.UDisks",
                    "DeviceChanged",
                    this,
                    SLOT(onDeviceChanged(QDBusObjectPath)));

    QDBusInterface devEnum("org.freedesktop.UDisks",
                           "/org/freedesktop/UDisks",
                           "org.freedesktop.UDisks",
                           QDBusConnection::systemBus());

    QDBusMessage enumRes = devEnum.call("EnumerateDevices");
    // TODO/FIXME: error checking
//    if (enumRes.type() == QDBusMessage::ErrorMessage)
//    {
//        fprintf(stderr, "ERROR: Can't call EnumerateDevices\n");
//        fprintf(stderr, "       %s : %s\n", qPrintable(enumRes.errorName()), qPrintable(enumRes.errorMessage()));
//    }
//
//    if (enumRes.type() != QDBusMessage::ReplyMessage || !enumRes.arguments().at(0).canConvert<QDBusArgument>())
//    {
//        fprintf(stderr, "ERROR: Unexpected result type of EnumerateDevices call\n");
//    }
//
    const QDBusArgument enumArg = enumRes.arguments().at(0).value<QDBusArgument>();
//    if (enumArg.currentType() != QDBusArgument::ArrayType)
//    {
//        fprintf(stderr, "ERROR: Unexpected argument type of EnumerateDevices call\n");
//    }

    enumArg.beginArray();
    while (!enumArg.atEnd())
    {
        addDevice(qdbus_cast<QDBusObjectPath>(enumArg));
    }
    enumArg.endArray();
}
开发者ID:bwalter,项目名称:razor-qt,代码行数:60,代码来源:udisksmanager.cpp

示例2: 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

示例3: dBusArgConvertAAY

QStringList Partition::dBusArgConvertAAY(const QDBusArgument &byteArrayArray) const
{
	QStringList stringList;
	byteArrayArray.beginArray();
	while (!byteArrayArray.atEnd())
		stringList << qdbus_cast<QByteArray>(byteArrayArray);

	byteArrayArray.endArray();

	return stringList;
}
开发者ID:vic-prog,项目名称:libqdrive,代码行数:11,代码来源:Partition.cpp

示例4: while

QList<QDBusObjectPath> Udisks2Lister::GetMountedPartitionsFromDBusArgument(
    const QDBusArgument& input) {
  QList<QDBusObjectPath> result;

  input.beginArray();
  while (!input.atEnd()) {
    QDBusObjectPath extractedPath;
    input >> extractedPath;
    result.push_back(extractedPath);
  }
  input.endArray();

  return result;
}
开发者ID:Atrament666,项目名称:Clementine,代码行数:14,代码来源:udisks2lister.cpp

示例5: call

std::vector<Device> KinesixdProxy::GetValidDeviceList()
{
    QDBusMessage reply = call(QDBus::BlockWithGui, KINESIXD_GET_VALID_DEVICE_LIST);
    QDBusArgument arg = reply.arguments().at(0).value<QDBusArgument>();

    std::vector<Device> deviceList;
    arg.beginArray();
    while (!arg.atEnd())
    {
        Device d;
        arg >> d;
        deviceList.push_back(d);
    }
    arg.endArray();

    return deviceList;
}
开发者ID:kicsyromy,项目名称:kinesix_client,代码行数:17,代码来源:kinesixd_proxy.cpp

示例6: update

void UDiskProvider::update()
{

    QDBusInterface devEnum("org.freedesktop.UDisks",
                           "/org/freedesktop/UDisks",
                           "org.freedesktop.UDisks",
                           QDBusConnection::systemBus());

    QDBusMessage enumRes = devEnum.call("EnumerateDevices");
    if (enumRes.type() != QDBusMessage::ReplyMessage || !enumRes.arguments().at(0).canConvert<QDBusArgument>())
    {
        if (enumRes.type() == QDBusMessage::ErrorMessage)
            qWarning() << "ERROR: Can't call EnumerateDevices"
                       <<  qPrintable(enumRes.errorName()) << qPrintable(enumRes.errorMessage());
        else
            qWarning() << "ERROR: Unexpected result type of EnumerateDevices call";
        return;
    }

    const QDBusArgument enumArg = enumRes.arguments().at(0).value<QDBusArgument>();
    if (enumArg.currentType() != QDBusArgument::ArrayType)
    {
        qWarning() << "ERROR: Unexpected argument type of EnumerateDevices call";
        return;
    }

    enumArg.beginArray();
    while (!enumArg.atEnd())
    {
        QDBusObjectPath path = qdbus_cast<QDBusObjectPath>(enumArg);

        if (mDevicesByPath.contains(path.path()))
            dbusDeviceChanged(path);
        else
            dbusDeviceAdded(path);
    }
    enumArg.endArray();

}
开发者ID:PeterJespersen,项目名称:razor-qt,代码行数:39,代码来源:rzmountproviders.cpp

示例7: loadNetworks

void SavedNetworksList::loadNetworks() {
    savedNetworks.clear();
    QDBusMessage m = savedInterface->call(QDBus::Block, "ListConnections");
    QDBusArgument knownNetworks = m.arguments().first().value<QDBusArgument>();
    knownNetworks.beginArray();
    while (!knownNetworks.atEnd()) {
        QDBusObjectPath o;
        knownNetworks >> o;

        QDBusMessage settingsMessage = QDBusMessage::createMethodCall("org.freedesktop.NetworkManager", o.path(), "org.freedesktop.NetworkManager.Settings.Connection", "GetSettings");
        QDBusArgument settingsArg = QDBusConnection::systemBus().call(settingsMessage).arguments().first().value<QDBusArgument>();
        QMap<QString, QVariantMap> settings;
        settingsArg >> settings;

        Setting s;
        QVariantMap connectionSettings = settings.value("connection");
        s.path = o;
        s.name = connectionSettings.value("id").toString();

        if (connectionSettings.value("type") == "802-3-ethernet") {
            s.NetworkType = Setting::Wired;
        } else if (connectionSettings.value("type") == "802-11-wireless") {
            s.NetworkType = Setting::Wireless;
        } else if (connectionSettings.value("type") == "bluetooth") {
            s.NetworkType = Setting::Bluetooth;
        } else if (connectionSettings.value("type") == "vpn") {
            s.NetworkType = Setting::VPN;
        } else if (connectionSettings.value("type") == "gsm" || connectionSettings.value("type") == "cdma") {
            s.NetworkType = Setting::Mobile;
        } else {
            s.NetworkType = Setting::Unknown;
        }

        savedNetworks.append(s);
    }
    knownNetworks.endArray();

    this->dataChanged(this->index(0), this->index(this->rowCount()));
}
开发者ID:bao-boyle,项目名称:theshell,代码行数:39,代码来源:savednetworkslist.cpp

示例8: sipNoMethod

static PyObject *meth_QDBusArgument_endArray(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        QDBusArgument *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QDBusArgument, &sipCpp))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp->endArray();
            Py_END_ALLOW_THREADS

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QDBusArgument, sipName_endArray, doc_QDBusArgument_endArray);

    return NULL;
}
开发者ID:annelida,项目名称:stuff,代码行数:23,代码来源:sipQtDBusQDBusArgument.cpp


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