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


C++ QNetworkProxy::setHostName方法代码示例

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


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

示例1: setApplicationProxy

void ProxyDialog::setApplicationProxy()
{
    if (ui->checkProxyStatus->checkState() == Qt::Checked)
    {
        QNetworkProxy proxy;
        proxy.setType(getProxyType());
        proxy.setHostName(ui->editAddress->text());
        proxy.setPort(ui->editPort->text().toInt());
        proxy.setUser(ui->editUserName->text());
        proxy.setPassword(ui->editPassword->text());
        QNetworkProxy::setApplicationProxy(proxy);
    }
    else
    {
        QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
    }
}
开发者ID:AlvaroSacari,项目名称:WizQTClient,代码行数:17,代码来源:wizproxydialog.cpp

示例2: readSettings

void MainWindow::readSettings()
{
	static bool firstRun = true;
	QSettings s;
	// the static object for preferences already reads in the settings
	// and sets up the font, so just get what we need for the toolbox and other widgets here

	s.beginGroup("TecDetails");
	TOOLBOX_PREF_BUTTON(calcalltissues, calcalltissues, profCalcAllTissues);
	TOOLBOX_PREF_BUTTON(calcceiling, calcceiling, profCalcCeiling);
	TOOLBOX_PREF_BUTTON(dcceiling, dcceiling, profDcCeiling);
	TOOLBOX_PREF_BUTTON(ead, ead, profEad);
	TOOLBOX_PREF_BUTTON(calcceiling3m, calcceiling3m, profIncrement3m);
	TOOLBOX_PREF_BUTTON(mod, mod, profMod);
	TOOLBOX_PREF_BUTTON(calcndltts, calcndltts, profNdl_tts);
	TOOLBOX_PREF_BUTTON(pp_graphs.phe, phegraph, profPhe);
	TOOLBOX_PREF_BUTTON(pp_graphs.pn2, pn2graph, profPn2);
	TOOLBOX_PREF_BUTTON(pp_graphs.po2, po2graph, profPO2);
	TOOLBOX_PREF_BUTTON(hrgraph, hrgraph, profHR);
	TOOLBOX_PREF_BUTTON(rulergraph, rulergraph, profRuler);
	TOOLBOX_PREF_BUTTON(show_sac, show_sac, profSAC);
	TOOLBOX_PREF_BUTTON(show_pictures_in_profile, show_pictures_in_profile, profTogglePicture);
	TOOLBOX_PREF_BUTTON(tankbar, tankbar, profTankbar);
	TOOLBOX_PREF_BUTTON(percentagegraph, percentagegraph, profTissues);
	s.endGroup();
	s.beginGroup("DiveComputer");
	default_dive_computer_vendor = getSetting(s, "dive_computer_vendor");
	default_dive_computer_product = getSetting(s, "dive_computer_product");
	default_dive_computer_device = getSetting(s, "dive_computer_device");
	s.endGroup();
	QNetworkProxy proxy;
	proxy.setType(QNetworkProxy::ProxyType(prefs.proxy_type));
	proxy.setHostName(prefs.proxy_host);
	proxy.setPort(prefs.proxy_port);
	if (prefs.proxy_auth) {
		proxy.setUser(prefs.proxy_user);
		proxy.setPassword(prefs.proxy_pass);
	}
	QNetworkProxy::setApplicationProxy(proxy);

	loadRecentFiles(&s);
	if (firstRun) {
		checkSurvey(&s);
		firstRun = false;
	}
}
开发者ID:parikmaher534,项目名称:subsurface,代码行数:46,代码来源:mainwindow.cpp

示例3: winFile

/**
 * Constructor with default argument
 * @param aParent The parent object
 */
