mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 21:21:24 -07:00
parent
fc49856857
commit
7539bee5c5
4 changed files with 0 additions and 50 deletions
|
@ -159,12 +159,7 @@ QString Utils::String::fromStdString(const std::string &str)
|
|||
|
||||
std::string Utils::String::toStdString(const QString &str)
|
||||
{
|
||||
#ifdef QBT_USES_QT5
|
||||
return str.toStdString();
|
||||
#else
|
||||
QByteArray utf8 = str.toUtf8();
|
||||
return std::string(utf8.constData(), utf8.length());
|
||||
#endif
|
||||
}
|
||||
|
||||
// to send numbers instead of strings with suffixes
|
||||
|
@ -196,26 +191,5 @@ bool Utils::String::slowEquals(const QByteArray &a, const QByteArray &b)
|
|||
|
||||
QString Utils::String::toHtmlEscaped(const QString &str)
|
||||
{
|
||||
#ifdef QBT_USES_QT5
|
||||
return str.toHtmlEscaped();
|
||||
#else
|
||||
// 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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue