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


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

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


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

示例1: setProxy

void ownCloudFolder::setProxy()
{
    if( _csync_ctx ) {
        /* Store proxy */
        QUrl proxyUrl(ownCloudInfo::instance()->webdavUrl());
        QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(proxyUrl);
        // We set at least one in Application
        Q_ASSERT(proxies.count() > 0);
        QNetworkProxy proxy = proxies.first();
        if (proxy.type() == QNetworkProxy::NoProxy) {
            qDebug() << "Passing NO proxy to csync for" << proxyUrl;
        } else {
            qDebug() << "Passing" << proxy.hostName() << "of proxy type " << proxy.type()
                     << " to csync for" << proxyUrl;
        }
        int proxyPort = proxy.port();

        csync_set_module_property(_csync_ctx, "proxy_type", (char*) proxyTypeToCStr(proxy.type()) );
        csync_set_module_property(_csync_ctx, "proxy_host", proxy.hostName().toUtf8().data() );
        csync_set_module_property(_csync_ctx, "proxy_port", &proxyPort );
        csync_set_module_property(_csync_ctx, "proxy_user", proxy.user().toUtf8().data()     );
        csync_set_module_property(_csync_ctx, "proxy_pwd" , proxy.password().toUtf8().data() );

        csync_set_module_property(_csync_ctx, "csync_context", _csync_ctx);
    }
}
开发者ID:Manoharsai,项目名称:mirall,代码行数:26,代码来源:owncloudfolder.cpp

示例2: setRubyProxyEnvironment

