diff options
author | Water-Team <water@pad.test.qt.nokia.com> | 2011-11-18 00:00:14 (GMT) |
---|---|---|
committer | Water-Team <water@pad.test.qt.nokia.com> | 2011-11-18 00:00:14 (GMT) |
commit | 34d7dd61ed259e4e6e05d191a9a6da4c8bb41216 (patch) | |
tree | 6da77fbe2d56d5b95587a6785a4ac8039b06141a /src | |
parent | 54c6d478fcad7f13563da713958bb359a17e7363 (diff) | |
parent | 9a5b5f4a70bad52b922fd0a2973b44dae945da13 (diff) | |
download | Qt-34d7dd61ed259e4e6e05d191a9a6da4c8bb41216.zip Qt-34d7dd61ed259e4e6e05d191a9a6da4c8bb41216.tar.gz Qt-34d7dd61ed259e4e6e05d191a9a6da4c8bb41216.tar.bz2 |
Merge branch '4.8-upstream' into master-water
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qgraphicssystem_runtime.cpp | 10 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystemfactory.cpp | 2 | ||||
-rw-r--r-- | src/network/kernel/qnetworkproxy_generic.cpp | 31 |
3 files changed, 36 insertions, 7 deletions
diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 19b29a1..6d3f16e 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -330,11 +330,15 @@ QRuntimeGraphicsSystem::QRuntimeGraphicsSystem() { QApplicationPrivate::runtime_graphics_system = true; + if (!qgetenv("QT_DEFAULT_RUNTIME_SYSTEM").isEmpty()) { + m_graphicsSystemName = QString::fromLocal8Bit(qgetenv("QT_DEFAULT_RUNTIME_SYSTEM")); + } else { #ifdef QT_DEFAULT_RUNTIME_SYSTEM - m_graphicsSystemName = QLatin1String(QT_DEFAULT_RUNTIME_SYSTEM); - if (m_graphicsSystemName.isNull()) + m_graphicsSystemName = QLatin1String(QT_DEFAULT_RUNTIME_SYSTEM); + if (m_graphicsSystemName.isNull()) #endif - m_graphicsSystemName = QLatin1String("raster"); + m_graphicsSystemName = QLatin1String("raster"); + } #ifdef Q_OS_SYMBIAN m_windowSurfaceDestroyPolicy = DestroyAfterFirstFlush; diff --git a/src/gui/painting/qgraphicssystemfactory.cpp b/src/gui/painting/qgraphicssystemfactory.cpp index 01ece09..b817a90 100644 --- a/src/gui/painting/qgraphicssystemfactory.cpp +++ b/src/gui/painting/qgraphicssystemfactory.cpp @@ -45,7 +45,6 @@ #include "qmutex.h" #include "qapplication.h" -#include <private/qapplication_p.h> #include "qgraphicssystem_raster_p.h" #include "qgraphicssystem_runtime_p.h" #include "qdebug.h" @@ -80,7 +79,6 @@ QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key) } #endif - QApplicationPrivate::graphics_system_name = system; if (system == QLatin1String("raster")) return new QRasterGraphicsSystem; else if (system == QLatin1String("runtime")) diff --git a/src/network/kernel/qnetworkproxy_generic.cpp b/src/network/kernel/qnetworkproxy_generic.cpp index e9eaee9..f78f63d 100644 --- a/src/network/kernel/qnetworkproxy_generic.cpp +++ b/src/network/kernel/qnetworkproxy_generic.cpp @@ -41,17 +41,44 @@ #include "qnetworkproxy.h" +#include <QtCore/QByteArray> +#include <QtCore/QUrl> + #ifndef QT_NO_NETWORKPROXY /* - * No system proxy. Just return a list with NoProxy. + * Construct a proxy from the environment variable http_proxy. + * Or no system proxy. Just return a list with NoProxy. */ QT_BEGIN_NAMESPACE QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &) { - return QList<QNetworkProxy>() << QNetworkProxy::NoProxy; + QList<QNetworkProxy> proxyList; + + QByteArray proxy_env = qgetenv("http_proxy"); + if (!proxy_env.isEmpty()) { + QUrl url = QUrl(QString::fromLocal8Bit(proxy_env)); + if (url.scheme() == QLatin1String("socks5")) { + QNetworkProxy proxy(QNetworkProxy::Socks5Proxy, url.host(), + url.port() ? url.port() : 1080, url.userName(), url.password()); + proxyList << proxy; + } else if (url.scheme() == QLatin1String("socks5h")) { + QNetworkProxy proxy(QNetworkProxy::Socks5Proxy, url.host(), + url.port() ? url.port() : 1080, url.userName(), url.password()); + proxy.setCapabilities(QNetworkProxy::HostNameLookupCapability); + proxyList << proxy; + } else if (url.scheme() == QLatin1String("http") || url.scheme().isEmpty()) { + QNetworkProxy proxy(QNetworkProxy::HttpProxy, url.host(), + url.port() ? url.port() : 8080, url.userName(), url.password()); + proxyList << proxy; + } + } + if (proxyList.isEmpty()) + proxyList << QNetworkProxy::NoProxy; + + return proxyList; } QT_END_NAMESPACE |