Drop Qt 4 support

This commit is contained in:
Eugene Shalygin
2017-01-19 13:10:09 +01:00
parent 60998a68eb
commit e64bb1de8c
67 changed files with 48 additions and 8809 deletions

View File

@@ -31,9 +31,7 @@
#include <QStringList>
#include <QUrl>
#ifdef QBT_USES_QT5
#include <QUrlQuery>
#endif
#include <QDir>
#include <QDebug>
#include "requestparser.h"
@@ -121,11 +119,7 @@ bool RequestParser::parseStartingLine(const QString &line)
m_request.path = url.path(); // Path
// Parse GET parameters
#ifndef QBT_USES_QT5
QListIterator<QPair<QString, QString> > i(url.queryItems());
#else
QListIterator<QPair<QString, QString> > i(QUrlQuery(url).queryItems());
#endif
while (i.hasNext()) {
QPair<QString, QString> pair = i.next();
m_request.gets[pair.first] = pair.second;
@@ -220,13 +214,8 @@ bool RequestParser::parseContent(const QByteArray& data)
// Parse url-encoded POST data
if (m_request.headers["content-type"].startsWith("application/x-www-form-urlencoded")) {
QUrl url;
#ifndef QBT_USES_QT5
url.setEncodedQuery(data);
QListIterator<QPair<QString, QString> > i(url.queryItems());
#else
url.setQuery(data);
QListIterator<QPair<QString, QString> > i(QUrlQuery(url).queryItems(QUrl::FullyDecoded));
#endif
while (i.hasNext()) {
QPair<QString, QString> pair = i.next();
m_request.posts[pair.first.toLower()] = pair.second;

View File

@@ -76,11 +76,7 @@ void Server::disableHttps()
}
#endif
#ifdef QBT_USES_QT5
void Server::incomingConnection(qintptr socketDescriptor)
#else
void Server::incomingConnection(int socketDescriptor)
#endif
{
QTcpSocket *serverSocket;
#ifndef QT_NO_OPENSSL
@@ -95,11 +91,7 @@ void Server::incomingConnection(int socketDescriptor)
if (m_https) {
static_cast<QSslSocket *>(serverSocket)->setProtocol(QSsl::SecureProtocols);
static_cast<QSslSocket *>(serverSocket)->setPrivateKey(m_key);
#ifdef QBT_USES_QT5
static_cast<QSslSocket *>(serverSocket)->setLocalCertificateChain(m_certificates);
#else
static_cast<QSslSocket *>(serverSocket)->setLocalCertificate(m_certificates.first());
#endif
static_cast<QSslSocket *>(serverSocket)->setPeerVerifyMode(QSslSocket::VerifyNone);
static_cast<QSslSocket *>(serverSocket)->startServerEncryption();
}

View File

@@ -62,15 +62,10 @@ namespace Http
private:
IRequestHandler *m_requestHandler;
#ifdef QBT_USES_QT5
void incomingConnection(qintptr socketDescriptor);
#else
void incomingConnection(int socketDescriptor);
#endif
#ifndef QT_NO_OPENSSL
QList<QSslCipher> safeCipherList() const;
bool m_https;
QList<QSslCertificate> m_certificates;
QSslKey m_key;