void PatMainWindow::setRubyProxyEnvironment(const QNetworkProxy &t_proxy)
{
  OS_ASSERT(t_proxy.type() == QNetworkProxy::NoProxy || t_proxy.type() == QNetworkProxy::HttpProxy);

  if (t_proxy.type() == QNetworkProxy::NoProxy)
  {
    LOG(Info, "Clearing proxy environment variables");
    bool set = qputenv("HTTP_PROXY", QByteArray());
    OS_ASSERT(set);
    set = qputenv("HTTP_PROXY_USER", QByteArray());
    OS_ASSERT(set);
    set = qputenv("HTTP_PROXY_PASS", QByteArray());
    OS_ASSERT(set);
    set = qputenv("HTTP_USER", QByteArray());
    OS_ASSERT(set);
    set = qputenv("HTTP_PASS", QByteArray());
    OS_ASSERT(set);
  } else if (t_proxy.type() == QNetworkProxy::HttpProxy) {
    LOG(Info, "Clearing proxy environment variables");
    QUrl urlsimple;
    urlsimple.setHost(t_proxy.hostName());
    urlsimple.setPort(t_proxy.port());
    urlsimple.setScheme("http");
    bool set = qputenv("HTTP_PROXY", urlsimple.toString().toLatin1());
    OS_ASSERT(set);
    set = qputenv("HTTP_PROXY_USER", t_proxy.user().toLatin1());
    OS_ASSERT(set);
    set = qputenv("HTTP_PROXY_PASS", t_proxy.password().toLatin1());
    OS_ASSERT(set);
    set = qputenv("HTTP_USER", t_proxy.user().toLatin1());
    OS_ASSERT(set);
    set = qputenv("HTTP_PASS", t_proxy.password().toLatin1());
    OS_ASSERT(set);
  }
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:35,代码来源:PatMainWindow.cpp

示例3: setCSyncProxy

void ClientProxy::setCSyncProxy( const QUrl& url, CSYNC *csync_ctx )
{
    /* Store proxy */
    QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(QNetworkProxyQuery(url));
    // We set at least one in Application
    Q_ASSERT(proxies.count() > 0);
    QNetworkProxy proxy = proxies.first();
    if (proxy.type() == QNetworkProxy::NoProxy) {
        qDebug() << "Passing NO proxy to csync for" << url.toString();
    } else {
        qDebug() << "Passing" << proxy.hostName() << "of proxy type " << proxy.type()
                 << " to csync for" << url.toString();
    }

    const char *proxy_type = proxyTypeToCStr(proxy.type());
    const char* proxy_host = proxy.hostName().toUtf8().data();
    int proxy_port         = proxy.port();
    const char *proxy_user = proxy.user().toUtf8().data();
    const char *proxy_pwd  = proxy.password().toUtf8().data();

    csync_set_module_property( csync_ctx, "proxy_type", (void*)proxy_type );
    csync_set_module_property( csync_ctx, "proxy_host", (void*)proxy_host );
    csync_set_module_property( csync_ctx, "proxy_port", (void*)&proxy_port );
    csync_set_module_property( csync_ctx, "proxy_user", (void*)proxy_user );
    csync_set_module_property( csync_ctx, "proxy_pwd",  (void*)proxy_pwd );

}
开发者ID:dansoftware,项目名称:mirall,代码行数:27,代码来源:clientproxy.cpp

示例4: autoDetectProxy

void ProxyPreferencesWidget::autoDetectProxy()
{
    LOG("Trying to find system proxy.");
    QNetworkProxy proxy;
//    QNetworkProxyFactory::setUseSystemConfiguration(true);
    QNetworkProxyQuery npq(QUrl("http://www.google.com"));
    QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
    foreach(const QNetworkProxy &p, listOfProxies) {
        if (p.type()==QNetworkProxy::HttpProxy && !p.hostName().isEmpty()) {
            LOG("Using proxy " + p.hostName());
            proxy = p;
            break;
        }
    }

    if (proxy.hostName().isEmpty()) {
        ui->proxyHostName->clear();
        ui->proxyPort->setValue(0);
        ui->proxyUserName->clear();
        ui->proxyUserPassword->clear();
    } else {
        ui->proxyHostName->setText(proxy.hostName());
        ui->proxyPort->setValue(proxy.port());
        ui->proxyUserName->setText(proxy.user());
        ui->proxyUserPassword->setText(proxy.password());
    }
}
开发者ID:NyFanomezana,项目名称:freemedforms,代码行数:27,代码来源:networkpreferences.cpp

示例5: setProxy

void FileDownloader::setProxy(QNetworkProxy proxy) {
	http->abort();
	http->setProxy(proxy);

	qDebug("FileDownloader::setProxy: host: '%s' port: %d type: %d",
           proxy.hostName().toUtf8().constData(), proxy.port(), proxy.type());
}
开发者ID:autoscatto,项目名称:retroshare,代码行数:7,代码来源:filedownloader.cpp

示例6: setCSyncProxy

void ClientProxy::setCSyncProxy( const QUrl& url, CSYNC *csync_ctx )
{
#ifdef USE_NEON
    /* Store proxy */
    QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(QNetworkProxyQuery(url));
    // We set at least one in Application
    Q_ASSERT(proxies.count() > 0);
    if (proxies.count() == 0) {
        qDebug() << Q_FUNC_INFO << "No proxy!";
        return;
    }
    QNetworkProxy proxy = proxies.first();
    if (proxy.type() == QNetworkProxy::NoProxy) {
        qDebug() << "Passing NO proxy to csync for" << url.toString();
    } else {
        qDebug() << "Passing" << proxy.hostName() << "of proxy type " << proxy.type()
                 << " to csync for" << url.toString();
    }

    csync_set_module_property( csync_ctx, "proxy_type", (void*)(proxyTypeToCStr(proxy.type())));
    csync_set_module_property( csync_ctx, "proxy_host", proxy.hostName().toUtf8().data());
    int proxy_port         = proxy.port();
    csync_set_module_property( csync_ctx, "proxy_port", &proxy_port );
    csync_set_module_property( csync_ctx, "proxy_user", proxy.user().toUtf8().data());
    csync_set_module_property( csync_ctx, "proxy_pwd",  proxy.password().toUtf8().data());
#else
    Q_UNUSED(url);
    Q_UNUSED(csync_ctx);
#endif
}
开发者ID:24killen,项目名称:client,代码行数:30,代码来源:clientproxy.cpp

示例7: Init

void Proxy::Init()
{
    if (CONF->UsingProxy())
    {
        QNetworkProxy ps = CONF->GetProxy();
        SetProxy(CONF->ProxyType(), ps.hostName(), ps.port(), ps.user(), ps.password());
    }
}
开发者ID:grumpy-irc,项目名称:grumpy,代码行数:8,代码来源:proxy.cpp

示例8: proxy

QString Phantom::proxy()
{
    QNetworkProxy proxy = QNetworkProxy::applicationProxy();
    if (proxy.hostName().isEmpty()) {
        return NULL;
    }
    return proxy.hostName() + ":" + QString::number(proxy.port());
}
开发者ID:wision,项目名称:phantomjs,代码行数:8,代码来源:phantom.cpp

示例9: save

		void save()
		{
			QNetworkProxy proxy = QNetworkProxy::applicationProxy();
			Config::setValue("/Network/Proxy/Type", proxy.type());
			Config::setValue("/Network/Proxy/HostName", proxy.hostName());
			Config::setValue("/Network/Proxy/Port", proxy.port());
			Config::setValue("/Network/Proxy/User", proxy.user());
			Config::setValue("/Network/Proxy/Password", proxy.password());
		}
开发者ID:FantasyNJ,项目名称:BiliLocal-OSX,代码行数:9,代码来源:NetworkConfiguration.cpp

示例10: setCurrentProxy

void connection::setCurrentProxy(QNetworkProxy &proxyToCopy)
{
	currentProxy.setType(proxyToCopy.type());
	currentProxy.setHostName(proxyToCopy.hostName());
	currentProxy.setPort(proxyToCopy.port());
	currentProxy.setUser(proxyToCopy.user());
	currentProxy.setPassword(proxyToCopy.password());
	
}
开发者ID:veksha,项目名称:vekshas-qutim-protocols,代码行数:9,代码来源:connection.cpp

示例11: setProxyCredentials

void PackageManagerProxyFactory::setProxyCredentials(const QNetworkProxy &proxy,
                                                     const QString &user,
                                                     const QString &password)
{
    auto p = std::find_if(m_proxyCredentials.begin(), m_proxyCredentials.end(),
                          FindProxyCredential(proxy.hostName(), proxy.port()));

    if (p == m_proxyCredentials.end()) {
        ProxyCredential proxyCredential;
        proxyCredential.host = proxy.hostName();
        proxyCredential.port = proxy.port();
        proxyCredential.user = user;
        proxyCredential.password = password;
        m_proxyCredentials.append(proxyCredential);
    } else {
        p->user = user;
        p->password = password;
    }
}
开发者ID:qtproject,项目名称:installer-framework,代码行数:19,代码来源:packagemanagerproxyfactory.cpp

示例12: setProxy

void FindSubtitlesWindow::setProxy(QNetworkProxy proxy) {
	downloader->abort();
	downloader->setProxy(proxy);

#ifdef DOWNLOAD_SUBS
	file_downloader->setProxy(proxy);
#endif

	qDebug("FindSubtitlesWindow::setProxy: host: '%s' port: %d type: %d",
           proxy.hostName().toUtf8().constData(), proxy.port(), proxy.type());
}
开发者ID:autoscatto,项目名称:retroshare,代码行数:11,代码来源:findsubtitleswindow.cpp

示例13: testSetProperty

void HTTPTransportTest::testSetProperty()
{
    HTTPTransport transport;
    transport.setProperty("foo", "bar");
    QString proxyHost("http://foo.bar.net");
    transport.setProperty(HTTPNUMBEROFRESENDATTEMPTSPROP, "10");
    transport.setProperty(HTTPPROXYHOSTPROP, proxyHost);
    transport.setProperty(HTTPPROXYPORTPROP, "5555");

    QNetworkProxy proxy = transport.getProxyConfig();
    QCOMPARE(proxy.hostName(), proxyHost);
    QCOMPARE(proxy.port(), (quint16)5555);
}
开发者ID:kavuri,项目名称:buteo-syncml,代码行数:13,代码来源:HTTPTransportTest.cpp

示例14: testSetProxy

void HTTPTransportTest::testSetProxy()
{
    HTTPTransport transport;
    QNetworkProxy proxy;
    QString proxyHost("http://foo.bar.net");
    quint16 port = 5555;
    proxy.setHostName(proxyHost);
    proxy.setPort(port);
    transport.setProxyConfig(proxy);

    proxy = transport.getProxyConfig();
    QCOMPARE(proxy.hostName(), proxyHost);
    QCOMPARE(proxy.port(), port);
}
开发者ID:kavuri,项目名称:buteo-syncml,代码行数:14,代码来源:HTTPTransportTest.cpp

示例15: QDialog

NetworkSettingsDialog::NetworkSettingsDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::NetworkSettingsDialog)
{
    ui->setupUi(this);
    QValidator *val = new QIntValidator(this);
    ui->proxyportEdit->setValidator(val);

    QNetworkProxy proxy = QNetworkProxy::applicationProxy();

    if (proxy.type() != proxy.NoProxy)
    {
        ui->proxyhostEdit->setText(proxy.hostName());
        ui->proxyportEdit->setText(QString::number(proxy.port()));
        ui->proxyuserEdit->setText(proxy.user());
        ui->proxypassEdit->setText(proxy.password());
    }
}
开发者ID:CNCBASHER,项目名称:berryboot,代码行数:18,代码来源:networksettingsdialog.cpp


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