SmfTransportManagerUtil::SmfTransportManagerUtil ( )
		: m_networkAccessManager ( this )
	{
	// Storage of settings (Only data usage as of now)
	m_settings = new QSettings("Sasken", "SmfTransportManager");

	// Create the settings if no data is stored
	if( !m_settings->contains("Sent Data") )
		m_settings->setValue("Sent Data", 0);
	if( !m_settings->contains("Received Data") )
		m_settings->setValue("Received Data", 0);
	
#ifdef EMULATORTESTING
	qDebug()<<"Using PROXY SETTINGS!!!, change for device testing";
	
	// Reading the keys, CSM Stubbed - START
	QFile winFile("c:\\data\\DoNotShare.txt");
	if (!winFile.open(QIODevice::ReadOnly))
		{
		qDebug()<<"File to read the windows username and password could not be opened, returning!!!";
		return;
		}
	
	QByteArray winArr = winFile.readAll();
	QList<QByteArray> winList = winArr.split(' ');
	winFile.close();
	
	QString httpUser(winList[0]);
	QString httpPass(winList[1]);

    // For proxy settings on emulator only - REMOVE for device
    QString httpProxy = "10.1.0.214";
    QString httpPort = "3128";
    
    //==Classes used from Network Module==
    QNetworkProxy proxy;

    proxy.setType(QNetworkProxy::HttpProxy);
    proxy.setHostName(httpProxy);
    proxy.setPort(httpPort.toInt());
    proxy.setUser(httpUser);
    proxy.setPassword(httpPass);
		
    QNetworkProxy::setApplicationProxy(proxy);
#endif
	}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:50,代码来源:smftransportmanagerutil.cpp

示例4: getProxySettings

bool OptionsModel::getProxySettings(QNetworkProxy& proxy) const
{
    // Directly query current base proxy, because
    // GUI settings can be overridden with -proxy.
    proxyType curProxy;
    if (GetProxy(NET_IPV4, curProxy)) {
        proxy.setType(QNetworkProxy::Socks5Proxy);
        proxy.setHostName(QString::fromStdString(curProxy.proxy.ToStringIP()));
        proxy.setPort(curProxy.proxy.GetPort());

        return true;
    }
    else
        proxy.setType(QNetworkProxy::NoProxy);

    return false;
}
开发者ID:franklee1,项目名称:asdasdf,代码行数:17,代码来源:optionsmodel.cpp

示例5: loadSettings

void NetworkAccessManager::loadSettings()
{
    QSettings settings;
    settings.beginGroup(QLatin1String("proxy"));
    QNetworkProxy proxy;
    if (settings.value(QLatin1String("enabled"), false).toBool()) {
        if (settings.value(QLatin1String("type"), 0).toInt() == 0)
            proxy = QNetworkProxy::Socks5Proxy;
        else
            proxy = QNetworkProxy::HttpProxy;
        proxy.setHostName(settings.value(QLatin1String("hostName")).toString());
        proxy.setPort(settings.value(QLatin1String("port"), 1080).toInt());
        proxy.setUser(settings.value(QLatin1String("userName")).toString());
        proxy.setPassword(settings.value(QLatin1String("password")).toString());
    }
    setProxy(proxy);
}
开发者ID:Fale,项目名称:qtmoko,代码行数:17,代码来源:networkaccessmanager.cpp

示例6: loadSettings

void ThunderCore::loadSettings()
{
    QSettings settings;
    settings.beginGroup("Proxy");

    if (settings.value("ProxyEnabled", false).toBool())
    {
        QNetworkProxy proxy;
        proxy.setUser(settings.value("User").toString());
        proxy.setPassword(settings.value("Cred").toString());
        proxy.setHostName(settings.value("Server").toString());

        error (tr("Proxy %1 is enabled.").arg(proxy.hostName()), Info);
        tc_nam->setProxy(proxy);
    }

}
开发者ID:0ks3ii,项目名称:XLCloudClient,代码行数:17,代码来源:thundercore.cpp

示例7: getUrl

void httpsocket::getUrl(QString url)
{
    if(this->useProxy==true){
        QNetworkProxy proxy;
        proxy.setType(QNetworkProxy::HttpProxy);
        proxy.setHostName(this->proxyAddress);//"200.50.166.43"
        proxy.setPort(this->proxyPort);//8080
        //proxy.setUser("username");
        //proxy.setPassword("password");
        QNetworkProxy::setApplicationProxy(proxy);
    }

    qDebug()<< "Connecting...";
    QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    connect(manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(replyFinished(QNetworkReply*)));

    manager->get(QNetworkRequest(QUrl(url)));
}
开发者ID:80Z,项目名称:Stealth,代码行数:18,代码来源:httpsocket.cpp

示例8: setProxyHostPort

void JuickDownloader::setProxyHostPort(const QString& host, int port, const QString& username, const QString& pass, const QString& type)
{
    QNetworkProxy prx;

    if(!host.isEmpty()) {
        prx.setType(QNetworkProxy::HttpCachingProxy);
        if(type == "socks")
            prx.setType(QNetworkProxy::Socks5Proxy);
        prx.setPort(port);
        prx.setHostName(host);
        if(!username.isEmpty()) {
            prx.setUser(username);
            prx.setPassword(pass);
        }
    }

    manager_->setProxy(prx);
}
开发者ID:eta-im-dev,项目名称:eta-im-snapshots,代码行数:18,代码来源:juickdownloader.cpp

示例9: httpProxy

QNetworkProxy ProxySettings::httpProxy ()
{
    QSettings settings;
    QNetworkProxy proxy;

    bool proxyInUse = settings.value ("http_proxy/use", 0).toBool ();
    if (proxyInUse) {
        proxy.setType (QNetworkProxy::HttpProxy);
        proxy.setHostName (settings.value ("http_proxy/hostname", "").toString ());// "192.168.220.5"
        proxy.setPort (settings.value ("http_proxy/port", 80).toInt ());  // 8080
        proxy.setUser (settings.value ("http_proxy/username", "").toString ());
        proxy.setPassword (settings.value ("http_proxy/password", "").toString ());
        //QNetworkProxy::setApplicationProxy (proxy);
    }
    else {
        proxy.setType (QNetworkProxy::NoProxy);
    }
    return proxy;
}
开发者ID:pcacjr,项目名称:qt-creator,代码行数:19,代码来源:proxysettings.cpp

示例10: setProxy

bool setProxy(QString hostName, int port)
{
    QNetworkProxy myProxy;

    myProxy.setType(QNetworkProxy::HttpProxy);
    myProxy.setHostName(hostName);
    myProxy.setPort(port);

    qDebug("Init Proxy...");
    try {
       QNetworkProxy::setApplicationProxy(myProxy);
    }
    catch (...) {
       qDebug("Error in proxy configuration!");
       return false;
    }

    return true;
}
开发者ID:ftomei,项目名称:CRITERIA-3D,代码行数:19,代码来源:main.cpp

示例11: loadSettings

void NetworkManager::loadSettings()
{
    Settings settings;
    settings.beginGroup("Language");
    QStringList langs = settings.value("acceptLanguage", AcceptLanguage::defaultLanguage()).toStringList();
    settings.endGroup();
    mApp->webProfile()->setHttpAcceptLanguage(AcceptLanguage::generateHeader(langs));

    QNetworkProxy proxy;
    settings.beginGroup("Web-Proxy");
    proxy.setType(QNetworkProxy::ProxyType(settings.value("ProxyType", QNetworkProxy::NoProxy).toInt()));
    proxy.setHostName(settings.value("HostName", QString()).toString());
    proxy.setPort(settings.value("Port", 8080).toInt());
    proxy.setUser(settings.value("Username", QString()).toString());
    proxy.setPassword(settings.value("Password", QString()).toString());
    settings.endGroup();
    QNetworkProxy::setApplicationProxy(proxy);

    m_urlInterceptor->loadSettings();
}
开发者ID:JandunCN,项目名称:qupzilla,代码行数:20,代码来源:networkmanager.cpp

