mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Merge pull request #6455 from Chocobo1/qt4
Fix issues when compiling with Qt4
This commit is contained in:
commit
bf3ef61a1d
2 changed files with 25 additions and 3 deletions
|
@ -28,14 +28,18 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "server.h"
|
||||||
|
|
||||||
|
#include <QNetworkProxy>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
#ifndef QT_NO_OPENSSL
|
#ifndef QT_NO_OPENSSL
|
||||||
#include <QSslSocket>
|
#include <QSslSocket>
|
||||||
#else
|
#else
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#endif
|
#endif
|
||||||
#include <QNetworkProxy>
|
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "server.h"
|
|
||||||
|
|
||||||
using namespace Http;
|
using namespace Http;
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
|
||||||
#ifdef QBT_USES_QT5
|
#ifdef QBT_USES_QT5
|
||||||
#include <QCollator>
|
#include <QCollator>
|
||||||
#endif
|
#endif
|
||||||
|
@ -217,6 +218,23 @@ QString Utils::String::toHtmlEscaped(const QString &str)
|
||||||
#ifdef QBT_USES_QT5
|
#ifdef QBT_USES_QT5
|
||||||
return str.toHtmlEscaped();
|
return str.toHtmlEscaped();
|
||||||
#else
|
#else
|
||||||
return Qt::escape(str);
|
// code from Qt
|
||||||
|
QString rich;
|
||||||
|
const int len = str.length();
|
||||||
|
rich.reserve(int(len * 1.1));
|
||||||
|
for (int i = 0; i < len; ++i) {
|
||||||
|
if (str.at(i) == QLatin1Char('<'))
|
||||||
|
rich += QLatin1String("<");
|
||||||
|
else if (str.at(i) == QLatin1Char('>'))
|
||||||
|
rich += QLatin1String(">");
|
||||||
|
else if (str.at(i) == QLatin1Char('&'))
|
||||||
|
rich += QLatin1String("&");
|
||||||
|
else if (str.at(i) == QLatin1Char('"'))
|
||||||
|
rich += QLatin1String(""");
|
||||||
|
else
|
||||||
|
rich += str.at(i);
|
||||||
|
}
|
||||||
|
rich.squeeze();
|
||||||
|
return rich;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue