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


C++ QStringMap::contains方法代码示例

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


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

示例1: setParams

/**
* This controller needs the parameter 'machine' with the name of the machine
*
* \param[in] params The parameter map
*/
void InfoController::setParams(const QStringMap& params)
{
	if( !params.contains("machine") || !params.contains("machine"))
	{
		std::cerr << "InfoController: Required parameter not found" << std::endl;
		return;
	}

	_machine = params["machine"];
	_model.setDatabaseFile( params["db"] );
}
开发者ID:xjrsanchezx,项目名称:hvg-interface,代码行数:16,代码来源:infoController.cpp

示例2: readConfig

void VpncSettingWidget::readConfig()
{
    Q_D(VpncSettingWidget);
    // General settings
    QStringMap dataMap = d->setting->data();
    //   gateway
    QString gateway = dataMap[NM_VPNC_KEY_GATEWAY];
    if (!gateway.isEmpty()) {
        d->ui.leGateway->setText(gateway);
    }
    //   username
    QString user = dataMap[NM_VPNC_KEY_XAUTH_USER];
    if (!user.isEmpty()) {
        d->ui.leUserName->setText(user);
    }
    //   group name
    QString group = dataMap[NM_VPNC_KEY_ID];
    if (!group.isEmpty()) {
        d->ui.leGroupName->setText(group);
    }
    // hybrid auth
    if (dataMap[NM_VPNC_KEY_AUTHMODE] == QLatin1String("hybrid")) {
        d->ui.cbUseHybridAuth->setChecked(true);
        d->ui.leCaCertPath->setUrl(KUrl(dataMap[NM_VPNC_KEY_CA_FILE]));
    }
    // password storage type is set in readSecrets

    // Optional settings
    //   domain
    QString domain = dataMap[NM_VPNC_KEY_DOMAIN];
    if (!domain.isEmpty()) {
        d->ui.leDomain->setText(domain);
    }

    //   encryption
    if (dataMap[NM_VPNC_KEY_SINGLE_DES] == QLatin1String("yes")) {
        d->ui.cboEncryptionMethod->setCurrentIndex(VpncSettingWidgetPrivate::EnumEncryptionMethod::Weak);
    } else if (dataMap[NM_VPNC_KEY_NO_ENCRYPTION] == QLatin1String("yes")) {
        d->ui.cboEncryptionMethod->setCurrentIndex(VpncSettingWidgetPrivate::EnumEncryptionMethod::None);
    }

    //   nat traversal
    if (dataMap[NM_VPNC_KEY_NAT_TRAVERSAL_MODE] == NM_VPNC_NATT_MODE_NATT)
        d->ui.cboNatTraversal->setCurrentIndex(VpncSettingWidgetPrivate::EnumNatt::NattIfAvail);
    else if (dataMap[NM_VPNC_KEY_NAT_TRAVERSAL_MODE] == NM_VPNC_NATT_MODE_NATT_ALWAYS)
        d->ui.cboNatTraversal->setCurrentIndex(VpncSettingWidgetPrivate::EnumNatt::Force);
    else if (dataMap[NM_VPNC_KEY_NAT_TRAVERSAL_MODE] == NM_VPNC_NATT_MODE_CISCO)
        d->ui.cboNatTraversal->setCurrentIndex(VpncSettingWidgetPrivate::EnumNatt::CiscoUdp);
    else if (dataMap[NM_VPNC_KEY_NAT_TRAVERSAL_MODE] == NM_VPNC_NATT_MODE_NONE)
        d->ui.cboNatTraversal->setCurrentIndex(VpncSettingWidgetPrivate::EnumNatt::Disabled);

    //   dead peer detection
    if (dataMap.contains(NM_VPNC_KEY_DPD_IDLE_TIMEOUT)) {
        uint dpdTimeout = dataMap.value(NM_VPNC_KEY_DPD_IDLE_TIMEOUT).toUInt();
        if (dpdTimeout == 0) {
            d->ui.chkDeadPeerDetection->setChecked(false);
            d->dpdTimeout = dpdTimeout;
        }
    }
    //   dh group
    if (dataMap.contains(NM_VPNC_KEY_DHGROUP)) {
        QString dhGroup = dataMap.value(NM_VPNC_KEY_DHGROUP);
        if (dhGroup == NM_VPNC_DHGROUP_DH1) {
            // DH Group 1
            d->ui.cboDHGroup->setCurrentIndex(VpncSettingWidgetPrivate::EnumDh::Dh1);
        } else if (dhGroup == NM_VPNC_DHGROUP_DH2) {
            // DH Group 2
            d->ui.cboDHGroup->setCurrentIndex(VpncSettingWidgetPrivate::EnumDh::Dh2);
        } else if (dhGroup == NM_VPNC_DHGROUP_DH5) {
            // DH Group 5
            d->ui.cboDHGroup->setCurrentIndex(VpncSettingWidgetPrivate::EnumDh::Dh5);
        }
    }

    // Perfect Forward Secrecy
    if (dataMap.contains(NM_VPNC_KEY_PERFECT_FORWARD)) {
        QString forwardSecrecy = dataMap.value(NM_VPNC_KEY_PERFECT_FORWARD);
        if (forwardSecrecy == QLatin1String("nopfs")) {
            d->ui.cboPerfectForwardSecrecy->setCurrentIndex(VpncSettingWidgetPrivate::EnumPerfectForwardSecrecy::NoPfs);
        } else if (forwardSecrecy == QLatin1String("server")) {
            d->ui.cboPerfectForwardSecrecy->setCurrentIndex(VpncSettingWidgetPrivate::EnumPerfectForwardSecrecy::Server);
        } else if (forwardSecrecy == QLatin1String("dh1")) {
            d->ui.cboPerfectForwardSecrecy->setCurrentIndex(VpncSettingWidgetPrivate::EnumPerfectForwardSecrecy::Dh1);
        } else if (forwardSecrecy == QLatin1String("dh2")) {
            d->ui.cboPerfectForwardSecrecy->setCurrentIndex(VpncSettingWidgetPrivate::EnumPerfectForwardSecrecy::Dh2);
        } else if (forwardSecrecy == QLatin1String("dh5")) {
            d->ui.cboPerfectForwardSecrecy->setCurrentIndex(VpncSettingWidgetPrivate::EnumPerfectForwardSecrecy::Dh5);
        }
    }

    // Vendor
    if (dataMap.contains(NM_VPNC_KEY_VENDOR)) {
        QString vendor = dataMap.value(NM_VPNC_KEY_VENDOR);
        if (vendor == QLatin1String("cisco")) {
            d->ui.cboVendor->setCurrentIndex(VpncSettingWidgetPrivate::EnumVendor::Cisco);
        } else if (vendor == QLatin1String("netscreen")) {
            d->ui.cboVendor->setCurrentIndex(VpncSettingWidgetPrivate::EnumVendor::Netscreen);
        }
    }

//.........这里部分代码省略.........
开发者ID:netrunner-debian-kde-extras,项目名称:networkmanagement,代码行数:101,代码来源:vpncwidget.cpp


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