summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkreplyhttpimpl.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@theqtcompany.com>2016-03-08 13:29:01 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-03-08 15:50:07 +0000
commitb366530f584eb4d3e94e32783d533a4a0557f8f4 (patch)
tree8371f2de97426fad2ff448520c2bf39cd7cd4383 /src/network/access/qnetworkreplyhttpimpl.cpp
parent2027c0b926d1fc41c929616e209e31fa11b5dc4d (diff)
Simplified repeated #if-ery and entangled conditionals.
Three checks of the same #if managed to save repetition of (if I felt charitable) three shared lines, compared to combining the three into one, which leaves the code easier to read (and obviates the need for one of the "shared" lines). Split a long line while moving it. Change-Id: I762d10ae1df1224c749206b8eb490bafd7ea4900 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index afb7a204e2..5d0e5b998b 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -1746,10 +1746,8 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation()
QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection);
return;
}
-#endif
if (!start(request)) {
-#ifndef QT_NO_BEARERMANAGEMENT
// backend failed to start because the session state is not Connected.
// QNetworkAccessManager will call reply->backend->start() again for us when the session
// state changes.
@@ -1771,21 +1769,21 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation()
QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection);
return;
}
+ } else if (session) {
+ QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)),
+ q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)),
+ Qt::QueuedConnection);
+ }
#else
+ if (!start(request)) {
qWarning("Backend start failed");
QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection,
Q_ARG(QNetworkReply::NetworkError, QNetworkReply::UnknownNetworkError),
Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "backend start error.")));
QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection);
return;
-#endif
- } else {
-#ifndef QT_NO_BEARERMANAGEMENT
- if (session)
- QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)),
- q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection);
-#endif
}
+#endif // QT_NO_BEARERMANAGEMENT
if (synchronous) {
state = Finished;