From: Oliver Wolff Date: Mon, 10 Mar 2014 12:03:01 +0000 (+0100) Subject: networkaccessmanagerfactory example: Fixed build with QT_NO_NETWORKPROXY X-Git-Tag: upstream/5.3.1~293 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9cc72b43e09c5abd94bb8d13e5b3fbe4d674a726;p=platform%2Fupstream%2Fqtdeclarative.git networkaccessmanagerfactory example: Fixed build with QT_NO_NETWORKPROXY Change-Id: I803dd555961420b8189f36e1978a3fb65ab4d2a0 Reviewed-by: Friedemann Kleint Reviewed-by: Andrew Knight --- diff --git a/examples/qml/networkaccessmanagerfactory/main.cpp b/examples/qml/networkaccessmanagerfactory/main.cpp index 9fe8882..c8c2b7b 100644 --- a/examples/qml/networkaccessmanagerfactory/main.cpp +++ b/examples/qml/networkaccessmanagerfactory/main.cpp @@ -56,8 +56,10 @@ networkaccessmanagerfactory [-host -port ] [file] */ +#ifndef QT_NO_NETWORKPROXY static QString proxyHost; static int proxyPort = 0; +#endif // !QT_NO_NETWORKPROXY class MyNetworkAccessManagerFactory : public QQmlNetworkAccessManagerFactory { @@ -68,11 +70,13 @@ public: QNetworkAccessManager *MyNetworkAccessManagerFactory::create(QObject *parent) { QNetworkAccessManager *nam = new QNetworkAccessManager(parent); +#ifndef QT_NO_NETWORKPROXY if (!proxyHost.isEmpty()) { qDebug() << "Created QNetworkAccessManager using proxy" << (proxyHost + ":" + QString::number(proxyPort)); QNetworkProxy proxy(QNetworkProxy::HttpCachingProxy, proxyHost, proxyPort); nam->setProxy(proxy); } +#endif // !QT_NO_NETWORKPROXY return nam; } @@ -84,10 +88,12 @@ int main(int argc, char ** argv) QGuiApplication app(argc, argv); QCommandLineParser parser; +#ifndef QT_NO_NETWORKPROXY QCommandLineOption proxyHostOption("host", "The proxy host to use.", "host"); parser.addOption(proxyHostOption); QCommandLineOption proxyPortOption("port", "The proxy port to use.", "port", "0"); parser.addOption(proxyPortOption); +#endif // !QT_NO_NETWORKPROXY parser.addPositionalArgument("file", "The file to use."); QCommandLineOption helpOption = parser.addHelpOption(); parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); @@ -100,6 +106,7 @@ int main(int argc, char ** argv) qWarning() << parser.helpText(); exit(0); } +#ifndef QT_NO_NETWORKPROXY if (parser.isSet(proxyHostOption)) proxyHost = parser.value(proxyHostOption); if (parser.isSet(proxyPortOption)) { @@ -111,6 +118,7 @@ int main(int argc, char ** argv) exit(1); } } +#endif // !QT_NO_NETWORKPROXY if (parser.positionalArguments().count() == 1) source = QUrl::fromLocalFile(parser.positionalArguments().first());