示例12: saveToSettings

void ProxyPreferencesWidget::saveToSettings(Core::ISettings *sets)
{
    Core::ISettings *s;
    if (!sets)
        s = settings();
    else
        s = sets;

    if (ui->proxyHostName->text().isEmpty()) {
        QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
    } else {
        QNetworkProxy proxy;
        proxy.setType(QNetworkProxy::HttpProxy);
        proxy.setHostName(ui->proxyHostName->text());
        proxy.setPort(ui->proxyPort->value());
        proxy.setUser(ui->proxyUserName->text());
        proxy.setPassword(ui->proxyUserPassword->text());
        s->setValue(Core::Constants::S_PROXY, Utils::Serializer::serializeProxy(proxy));
        QNetworkProxy::setApplicationProxy(proxy);
    }
}
开发者ID:NyFanomezana,项目名称:freemedforms,代码行数:21,代码来源:networkpreferences.cpp

示例13: httpProxy

QNetworkProxy* UBSettings::httpProxy()
{
    QNetworkProxy* proxy = 0;

    if (mAppSettings->value("Proxy/Enabled", false).toBool()) {

        proxy = new QNetworkProxy();

        if (mAppSettings->value("Proxy/Type", "HTTP").toString() == "Socks5")
            proxy->setType(QNetworkProxy::Socks5Proxy);
        else
            proxy->setType(QNetworkProxy::HttpProxy);

        proxy->setHostName(mAppSettings->value("Proxy/HostName").toString());
        proxy->setPort(mAppSettings->value("Proxy/Port", 1080).toInt());
        proxy->setUser(mAppSettings->value("Proxy/UserName").toString());
        proxy->setPassword(mAppSettings->value("Proxy/Password").toString());
    }

    return proxy;
}
开发者ID:fightersheart,项目名称:myLiveNotes,代码行数:21,代码来源:UBSettings.cpp

示例14: applyProxySettings

void GameUIConfig::applyProxySettings()
{
    QNetworkProxy proxy;

    int proxyType = Form->ui.pageOptions->cbProxyType->currentIndex();

    if(proxyType == PageOptions::SystemProxy)
    {
        // use system proxy settings
        proxy = QNetworkProxyFactory::systemProxyForQuery().at(0);
    } else
    {
        proxy.setType(proxyTypesMap[proxyType]);
        proxy.setHostName(Form->ui.pageOptions->leProxy->text());
        proxy.setPort(Form->ui.pageOptions->sbProxyPort->value());
        proxy.setUser(Form->ui.pageOptions->leProxyLogin->text());
        proxy.setPassword(Form->ui.pageOptions->leProxyPassword->text());
    }

    QNetworkProxy::setApplicationProxy(proxy);
}
开发者ID:LocutusOfBorg,项目名称:hw,代码行数:21,代码来源:gameuiconfig.cpp

示例15: getProxy

QNetworkProxy Settings::getProxy() const
{
    QNetworkProxy proxy;
    switch(Settings::getProxyType())
    {
        case ProxyType::ptNone:
            proxy.setType(QNetworkProxy::NoProxy);
            break;
        case ProxyType::ptSOCKS5:
            proxy.setType(QNetworkProxy::Socks5Proxy);
            break;
        case ProxyType::ptHTTP:
            proxy.setType(QNetworkProxy::HttpProxy);
            break;
        default:
            proxy.setType(QNetworkProxy::NoProxy);
            qWarning() << "Invalid Proxy type, setting to NoProxy";
    }
    proxy.setHostName(Settings::getProxyAddr());
    proxy.setPort(Settings::getProxyPort());
    return proxy;
}
开发者ID:Doom032,项目名称:qTox,代码行数:22,代码来源:settings.cpp


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