Browse Source

Use QString literals

This patch covers src/gui and some leftovers from previous commit.
adaptive-webui-19844
Chocobo1 3 years ago
parent
commit
802ec5a14e
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 4
      src/base/bittorrent/peeraddress.cpp
  2. 4
      src/base/bittorrent/peerinfo.cpp
  3. 2
      src/base/bittorrent/session.cpp
  4. 3
      src/base/http/server.cpp
  5. 2
      src/base/net/smtp.cpp
  6. 10
      src/base/rss/rss_item.cpp
  7. 533
      src/base/rss/rss_parser.cpp
  8. 24
      src/base/torrentfilter.cpp
  9. 126
      src/base/unicodestrings.h
  10. 11
      src/base/utils/foreignapps.cpp
  11. 6
      src/base/utils/misc.cpp
  12. 2
      src/base/utils/net.cpp
  13. 39
      src/gui/aboutdialog.cpp
  14. 6
      src/gui/addnewtorrentdialog.cpp
  15. 86
      src/gui/advancedsettings.cpp
  16. 5
      src/gui/categoryfiltermodel.cpp
  17. 18
      src/gui/categoryfilterwidget.cpp
  18. 6
      src/gui/cookiesdialog.cpp
  19. 5
      src/gui/deletionconfirmationdialog.cpp
  20. 14
      src/gui/downloadfromurldialog.cpp
  21. 9
      src/gui/executionlogwidget.cpp
  22. 2
      src/gui/fspathedit_p.cpp
  23. 5
      src/gui/lineedit.cpp
  24. 2
      src/gui/log/loglistview.cpp
  25. 78
      src/gui/mainwindow.cpp
  26. 166
      src/gui/optionsdialog.cpp
  27. 39
      src/gui/powermanagement/powermanagement_x11.cpp
  28. 2
      src/gui/previewlistdelegate.cpp
  29. 20
      src/gui/properties/peerlistwidget.cpp
  30. 2
      src/gui/properties/peersadditiondialog.cpp
  31. 36
      src/gui/properties/propertieswidget.cpp
  32. 12
      src/gui/properties/proptabbar.cpp
  33. 2
      src/gui/properties/speedplotview.cpp
  34. 2
      src/gui/properties/speedwidget.cpp
  35. 46
      src/gui/properties/trackerlistwidget.cpp
  36. 12
      src/gui/properties/trackersadditiondialog.cpp
  37. 6
      src/gui/rss/articlelistwidget.cpp
  38. 90
      src/gui/rss/automatedrssdownloader.cpp
  39. 2
      src/gui/rss/feedlistwidget.cpp
  40. 4
      src/gui/rss/htmlbrowser.cpp
  41. 72
      src/gui/rss/rsswidget.cpp
  42. 30
      src/gui/search/pluginselectdialog.cpp
  43. 18
      src/gui/search/searchjobwidget.cpp
  44. 22
      src/gui/search/searchwidget.cpp
  45. 4
      src/gui/shutdownconfirmdialog.cpp
  46. 2
      src/gui/statsdialog.cpp
  47. 16
      src/gui/statusbar.cpp
  48. 2
      src/gui/tagfiltermodel.cpp
  49. 16
      src/gui/tagfilterwidget.cpp
  50. 2
      src/gui/torrentcontentmodel.cpp
  51. 8
      src/gui/torrentcreatordialog.cpp
  52. 8
      src/gui/torrentoptionsdialog.cpp
  53. 4
      src/gui/trackerentriesdialog.cpp
  54. 46
      src/gui/transferlistfilterswidget.cpp
  55. 8
      src/gui/transferlistmodel.cpp
  56. 76
      src/gui/transferlistwidget.cpp
  57. 4
      src/gui/uithememanager.cpp
  58. 31
      src/gui/utils.cpp
  59. 2
      src/gui/watchedfolderoptionsdialog.cpp

4
src/base/bittorrent/peeraddress.cpp

@ -67,9 +67,9 @@ QString PeerAddress::toString() const @@ -67,9 +67,9 @@ QString PeerAddress::toString() const
return {};
const QString ipStr = (ip.protocol() == QAbstractSocket::IPv6Protocol)
? ('[' + ip.toString() + ']')
? (u'[' + ip.toString() + u']')
: ip.toString();
return (ipStr + ':' + QString::number(port));
return (ipStr + u':' + QString::number(port));
}
bool BitTorrent::operator==(const BitTorrent::PeerAddress &left, const BitTorrent::PeerAddress &right)

4
src/base/bittorrent/peerinfo.cpp

@ -214,7 +214,7 @@ QBitArray PeerInfo::pieces() const @@ -214,7 +214,7 @@ QBitArray PeerInfo::pieces() const
QString PeerInfo::connectionType() const
{
if (m_nativeInfo.flags & lt::peer_info::utp_socket)
return QString::fromUtf8(C_UTP);
return C_UTP;
return (m_nativeInfo.connection_type == lt::peer_info::standard_bittorrent)
? QLatin1String {"BT"}
@ -316,7 +316,7 @@ void PeerInfo::determineFlags() @@ -316,7 +316,7 @@ void PeerInfo::determineFlags()
// P = Peer is using uTorrent uTP
if (useUTPSocket())
updateFlags(QLatin1Char('P'), QString::fromUtf8(C_UTP));
updateFlags(QLatin1Char('P'), C_UTP);
m_flags.chop(1);
m_flagsDescription.chop(1);

2
src/base/bittorrent/session.cpp

@ -5094,7 +5094,7 @@ void Session::handlePeerBlockedAlert(const lt::peer_blocked_alert *p) @@ -5094,7 +5094,7 @@ void Session::handlePeerBlockedAlert(const lt::peer_blocked_alert *p)
reason = tr("use of privileged port", "this peer was blocked. Reason: use of privileged port.");
break;
case lt::peer_blocked_alert::utp_disabled:
reason = tr("%1 is disabled", "this peer was blocked. Reason: uTP is disabled.").arg(QString::fromUtf8(C_UTP)); // don't translate μTP
reason = tr("%1 is disabled", "this peer was blocked. Reason: uTP is disabled.").arg(C_UTP); // don't translate μTP
break;
case lt::peer_blocked_alert::tcp_disabled:
reason = tr("%1 is disabled", "this peer was blocked. Reason: TCP is disabled.").arg(u"TCP"_qs); // don't translate TCP

3
src/base/http/server.cpp

@ -40,6 +40,7 @@ @@ -40,6 +40,7 @@
#include <QTimer>
#include "base/algorithm.h"
#include "base/global.h"
#include "base/utils/net.h"
#include "connection.h"
@ -51,7 +52,7 @@ namespace @@ -51,7 +52,7 @@ namespace
QList<QSslCipher> safeCipherList()
{
const QStringList badCiphers {"idea", "rc4"};
const QStringList badCiphers {u"idea"_qs, u"rc4"_qs};
const QList<QSslCipher> allCiphers {QSslConfiguration::supportedCiphers()};
QList<QSslCipher> safeCiphers;
std::copy_if(allCiphers.cbegin(), allCiphers.cend(), std::back_inserter(safeCiphers), [&badCiphers](const QSslCipher &cipher)

2
src/base/net/smtp.cpp

@ -215,7 +215,7 @@ void Smtp::readyRead() @@ -215,7 +215,7 @@ void Smtp::readyRead()
case EhloSent:
case HeloSent:
case EhloGreetReceived:
parseEhloResponse(code, (line[3] != ' '), line.mid(4));
parseEhloResponse(code, (line[3] != ' '), QString::fromUtf8(line.mid(4)));
break;
#ifndef QT_NO_OPENSSL
case StartTLSSent:

10
src/base/rss/rss_item.cpp

@ -34,9 +34,11 @@ @@ -34,9 +34,11 @@
#include <QRegularExpression>
#include <QStringList>
#include "base/global.h"
using namespace RSS;
const QChar Item::PathSeparator('\\');
const QChar Item::PathSeparator = u'\\';
Item::Item(const QString &path)
: m_path(path)
@ -67,7 +69,7 @@ QString Item::name() const @@ -67,7 +69,7 @@ QString Item::name() const
bool Item::isValidPath(const QString &path)
{
static const QRegularExpression re(
QString(R"(\A[^\%1]+(\%1[^\%1]+)*\z)").arg(Item::PathSeparator)
uR"(\A[^\%1]+(\%1[^\%1]+)*\z)"_qs.arg(Item::PathSeparator)
, QRegularExpression::DontCaptureOption);
if (path.isEmpty() || !re.match(path).hasMatch())
@ -107,8 +109,8 @@ QStringList Item::expandPath(const QString &path) @@ -107,8 +109,8 @@ QStringList Item::expandPath(const QString &path)
QString Item::parentPath(const QString &path)
{
int pos;
return ((pos = path.lastIndexOf(Item::PathSeparator)) >= 0 ? path.left(pos) : "");
const int pos = path.lastIndexOf(Item::PathSeparator);
return (pos >= 0) ? path.left(pos) : QString();
}
QString Item::relativeName(const QString &path)

533
src/base/rss/rss_parser.cpp

@ -40,6 +40,7 @@ @@ -40,6 +40,7 @@
#include <QXmlStreamEntityResolver>
#include <QXmlStreamReader>
#include "base/global.h"
#include "rss_article.h"
namespace
@ -55,303 +56,303 @@ namespace @@ -55,303 +56,303 @@ namespace
// http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent
static const QHash<QString, QString> HTMLEntities
{
{"nbsp", "&#160;"}, // no-break space = non-breaking space, U+00A0 ISOnum
{"iexcl", "&#161;"}, // inverted exclamation mark, U+00A1 ISOnum
{"cent", "&#162;"}, // cent sign, U+00A2 ISOnum
{"pound", "&#163;"}, // pound sign, U+00A3 ISOnum
{"curren", "&#164;"}, // currency sign, U+00A4 ISOnum
{"yen", "&#165;"}, // yen sign = yuan sign, U+00A5 ISOnum
{"brvbar", "&#166;"}, // broken bar = broken vertical bar, U+00A6 ISOnum
{"sect", "&#167;"}, // section sign, U+00A7 ISOnum
{"uml", "&#168;"}, // diaeresis = spacing diaeresis, U+00A8 ISOdia
{"copy", "&#169;"}, // copyright sign, U+00A9 ISOnum
{"ordf", "&#170;"}, // feminine ordinal indicator, U+00AA ISOnum
{"laquo", "&#171;"}, // left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum
{"not", "&#172;"}, // not sign = angled dash, U+00AC ISOnum
{"shy", "&#173;"}, // soft hyphen = discretionary hyphen, U+00AD ISOnum
{"reg", "&#174;"}, // registered sign = registered trade mark sign, U+00AE ISOnum
{"macr", "&#175;"}, // macron = spacing macron = overline = APL overbar, U+00AF ISOdia
{"deg", "&#176;"}, // degree sign, U+00B0 ISOnum
{"plusmn", "&#177;"}, // plus-minus sign = plus-or-minus sign, U+00B1 ISOnum
{"sup2", "&#178;"}, // superscript two = superscript digit two = squared, U+00B2 ISOnum
{"sup3", "&#179;"}, // superscript three = superscript digit three = cubed, U+00B3 ISOnum
{"acute", "&#180;"}, // acute accent = spacing acute, U+00B4 ISOdia
{"micro", "&#181;"}, // micro sign, U+00B5 ISOnum
{"para", "&#182;"}, // pilcrow sign = paragraph sign, U+00B6 ISOnum
{"middot", "&#183;"}, // middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum
{"cedil", "&#184;"}, // cedilla = spacing cedilla, U+00B8 ISOdia
{"sup1", "&#185;"}, // superscript one = superscript digit one, U+00B9 ISOnum
{"ordm", "&#186;"}, // masculine ordinal indicator, U+00BA ISOnum
{"raquo", "&#187;"}, // right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum
{"frac14", "&#188;"}, // vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum
{"frac12", "&#189;"}, // vulgar fraction one half = fraction one half, U+00BD ISOnum
{"frac34", "&#190;"}, // vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum
{"iquest", "&#191;"}, // inverted question mark = turned question mark, U+00BF ISOnum
{"Agrave", "&#192;"}, // latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1
{"Aacute", "&#193;"}, // latin capital letter A with acute, U+00C1 ISOlat1
{"Acirc", "&#194;"}, // latin capital letter A with circumflex, U+00C2 ISOlat1
{"Atilde", "&#195;"}, // latin capital letter A with tilde, U+00C3 ISOlat1
{"Auml", "&#196;"}, // latin capital letter A with diaeresis, U+00C4 ISOlat1
{"Aring", "&#197;"}, // latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1
{"AElig", "&#198;"}, // latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1
{"Ccedil", "&#199;"}, // latin capital letter C with cedilla, U+00C7 ISOlat1
{"Egrave", "&#200;"}, // latin capital letter E with grave, U+00C8 ISOlat1
{"Eacute", "&#201;"}, // latin capital letter E with acute, U+00C9 ISOlat1
{"Ecirc", "&#202;"}, // latin capital letter E with circumflex, U+00CA ISOlat1
{"Euml", "&#203;"}, // latin capital letter E with diaeresis, U+00CB ISOlat1
{"Igrave", "&#204;"}, // latin capital letter I with grave, U+00CC ISOlat1
{"Iacute", "&#205;"}, // latin capital letter I with acute, U+00CD ISOlat1
{"Icirc", "&#206;"}, // latin capital letter I with circumflex, U+00CE ISOlat1
{"Iuml", "&#207;"}, // latin capital letter I with diaeresis, U+00CF ISOlat1
{"ETH", "&#208;"}, // latin capital letter ETH, U+00D0 ISOlat1
{"Ntilde", "&#209;"}, // latin capital letter N with tilde, U+00D1 ISOlat1
{"Ograve", "&#210;"}, // latin capital letter O with grave, U+00D2 ISOlat1
{"Oacute", "&#211;"}, // latin capital letter O with acute, U+00D3 ISOlat1
{"Ocirc", "&#212;"}, // latin capital letter O with circumflex, U+00D4 ISOlat1
{"Otilde", "&#213;"}, // latin capital letter O with tilde, U+00D5 ISOlat1
{"Ouml", "&#214;"}, // latin capital letter O with diaeresis, U+00D6 ISOlat1
{"times", "&#215;"}, // multiplication sign, U+00D7 ISOnum
{"Oslash", "&#216;"}, // latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1
{"Ugrave", "&#217;"}, // latin capital letter U with grave, U+00D9 ISOlat1
{"Uacute", "&#218;"}, // latin capital letter U with acute, U+00DA ISOlat1
{"Ucirc", "&#219;"}, // latin capital letter U with circumflex, U+00DB ISOlat1
{"Uuml", "&#220;"}, // latin capital letter U with diaeresis, U+00DC ISOlat1
{"Yacute", "&#221;"}, // latin capital letter Y with acute, U+00DD ISOlat1
{"THORN", "&#222;"}, // latin capital letter THORN, U+00DE ISOlat1
{"szlig", "&#223;"}, // latin small letter sharp s = ess-zed, U+00DF ISOlat1
{"agrave", "&#224;"}, // latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1
{"aacute", "&#225;"}, // latin small letter a with acute, U+00E1 ISOlat1
{"acirc", "&#226;"}, // latin small letter a with circumflex, U+00E2 ISOlat1
{"atilde", "&#227;"}, // latin small letter a with tilde, U+00E3 ISOlat1
{"auml", "&#228;"}, // latin small letter a with diaeresis, U+00E4 ISOlat1
{"aring", "&#229;"}, // latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1
{"aelig", "&#230;"}, // latin small letter ae = latin small ligature ae, U+00E6 ISOlat1
{"ccedil", "&#231;"}, // latin small letter c with cedilla, U+00E7 ISOlat1
{"egrave", "&#232;"}, // latin small letter e with grave, U+00E8 ISOlat1
{"eacute", "&#233;"}, // latin small letter e with acute, U+00E9 ISOlat1
{"ecirc", "&#234;"}, // latin small letter e with circumflex, U+00EA ISOlat1
{"euml", "&#235;"}, // latin small letter e with diaeresis, U+00EB ISOlat1
{"igrave", "&#236;"}, // latin small letter i with grave, U+00EC ISOlat1
{"iacute", "&#237;"}, // latin small letter i with acute, U+00ED ISOlat1
{"icirc", "&#238;"}, // latin small letter i with circumflex, U+00EE ISOlat1
{"iuml", "&#239;"}, // latin small letter i with diaeresis, U+00EF ISOlat1
{"eth", "&#240;"}, // latin small letter eth, U+00F0 ISOlat1
{"ntilde", "&#241;"}, // latin small letter n with tilde, U+00F1 ISOlat1
{"ograve", "&#242;"}, // latin small letter o with grave, U+00F2 ISOlat1
{"oacute", "&#243;"}, // latin small letter o with acute, U+00F3 ISOlat1
{"ocirc", "&#244;"}, // latin small letter o with circumflex, U+00F4 ISOlat1
{"otilde", "&#245;"}, // latin small letter o with tilde, U+00F5 ISOlat1
{"ouml", "&#246;"}, // latin small letter o with diaeresis, U+00F6 ISOlat1
{"divide", "&#247;"}, // division sign, U+00F7 ISOnum
{"oslash", "&#248;"}, // latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1
{"ugrave", "&#249;"}, // latin small letter u with grave, U+00F9 ISOlat1
{"uacute", "&#250;"}, // latin small letter u with acute, U+00FA ISOlat1
{"ucirc", "&#251;"}, // latin small letter u with circumflex, U+00FB ISOlat1
{"uuml", "&#252;"}, // latin small letter u with diaeresis, U+00FC ISOlat1
{"yacute", "&#253;"}, // latin small letter y with acute, U+00FD ISOlat1
{"thorn", "&#254;"}, // latin small letter thorn, U+00FE ISOlat1
{"yuml", "&#255;"}, // latin small letter y with diaeresis, U+00FF ISOlat1
{u"nbsp"_qs, u"&#160;"_qs}, // no-break space = non-breaking space, U+00A0 ISOnum
{u"iexcl"_qs, u"&#161;"_qs}, // inverted exclamation mark, U+00A1 ISOnum
{u"cent"_qs, u"&#162;"_qs}, // cent sign, U+00A2 ISOnum
{u"pound"_qs, u"&#163;"_qs}, // pound sign, U+00A3 ISOnum
{u"curren"_qs, u"&#164;"_qs}, // currency sign, U+00A4 ISOnum
{u"yen"_qs, u"&#165;"_qs}, // yen sign = yuan sign, U+00A5 ISOnum
{u"brvbar"_qs, u"&#166;"_qs}, // broken bar = broken vertical bar, U+00A6 ISOnum
{u"sect"_qs, u"&#167;"_qs}, // section sign, U+00A7 ISOnum
{u"uml"_qs, u"&#168;"_qs}, // diaeresis = spacing diaeresis, U+00A8 ISOdia
{u"copy"_qs, u"&#169;"_qs}, // copyright sign, U+00A9 ISOnum
{u"ordf"_qs, u"&#170;"_qs}, // feminine ordinal indicator, U+00AA ISOnum
{u"laquo"_qs, u"&#171;"_qs}, // left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum
{u"not"_qs, u"&#172;"_qs}, // not sign = angled dash, U+00AC ISOnum
{u"shy"_qs, u"&#173;"_qs}, // soft hyphen = discretionary hyphen, U+00AD ISOnum
{u"reg"_qs, u"&#174;"_qs}, // registered sign = registered trade mark sign, U+00AE ISOnum
{u"macr"_qs, u"&#175;"_qs}, // macron = spacing macron = overline = APL overbar, U+00AF ISOdia
{u"deg"_qs, u"&#176;"_qs}, // degree sign, U+00B0 ISOnum
{u"plusmn"_qs, u"&#177;"_qs}, // plus-minus sign = plus-or-minus sign, U+00B1 ISOnum
{u"sup2"_qs, u"&#178;"_qs}, // superscript two = superscript digit two = squared, U+00B2 ISOnum
{u"sup3"_qs, u"&#179;"_qs}, // superscript three = superscript digit three = cubed, U+00B3 ISOnum
{u"acute"_qs, u"&#180;"_qs}, // acute accent = spacing acute, U+00B4 ISOdia
{u"micro"_qs, u"&#181;"_qs}, // micro sign, U+00B5 ISOnum
{u"para"_qs, u"&#182;"_qs}, // pilcrow sign = paragraph sign, U+00B6 ISOnum
{u"middot"_qs, u"&#183;"_qs}, // middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum
{u"cedil"_qs, u"&#184;"_qs}, // cedilla = spacing cedilla, U+00B8 ISOdia
{u"sup1"_qs, u"&#185;"_qs}, // superscript one = superscript digit one, U+00B9 ISOnum
{u"ordm"_qs, u"&#186;"_qs}, // masculine ordinal indicator, U+00BA ISOnum
{u"raquo"_qs, u"&#187;"_qs}, // right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum
{u"frac14"_qs, u"&#188;"_qs}, // vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum
{u"frac12"_qs, u"&#189;"_qs}, // vulgar fraction one half = fraction one half, U+00BD ISOnum
{u"frac34"_qs, u"&#190;"_qs}, // vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum
{u"iquest"_qs, u"&#191;"_qs}, // inverted question mark = turned question mark, U+00BF ISOnum
{u"Agrave"_qs, u"&#192;"_qs}, // latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1
{u"Aacute"_qs, u"&#193;"_qs}, // latin capital letter A with acute, U+00C1 ISOlat1
{u"Acirc"_qs, u"&#194;"_qs}, // latin capital letter A with circumflex, U+00C2 ISOlat1
{u"Atilde"_qs, u"&#195;"_qs}, // latin capital letter A with tilde, U+00C3 ISOlat1
{u"Auml"_qs, u"&#196;"_qs}, // latin capital letter A with diaeresis, U+00C4 ISOlat1
{u"Aring"_qs, u"&#197;"_qs}, // latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1
{u"AElig"_qs, u"&#198;"_qs}, // latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1
{u"Ccedil"_qs, u"&#199;"_qs}, // latin capital letter C with cedilla, U+00C7 ISOlat1
{u"Egrave"_qs, u"&#200;"_qs}, // latin capital letter E with grave, U+00C8 ISOlat1
{u"Eacute"_qs, u"&#201;"_qs}, // latin capital letter E with acute, U+00C9 ISOlat1
{u"Ecirc"_qs, u"&#202;"_qs}, // latin capital letter E with circumflex, U+00CA ISOlat1
{u"Euml"_qs, u"&#203;"_qs}, // latin capital letter E with diaeresis, U+00CB ISOlat1
{u"Igrave"_qs, u"&#204;"_qs}, // latin capital letter I with grave, U+00CC ISOlat1
{u"Iacute"_qs, u"&#205;"_qs}, // latin capital letter I with acute, U+00CD ISOlat1
{u"Icirc"_qs, u"&#206;"_qs}, // latin capital letter I with circumflex, U+00CE ISOlat1
{u"Iuml"_qs, u"&#207;"_qs}, // latin capital letter I with diaeresis, U+00CF ISOlat1
{u"ETH"_qs, u"&#208;"_qs}, // latin capital letter ETH, U+00D0 ISOlat1
{u"Ntilde"_qs, u"&#209;"_qs}, // latin capital letter N with tilde, U+00D1 ISOlat1
{u"Ograve"_qs, u"&#210;"_qs}, // latin capital letter O with grave, U+00D2 ISOlat1
{u"Oacute"_qs, u"&#211;"_qs}, // latin capital letter O with acute, U+00D3 ISOlat1
{u"Ocirc"_qs, u"&#212;"_qs}, // latin capital letter O with circumflex, U+00D4 ISOlat1
{u"Otilde"_qs, u"&#213;"_qs}, // latin capital letter O with tilde, U+00D5 ISOlat1
{u"Ouml"_qs, u"&#214;"_qs}, // latin capital letter O with diaeresis, U+00D6 ISOlat1
{u"times"_qs, u"&#215;"_qs}, // multiplication sign, U+00D7 ISOnum
{u"Oslash"_qs, u"&#216;"_qs}, // latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1
{u"Ugrave"_qs, u"&#217;"_qs}, // latin capital letter U with grave, U+00D9 ISOlat1
{u"Uacute"_qs, u"&#218;"_qs}, // latin capital letter U with acute, U+00DA ISOlat1
{u"Ucirc"_qs, u"&#219;"_qs}, // latin capital letter U with circumflex, U+00DB ISOlat1
{u"Uuml"_qs, u"&#220;"_qs}, // latin capital letter U with diaeresis, U+00DC ISOlat1
{u"Yacute"_qs, u"&#221;"_qs}, // latin capital letter Y with acute, U+00DD ISOlat1
{u"THORN"_qs, u"&#222;"_qs}, // latin capital letter THORN, U+00DE ISOlat1
{u"szlig"_qs, u"&#223;"_qs}, // latin small letter sharp s = ess-zed, U+00DF ISOlat1
{u"agrave"_qs, u"&#224;"_qs}, // latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1
{u"aacute"_qs, u"&#225;"_qs}, // latin small letter a with acute, U+00E1 ISOlat1
{u"acirc"_qs, u"&#226;"_qs}, // latin small letter a with circumflex, U+00E2 ISOlat1
{u"atilde"_qs, u"&#227;"_qs}, // latin small letter a with tilde, U+00E3 ISOlat1
{u"auml"_qs, u"&#228;"_qs}, // latin small letter a with diaeresis, U+00E4 ISOlat1
{u"aring"_qs, u"&#229;"_qs}, // latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1
{u"aelig"_qs, u"&#230;"_qs}, // latin small letter ae = latin small ligature ae, U+00E6 ISOlat1
{u"ccedil"_qs, u"&#231;"_qs}, // latin small letter c with cedilla, U+00E7 ISOlat1
{u"egrave"_qs, u"&#232;"_qs}, // latin small letter e with grave, U+00E8 ISOlat1
{u"eacute"_qs, u"&#233;"_qs}, // latin small letter e with acute, U+00E9 ISOlat1
{u"ecirc"_qs, u"&#234;"_qs}, // latin small letter e with circumflex, U+00EA ISOlat1
{u"euml"_qs, u"&#235;"_qs}, // latin small letter e with diaeresis, U+00EB ISOlat1
{u"igrave"_qs, u"&#236;"_qs}, // latin small letter i with grave, U+00EC ISOlat1
{u"iacute"_qs, u"&#237;"_qs}, // latin small letter i with acute, U+00ED ISOlat1
{u"icirc"_qs, u"&#238;"_qs}, // latin small letter i with circumflex, U+00EE ISOlat1
{u"iuml"_qs, u"&#239;"_qs}, // latin small letter i with diaeresis, U+00EF ISOlat1
{u"eth"_qs, u"&#240;"_qs}, // latin small letter eth, U+00F0 ISOlat1
{u"ntilde"_qs, u"&#241;"_qs}, // latin small letter n with tilde, U+00F1 ISOlat1
{u"ograve"_qs, u"&#242;"_qs}, // latin small letter o with grave, U+00F2 ISOlat1
{u"oacute"_qs, u"&#243;"_qs}, // latin small letter o with acute, U+00F3 ISOlat1
{u"ocirc"_qs, u"&#244;"_qs}, // latin small letter o with circumflex, U+00F4 ISOlat1
{u"otilde"_qs, u"&#245;"_qs}, // latin small letter o with tilde, U+00F5 ISOlat1
{u"ouml"_qs, u"&#246;"_qs}, // latin small letter o with diaeresis, U+00F6 ISOlat1
{u"divide"_qs, u"&#247;"_qs}, // division sign, U+00F7 ISOnum
{u"oslash"_qs, u"&#248;"_qs}, // latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1
{u"ugrave"_qs, u"&#249;"_qs}, // latin small letter u with grave, U+00F9 ISOlat1
{u"uacute"_qs, u"&#250;"_qs}, // latin small letter u with acute, U+00FA ISOlat1
{u"ucirc"_qs, u"&#251;"_qs}, // latin small letter u with circumflex, U+00FB ISOlat1
{u"uuml"_qs, u"&#252;"_qs}, // latin small letter u with diaeresis, U+00FC ISOlat1
{u"yacute"_qs, u"&#253;"_qs}, // latin small letter y with acute, U+00FD ISOlat1
{u"thorn"_qs, u"&#254;"_qs}, // latin small letter thorn, U+00FE ISOlat1
{u"yuml"_qs, u"&#255;"_qs}, // latin small letter y with diaeresis, U+00FF ISOlat1
// Latin Extended-A
{"OElig", "&#338;"}, // latin capital ligature OE, U+0152 ISOlat2
{"oelig", "&#339;"}, // latin small ligature oe, U+0153 ISOlat2
{u"OElig"_qs, u"&#338;"_qs}, // latin capital ligature OE, U+0152 ISOlat2
{u"oelig"_qs, u"&#339;"_qs}, // latin small ligature oe, U+0153 ISOlat2
// ligature is a misnomer, this is a separate character in some languages
{"Scaron", "&#352;"}, // latin capital letter S with caron, U+0160 ISOlat2
{"scaron", "&#353;"}, // latin small letter s with caron, U+0161 ISOlat2
{"Yuml", "&#376;"}, // latin capital letter Y with diaeresis, U+0178 ISOlat2
{u"Scaron"_qs, u"&#352;"_qs}, // latin capital letter S with caron, U+0160 ISOlat2
{u"scaron"_qs, u"&#353;"_qs}, // latin small letter s with caron, U+0161 ISOlat2
{u"Yuml"_qs, u"&#376;"_qs}, // latin capital letter Y with diaeresis, U+0178 ISOlat2
// Spacing Modifier Letters
{"circ", "&#710;"}, // modifier letter circumflex accent, U+02C6 ISOpub
{"tilde", "&#732;"}, // small tilde, U+02DC ISOdia
{u"circ"_qs, u"&#710;"_qs}, // modifier letter circumflex accent, U+02C6 ISOpub
{u"tilde"_qs, u"&#732;"_qs}, // small tilde, U+02DC ISOdia
// General Punctuation
{"ensp", "&#8194;"}, // en space, U+2002 ISOpub
{"emsp", "&#8195;"}, // em space, U+2003 ISOpub
{"thinsp", "&#8201;"}, // thin space, U+2009 ISOpub
{"zwnj", "&#8204;"}, // zero width non-joiner, U+200C NEW RFC 2070
{"zwj", "&#8205;"}, // zero width joiner, U+200D NEW RFC 2070
{"lrm", "&#8206;"}, // left-to-right mark, U+200E NEW RFC 2070
{"rlm", "&#8207;"}, // right-to-left mark, U+200F NEW RFC 2070
{"ndash", "&#8211;"}, // en dash, U+2013 ISOpub
{"mdash", "&#8212;"}, // em dash, U+2014 ISOpub
{"lsquo", "&#8216;"}, // left single quotation mark, U+2018 ISOnum
{"rsquo", "&#8217;"}, // right single quotation mark, U+2019 ISOnum
{"sbquo", "&#8218;"}, // single low-9 quotation mark, U+201A NEW
{"ldquo", "&#8220;"}, // left double quotation mark, U+201C ISOnum
{"rdquo", "&#8221;"}, // right double quotation mark, U+201D ISOnum
{"bdquo", "&#8222;"}, // double low-9 quotation mark, U+201E NEW
{"dagger", "&#8224;"}, // dagger, U+2020 ISOpub
{"Dagger", "&#8225;"}, // double dagger, U+2021 ISOpub
{"permil", "&#8240;"}, // per mille sign, U+2030 ISOtech
{"lsaquo", "&#8249;"}, // single left-pointing angle quotation mark, U+2039 ISO proposed
{u"ensp"_qs, u"&#8194;"_qs}, // en space, U+2002 ISOpub
{u"emsp"_qs, u"&#8195;"_qs}, // em space, U+2003 ISOpub
{u"thinsp"_qs, u"&#8201;"_qs}, // thin space, U+2009 ISOpub
{u"zwnj"_qs, u"&#8204;"_qs}, // zero width non-joiner, U+200C NEW RFC 2070
{u"zwj"_qs, u"&#8205;"_qs}, // zero width joiner, U+200D NEW RFC 2070
{u"lrm"_qs, u"&#8206;"_qs}, // left-to-right mark, U+200E NEW RFC 2070
{u"rlm"_qs, u"&#8207;"_qs}, // right-to-left mark, U+200F NEW RFC 2070
{u"ndash"_qs, u"&#8211;"_qs}, // en dash, U+2013 ISOpub
{u"mdash"_qs, u"&#8212;"_qs}, // em dash, U+2014 ISOpub
{u"lsquo"_qs, u"&#8216;"_qs}, // left single quotation mark, U+2018 ISOnum
{u"rsquo"_qs, u"&#8217;"_qs}, // right single quotation mark, U+2019 ISOnum
{u"sbquo"_qs, u"&#8218;"_qs}, // single low-9 quotation mark, U+201A NEW
{u"ldquo"_qs, u"&#8220;"_qs}, // left double quotation mark, U+201C ISOnum
{u"rdquo"_qs, u"&#8221;"_qs}, // right double quotation mark, U+201D ISOnum
{u"bdquo"_qs, u"&#8222;"_qs}, // double low-9 quotation mark, U+201E NEW
{u"dagger"_qs, u"&#8224;"_qs}, // dagger, U+2020 ISOpub
{u"Dagger"_qs, u"&#8225;"_qs}, // double dagger, U+2021 ISOpub
{u"permil"_qs, u"&#8240;"_qs}, // per mille sign, U+2030 ISOtech
{u"lsaquo"_qs, u"&#8249;"_qs}, // single left-pointing angle quotation mark, U+2039 ISO proposed
// lsaquo is proposed but not yet ISO standardized
{"rsaquo", "&#8250;"}, // single right-pointing angle quotation mark, U+203A ISO proposed
{u"rsaquo"_qs, u"&#8250;"_qs}, // single right-pointing angle quotation mark, U+203A ISO proposed
// rsaquo is proposed but not yet ISO standardized
// Currency Symbols
{"euro", "&#8364;"}, // euro sign, U+20AC NEW
{u"euro"_qs, u"&#8364;"_qs}, // euro sign, U+20AC NEW
// Latin Extended-B
{"fnof", "&#402;"}, // latin small letter f with hook = function = florin, U+0192 ISOtech
{u"fnof"_qs, u"&#402;"_qs}, // latin small letter f with hook = function = florin, U+0192 ISOtech
// Greek
{"Alpha", "&#913;"}, // greek capital letter alpha, U+0391
{"Beta", "&#914;"}, // greek capital letter beta, U+0392
{"Gamma", "&#915;"}, // greek capital letter gamma, U+0393 ISOgrk3
{"Delta", "&#916;"}, // greek capital letter delta, U+0394 ISOgrk3
{"Epsilon", "&#917;"}, // greek capital letter epsilon, U+0395
{"Zeta", "&#918;"}, // greek capital letter zeta, U+0396
{"Eta", "&#919;"}, // greek capital letter eta, U+0397
{"Theta", "&#920;"}, // greek capital letter theta, U+0398 ISOgrk3
{"Iota", "&#921;"}, // greek capital letter iota, U+0399
{"Kappa", "&#922;"}, // greek capital letter kappa, U+039A
{"Lambda", "&#923;"}, // greek capital letter lamda, U+039B ISOgrk3
{"Mu", "&#924;"}, // greek capital letter mu, U+039C
{"Nu", "&#925;"}, // greek capital letter nu, U+039D
{"Xi", "&#926;"}, // greek capital letter xi, U+039E ISOgrk3
{"Omicron", "&#927;"}, // greek capital letter omicron, U+039F
{"Pi", "&#928;"}, // greek capital letter pi, U+03A0 ISOgrk3
{"Rho", "&#929;"}, // greek capital letter rho, U+03A1
{"Sigma", "&#931;"}, // greek capital letter sigma, U+03A3 ISOgrk3
{"Tau", "&#932;"}, // greek capital letter tau, U+03A4
{"Upsilon", "&#933;"}, // greek capital letter upsilon, U+03A5 ISOgrk3
{"Phi", "&#934;"}, // greek capital letter phi, U+03A6 ISOgrk3
{"Chi", "&#935;"}, // greek capital letter chi, U+03A7
{"Psi", "&#936;"}, // greek capital letter psi, U+03A8 ISOgrk3
{"Omega", "&#937;"}, // greek capital letter omega, U+03A9 ISOgrk3
{"alpha", "&#945;"}, // greek small letter alpha, U+03B1 ISOgrk3
{"beta", "&#946;"}, // greek small letter beta, U+03B2 ISOgrk3
{"gamma", "&#947;"}, // greek small letter gamma, U+03B3 ISOgrk3
{"delta", "&#948;"}, // greek small letter delta, U+03B4 ISOgrk3
{"epsilon", "&#949;"}, // greek small letter epsilon, U+03B5 ISOgrk3
{"zeta", "&#950;"}, // greek small letter zeta, U+03B6 ISOgrk3
{"eta", "&#951;"}, // greek small letter eta, U+03B7 ISOgrk3
{"theta", "&#952;"}, // greek small letter theta, U+03B8 ISOgrk3
{"iota", "&#953;"}, // greek small letter iota, U+03B9 ISOgrk3
{"kappa", "&#954;"}, // greek small letter kappa, U+03BA ISOgrk3
{"lambda", "&#955;"}, // greek small letter lamda, U+03BB ISOgrk3
{"mu", "&#956;"}, // greek small letter mu, U+03BC ISOgrk3
{"nu", "&#957;"}, // greek small letter nu, U+03BD ISOgrk3
{"xi", "&#958;"}, // greek small letter xi, U+03BE ISOgrk3
{"omicron", "&#959;"}, // greek small letter omicron, U+03BF NEW
{"pi", "&#960;"}, // greek small letter pi, U+03C0 ISOgrk3
{"rho", "&#961;"}, // greek small letter rho, U+03C1 ISOgrk3
{"sigmaf", "&#962;"}, // greek small letter final sigma, U+03C2 ISOgrk3
{"sigma", "&#963;"}, // greek small letter sigma, U+03C3 ISOgrk3
{"tau", "&#964;"}, // greek small letter tau, U+03C4 ISOgrk3
{"upsilon", "&#965;"}, // greek small letter upsilon, U+03C5 ISOgrk3
{"phi", "&#966;"}, // greek small letter phi, U+03C6 ISOgrk3
{"chi", "&#967;"}, // greek small letter chi, U+03C7 ISOgrk3
{"psi", "&#968;"}, // greek small letter psi, U+03C8 ISOgrk3
{"omega", "&#969;"}, // greek small letter omega, U+03C9 ISOgrk3
{"thetasym", "&#977;"}, // greek theta symbol, U+03D1 NEW
{"upsih", "&#978;"}, // greek upsilon with hook symbol, U+03D2 NEW
{"piv", "&#982;"}, // greek pi symbol, U+03D6 ISOgrk3
{u"Alpha"_qs, u"&#913;"_qs}, // greek capital letter alpha, U+0391
{u"Beta"_qs, u"&#914;"_qs}, // greek capital letter beta, U+0392
{u"Gamma"_qs, u"&#915;"_qs}, // greek capital letter gamma, U+0393 ISOgrk3
{u"Delta"_qs, u"&#916;"_qs}, // greek capital letter delta, U+0394 ISOgrk3
{u"Epsilon"_qs, u"&#917;"_qs}, // greek capital letter epsilon, U+0395
{u"Zeta"_qs, u"&#918;"_qs}, // greek capital letter zeta, U+0396
{u"Eta"_qs, u"&#919;"_qs}, // greek capital letter eta, U+0397
{u"Theta"_qs, u"&#920;"_qs}, // greek capital letter theta, U+0398 ISOgrk3
{u"Iota"_qs, u"&#921;"_qs}, // greek capital letter iota, U+0399
{u"Kappa"_qs, u"&#922;"_qs}, // greek capital letter kappa, U+039A
{u"Lambda"_qs, u"&#923;"_qs}, // greek capital letter lamda, U+039B ISOgrk3
{u"Mu"_qs, u"&#924;"_qs}, // greek capital letter mu, U+039C
{u"Nu"_qs, u"&#925;"_qs}, // greek capital letter nu, U+039D
{u"Xi"_qs, u"&#926;"_qs}, // greek capital letter xi, U+039E ISOgrk3
{u"Omicron"_qs, u"&#927;"_qs}, // greek capital letter omicron, U+039F
{u"Pi"_qs, u"&#928;"_qs}, // greek capital letter pi, U+03A0 ISOgrk3
{u"Rho"_qs, u"&#929;"_qs}, // greek capital letter rho, U+03A1
{u"Sigma"_qs, u"&#931;"_qs}, // greek capital letter sigma, U+03A3 ISOgrk3
{u"Tau"_qs, u"&#932;"_qs}, // greek capital letter tau, U+03A4
{u"Upsilon"_qs, u"&#933;"_qs}, // greek capital letter upsilon, U+03A5 ISOgrk3
{u"Phi"_qs, u"&#934;"_qs}, // greek capital letter phi, U+03A6 ISOgrk3
{u"Chi"_qs, u"&#935;"_qs}, // greek capital letter chi, U+03A7
{u"Psi"_qs, u"&#936;"_qs}, // greek capital letter psi, U+03A8 ISOgrk3
{u"Omega"_qs, u"&#937;"_qs}, // greek capital letter omega, U+03A9 ISOgrk3
{u"alpha"_qs, u"&#945;"_qs}, // greek small letter alpha, U+03B1 ISOgrk3
{u"beta"_qs, u"&#946;"_qs}, // greek small letter beta, U+03B2 ISOgrk3
{u"gamma"_qs, u"&#947;"_qs}, // greek small letter gamma, U+03B3 ISOgrk3
{u"delta"_qs, u"&#948;"_qs}, // greek small letter delta, U+03B4 ISOgrk3
{u"epsilon"_qs, u"&#949;"_qs}, // greek small letter epsilon, U+03B5 ISOgrk3
{u"zeta"_qs, u"&#950;"_qs}, // greek small letter zeta, U+03B6 ISOgrk3
{u"eta"_qs, u"&#951;"_qs}, // greek small letter eta, U+03B7 ISOgrk3
{u"theta"_qs, u"&#952;"_qs}, // greek small letter theta, U+03B8 ISOgrk3
{u"iota"_qs, u"&#953;"_qs}, // greek small letter iota, U+03B9 ISOgrk3
{u"kappa"_qs, u"&#954;"_qs}, // greek small letter kappa, U+03BA ISOgrk3
{u"lambda"_qs, u"&#955;"_qs}, // greek small letter lamda, U+03BB ISOgrk3
{u"mu"_qs, u"&#956;"_qs}, // greek small letter mu, U+03BC ISOgrk3
{u"nu"_qs, u"&#957;"_qs}, // greek small letter nu, U+03BD ISOgrk3
{u"xi"_qs, u"&#958;"_qs}, // greek small letter xi, U+03BE ISOgrk3
{u"omicron"_qs, u"&#959;"_qs}, // greek small letter omicron, U+03BF NEW
{u"pi"_qs, u"&#960;"_qs}, // greek small letter pi, U+03C0 ISOgrk3
{u"rho"_qs, u"&#961;"_qs}, // greek small letter rho, U+03C1 ISOgrk3
{u"sigmaf"_qs, u"&#962;"_qs}, // greek small letter final sigma, U+03C2 ISOgrk3
{u"sigma"_qs, u"&#963;"_qs}, // greek small letter sigma, U+03C3 ISOgrk3
{u"tau"_qs, u"&#964;"_qs}, // greek small letter tau, U+03C4 ISOgrk3
{u"upsilon"_qs, u"&#965;"_qs}, // greek small letter upsilon, U+03C5 ISOgrk3
{u"phi"_qs, u"&#966;"_qs}, // greek small letter phi, U+03C6 ISOgrk3
{u"chi"_qs, u"&#967;"_qs}, // greek small letter chi, U+03C7 ISOgrk3
{u"psi"_qs, u"&#968;"_qs}, // greek small letter psi, U+03C8 ISOgrk3
{u"omega"_qs, u"&#969;"_qs}, // greek small letter omega, U+03C9 ISOgrk3
{u"thetasym"_qs, u"&#977;"_qs}, // greek theta symbol, U+03D1 NEW
{u"upsih"_qs, u"&#978;"_qs}, // greek upsilon with hook symbol, U+03D2 NEW
{u"piv"_qs, u"&#982;"_qs}, // greek pi symbol, U+03D6 ISOgrk3
// General Punctuation
{"bull", "&#8226;"}, // bullet = black small circle, U+2022 ISOpub
{u"bull"_qs, u"&#8226;"_qs}, // bullet = black small circle, U+2022 ISOpub
// bullet is NOT the same as bullet operator, U+2219
{"hellip", "&#8230;"}, // horizontal ellipsis = three dot leader, U+2026 ISOpub
{"prime", "&#8242;"}, // prime = minutes = feet, U+2032 ISOtech
{"Prime", "&#8243;"}, // double prime = seconds = inches, U+2033 ISOtech
{"oline", "&#8254;"}, // overline = spacing overscore, U+203E NEW
{"frasl", "&#8260;"}, // fraction slash, U+2044 NEW
{u"hellip"_qs, u"&#8230;"_qs}, // horizontal ellipsis = three dot leader, U+2026 ISOpub
{u"prime"_qs, u"&#8242;"_qs}, // prime = minutes = feet, U+2032 ISOtech
{u"Prime"_qs, u"&#8243;"_qs}, // double prime = seconds = inches, U+2033 ISOtech
{u"oline"_qs, u"&#8254;"_qs}, // overline = spacing overscore, U+203E NEW
{u"frasl"_qs, u"&#8260;"_qs}, // fraction slash, U+2044 NEW
// Letterlike Symbols
{"weierp", "&#8472;"}, // script capital P = power set = Weierstrass p, U+2118 ISOamso
{"image", "&#8465;"}, // black-letter capital I = imaginary part, U+2111 ISOamso
{"real", "&#8476;"}, // black-letter capital R = real part symbol, U+211C ISOamso
{"trade", "&#8482;"}, // trade mark sign, U+2122 ISOnum
{"alefsym", "&#8501;"}, // alef symbol = first transfinite cardinal, U+2135 NEW
{u"weierp"_qs, u"&#8472;"_qs}, // script capital P = power set = Weierstrass p, U+2118 ISOamso
{u"image"_qs, u"&#8465;"_qs}, // black-letter capital I = imaginary part, U+2111 ISOamso
{u"real"_qs, u"&#8476;"_qs}, // black-letter capital R = real part symbol, U+211C ISOamso
{u"trade"_qs, u"&#8482;"_qs}, // trade mark sign, U+2122 ISOnum
{u"alefsym"_qs, u"&#8501;"_qs}, // alef symbol = first transfinite cardinal, U+2135 NEW
// alef symbol is NOT the same as hebrew letter alef,
// U+05D0 although the same glyph could be used to depict both characters
// Arrows
{"larr", "&#8592;"}, // leftwards arrow, U+2190 ISOnum
{"uarr", "&#8593;"}, // upwards arrow, U+2191 ISOnum
{"rarr", "&#8594;"}, // rightwards arrow, U+2192 ISOnum
{"darr", "&#8595;"}, // downwards arrow, U+2193 ISOnum
{"harr", "&#8596;"}, // left right arrow, U+2194 ISOamsa
{"crarr", "&#8629;"}, // downwards arrow with corner leftwards = carriage return, U+21B5 NEW
{"lArr", "&#8656;"}, // leftwards double arrow, U+21D0 ISOtech
{u"larr"_qs, u"&#8592;"_qs}, // leftwards arrow, U+2190 ISOnum
{u"uarr"_qs, u"&#8593;"_qs}, // upwards arrow, U+2191 ISOnum
{u"rarr"_qs, u"&#8594;"_qs}, // rightwards arrow, U+2192 ISOnum
{u"darr"_qs, u"&#8595;"_qs}, // downwards arrow, U+2193 ISOnum
{u"harr"_qs, u"&#8596;"_qs}, // left right arrow, U+2194 ISOamsa
{u"crarr"_qs, u"&#8629;"_qs}, // downwards arrow with corner leftwards = carriage return, U+21B5 NEW
{u"lArr"_qs, u"&#8656;"_qs}, // leftwards double arrow, U+21D0 ISOtech
// Unicode does not say that lArr is the same as the 'is implied by' arrow
// but also does not have any other character for that function. So lArr can
// be used for 'is implied by' as ISOtech suggests
{"uArr", "&#8657;"}, // upwards double arrow, U+21D1 ISOamsa
{"rArr", "&#8658;"}, // rightwards double arrow, U+21D2 ISOtech
{u"uArr"_qs, u"&#8657;"_qs}, // upwards double arrow, U+21D1 ISOamsa
{u"rArr"_qs, u"&#8658;"_qs}, // rightwards double arrow, U+21D2 ISOtech
// Unicode does not say this is the 'implies' character but does not have
// another character with this function so rArr can be used for 'implies'
// as ISOtech suggests
{"dArr", "&#8659;"}, // downwards double arrow, U+21D3 ISOamsa
{"hArr", "&#8660;"}, // left right double arrow, U+21D4 ISOamsa
{u"dArr"_qs, u"&#8659;"_qs}, // downwards double arrow, U+21D3 ISOamsa
{u"hArr"_qs, u"&#8660;"_qs}, // left right double arrow, U+21D4 ISOamsa
// Mathematical Operators
{"forall", "&#8704;"}, // for all, U+2200 ISOtech
{"part", "&#8706;"}, // partial differential, U+2202 ISOtech
{"exist", "&#8707;"}, // there exists, U+2203 ISOtech
{"empty", "&#8709;"}, // empty set = null set, U+2205 ISOamso
{"nabla", "&#8711;"}, // nabla = backward difference, U+2207 ISOtech
{"isin", "&#8712;"}, // element of, U+2208 ISOtech
{"notin", "&#8713;"}, // not an element of, U+2209 ISOtech
{"ni", "&#8715;"}, // contains as member, U+220B ISOtech
{"prod", "&#8719;"}, // n-ary product = product sign, U+220F ISOamsb
{u"forall"_qs, u"&#8704;"_qs}, // for all, U+2200 ISOtech
{u"part"_qs, u"&#8706;"_qs}, // partial differential, U+2202 ISOtech
{u"exist"_qs, u"&#8707;"_qs}, // there exists, U+2203 ISOtech
{u"empty"_qs, u"&#8709;"_qs}, // empty set = null set, U+2205 ISOamso
{u"nabla"_qs, u"&#8711;"_qs}, // nabla = backward difference, U+2207 ISOtech
{u"isin"_qs, u"&#8712;"_qs}, // element of, U+2208 ISOtech
{u"notin"_qs, u"&#8713;"_qs}, // not an element of, U+2209 ISOtech
{u"ni"_qs, u"&#8715;"_qs}, // contains as member, U+220B ISOtech
{u"prod"_qs, u"&#8719;"_qs}, // n-ary product = product sign, U+220F ISOamsb
// prod is NOT the same character as U+03A0 'greek capital letter pi' though
// the same glyph might be used for both
{"sum", "&#8721;"}, // n-ary summation, U+2211 ISOamsb
{u"sum"_qs, u"&#8721;"_qs}, // n-ary summation, U+2211 ISOamsb
// sum is NOT the same character as U+03A3 'greek capital letter sigma'
// though the same glyph might be used for both
{"minus", "&#8722;"}, // minus sign, U+2212 ISOtech
{"lowast", "&#8727;"}, // asterisk operator, U+2217 ISOtech
{"radic", "&#8730;"}, // square root = radical sign, U+221A ISOtech
{"prop", "&#8733;"}, // proportional to, U+221D ISOtech
{"infin", "&#8734;"}, // infinity, U+221E ISOtech
{"ang", "&#8736;"}, // angle, U+2220 ISOamso
{"and", "&#8743;"}, // logical and = wedge, U+2227 ISOtech
{"or", "&#8744;"}, // logical or = vee, U+2228 ISOtech
{"cap", "&#8745;"}, // intersection = cap, U+2229 ISOtech
{"cup", "&#8746;"}, // union = cup, U+222A ISOtech
{"int", "&#8747;"}, // integral, U+222B ISOtech
{"there4", "&#8756;"}, // therefore, U+2234 ISOtech
{"sim", "&#8764;"}, // tilde operator = varies with = similar to, U+223C ISOtech
{u"minus"_qs, u"&#8722;"_qs}, // minus sign, U+2212 ISOtech
{u"lowast"_qs, u"&#8727;"_qs}, // asterisk operator, U+2217 ISOtech
{u"radic"_qs, u"&#8730;"_qs}, // square root = radical sign, U+221A ISOtech
{u"prop"_qs, u"&#8733;"_qs}, // proportional to, U+221D ISOtech
{u"infin"_qs, u"&#8734;"_qs}, // infinity, U+221E ISOtech
{u"ang"_qs, u"&#8736;"_qs}, // angle, U+2220 ISOamso
{u"and"_qs, u"&#8743;"_qs}, // logical and = wedge, U+2227 ISOtech
{u"or"_qs, u"&#8744;"_qs}, // logical or = vee, U+2228 ISOtech
{u"cap"_qs, u"&#8745;"_qs}, // intersection = cap, U+2229 ISOtech
{u"cup"_qs, u"&#8746;"_qs}, // union = cup, U+222A ISOtech
{u"int"_qs, u"&#8747;"_qs}, // integral, U+222B ISOtech
{u"there4"_qs, u"&#8756;"_qs}, // therefore, U+2234 ISOtech
{u"sim"_qs, u"&#8764;"_qs}, // tilde operator = varies with = similar to, U+223C ISOtech
// tilde operator is NOT the same character as the tilde, U+007E,
// although the same glyph might be used to represent both
{"cong", "&#8773;"}, // approximately equal to, U+2245 ISOtech
{"asymp", "&#8776;"}, // almost equal to = asymptotic to, U+2248 ISOamsr
{"ne", "&#8800;"}, // not equal to, U+2260 ISOtech
{"equiv", "&#8801;"}, // identical to, U+2261 ISOtech
{"le", "&#8804;"}, // less-than or equal to, U+2264 ISOtech
{"ge", "&#8805;"}, // greater-than or equal to, U+2265 ISOtech
{"sub", "&#8834;"}, // subset of, U+2282 ISOtech
{"sup", "&#8835;"}, // superset of, U+2283 ISOtech
{"nsub", "&#8836;"}, // not a subset of, U+2284 ISOamsn
{"sube", "&#8838;"}, // subset of or equal to, U+2286 ISOtech
{"supe", "&#8839;"}, // superset of or equal to, U+2287 ISOtech
{"oplus", "&#8853;"}, // circled plus = direct sum, U+2295 ISOamsb
{"otimes", "&#8855;"}, // circled times = vector product, U+2297 ISOamsb
{"perp", "&#8869;"}, // up tack = orthogonal to = perpendicular, U+22A5 ISOtech
{"sdot", "&#8901;"}, // dot operator, U+22C5 ISOamsb
{u"cong"_qs, u"&#8773;"_qs}, // approximately equal to, U+2245 ISOtech
{u"asymp"_qs, u"&#8776;"_qs}, // almost equal to = asymptotic to, U+2248 ISOamsr
{u"ne"_qs, u"&#8800;"_qs}, // not equal to, U+2260 ISOtech
{u"equiv"_qs, u"&#8801;"_qs}, // identical to, U+2261 ISOtech
{u"le"_qs, u"&#8804;"_qs}, // less-than or equal to, U+2264 ISOtech
{u"ge"_qs, u"&#8805;"_qs}, // greater-than or equal to, U+2265 ISOtech
{u"sub"_qs, u"&#8834;"_qs}, // subset of, U+2282 ISOtech
{u"sup"_qs, u"&#8835;"_qs}, // superset of, U+2283 ISOtech
{u"nsub"_qs, u"&#8836;"_qs}, // not a subset of, U+2284 ISOamsn
{u"sube"_qs, u"&#8838;"_qs}, // subset of or equal to, U+2286 ISOtech
{u"supe"_qs, u"&#8839;"_qs}, // superset of or equal to, U+2287 ISOtech
{u"oplus"_qs, u"&#8853;"_qs}, // circled plus = direct sum, U+2295 ISOamsb
{u"otimes"_qs, u"&#8855;"_qs}, // circled times = vector product, U+2297 ISOamsb
{u"perp"_qs, u"&#8869;"_qs}, // up tack = orthogonal to = perpendicular, U+22A5 ISOtech
{u"sdot"_qs, u"&#8901;"_qs}, // dot operator, U+22C5 ISOamsb
// dot operator is NOT the same character as U+00B7 middle dot
// Miscellaneous Technical
{"lceil", "&#8968;"}, // left ceiling = APL upstile, U+2308 ISOamsc
{"rceil", "&#8969;"}, // right ceiling, U+2309 ISOamsc
{"lfloor", "&#8970;"}, // left floor = APL downstile, U+230A ISOamsc
{"rfloor", "&#8971;"}, // right floor, U+230B ISOamsc
{"lang", "&#9001;"}, // left-pointing angle bracket = bra, U+2329 ISOtech
{u"lceil"_qs, u"&#8968;"_qs}, // left ceiling = APL upstile, U+2308 ISOamsc
{u"rceil"_qs, u"&#8969;"_qs}, // right ceiling, U+2309 ISOamsc
{u"lfloor"_qs, u"&#8970;"_qs}, // left floor = APL downstile, U+230A ISOamsc
{u"rfloor"_qs, u"&#8971;"_qs}, // right floor, U+230B ISOamsc
{u"lang"_qs, u"&#9001;"_qs}, // left-pointing angle bracket = bra, U+2329 ISOtech
// lang is NOT the same character as U+003C 'less than sign'
// or U+2039 'single left-pointing angle quotation mark'
{"rang", "&#9002;"}, // right-pointing angle bracket = ket, U+232A ISOtech
{u"rang"_qs, u"&#9002;"_qs}, // right-pointing angle bracket = ket, U+232A ISOtech
// rang is NOT the same character as U+003E 'greater than sign'
// or U+203A 'single right-pointing angle quotation mark'
// Geometric Shapes
{"loz", "&#9674;"}, // lozenge, U+25CA ISOpub
{u"loz"_qs, u"&#9674;"_qs}, // lozenge, U+25CA ISOpub
// Miscellaneous Symbols
{"spades", "&#9824;"}, // black spade suit, U+2660 ISOpub
{"clubs", "&#9827;"}, // black club suit = shamrock, U+2663 ISOpub
{"hearts", "&#9829;"}, // black heart suit = valentine, U+2665 ISOpub
{"diams", "&#9830;"} // black diamond suit, U+2666 ISOpub
{u"spades"_qs, u"&#9824;"_qs}, // black spade suit, U+2660 ISOpub
{u"clubs"_qs, u"&#9827;"_qs}, // black club suit = shamrock, U+2663 ISOpub
{u"hearts"_qs, u"&#9829;"_qs}, // black heart suit = valentine, U+2665 ISOpub
{u"diams"_qs, u"&#9830;"_qs} // black diamond suit, U+2666 ISOpub
};
return HTMLEntities.value(name);
}
@ -360,23 +361,23 @@ namespace @@ -360,23 +361,23 @@ namespace
// Ported to Qt from KDElibs4
QDateTime parseDate(const QString &string)
{
const char shortDay[][4] =
const char16_t shortDay[][4] =
{
"Mon", "Tue", "Wed",
"Thu", "Fri", "Sat",
"Sun"
u"Mon", u"Tue", u"Wed",
u"Thu", u"Fri", u"Sat",
u"Sun"
};
const char longDay[][10] =
const char16_t longDay[][10] =
{
"Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday",
"Sunday"
u"Monday", u"Tuesday", u"Wednesday",
u"Thursday", u"Friday", u"Saturday",
u"Sunday"
};
const char shortMonth[][4] =
const char16_t shortMonth[][4] =
{
"Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
u"Jan", u"Feb", u"Mar", u"Apr",
u"May", u"Jun", u"Jul", u"Aug",
u"Sep", u"Oct", u"Nov", u"Dec"
};
const QString str = string.trimmed();
@ -391,7 +392,7 @@ namespace @@ -391,7 +392,7 @@ namespace
int nmin = 8;
int nsec = 9;
// Also accept obsolete form "Weekday, DD-Mon-YY HH:MM:SS ±hhmm"
QRegularExpression rx {"^(?:([A-Z][a-z]+),\\s*)?(\\d{1,2})(\\s+|-)([^-\\s]+)(\\s+|-)(\\d{2,4})\\s+(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s+(\\S+)$"};
QRegularExpression rx {u"^(?:([A-Z][a-z]+),\\s*)?(\\d{1,2})(\\s+|-)([^-\\s]+)(\\s+|-)(\\d{2,4})\\s+(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s+(\\S+)$"_qs};
QRegularExpressionMatch rxMatch;
QStringList parts;
if (str.indexOf(rx, 0, &rxMatch) == 0)
@ -406,7 +407,7 @@ namespace @@ -406,7 +407,7 @@ namespace
else
{
// Check for the obsolete form "Wdy Mon DD HH:MM:SS YYYY"
rx = QRegularExpression {"^([A-Z][a-z]+)\\s+(\\S+)\\s+(\\d\\d)\\s+(\\d\\d):(\\d\\d):(\\d\\d)\\s+(\\d\\d\\d\\d)$"};
rx = QRegularExpression {u"^([A-Z][a-z]+)\\s+(\\S+)\\s+(\\d\\d)\\s+(\\d\\d):(\\d\\d):(\\d\\d)\\s+(\\d\\d\\d\\d)$"_qs};
if (str.indexOf(rx, 0, &rxMatch) != 0)
return QDateTime::currentDateTime();
@ -465,7 +466,7 @@ namespace @@ -465,7 +466,7 @@ namespace
bool negOffset = false;
if (parts.count() > 10)
{
rx = QRegularExpression {"^([+-])(\\d\\d)(\\d\\d)$"};
rx = QRegularExpression {u"^([+-])(\\d\\d)(\\d\\d)$"_qs};
if (parts[10].indexOf(rx, 0, &rxMatch) == 0)
{
// It's a UTC offset ±hhmm
@ -628,9 +629,9 @@ void Parser::parseRssArticle(QXmlStreamReader &xml) @@ -628,9 +629,9 @@ void Parser::parseRssArticle(QXmlStreamReader &xml)
}
else if (name == QLatin1String("enclosure"))
{
if (xml.attributes().value("type") == QLatin1String("application/x-bittorrent"))
if (xml.attributes().value(u"type"_qs) == QLatin1String("application/x-bittorrent"))
article[Article::KeyTorrentURL] = xml.attributes().value(QLatin1String("url")).toString();
else if (xml.attributes().value("type").isEmpty())
else if (xml.attributes().value(u"type"_qs).isEmpty())
altTorrentUrl = xml.attributes().value(QLatin1String("url")).toString();
}
else if (name == QLatin1String("link"))
@ -786,7 +787,7 @@ void Parser::parseAtomArticle(QXmlStreamReader &xml) @@ -786,7 +787,7 @@ void Parser::parseAtomArticle(QXmlStreamReader &xml)
void Parser::parseAtomChannel(QXmlStreamReader &xml)
{
m_baseUrl = xml.attributes().value("xml:base").toString();
m_baseUrl = xml.attributes().value(u"xml:base"_qs).toString();
while (!xml.atEnd())
{

24
src/base/torrentfilter.cpp

@ -84,29 +84,29 @@ bool TorrentFilter::setTypeByName(const QString &filter) @@ -84,29 +84,29 @@ bool TorrentFilter::setTypeByName(const QString &filter)
{
Type type = All;
if (filter == "downloading")
if (filter == u"downloading")
type = Downloading;
else if (filter == "seeding")
else if (filter == u"seeding")
type = Seeding;
else if (filter == "completed")
else if (filter == u"completed")
type = Completed;
else if (filter == "paused")
else if (filter == u"paused")
type = Paused;
else if (filter == "resumed")
else if (filter == u"resumed")
type = Resumed;
else if (filter == "active")
else if (filter == u"active")
type = Active;
else if (filter == "inactive")
else if (filter == u"inactive")
type = Inactive;
else if (filter == "stalled")
else if (filter == u"stalled")
type = Stalled;
else if (filter == "stalled_uploading")
else if (filter == u"stalled_uploading")
type = StalledUploading;
else if (filter == "stalled_downloading")
else if (filter == u"stalled_downloading")
type = StalledDownloading;
else if (filter == "checking")
else if (filter == u"checking")
type = Checking;
else if (filter == "errored")
else if (filter == u"errored")
type = Errored;
return setType(type);

126
src/base/unicodestrings.h

@ -28,70 +28,72 @@ @@ -28,70 +28,72 @@
#pragma once
#include "global.h"
// Because of the poor handling of UTF-8 characters in MSVC (emits warning C4819),
// we put all problematic UTF-8 chars/strings in this file.
// See issue #3059 for more details (https://github.com/qbittorrent/qBittorrent/issues/3059).
const char C_COPYRIGHT[] = "©";
const char C_INEQUALITY[] = "";
const char C_INFINITY[] = "";
const char C_NON_BREAKING_SPACE[] = " ";
const char C_THIN_SPACE[] = "";
const char C_UTP[] = "μTP";
inline const QString C_COPYRIGHT = u"©"_qs;
inline const QString C_INEQUALITY = u""_qs;
inline const QString C_INFINITY = u""_qs;
inline const QString C_NON_BREAKING_SPACE = u" "_qs;
inline const QString C_THIN_SPACE = u""_qs;
inline const QString C_UTP = u"μTP"_qs;
const char C_LOCALE_ARABIC[] = "عربي";
const char C_LOCALE_ARMENIAN[] = "Հայերեն";
const char C_LOCALE_AZERBAIJANI[] = "Azərbaycan dili";
const char C_LOCALE_BASQUE[] = "Euskara";
const char C_LOCALE_BULGARIAN[] = "Български";
const char C_LOCALE_BYELORUSSIAN[] = "Беларуская";
const char C_LOCALE_CATALAN[] = "Català";
const char C_LOCALE_CHINESE_SIMPLIFIED[] = "简体中文";
const char C_LOCALE_CHINESE_TRADITIONAL_HK[] = "香港正體字";
const char C_LOCALE_CHINESE_TRADITIONAL_TW[] = "正體中文";
const char C_LOCALE_CROATIAN[] = "Hrvatski";
const char C_LOCALE_CZECH[] = "Čeština";
const char C_LOCALE_DANISH[] = "Dansk";
const char C_LOCALE_DUTCH[] = "Nederlands";
const char C_LOCALE_ENGLISH[] = "English";
const char C_LOCALE_ENGLISH_AUSTRALIA[] = "English (Australia)";
const char C_LOCALE_ENGLISH_UNITEDKINGDOM[] = "English (United Kingdom)";
const char C_LOCALE_ESPERANTO[] = "Esperanto";
const char C_LOCALE_ESTONIAN[] = "Eesti, eesti keel";
const char C_LOCALE_FINNISH[] = "Suomi";
const char C_LOCALE_FRENCH[] = "Français";
const char C_LOCALE_GALICIAN[] = "Galego";
const char C_LOCALE_GEORGIAN[] = "ქართული";
const char C_LOCALE_GERMAN[] = "Deutsch";
const char C_LOCALE_GREEK[] = "Ελληνικά";
const char C_LOCALE_HEBREW[] = "עברית";
const char C_LOCALE_HINDI[] = "ि, हि";
const char C_LOCALE_HUNGARIAN[] = "Magyar";
const char C_LOCALE_ICELANDIC[] = "Íslenska";
const char C_LOCALE_INDONESIAN[] = "Bahasa Indonesia";
const char C_LOCALE_ITALIAN[] = "Italiano";
const char C_LOCALE_JAPANESE[] = "日本語";
const char C_LOCALE_KOREAN[] = "한국어";
const char C_LOCALE_LATGALIAN[] = "Latgalīšu volūda";
const char C_LOCALE_LATVIAN[] = "Latviešu valoda";
const char C_LOCALE_LITHUANIAN[] = "Lietuvių";
const char C_LOCALE_MALAY[] = "بهاس ملايو";
const char C_LOCALE_MONGOLIAN[] = "Монгол хэл";
const char C_LOCALE_NORWEGIAN[] = "Norsk";
const char C_LOCALE_OCCITAN[] = "lenga d'òc";
const char C_LOCALE_PERSIAN[] = "فارسی";
const char C_LOCALE_POLISH[] = "Polski";
const char C_LOCALE_PORTUGUESE[] = "Português";
const char C_LOCALE_PORTUGUESE_BRAZIL[] = "Português brasileiro";
const char C_LOCALE_ROMANIAN[] = "Română";
const char C_LOCALE_RUSSIAN[] = "Русский";
const char C_LOCALE_SERBIAN[] = "Српски";
const char C_LOCALE_SLOVAK[] = "Slovenčina";
const char C_LOCALE_SLOVENIAN[] = "Slovenščina";
const char C_LOCALE_SPANISH[] = "Español";
const char C_LOCALE_SWEDISH[] = "Svenska";
const char C_LOCALE_THAI[] = "ไทย";
const char C_LOCALE_TURKISH[] = "Türkçe";
const char C_LOCALE_UKRAINIAN[] = "Українська";
const char C_LOCALE_UZBEK[] = "أۇزبېك";
const char C_LOCALE_VIETNAMESE[] = "Tiếng Việt";
inline const QString C_LOCALE_ARABIC = u"عربي"_qs;
inline const QString C_LOCALE_ARMENIAN = u"Հայերեն"_qs;
inline const QString C_LOCALE_AZERBAIJANI = u"Azərbaycan dili"_qs;
inline const QString C_LOCALE_BASQUE = u"Euskara"_qs;
inline const QString C_LOCALE_BULGARIAN = u"Български"_qs;
inline const QString C_LOCALE_BYELORUSSIAN = u"Беларуская"_qs;
inline const QString C_LOCALE_CATALAN = u"Català"_qs;
inline const QString C_LOCALE_CHINESE_SIMPLIFIED = u"简体中文"_qs;
inline const QString C_LOCALE_CHINESE_TRADITIONAL_HK = u"香港正體字"_qs;
inline const QString C_LOCALE_CHINESE_TRADITIONAL_TW = u"正體中文"_qs;
inline const QString C_LOCALE_CROATIAN = u"Hrvatski"_qs;
inline const QString C_LOCALE_CZECH = u"Čeština"_qs;
inline const QString C_LOCALE_DANISH = u"Dansk"_qs;
inline const QString C_LOCALE_DUTCH = u"Nederlands"_qs;
inline const QString C_LOCALE_ENGLISH = u"English"_qs;
inline const QString C_LOCALE_ENGLISH_AUSTRALIA = u"English (Australia)"_qs;
inline const QString C_LOCALE_ENGLISH_UNITEDKINGDOM = u"English (United Kingdom)"_qs;
inline const QString C_LOCALE_ESPERANTO = u"Esperanto"_qs;
inline const QString C_LOCALE_ESTONIAN = u"Eesti, eesti keel"_qs;
inline const QString C_LOCALE_FINNISH = u"Suomi"_qs;
inline const QString C_LOCALE_FRENCH = u"Français"_qs;
inline const QString C_LOCALE_GALICIAN = u"Galego"_qs;
inline const QString C_LOCALE_GEORGIAN = u"ქართული"_qs;
inline const QString C_LOCALE_GERMAN = u"Deutsch"_qs;
inline const QString C_LOCALE_GREEK = u"Ελληνικά"_qs;
inline const QString C_LOCALE_HEBREW = u"עברית"_qs;
inline const QString C_LOCALE_HINDI = u"ि, हि"_qs;
inline const QString C_LOCALE_HUNGARIAN = u"Magyar"_qs;
inline const QString C_LOCALE_ICELANDIC = u"Íslenska"_qs;
inline const QString C_LOCALE_INDONESIAN = u"Bahasa Indonesia"_qs;
inline const QString C_LOCALE_ITALIAN = u"Italiano"_qs;
inline const QString C_LOCALE_JAPANESE = u"日本語"_qs;
inline const QString C_LOCALE_KOREAN = u"한국어"_qs;
inline const QString C_LOCALE_LATGALIAN = u"Latgalīšu volūda"_qs;
inline const QString C_LOCALE_LATVIAN = u"Latviešu valoda"_qs;
inline const QString C_LOCALE_LITHUANIAN = u"Lietuvių"_qs;
inline const QString C_LOCALE_MALAY = u"بهاس ملايو"_qs;
inline const QString C_LOCALE_MONGOLIAN = u"Монгол хэл"_qs;
inline const QString C_LOCALE_NORWEGIAN = u"Norsk"_qs;
inline const QString C_LOCALE_OCCITAN = u"lenga d'òc"_qs;
inline const QString C_LOCALE_PERSIAN = u"فارسی"_qs;
inline const QString C_LOCALE_POLISH = u"Polski"_qs;
inline const QString C_LOCALE_PORTUGUESE = u"Português"_qs;
inline const QString C_LOCALE_PORTUGUESE_BRAZIL = u"Português brasileiro"_qs;
inline const QString C_LOCALE_ROMANIAN = u"Română"_qs;
inline const QString C_LOCALE_RUSSIAN = u"Русский"_qs;
inline const QString C_LOCALE_SERBIAN = u"Српски"_qs;
inline const QString C_LOCALE_SLOVAK = u"Slovenčina"_qs;
inline const QString C_LOCALE_SLOVENIAN = u"Slovenščina"_qs;
inline const QString C_LOCALE_SPANISH = u"Español"_qs;
inline const QString C_LOCALE_SWEDISH = u"Svenska"_qs;
inline const QString C_LOCALE_THAI = u"ไทย"_qs;
inline const QString C_LOCALE_TURKISH = u"Türkçe"_qs;
inline const QString C_LOCALE_UKRAINIAN = u"Українська"_qs;
inline const QString C_LOCALE_UZBEK = u"أۇزبېك"_qs;
inline const QString C_LOCALE_VIETNAMESE = u"Tiếng Việt"_qs;

11
src/base/utils/foreignapps.cpp

@ -42,6 +42,7 @@ @@ -42,6 +42,7 @@
#include <QDir>
#endif
#include "base/global.h"
#include "base/logger.h"
#include "base/utils/bytearray.h"
@ -52,7 +53,7 @@ namespace @@ -52,7 +53,7 @@ namespace
bool testPythonInstallation(const QString &exeName, PythonInfo &info)
{
QProcess proc;
proc.start(exeName, {"--version"}, QIODevice::ReadOnly);
proc.start(exeName, {u"--version"_qs}, QIODevice::ReadOnly);
if (proc.waitForFinished() && (proc.exitCode() == QProcess::NormalExit))
{
QByteArray procOutput = proc.readAllStandardOutput();
@ -69,8 +70,8 @@ namespace @@ -69,8 +70,8 @@ namespace
// User reports: `python --version` -> "Python 3.6.6+"
// So trim off unrelated characters
const QString versionStr = outputSplit[1];
const int idx = versionStr.indexOf(QRegularExpression("[^\\.\\d]"));
const auto versionStr = QString::fromLocal8Bit(outputSplit[1]);
const int idx = versionStr.indexOf(QRegularExpression(u"[^\\.\\d]"_qs));
try
{
@ -274,10 +275,10 @@ PythonInfo Utils::ForeignApps::pythonInfo() @@ -274,10 +275,10 @@ PythonInfo Utils::ForeignApps::pythonInfo()
static PythonInfo pyInfo;
if (!pyInfo.isValid())
{
if (testPythonInstallation("python3", pyInfo))
if (testPythonInstallation(u"python3"_qs, pyInfo))
return pyInfo;
if (testPythonInstallation("python", pyInfo))
if (testPythonInstallation(u"python"_qs, pyInfo))
return pyInfo;
#if defined(Q_OS_WIN)

6
src/base/utils/misc.cpp

@ -265,7 +265,7 @@ QString Utils::Misc::friendlyUnit(const qint64 bytes, const bool isSpeed) @@ -265,7 +265,7 @@ QString Utils::Misc::friendlyUnit(const qint64 bytes, const bool isSpeed)
if (!result)
return QCoreApplication::translate("misc", "Unknown", "Unknown (size)");
return Utils::String::fromDouble(result->value, friendlyUnitPrecision(result->unit))
+ QString::fromUtf8(C_NON_BREAKING_SPACE)
+ C_NON_BREAKING_SPACE
+ unitString(result->unit, isSpeed);
}
@ -354,9 +354,9 @@ bool Utils::Misc::isPreviewable(const Path &filePath) @@ -354,9 +354,9 @@ bool Utils::Misc::isPreviewable(const Path &filePath)
QString Utils::Misc::userFriendlyDuration(const qlonglong seconds, const qlonglong maxCap)
{
if (seconds < 0)
return QString::fromUtf8(C_INFINITY);
return C_INFINITY;
if ((maxCap >= 0) && (seconds >= maxCap))
return QString::fromUtf8(C_INFINITY);
return C_INFINITY;
if (seconds == 0)
return u"0"_qs;

2
src/base/utils/net.cpp

@ -94,7 +94,7 @@ namespace Utils @@ -94,7 +94,7 @@ namespace Utils
QString subnetToString(const Subnet &subnet)
{
return subnet.first.toString() + '/' + QString::number(subnet.second);
return subnet.first.toString() + u'/' + QString::number(subnet.second);
}
QHostAddress canonicalIPv6Addr(const QHostAddress &addr)

39
src/gui/aboutdialog.cpp

@ -55,19 +55,19 @@ AboutDialog::AboutDialog(QWidget *parent) @@ -55,19 +55,19 @@ AboutDialog::AboutDialog(QWidget *parent)
m_ui->logo->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(QLatin1String("qbittorrent-tray")), this, 32));
// About
const QString aboutText = QString(
"<p style=\"white-space: pre-wrap;\">"
"%1\n\n"
"%2\n\n"
"<table>"
"<tr><td>%3</td><td><a href=\"https://www.qbittorrent.org\">https://www.qbittorrent.org</a></td></tr>"
"<tr><td>%4</td><td><a href=\"http://forum.qbittorrent.org\">http://forum.qbittorrent.org</a></td></tr>"
"<tr><td>%5</td><td><a href=\"http://bugs.qbittorrent.org\">http://bugs.qbittorrent.org</a></td></tr>"
"</table>"
"</p>")
const QString aboutText =
u"<p style=\"white-space: pre-wrap;\">"
u"%1\n\n"
u"%2\n\n"
u"<table>"
u"<tr><td>%3</td><td><a href=\"https://www.qbittorrent.org\">https://www.qbittorrent.org</a></td></tr>"
u"<tr><td>%4</td><td><a href=\"http://forum.qbittorrent.org\">http://forum.qbittorrent.org</a></td></tr>"
u"<tr><td>%5</td><td><a href=\"http://bugs.qbittorrent.org\">http://bugs.qbittorrent.org</a></td></tr>"
u"</table>"
u"</p>"_qs
.arg(tr("An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar.")
.replace("C++", "C\u2060+\u2060+") // make C++ non-breaking
, tr("Copyright %1 2006-2022 The qBittorrent project").arg(QString::fromUtf8(C_COPYRIGHT))
.replace(u"C++"_qs, u"C\u2060+\u2060+"_qs) // make C++ non-breaking
, tr("Copyright %1 2006-2022 The qBittorrent project").arg(C_COPYRIGHT)
, tr("Home Page:")
, tr("Forum:")
, tr("Bug Tracker:"));
@ -76,7 +76,7 @@ AboutDialog::AboutDialog(QWidget *parent) @@ -76,7 +76,7 @@ AboutDialog::AboutDialog(QWidget *parent)
m_ui->labelMascot->setPixmap(Utils::Gui::scaledPixmap(Path(u":/icons/mascot.png"_qs), this));
// Thanks
QFile thanksfile(":/thanks.html");
QFile thanksfile(u":/thanks.html"_qs);
if (thanksfile.open(QIODevice::ReadOnly | QIODevice::Text))
{
m_ui->textBrowserThanks->setHtml(QString::fromUtf8(thanksfile.readAll().constData()));
@ -84,7 +84,7 @@ AboutDialog::AboutDialog(QWidget *parent) @@ -84,7 +84,7 @@ AboutDialog::AboutDialog(QWidget *parent)
}
// Translation
QFile translatorsfile(":/translators.html");
QFile translatorsfile(u":/translators.html"_qs);
if (translatorsfile.open(QIODevice::ReadOnly | QIODevice::Text))
{
m_ui->textBrowserTranslation->setHtml(QString::fromUtf8(translatorsfile.readAll().constData()));
@ -92,7 +92,7 @@ AboutDialog::AboutDialog(QWidget *parent) @@ -92,7 +92,7 @@ AboutDialog::AboutDialog(QWidget *parent)
}
// License
QFile licensefile(":/gpl.html");
QFile licensefile(u":/gpl.html"_qs);
if (licensefile.open(QIODevice::ReadOnly | QIODevice::Text))
{
m_ui->textBrowserLicense->setHtml(QString::fromUtf8(licensefile.readAll().constData()));
@ -100,16 +100,15 @@ AboutDialog::AboutDialog(QWidget *parent) @@ -100,16 +100,15 @@ AboutDialog::AboutDialog(QWidget *parent)
}
// Software Used
m_ui->labelQtVer->setText(QT_VERSION_STR);
m_ui->labelQtVer->setText(QStringLiteral(QT_VERSION_STR));
m_ui->labelLibtVer->setText(Utils::Misc::libtorrentVersionString());
m_ui->labelBoostVer->setText(Utils::Misc::boostVersionString());
m_ui->labelOpensslVer->setText(Utils::Misc::opensslVersionString());
m_ui->labelZlibVer->setText(Utils::Misc::zlibVersionString());
const QString DBIPText = QString(
"<html><head/><body><p>"
"%1"
" (<a href=\"https://db-ip.com/\">https://db-ip.com/</a>)</p></body></html>")
const QString DBIPText = u"<html><head/><body><p>"
u"%1 (<a href=\"https://db-ip.com/\">https://db-ip.com/</a>)"
u"</p></body></html>"_qs
.arg(tr("The free IP to Country Lite database by DB-IP is used for resolving the countries of peers. "
"The database is licensed under the Creative Commons Attribution 4.0 International License"));
m_ui->labelDBIP->setText(DBIPText);

6
src/gui/addnewtorrentdialog.cpp

@ -231,7 +231,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP @@ -231,7 +231,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
m_ui->categoryComboBox->addItem(m_torrentParams.category);
if (!defaultCategory.isEmpty())
m_ui->categoryComboBox->addItem(defaultCategory);
m_ui->categoryComboBox->addItem("");
m_ui->categoryComboBox->addItem(u""_qs);
for (const QString &category : asConst(categories))
if (category != defaultCategory && category != m_torrentParams.category)
@ -348,7 +348,7 @@ void AddNewTorrentDialog::show(const QString &source, QWidget *parent) @@ -348,7 +348,7 @@ void AddNewTorrentDialog::show(const QString &source, QWidget *parent)
bool AddNewTorrentDialog::loadTorrentFile(const QString &source)
{
const Path decodedPath {source.startsWith("file://", Qt::CaseInsensitive)
const Path decodedPath {source.startsWith(u"file://", Qt::CaseInsensitive)
? QUrl::fromEncoded(source.toLocal8Bit()).toLocalFile()
: source};
@ -716,7 +716,7 @@ void AddNewTorrentDialog::displayContentTreeMenu() @@ -716,7 +716,7 @@ void AddNewTorrentDialog::displayContentTreeMenu()
if (selectedRows.size() == 1)
{
menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename..."), this, &AddNewTorrentDialog::renameSelectedFile);
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Rename..."), this, &AddNewTorrentDialog::renameSelectedFile);
menu->addSeparator();
QMenu *priorityMenu = menu->addMenu(tr("Priority"));

86
src/gui/advancedsettings.cpp

@ -47,7 +47,7 @@ namespace @@ -47,7 +47,7 @@ namespace
{
QString makeLink(const QString &url, const QString &linkLabel)
{
return QStringLiteral("<a href=\"%1\">%2</a>").arg(url, linkLabel);
return u"<a href=\"%1\">%2</a>"_qs.arg(url, linkLabel);
}
enum AdvSettingsCols
@ -443,7 +443,7 @@ void AdvancedSettings::loadAdvancedSettings() @@ -443,7 +443,7 @@ void AdvancedSettings::loadAdvancedSettings()
}
m_comboBoxOSMemoryPriority.setCurrentIndex(OSMemoryPriorityIndex);
addRow(OS_MEMORY_PRIORITY, (tr("Process memory priority (Windows >= 8 only)")
+ ' ' + makeLink("https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-memory_priority_information", "(?)"))
+ u' ' + makeLink(u"https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-memory_priority_information"_qs, u"(?)"_qs))
, &m_comboBoxOSMemoryPriority);
m_spinBoxMemoryWorkingSetLimit.setMinimum(1);
@ -452,7 +452,7 @@ void AdvancedSettings::loadAdvancedSettings() @@ -452,7 +452,7 @@ void AdvancedSettings::loadAdvancedSettings()
m_spinBoxMemoryWorkingSetLimit.setValue(static_cast<Application *>(QCoreApplication::instance())->memoryWorkingSetLimit());
addRow(MEMORY_WORKING_SET_LIMIT, (tr("Physical memory (RAM) usage limit")
+ ' ' + makeLink("https://wikipedia.org/wiki/Working_set", "(?)"))
+ u' ' + makeLink(u"https://wikipedia.org/wiki/Working_set"_qs, u"(?)"_qs))
, &m_spinBoxMemoryWorkingSetLimit);
#endif
@ -460,7 +460,7 @@ void AdvancedSettings::loadAdvancedSettings() @@ -460,7 +460,7 @@ void AdvancedSettings::loadAdvancedSettings()
m_spinBoxAsyncIOThreads.setMinimum(1);
m_spinBoxAsyncIOThreads.setMaximum(1024);
m_spinBoxAsyncIOThreads.setValue(session->asyncIOThreads());
addRow(ASYNC_IO_THREADS, (tr("Asynchronous I/O threads") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#aio_threads", "(?)"))
addRow(ASYNC_IO_THREADS, (tr("Asynchronous I/O threads") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#aio_threads"_qs, u"(?)"_qs))
, &m_spinBoxAsyncIOThreads);
#ifdef QBT_USES_LIBTORRENT2
@ -468,7 +468,7 @@ void AdvancedSettings::loadAdvancedSettings() @@ -468,7 +468,7 @@ void AdvancedSettings::loadAdvancedSettings()
m_spinBoxHashingThreads.setMinimum(1);
m_spinBoxHashingThreads.setMaximum(1024);
m_spinBoxHashingThreads.setValue(session->hashingThreads());
addRow(HASHING_THREADS, (tr("Hashing threads") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#hashing_threads", "(?)"))
addRow(HASHING_THREADS, (tr("Hashing threads") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#hashing_threads"_qs, u"(?)"_qs))
, &m_spinBoxHashingThreads);
#endif
@ -476,7 +476,7 @@ void AdvancedSettings::loadAdvancedSettings() @@ -476,7 +476,7 @@ void AdvancedSettings::loadAdvancedSettings()
m_spinBoxFilePoolSize.setMinimum(1);
m_spinBoxFilePoolSize.setMaximum(std::numeric_limits<int>::max());
m_spinBoxFilePoolSize.setValue(session->filePoolSize());
addRow(FILE_POOL_SIZE, (tr("File pool size") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#file_pool_size", "(?)"))
addRow(FILE_POOL_SIZE, (tr("File pool size") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#file_pool_size"_qs, u"(?)"_qs))
, &m_spinBoxFilePoolSize);
// Checking Memory Usage
@ -490,7 +490,7 @@ void AdvancedSettings::loadAdvancedSettings() @@ -490,7 +490,7 @@ void AdvancedSettings::loadAdvancedSettings()
#endif
m_spinBoxCheckingMemUsage.setValue(session->checkingMemUsage());
m_spinBoxCheckingMemUsage.setSuffix(tr(" MiB"));
addRow(CHECKING_MEM_USAGE, (tr("Outstanding memory when checking torrents") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#checking_mem_usage", "(?)"))
addRow(CHECKING_MEM_USAGE, (tr("Outstanding memory when checking torrents") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#checking_mem_usage"_qs, u"(?)"_qs))
, &m_spinBoxCheckingMemUsage);
#ifndef QBT_USES_LIBTORRENT2
// Disk write cache
@ -506,14 +506,14 @@ void AdvancedSettings::loadAdvancedSettings() @@ -506,14 +506,14 @@ void AdvancedSettings::loadAdvancedSettings()
updateCacheSpinSuffix(m_spinBoxCache.value());
connect(&m_spinBoxCache, qOverload<int>(&QSpinBox::valueChanged)
, this, &AdvancedSettings::updateCacheSpinSuffix);
addRow(DISK_CACHE, (tr("Disk cache") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#cache_size", "(?)"))
addRow(DISK_CACHE, (tr("Disk cache") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#cache_size"_qs, u"(?)"_qs))
, &m_spinBoxCache);
// Disk cache expiry
m_spinBoxCacheTTL.setMinimum(1);
m_spinBoxCacheTTL.setMaximum(std::numeric_limits<int>::max());
m_spinBoxCacheTTL.setValue(session->diskCacheTTL());
m_spinBoxCacheTTL.setSuffix(tr(" s", " seconds"));
addRow(DISK_CACHE_TTL, (tr("Disk cache expiry interval") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#cache_expiry", "(?)"))
addRow(DISK_CACHE_TTL, (tr("Disk cache expiry interval") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#cache_expiry"_qs, u"(?)"_qs))
, &m_spinBoxCacheTTL);
#endif
// Disk queue size
@ -521,55 +521,55 @@ void AdvancedSettings::loadAdvancedSettings() @@ -521,55 +521,55 @@ void AdvancedSettings::loadAdvancedSettings()
m_spinBoxDiskQueueSize.setMaximum(std::numeric_limits<int>::max());
m_spinBoxDiskQueueSize.setValue(session->diskQueueSize() / 1024);
m_spinBoxDiskQueueSize.setSuffix(tr(" KiB"));
addRow(DISK_QUEUE_SIZE, (tr("Disk queue size") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#max_queued_disk_bytes", "(?)"))
addRow(DISK_QUEUE_SIZE, (tr("Disk queue size") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#max_queued_disk_bytes"_qs, u"(?)"_qs))
, &m_spinBoxDiskQueueSize);
// Enable OS cache
m_checkBoxOsCache.setChecked(session->useOSCache());
addRow(OS_CACHE, (tr("Enable OS cache") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#disk_io_write_mode", "(?)"))
addRow(OS_CACHE, (tr("Enable OS cache") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#disk_io_write_mode"_qs, u"(?)"_qs))
, &m_checkBoxOsCache);
#ifndef QBT_USES_LIBTORRENT2
// Coalesce reads & writes
m_checkBoxCoalesceRW.setChecked(session->isCoalesceReadWriteEnabled());
addRow(COALESCE_RW, (tr("Coalesce reads & writes") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#coalesce_reads", "(?)"))
addRow(COALESCE_RW, (tr("Coalesce reads & writes") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#coalesce_reads"_qs, u"(?)"_qs))
, &m_checkBoxCoalesceRW);
#endif
// Piece extent affinity
m_checkBoxPieceExtentAffinity.setChecked(session->usePieceExtentAffinity());
addRow(PIECE_EXTENT_AFFINITY, (tr("Use piece extent affinity") + ' ' + makeLink("https://libtorrent.org/single-page-ref.html#piece_extent_affinity", "(?)")), &m_checkBoxPieceExtentAffinity);
addRow(PIECE_EXTENT_AFFINITY, (tr("Use piece extent affinity") + u' ' + makeLink(u"https://libtorrent.org/single-page-ref.html#piece_extent_affinity"_qs, u"(?)"_qs)), &m_checkBoxPieceExtentAffinity);
// Suggest mode
m_checkBoxSuggestMode.setChecked(session->isSuggestModeEnabled());
addRow(SUGGEST_MODE, (tr("Send upload piece suggestions") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#suggest_mode", "(?)"))
addRow(SUGGEST_MODE, (tr("Send upload piece suggestions") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#suggest_mode"_qs, u"(?)"_qs))
, &m_checkBoxSuggestMode);
// Send buffer watermark
m_spinBoxSendBufferWatermark.setMinimum(1);
m_spinBoxSendBufferWatermark.setMaximum(std::numeric_limits<int>::max());
m_spinBoxSendBufferWatermark.setSuffix(tr(" KiB"));
m_spinBoxSendBufferWatermark.setValue(session->sendBufferWatermark());
addRow(SEND_BUF_WATERMARK, (tr("Send buffer watermark") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#send_buffer_watermark", "(?)"))
addRow(SEND_BUF_WATERMARK, (tr("Send buffer watermark") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#send_buffer_watermark"_qs, u"(?)"_qs))
, &m_spinBoxSendBufferWatermark);
m_spinBoxSendBufferLowWatermark.setMinimum(1);
m_spinBoxSendBufferLowWatermark.setMaximum(std::numeric_limits<int>::max());
m_spinBoxSendBufferLowWatermark.setSuffix(tr(" KiB"));
m_spinBoxSendBufferLowWatermark.setValue(session->sendBufferLowWatermark());
addRow(SEND_BUF_LOW_WATERMARK, (tr("Send buffer low watermark") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#send_buffer_low_watermark", "(?)"))
addRow(SEND_BUF_LOW_WATERMARK, (tr("Send buffer low watermark") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#send_buffer_low_watermark"_qs, u"(?)"_qs))
, &m_spinBoxSendBufferLowWatermark);
m_spinBoxSendBufferWatermarkFactor.setMinimum(1);
m_spinBoxSendBufferWatermarkFactor.setMaximum(std::numeric_limits<int>::max());
m_spinBoxSendBufferWatermarkFactor.setSuffix(" %");
m_spinBoxSendBufferWatermarkFactor.setSuffix(u" %"_qs);
m_spinBoxSendBufferWatermarkFactor.setValue(session->sendBufferWatermarkFactor());
addRow(SEND_BUF_WATERMARK_FACTOR, (tr("Send buffer watermark factor") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#send_buffer_watermark_factor", "(?)"))
addRow(SEND_BUF_WATERMARK_FACTOR, (tr("Send buffer watermark factor") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#send_buffer_watermark_factor"_qs, u"(?)"_qs))
, &m_spinBoxSendBufferWatermarkFactor);
// Outgoing connections per second
m_spinBoxConnectionSpeed.setMinimum(0);
m_spinBoxConnectionSpeed.setMaximum(std::numeric_limits<int>::max());
m_spinBoxConnectionSpeed.setValue(session->connectionSpeed());
addRow(CONNECTION_SPEED, (tr("Outgoing connections per second") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#connection_speed", "(?)"))
addRow(CONNECTION_SPEED, (tr("Outgoing connections per second") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#connection_speed"_qs, u"(?)"_qs))
, &m_spinBoxConnectionSpeed);
// Socket listen backlog size
m_spinBoxSocketBacklogSize.setMinimum(1);
m_spinBoxSocketBacklogSize.setMaximum(std::numeric_limits<int>::max());
m_spinBoxSocketBacklogSize.setValue(session->socketBacklogSize());
addRow(SOCKET_BACKLOG_SIZE, (tr("Socket backlog size") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#listen_queue_size", "(?)"))
addRow(SOCKET_BACKLOG_SIZE, (tr("Socket backlog size") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#listen_queue_size"_qs, u"(?)"_qs))
, &m_spinBoxSocketBacklogSize);
// Save resume data interval
m_spinBoxSaveResumeDataInterval.setMinimum(0);
@ -584,57 +584,57 @@ void AdvancedSettings::loadAdvancedSettings() @@ -584,57 +584,57 @@ void AdvancedSettings::loadAdvancedSettings()
m_spinBoxOutgoingPortsMin.setMaximum(65535);
m_spinBoxOutgoingPortsMin.setValue(session->outgoingPortsMin());
addRow(OUTGOING_PORT_MIN, (tr("Outgoing ports (Min) [0: Disabled]")
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#outgoing_port", "(?)"))
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#outgoing_port"_qs, u"(?)"_qs))
, &m_spinBoxOutgoingPortsMin);
// Outgoing port Min
m_spinBoxOutgoingPortsMax.setMinimum(0);
m_spinBoxOutgoingPortsMax.setMaximum(65535);
m_spinBoxOutgoingPortsMax.setValue(session->outgoingPortsMax());
addRow(OUTGOING_PORT_MAX, (tr("Outgoing ports (Max) [0: Disabled]")
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#outgoing_port", "(?)"))
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#outgoing_port"_qs, u"(?)"_qs))
, &m_spinBoxOutgoingPortsMax);
// UPnP lease duration
m_spinBoxUPnPLeaseDuration.setMinimum(0);
m_spinBoxUPnPLeaseDuration.setMaximum(std::numeric_limits<int>::max());
m_spinBoxUPnPLeaseDuration.setValue(session->UPnPLeaseDuration());
m_spinBoxUPnPLeaseDuration.setSuffix(tr(" s", " seconds"));
addRow(UPNP_LEASE_DURATION, (tr("UPnP lease duration [0: Permanent lease]") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#upnp_lease_duration", "(?)"))
addRow(UPNP_LEASE_DURATION, (tr("UPnP lease duration [0: Permanent lease]") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#upnp_lease_duration"_qs, u"(?)"_qs))
, &m_spinBoxUPnPLeaseDuration);
// Type of service
m_spinBoxPeerToS.setMinimum(0);
m_spinBoxPeerToS.setMaximum(255);
m_spinBoxPeerToS.setValue(session->peerToS());
addRow(PEER_TOS, (tr("Type of service (ToS) for connections to peers") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#peer_tos", "(?)"))
addRow(PEER_TOS, (tr("Type of service (ToS) for connections to peers") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#peer_tos"_qs, u"(?)"_qs))
, &m_spinBoxPeerToS);
// uTP-TCP mixed mode
m_comboBoxUtpMixedMode.addItems({tr("Prefer TCP"), tr("Peer proportional (throttles TCP)")});
m_comboBoxUtpMixedMode.setCurrentIndex(static_cast<int>(session->utpMixedMode()));
addRow(UTP_MIX_MODE, (tr("%1-TCP mixed mode algorithm", "uTP-TCP mixed mode algorithm").arg(C_UTP)
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#mixed_mode_algorithm", "(?)"))
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#mixed_mode_algorithm"_qs, u"(?)"_qs))
, &m_comboBoxUtpMixedMode);
// Support internationalized domain name (IDN)
m_checkBoxIDNSupport.setChecked(session->isIDNSupportEnabled());
addRow(IDN_SUPPORT, (tr("Support internationalized domain name (IDN)")
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#allow_idna", "(?)"))
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#allow_idna"_qs, u"(?)"_qs))
, &m_checkBoxIDNSupport);
// multiple connections per IP
m_checkBoxMultiConnectionsPerIp.setChecked(session->multiConnectionsPerIpEnabled());
addRow(MULTI_CONNECTIONS_PER_IP, (tr("Allow multiple connections from the same IP address")
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#allow_multiple_connections_per_ip", "(?)"))
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#allow_multiple_connections_per_ip"_qs, u"(?)"_qs))
, &m_checkBoxMultiConnectionsPerIp);
// Validate HTTPS tracker certificate
m_checkBoxValidateHTTPSTrackerCertificate.setChecked(session->validateHTTPSTrackerCertificate());
addRow(VALIDATE_HTTPS_TRACKER_CERTIFICATE, (tr("Validate HTTPS tracker certificates")
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#validate_https_trackers", "(?)"))
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#validate_https_trackers"_qs, u"(?)"_qs))
, &m_checkBoxValidateHTTPSTrackerCertificate);
// SSRF mitigation
m_checkBoxSSRFMitigation.setChecked(session->isSSRFMitigationEnabled());
addRow(SSRF_MITIGATION, (tr("Server-side request forgery (SSRF) mitigation")
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#ssrf_mitigation", "(?)"))
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#ssrf_mitigation"_qs, u"(?)"_qs))
, &m_checkBoxSSRFMitigation);
// Disallow connection to peers on privileged ports
m_checkBoxBlockPeersOnPrivilegedPorts.setChecked(session->blockPeersOnPrivilegedPorts());
addRow(BLOCK_PEERS_ON_PRIVILEGED_PORTS, (tr("Disallow connection to peers on privileged ports") + ' ' + makeLink("https://libtorrent.org/single-page-ref.html#no_connect_privileged_ports", "(?)")), &m_checkBoxBlockPeersOnPrivilegedPorts);
addRow(BLOCK_PEERS_ON_PRIVILEGED_PORTS, (tr("Disallow connection to peers on privileged ports") + u' ' + makeLink(u"https://libtorrent.org/single-page-ref.html#no_connect_privileged_ports"_qs, u"(?)"_qs)), &m_checkBoxBlockPeersOnPrivilegedPorts);
// Recheck completed torrents
m_checkBoxRecheckCompleted.setChecked(pref->recheckTorrentsOnCompletion());
addRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &m_checkBoxRecheckCompleted);
@ -680,17 +680,17 @@ void AdvancedSettings::loadAdvancedSettings() @@ -680,17 +680,17 @@ void AdvancedSettings::loadAdvancedSettings()
// Announce IP
m_lineEditAnnounceIP.setText(session->announceIP());
addRow(ANNOUNCE_IP, (tr("IP address reported to trackers (requires restart)")
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#announce_ip", "(?)"))
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#announce_ip"_qs, u"(?)"_qs))
, &m_lineEditAnnounceIP);
// Max concurrent HTTP announces
m_spinBoxMaxConcurrentHTTPAnnounces.setMaximum(std::numeric_limits<int>::max());
m_spinBoxMaxConcurrentHTTPAnnounces.setValue(session->maxConcurrentHTTPAnnounces());
addRow(MAX_CONCURRENT_HTTP_ANNOUNCES, (tr("Max concurrent HTTP announces") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#max_concurrent_http_announces", "(?)"))
addRow(MAX_CONCURRENT_HTTP_ANNOUNCES, (tr("Max concurrent HTTP announces") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#max_concurrent_http_announces"_qs, u"(?)"_qs))
, &m_spinBoxMaxConcurrentHTTPAnnounces);
// Stop tracker timeout
m_spinBoxStopTrackerTimeout.setValue(session->stopTrackerTimeout());
m_spinBoxStopTrackerTimeout.setSuffix(tr(" s", " seconds"));
addRow(STOP_TRACKER_TIMEOUT, (tr("Stop tracker timeout") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#stop_tracker_timeout", "(?)"))
addRow(STOP_TRACKER_TIMEOUT, (tr("Stop tracker timeout") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#stop_tracker_timeout"_qs, u"(?)"_qs))
, &m_spinBoxStopTrackerTimeout);
// Program notifications
@ -738,12 +738,12 @@ void AdvancedSettings::loadAdvancedSettings() @@ -738,12 +738,12 @@ void AdvancedSettings::loadAdvancedSettings()
// Choking algorithm
m_comboBoxChokingAlgorithm.addItems({tr("Fixed slots"), tr("Upload rate based")});
m_comboBoxChokingAlgorithm.setCurrentIndex(static_cast<int>(session->chokingAlgorithm()));
addRow(CHOKING_ALGORITHM, (tr("Upload slots behavior") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#choking_algorithm", "(?)"))
addRow(CHOKING_ALGORITHM, (tr("Upload slots behavior") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#choking_algorithm"_qs, u"(?)"_qs))
, &m_comboBoxChokingAlgorithm);
// Seed choking algorithm
m_comboBoxSeedChokingAlgorithm.addItems({tr("Round-robin"), tr("Fastest upload"), tr("Anti-leech")});
m_comboBoxSeedChokingAlgorithm.setCurrentIndex(static_cast<int>(session->seedChokingAlgorithm()));
addRow(SEED_CHOKING_ALGORITHM, (tr("Upload choking algorithm") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#seed_choking_algorithm", "(?)"))
addRow(SEED_CHOKING_ALGORITHM, (tr("Upload choking algorithm") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#seed_choking_algorithm"_qs, u"(?)"_qs))
, &m_comboBoxSeedChokingAlgorithm);
// Torrent recheck confirmation
@ -757,38 +757,38 @@ void AdvancedSettings::loadAdvancedSettings() @@ -757,38 +757,38 @@ void AdvancedSettings::loadAdvancedSettings()
// Announce to all trackers in a tier
m_checkBoxAnnounceAllTrackers.setChecked(session->announceToAllTrackers());
addRow(ANNOUNCE_ALL_TRACKERS, (tr("Always announce to all trackers in a tier")
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#announce_to_all_trackers", "(?)"))
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#announce_to_all_trackers"_qs, u"(?)"_qs))
, &m_checkBoxAnnounceAllTrackers);
// Announce to all tiers
m_checkBoxAnnounceAllTiers.setChecked(session->announceToAllTiers());
addRow(ANNOUNCE_ALL_TIERS, (tr("Always announce to all tiers")
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#announce_to_all_tiers", "(?)"))
+ u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#announce_to_all_tiers"_qs, u"(?)"_qs))
, &m_checkBoxAnnounceAllTiers);
m_spinBoxPeerTurnover.setMinimum(0);
m_spinBoxPeerTurnover.setMaximum(100);
m_spinBoxPeerTurnover.setValue(session->peerTurnover());
m_spinBoxPeerTurnover.setSuffix(" %");
addRow(PEER_TURNOVER, (tr("Peer turnover disconnect percentage") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#peer_turnover", "(?)"))
m_spinBoxPeerTurnover.setSuffix(u" %"_qs);
addRow(PEER_TURNOVER, (tr("Peer turnover disconnect percentage") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#peer_turnover"_qs, u"(?)"_qs))
, &m_spinBoxPeerTurnover);
m_spinBoxPeerTurnoverCutoff.setMinimum(0);
m_spinBoxPeerTurnoverCutoff.setMaximum(100);
m_spinBoxPeerTurnoverCutoff.setSuffix(" %");
m_spinBoxPeerTurnoverCutoff.setSuffix(u" %"_qs);
m_spinBoxPeerTurnoverCutoff.setValue(session->peerTurnoverCutoff());
addRow(PEER_TURNOVER_CUTOFF, (tr("Peer turnover threshold percentage") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#peer_turnover", "(?)"))
addRow(PEER_TURNOVER_CUTOFF, (tr("Peer turnover threshold percentage") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#peer_turnover"_qs, u"(?)"_qs))
, &m_spinBoxPeerTurnoverCutoff);
m_spinBoxPeerTurnoverInterval.setMinimum(30);
m_spinBoxPeerTurnoverInterval.setMaximum(3600);
m_spinBoxPeerTurnoverInterval.setSuffix(tr(" s", " seconds"));
m_spinBoxPeerTurnoverInterval.setValue(session->peerTurnoverInterval());
addRow(PEER_TURNOVER_INTERVAL, (tr("Peer turnover disconnect interval") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#peer_turnover", "(?)"))
addRow(PEER_TURNOVER_INTERVAL, (tr("Peer turnover disconnect interval") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#peer_turnover"_qs, u"(?)"_qs))
, &m_spinBoxPeerTurnoverInterval);
// Maximum outstanding requests to a single peer
m_spinBoxRequestQueueSize.setMinimum(1);
m_spinBoxRequestQueueSize.setMaximum(std::numeric_limits<int>::max());
m_spinBoxRequestQueueSize.setValue(session->requestQueueSize());
addRow(REQUEST_QUEUE_SIZE, (tr("Maximum outstanding requests to a single peer") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#max_out_request_queue", "(?)"))
addRow(REQUEST_QUEUE_SIZE, (tr("Maximum outstanding requests to a single peer") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#max_out_request_queue"_qs, u"(?)"_qs))
, &m_spinBoxRequestQueueSize);
}

5
src/gui/categoryfiltermodel.cpp

@ -214,13 +214,12 @@ QVariant CategoryFilterModel::data(const QModelIndex &index, int role) const @@ -214,13 +214,12 @@ QVariant CategoryFilterModel::data(const QModelIndex &index, int role) const
if ((index.column() == 0) && (role == Qt::DecorationRole))
{
return UIThemeManager::instance()->getIcon("inode-directory");
return UIThemeManager::instance()->getIcon(u"inode-directory"_qs);
}
if ((index.column() == 0) && (role == Qt::DisplayRole))
{
return QString(QStringLiteral("%1 (%2)"))
.arg(item->name()).arg(item->torrentsCount());
return u"%1 (%2)"_qs.arg(item->name(), QString::number(item->torrentsCount()));
}
if ((index.column() == 0) && (role == Qt::UserRole))

18
src/gui/categoryfilterwidget.cpp

@ -46,7 +46,7 @@ namespace @@ -46,7 +46,7 @@ namespace
if (index.isValid())
{
if (!index.parent().isValid() && (index.row() == 1))
categoryFilter = ""; // Uncategorized
categoryFilter = u""_qs; // Uncategorized
else if (index.parent().isValid() || (index.row() > 1))
categoryFilter = model->categoryName(index);
}
@ -109,7 +109,7 @@ void CategoryFilterWidget::showMenu() @@ -109,7 +109,7 @@ void CategoryFilterWidget::showMenu()
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add category...")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add category...")
, this, &CategoryFilterWidget::addCategory);
const auto selectedRows = selectionModel()->selectedRows();
@ -117,24 +117,24 @@ void CategoryFilterWidget::showMenu() @@ -117,24 +117,24 @@ void CategoryFilterWidget::showMenu()
{
if (BitTorrent::Session::instance()->isSubcategoriesEnabled())
{
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add subcategory...")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add subcategory...")
, this, &CategoryFilterWidget::addSubcategory);
}
menu->addAction(UIThemeManager::instance()->getIcon("document-edit"), tr("Edit category...")
menu->addAction(UIThemeManager::instance()->getIcon(u"document-edit"_qs), tr("Edit category...")
, this, &CategoryFilterWidget::editCategory);
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove category")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Remove category")
, this, &CategoryFilterWidget::removeCategory);
}
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove unused categories")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Remove unused categories")
, this, &CategoryFilterWidget::removeUnusedCategories);
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-start"), tr("Resume torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"media-playback-start"_qs), tr("Resume torrents")
, this, &CategoryFilterWidget::actionResumeTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-pause"), tr("Pause torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"media-playback-pause"_qs), tr("Pause torrents")
, this, &CategoryFilterWidget::actionPauseTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon("edit-delete"), tr("Delete torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-delete"_qs), tr("Delete torrents")
, this, &CategoryFilterWidget::actionDeleteTorrentsTriggered);
menu->popup(QCursor::pos());

6
src/gui/cookiesdialog.cpp

@ -52,9 +52,9 @@ CookiesDialog::CookiesDialog(QWidget *parent) @@ -52,9 +52,9 @@ CookiesDialog::CookiesDialog(QWidget *parent)
{
m_ui->setupUi(this);
setWindowIcon(UIThemeManager::instance()->getIcon("preferences-web-browser-cookies"));
m_ui->buttonAdd->setIcon(UIThemeManager::instance()->getIcon("list-add"));
m_ui->buttonDelete->setIcon(UIThemeManager::instance()->getIcon("list-remove"));
setWindowIcon(UIThemeManager::instance()->getIcon(u"preferences-web-browser-cookies"_qs));
m_ui->buttonAdd->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
m_ui->buttonDelete->setIcon(UIThemeManager::instance()->getIcon(u"list-remove"_qs));
m_ui->buttonAdd->setIconSize(Utils::Gui::mediumIconSize());
m_ui->buttonDelete->setIconSize(Utils::Gui::mediumIconSize());

5
src/gui/deletionconfirmationdialog.cpp

@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
#include <QPushButton>
#include "base/global.h"
#include "base/preferences.h"
#include "uithememanager.h"
#include "utils.h"
@ -47,9 +48,9 @@ DeletionConfirmationDialog::DeletionConfirmationDialog(QWidget *parent, const in @@ -47,9 +48,9 @@ DeletionConfirmationDialog::DeletionConfirmationDialog(QWidget *parent, const in
// Icons
const QSize iconSize = Utils::Gui::largeIconSize();
m_ui->labelWarning->setPixmap(UIThemeManager::instance()->getIcon("dialog-warning").pixmap(iconSize));
m_ui->labelWarning->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_qs).pixmap(iconSize));
m_ui->labelWarning->setFixedWidth(iconSize.width());
m_ui->rememberBtn->setIcon(UIThemeManager::instance()->getIcon("object-locked"));
m_ui->rememberBtn->setIcon(UIThemeManager::instance()->getIcon(u"object-locked"_qs));
m_ui->rememberBtn->setIconSize(Utils::Gui::mediumIconSize());
m_ui->checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());

14
src/gui/downloadfromurldialog.cpp

@ -45,15 +45,15 @@ namespace @@ -45,15 +45,15 @@ namespace
{
bool isDownloadable(const QString &str)
{
return (str.startsWith("http://", Qt::CaseInsensitive)
|| str.startsWith("https://", Qt::CaseInsensitive)
|| str.startsWith("ftp://", Qt::CaseInsensitive)
|| str.startsWith("magnet:", Qt::CaseInsensitive)
|| ((str.size() == 40) && !str.contains(QRegularExpression("[^0-9A-Fa-f]"))) // v1 hex-encoded SHA-1 info-hash
return (str.startsWith(u"http://", Qt::CaseInsensitive)
|| str.startsWith(u"https://", Qt::CaseInsensitive)
|| str.startsWith(u"ftp://", Qt::CaseInsensitive)
|| str.startsWith(u"magnet:", Qt::CaseInsensitive)
|| ((str.size() == 40) && !str.contains(QRegularExpression(u"[^0-9A-Fa-f]"_qs))) // v1 hex-encoded SHA-1 info-hash
#ifdef QBT_USES_LIBTORRENT2
|| ((str.size() == 64) && !str.contains(QRegularExpression("[^0-9A-Fa-f]"))) // v2 hex-encoded SHA-256 info-hash
|| ((str.size() == 64) && !str.contains(QRegularExpression(u"[^0-9A-Fa-f]"_qs))) // v2 hex-encoded SHA-256 info-hash
#endif
|| ((str.size() == 32) && !str.contains(QRegularExpression("[^2-7A-Za-z]")))); // v1 Base32 encoded SHA-1 info-hash
|| ((str.size() == 32) && !str.contains(QRegularExpression(u"[^2-7A-Za-z]"_qs)))); // v1 Base32 encoded SHA-1 info-hash
}
}

9
src/gui/executionlogwidget.cpp

@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
#include <QMenu>
#include <QPalette>
#include "base/global.h"
#include "log/logfiltermodel.h"
#include "log/loglistview.h"
#include "log/logmodel.h"
@ -68,8 +69,8 @@ ExecutionLogWidget::ExecutionLogWidget(const Log::MsgTypes types, QWidget *paren @@ -68,8 +69,8 @@ ExecutionLogWidget::ExecutionLogWidget(const Log::MsgTypes types, QWidget *paren
m_ui->tabBan->layout()->addWidget(peerView);
#ifndef Q_OS_MACOS
m_ui->tabConsole->setTabIcon(0, UIThemeManager::instance()->getIcon("view-calendar-journal"));
m_ui->tabConsole->setTabIcon(1, UIThemeManager::instance()->getIcon("view-filter"));
m_ui->tabConsole->setTabIcon(0, UIThemeManager::instance()->getIcon(u"view-calendar-journal"_qs));
m_ui->tabConsole->setTabIcon(1, UIThemeManager::instance()->getIcon(u"view-filter"_qs));
#endif
}
@ -91,11 +92,11 @@ void ExecutionLogWidget::displayContextMenu(const LogListView *view, const BaseL @@ -91,11 +92,11 @@ void ExecutionLogWidget::displayContextMenu(const LogListView *view, const BaseL
// only show copy action if any of the row is selected
if (view->currentIndex().isValid())
{
menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy")
, view, &LogListView::copySelection);
}
menu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Clear")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Clear")
, model, &BaseLogModel::reset);
menu->popup(QCursor::pos());

2
src/gui/fspathedit_p.cpp

@ -208,7 +208,7 @@ Private::FileLineEdit::FileLineEdit(QWidget *parent) @@ -208,7 +208,7 @@ Private::FileLineEdit::FileLineEdit(QWidget *parent)
, m_browseAction {nullptr}
, m_warningAction {nullptr}
{
m_completerModel->setRootPath("");
m_completerModel->setRootPath({});
m_completerModel->setIconProvider(&m_iconProvider);
m_completer->setModel(m_completerModel);
m_completer->setCompletionMode(QCompleter::PopupCompletion);

5
src/gui/lineedit.cpp

@ -16,15 +16,16 @@ @@ -16,15 +16,16 @@
#include <QStyle>
#include <QToolButton>
#include "base/global.h"
#include "uithememanager.h"
LineEdit::LineEdit(QWidget *parent)
: QLineEdit(parent)
{
m_searchButton = new QToolButton(this);
m_searchButton->setIcon(UIThemeManager::instance()->getIcon("edit-find"));
m_searchButton->setIcon(UIThemeManager::instance()->getIcon(u"edit-find"_qs));
m_searchButton->setCursor(Qt::ArrowCursor);
m_searchButton->setStyleSheet("QToolButton {border: none; padding: 2px;}");
m_searchButton->setStyleSheet(u"QToolButton {border: none; padding: 2px;}"_qs);
// padding between text and widget borders
setStyleSheet(QString::fromLatin1("QLineEdit {padding-left: %1px;}").arg(m_searchButton->sizeHint().width()));

2
src/gui/log/loglistview.cpp

@ -134,5 +134,5 @@ void LogListView::copySelection() const @@ -134,5 +134,5 @@ void LogListView::copySelection() const
const QModelIndexList selectedIndexes = selectionModel()->selectedRows();
for (const QModelIndex &index : selectedIndexes)
list.append(logText(index));
QApplication::clipboard()->setText(list.join('\n'));
QApplication::clipboard()->setText(list.join(u'\n'));
}

78
src/gui/mainwindow.cpp

@ -138,11 +138,11 @@ MainWindow::MainWindow(QWidget *parent) @@ -138,11 +138,11 @@ MainWindow::MainWindow(QWidget *parent)
Preferences *const pref = Preferences::instance();
m_uiLocked = pref->isUILocked();
setWindowTitle("qBittorrent " QBT_VERSION);
setWindowTitle(QStringLiteral("qBittorrent " QBT_VERSION));
m_displaySpeedInTitle = pref->speedInTitleBar();
// Setting icons
#ifndef Q_OS_MACOS
const QIcon appLogo(UIThemeManager::instance()->getIcon(QLatin1String("qbittorrent"), QLatin1String("qbittorrent-tray")));
const QIcon appLogo(UIThemeManager::instance()->getIcon(u"qbittorrent"_qs, u"qbittorrent-tray"_qs));
setWindowIcon(appLogo);
#endif // Q_OS_MACOS
@ -152,28 +152,28 @@ MainWindow::MainWindow(QWidget *parent) @@ -152,28 +152,28 @@ MainWindow::MainWindow(QWidget *parent)
addToolbarContextMenu();
m_ui->actionOpen->setIcon(UIThemeManager::instance()->getIcon("list-add"));
m_ui->actionDownloadFromURL->setIcon(UIThemeManager::instance()->getIcon("insert-link"));
m_ui->actionSetGlobalSpeedLimits->setIcon(UIThemeManager::instance()->getIcon("speedometer"));
m_ui->actionCreateTorrent->setIcon(UIThemeManager::instance()->getIcon("document-edit"));
m_ui->actionAbout->setIcon(UIThemeManager::instance()->getIcon("help-about"));
m_ui->actionStatistics->setIcon(UIThemeManager::instance()->getIcon("view-statistics"));
m_ui->actionTopQueuePos->setIcon(UIThemeManager::instance()->getIcon("go-top"));
m_ui->actionIncreaseQueuePos->setIcon(UIThemeManager::instance()->getIcon("go-up"));
m_ui->actionDecreaseQueuePos->setIcon(UIThemeManager::instance()->getIcon("go-down"));
m_ui->actionBottomQueuePos->setIcon(UIThemeManager::instance()->getIcon("go-bottom"));
m_ui->actionDelete->setIcon(UIThemeManager::instance()->getIcon("list-remove"));
m_ui->actionDocumentation->setIcon(UIThemeManager::instance()->getIcon("help-contents"));
m_ui->actionDonateMoney->setIcon(UIThemeManager::instance()->getIcon("wallet-open"));
m_ui->actionExit->setIcon(UIThemeManager::instance()->getIcon("application-exit"));
m_ui->actionLock->setIcon(UIThemeManager::instance()->getIcon("object-locked"));
m_ui->actionOptions->setIcon(UIThemeManager::instance()->getIcon("configure", "preferences-system"));
m_ui->actionPause->setIcon(UIThemeManager::instance()->getIcon("media-playback-pause"));
m_ui->actionPauseAll->setIcon(UIThemeManager::instance()->getIcon("media-playback-pause"));
m_ui->actionStart->setIcon(UIThemeManager::instance()->getIcon("media-playback-start"));
m_ui->actionStartAll->setIcon(UIThemeManager::instance()->getIcon("media-playback-start"));
m_ui->menuAutoShutdownOnDownloadsCompletion->setIcon(UIThemeManager::instance()->getIcon("application-exit"));
m_ui->actionManageCookies->setIcon(UIThemeManager::instance()->getIcon("preferences-web-browser-cookies"));
m_ui->actionOpen->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
m_ui->actionDownloadFromURL->setIcon(UIThemeManager::instance()->getIcon(u"insert-link"_qs));
m_ui->actionSetGlobalSpeedLimits->setIcon(UIThemeManager::instance()->getIcon(u"speedometer"_qs));
m_ui->actionCreateTorrent->setIcon(UIThemeManager::instance()->getIcon(u"document-edit"_qs));
m_ui->actionAbout->setIcon(UIThemeManager::instance()->getIcon(u"help-about"_qs));
m_ui->actionStatistics->setIcon(UIThemeManager::instance()->getIcon(u"view-statistics"_qs));
m_ui->actionTopQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-top"_qs));
m_ui->actionIncreaseQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-up"_qs));
m_ui->actionDecreaseQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-down"_qs));
m_ui->actionBottomQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-bottom"_qs));
m_ui->actionDelete->setIcon(UIThemeManager::instance()->getIcon(u"list-remove"_qs));
m_ui->actionDocumentation->setIcon(UIThemeManager::instance()->getIcon(u"help-contents"_qs));
m_ui->actionDonateMoney->setIcon(UIThemeManager::instance()->getIcon(u"wallet-open"_qs));
m_ui->actionExit->setIcon(UIThemeManager::instance()->getIcon(u"application-exit"_qs));
m_ui->actionLock->setIcon(UIThemeManager::instance()->getIcon(u"object-locked"_qs));
m_ui->actionOptions->setIcon(UIThemeManager::instance()->getIcon(u"configure"_qs, u"preferences-system"_qs));
m_ui->actionPause->setIcon(UIThemeManager::instance()->getIcon(u"media-playback-pause"_qs));
m_ui->actionPauseAll->setIcon(UIThemeManager::instance()->getIcon(u"media-playback-pause"_qs));
m_ui->actionStart->setIcon(UIThemeManager::instance()->getIcon(u"media-playback-start"_qs));
m_ui->actionStartAll->setIcon(UIThemeManager::instance()->getIcon(u"media-playback-start"_qs));
m_ui->menuAutoShutdownOnDownloadsCompletion->setIcon(UIThemeManager::instance()->getIcon(u"application-exit"_qs));
m_ui->actionManageCookies->setIcon(UIThemeManager::instance()->getIcon(u"preferences-web-browser-cookies"_qs));
auto *lockMenu = new QMenu(this);
lockMenu->addAction(tr("&Set Password"), this, &MainWindow::defineUILockPassword);
@ -232,7 +232,7 @@ MainWindow::MainWindow(QWidget *parent) @@ -232,7 +232,7 @@ MainWindow::MainWindow(QWidget *parent)
m_splitter->setCollapsible(1, false);
m_tabs->addTab(m_splitter,
#ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon("folder-remote"),
UIThemeManager::instance()->getIcon(u"folder-remote"_qs),
#endif
tr("Transfers"));
@ -694,7 +694,7 @@ void MainWindow::displayRSSTab(bool enable) @@ -694,7 +694,7 @@ void MainWindow::displayRSSTab(bool enable)
m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
#else
const int indexTab = m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
m_tabs->setTabIcon(indexTab, UIThemeManager::instance()->getIcon("application-rss+xml"));
m_tabs->setTabIcon(indexTab, UIThemeManager::instance()->getIcon(u"application-rss+xml"_qs));
#endif
}
}
@ -732,7 +732,7 @@ void MainWindow::displaySearchTab(bool enable) @@ -732,7 +732,7 @@ void MainWindow::displaySearchTab(bool enable)
m_searchWidget = new SearchWidget(this);
m_tabs->insertTab(1, m_searchWidget,
#ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon("edit-find"),
UIThemeManager::instance()->getIcon(u"edit-find"_qs),
#endif
tr("Search"));
}
@ -756,7 +756,7 @@ void MainWindow::updateNbTorrents() @@ -756,7 +756,7 @@ void MainWindow::updateNbTorrents()
void MainWindow::on_actionDocumentation_triggered() const
{
QDesktopServices::openUrl(QUrl("http://doc.qbittorrent.org"));
QDesktopServices::openUrl(QUrl(u"http://doc.qbittorrent.org"_qs));
}
void MainWindow::tabChanged(int newTab)
@ -1151,7 +1151,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) @@ -1151,7 +1151,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
if (mimeData->hasText())
{
const bool useTorrentAdditionDialog {AddNewTorrentDialog::isEnabled()};
const QStringList lines {mimeData->text().split('\n', Qt::SkipEmptyParts)};
const QStringList lines {mimeData->text().split(u'\n', Qt::SkipEmptyParts)};
for (QString line : lines)
{
@ -1207,7 +1207,7 @@ void MainWindow::closeEvent(QCloseEvent *e) @@ -1207,7 +1207,7 @@ void MainWindow::closeEvent(QCloseEvent *e)
show();
QMessageBox confirmBox(QMessageBox::Question, tr("Exiting qBittorrent"),
// Split it because the last sentence is used in the Web UI
tr("Some files are currently transferring.") + '\n' + tr("Are you sure you want to quit qBittorrent?"),
tr("Some files are currently transferring.") + u'\n' + tr("Are you sure you want to quit qBittorrent?"),
QMessageBox::NoButton, this);
QPushButton *noBtn = confirmBox.addButton(tr("&No"), QMessageBox::NoRole);
confirmBox.addButton(tr("&Yes"), QMessageBox::YesRole);
@ -1330,14 +1330,14 @@ void MainWindow::dropEvent(QDropEvent *event) @@ -1330,14 +1330,14 @@ void MainWindow::dropEvent(QDropEvent *event)
if (url.isEmpty())
continue;
files << ((url.scheme().compare("file", Qt::CaseInsensitive) == 0)
files << ((url.scheme().compare(u"file", Qt::CaseInsensitive) == 0)
? url.toLocalFile()
: url.toString());
}
}
else
{
files = event->mimeData()->text().split('\n');
files = event->mimeData()->text().split(u'\n');
}
// differentiate ".torrent" files/links & magnet links from others
@ -1377,7 +1377,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event) @@ -1377,7 +1377,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
for (const QString &mime : asConst(event->mimeData()->formats()))
qDebug("mimeData: %s", mime.toLocal8Bit().data());
if (event->mimeData()->hasFormat("text/plain") || event->mimeData()->hasFormat("text/uri-list"))
if (event->mimeData()->hasFormat(u"text/plain"_qs) || event->mimeData()->hasFormat(u"text/uri-list"_qs))
event->acceptProposedAction();
}
@ -1621,7 +1621,7 @@ void MainWindow::reloadSessionStats() @@ -1621,7 +1621,7 @@ void MainWindow::reloadSessionStats()
setWindowTitle(tr("[D: %1, U: %2] qBittorrent %3", "D = Download; U = Upload; %3 is qBittorrent version")
.arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate, true)
, Utils::Misc::friendlyUnit(status.payloadUploadRate, true)
, QBT_VERSION));
, QStringLiteral(QBT_VERSION)));
}
}
@ -1715,7 +1715,7 @@ void MainWindow::createTrayIcon(const int retries) @@ -1715,7 +1715,7 @@ void MainWindow::createTrayIcon(const int retries)
{
if (retries > 0)
{
LogMsg("System tray icon is not available, retrying...", Log::WARNING);
LogMsg(tr("System tray icon is not available, retrying..."), Log::WARNING);
QTimer::singleShot(std::chrono::seconds(2), this, [this, retries]()
{
if (Preferences::instance()->systemTrayEnabled())
@ -1724,7 +1724,7 @@ void MainWindow::createTrayIcon(const int retries) @@ -1724,7 +1724,7 @@ void MainWindow::createTrayIcon(const int retries)
}
else
{
LogMsg("System tray icon is still not available after retries. Disabling it.", Log::WARNING);
LogMsg(tr("System tray icon is still not available after retries. Disabling it."), Log::WARNING);
Preferences::instance()->setSystemTrayEnabled(false);
}
}
@ -1808,7 +1808,7 @@ void MainWindow::on_actionSpeedInTitleBar_triggered() @@ -1808,7 +1808,7 @@ void MainWindow::on_actionSpeedInTitleBar_triggered()
if (m_displaySpeedInTitle)
reloadSessionStats();
else
setWindowTitle("qBittorrent " QBT_VERSION);
setWindowTitle(QStringLiteral("qBittorrent " QBT_VERSION));
}
void MainWindow::on_actionRSSReader_triggered()
@ -1950,7 +1950,7 @@ void MainWindow::toggleAlternativeSpeeds() @@ -1950,7 +1950,7 @@ void MainWindow::toggleAlternativeSpeeds()
void MainWindow::on_actionDonateMoney_triggered()
{
QDesktopServices::openUrl(QUrl("https://www.qbittorrent.org/donate"));
QDesktopServices::openUrl(QUrl(u"https://www.qbittorrent.org/donate"_qs));
}
void MainWindow::showConnectionSettings()
@ -1974,7 +1974,7 @@ void MainWindow::on_actionExecutionLogs_triggered(bool checked) @@ -1974,7 +1974,7 @@ void MainWindow::on_actionExecutionLogs_triggered(bool checked)
m_tabs->addTab(m_executionLog, tr("Execution Log"));
#else
const int indexTab = m_tabs->addTab(m_executionLog, tr("Execution Log"));
m_tabs->setTabIcon(indexTab, UIThemeManager::instance()->getIcon("view-calendar-journal"));
m_tabs->setTabIcon(indexTab, UIThemeManager::instance()->getIcon(u"view-calendar-journal"_qs));
#endif
}
else

166
src/gui/optionsdialog.cpp

@ -83,7 +83,7 @@ namespace @@ -83,7 +83,7 @@ namespace
const QDate date {2018, 11, 5}; // Monday
QStringList ret;
for (int i = 0; i < 7; ++i)
ret.append(locale.toString(date.addDays(i), "dddd"));
ret.append(locale.toString(date.addDays(i), u"dddd"_qs));
return ret;
}
@ -91,70 +91,70 @@ namespace @@ -91,70 +91,70 @@ namespace
{
switch (locale.language())
{
case QLocale::Arabic: return QString::fromUtf8(C_LOCALE_ARABIC);
case QLocale::Armenian: return QString::fromUtf8(C_LOCALE_ARMENIAN);
case QLocale::Azerbaijani: return QString::fromUtf8(C_LOCALE_AZERBAIJANI);
case QLocale::Basque: return QString::fromUtf8(C_LOCALE_BASQUE);
case QLocale::Bulgarian: return QString::fromUtf8(C_LOCALE_BULGARIAN);
case QLocale::Byelorussian: return QString::fromUtf8(C_LOCALE_BYELORUSSIAN);
case QLocale::Catalan: return QString::fromUtf8(C_LOCALE_CATALAN);
case QLocale::Arabic: return C_LOCALE_ARABIC;
case QLocale::Armenian: return C_LOCALE_ARMENIAN;
case QLocale::Azerbaijani: return C_LOCALE_AZERBAIJANI;
case QLocale::Basque: return C_LOCALE_BASQUE;
case QLocale::Bulgarian: return C_LOCALE_BULGARIAN;
case QLocale::Byelorussian: return C_LOCALE_BYELORUSSIAN;
case QLocale::Catalan: return C_LOCALE_CATALAN;
case QLocale::Chinese:
switch (locale.country())
{
case QLocale::China: return QString::fromUtf8(C_LOCALE_CHINESE_SIMPLIFIED);
case QLocale::HongKong: return QString::fromUtf8(C_LOCALE_CHINESE_TRADITIONAL_HK);
default: return QString::fromUtf8(C_LOCALE_CHINESE_TRADITIONAL_TW);
case QLocale::China: return C_LOCALE_CHINESE_SIMPLIFIED;
case QLocale::HongKong: return C_LOCALE_CHINESE_TRADITIONAL_HK;
default: return C_LOCALE_CHINESE_TRADITIONAL_TW;
}
case QLocale::Croatian: return QString::fromUtf8(C_LOCALE_CROATIAN);
case QLocale::Czech: return QString::fromUtf8(C_LOCALE_CZECH);
case QLocale::Danish: return QString::fromUtf8(C_LOCALE_DANISH);
case QLocale::Dutch: return QString::fromUtf8(C_LOCALE_DUTCH);
case QLocale::Croatian: return C_LOCALE_CROATIAN;
case QLocale::Czech: return C_LOCALE_CZECH;
case QLocale::Danish: return C_LOCALE_DANISH;
case QLocale::Dutch: return C_LOCALE_DUTCH;
case QLocale::English:
switch (locale.country())
{
case QLocale::Australia: return QString::fromUtf8(C_LOCALE_ENGLISH_AUSTRALIA);
case QLocale::UnitedKingdom: return QString::fromUtf8(C_LOCALE_ENGLISH_UNITEDKINGDOM);
default: return QString::fromUtf8(C_LOCALE_ENGLISH);
case QLocale::Australia: return C_LOCALE_ENGLISH_AUSTRALIA;
case QLocale::UnitedKingdom: return C_LOCALE_ENGLISH_UNITEDKINGDOM;
default: return C_LOCALE_ENGLISH;
}
case QLocale::Estonian: return QString::fromUtf8(C_LOCALE_ESTONIAN);
case QLocale::Finnish: return QString::fromUtf8(C_LOCALE_FINNISH);
case QLocale::French: return QString::fromUtf8(C_LOCALE_FRENCH);
case QLocale::Galician: return QString::fromUtf8(C_LOCALE_GALICIAN);
case QLocale::Georgian: return QString::fromUtf8(C_LOCALE_GEORGIAN);
case QLocale::German: return QString::fromUtf8(C_LOCALE_GERMAN);
case QLocale::Greek: return QString::fromUtf8(C_LOCALE_GREEK);
case QLocale::Hebrew: return QString::fromUtf8(C_LOCALE_HEBREW);
case QLocale::Hindi: return QString::fromUtf8(C_LOCALE_HINDI);
case QLocale::Hungarian: return QString::fromUtf8(C_LOCALE_HUNGARIAN);
case QLocale::Icelandic: return QString::fromUtf8(C_LOCALE_ICELANDIC);
case QLocale::Indonesian: return QString::fromUtf8(C_LOCALE_INDONESIAN);
case QLocale::Italian: return QString::fromUtf8(C_LOCALE_ITALIAN);
case QLocale::Japanese: return QString::fromUtf8(C_LOCALE_JAPANESE);
case QLocale::Korean: return QString::fromUtf8(C_LOCALE_KOREAN);
case QLocale::Latvian: return QString::fromUtf8(C_LOCALE_LATVIAN);
case QLocale::Lithuanian: return QString::fromUtf8(C_LOCALE_LITHUANIAN);
case QLocale::Malay: return QString::fromUtf8(C_LOCALE_MALAY);
case QLocale::Mongolian: return QString::fromUtf8(C_LOCALE_MONGOLIAN);
case QLocale::NorwegianBokmal: return QString::fromUtf8(C_LOCALE_NORWEGIAN);
case QLocale::Occitan: return QString::fromUtf8(C_LOCALE_OCCITAN);
case QLocale::Persian: return QString::fromUtf8(C_LOCALE_PERSIAN);
case QLocale::Polish: return QString::fromUtf8(C_LOCALE_POLISH);
case QLocale::Estonian: return C_LOCALE_ESTONIAN;
case QLocale::Finnish: return C_LOCALE_FINNISH;
case QLocale::French: return C_LOCALE_FRENCH;
case QLocale::Galician: return C_LOCALE_GALICIAN;
case QLocale::Georgian: return C_LOCALE_GEORGIAN;
case QLocale::German: return C_LOCALE_GERMAN;
case QLocale::Greek: return C_LOCALE_GREEK;
case QLocale::Hebrew: return C_LOCALE_HEBREW;
case QLocale::Hindi: return C_LOCALE_HINDI;
case QLocale::Hungarian: return C_LOCALE_HUNGARIAN;
case QLocale::Icelandic: return C_LOCALE_ICELANDIC;
case QLocale::Indonesian: return C_LOCALE_INDONESIAN;
case QLocale::Italian: return C_LOCALE_ITALIAN;
case QLocale::Japanese: return C_LOCALE_JAPANESE;
case QLocale::Korean: return C_LOCALE_KOREAN;
case QLocale::Latvian: return C_LOCALE_LATVIAN;
case QLocale::Lithuanian: return C_LOCALE_LITHUANIAN;
case QLocale::Malay: return C_LOCALE_MALAY;
case QLocale::Mongolian: return C_LOCALE_MONGOLIAN;
case QLocale::NorwegianBokmal: return C_LOCALE_NORWEGIAN;
case QLocale::Occitan: return C_LOCALE_OCCITAN;
case QLocale::Persian: return C_LOCALE_PERSIAN;
case QLocale::Polish: return C_LOCALE_POLISH;
case QLocale::Portuguese:
if (locale.country() == QLocale::Brazil)
return QString::fromUtf8(C_LOCALE_PORTUGUESE_BRAZIL);
return QString::fromUtf8(C_LOCALE_PORTUGUESE);
case QLocale::Romanian: return QString::fromUtf8(C_LOCALE_ROMANIAN);
case QLocale::Russian: return QString::fromUtf8(C_LOCALE_RUSSIAN);
case QLocale::Serbian: return QString::fromUtf8(C_LOCALE_SERBIAN);
case QLocale::Slovak: return QString::fromUtf8(C_LOCALE_SLOVAK);
case QLocale::Slovenian: return QString::fromUtf8(C_LOCALE_SLOVENIAN);
case QLocale::Spanish: return QString::fromUtf8(C_LOCALE_SPANISH);
case QLocale::Swedish: return QString::fromUtf8(C_LOCALE_SWEDISH);
case QLocale::Thai: return QString::fromUtf8(C_LOCALE_THAI);
case QLocale::Turkish: return QString::fromUtf8(C_LOCALE_TURKISH);
case QLocale::Ukrainian: return QString::fromUtf8(C_LOCALE_UKRAINIAN);
case QLocale::Uzbek: return QString::fromUtf8(C_LOCALE_UZBEK);
case QLocale::Vietnamese: return QString::fromUtf8(C_LOCALE_VIETNAMESE);
return C_LOCALE_PORTUGUESE_BRAZIL;
return C_LOCALE_PORTUGUESE;
case QLocale::Romanian: return C_LOCALE_ROMANIAN;
case QLocale::Russian: return C_LOCALE_RUSSIAN;
case QLocale::Serbian: return C_LOCALE_SERBIAN;
case QLocale::Slovak: return C_LOCALE_SLOVAK;
case QLocale::Slovenian: return C_LOCALE_SLOVENIAN;
case QLocale::Spanish: return C_LOCALE_SPANISH;
case QLocale::Swedish: return C_LOCALE_SWEDISH;
case QLocale::Thai: return C_LOCALE_THAI;
case QLocale::Turkish: return C_LOCALE_TURKISH;
case QLocale::Ukrainian: return C_LOCALE_UKRAINIAN;
case QLocale::Uzbek: return C_LOCALE_UZBEK;
case QLocale::Vietnamese: return C_LOCALE_VIETNAMESE;
default:
const QString lang = QLocale::languageToString(locale.language());
qWarning() << "Unrecognized language name: " << lang;
@ -193,18 +193,18 @@ OptionsDialog::OptionsDialog(QWidget *parent) @@ -193,18 +193,18 @@ OptionsDialog::OptionsDialog(QWidget *parent)
#endif
// Icons
m_ui->tabSelection->item(TAB_UI)->setIcon(UIThemeManager::instance()->getIcon("preferences-desktop"));
m_ui->tabSelection->item(TAB_BITTORRENT)->setIcon(UIThemeManager::instance()->getIcon("preferences-system-network"));
m_ui->tabSelection->item(TAB_CONNECTION)->setIcon(UIThemeManager::instance()->getIcon("network-wired"));
m_ui->tabSelection->item(TAB_DOWNLOADS)->setIcon(UIThemeManager::instance()->getIcon("folder-download"));
m_ui->tabSelection->item(TAB_SPEED)->setIcon(UIThemeManager::instance()->getIcon("speedometer", "chronometer"));
m_ui->tabSelection->item(TAB_RSS)->setIcon(UIThemeManager::instance()->getIcon("rss-config", "application-rss+xml"));
m_ui->tabSelection->item(TAB_UI)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-desktop"_qs));
m_ui->tabSelection->item(TAB_BITTORRENT)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-system-network"_qs));
m_ui->tabSelection->item(TAB_CONNECTION)->setIcon(UIThemeManager::instance()->getIcon(u"network-wired"_qs));
m_ui->tabSelection->item(TAB_DOWNLOADS)->setIcon(UIThemeManager::instance()->getIcon(u"folder-download"_qs));
m_ui->tabSelection->item(TAB_SPEED)->setIcon(UIThemeManager::instance()->getIcon(u"speedometer"_qs, u"chronometer"_qs));
m_ui->tabSelection->item(TAB_RSS)->setIcon(UIThemeManager::instance()->getIcon(u"rss-config"_qs, u"application-rss+xml"_qs));
#ifndef DISABLE_WEBUI
m_ui->tabSelection->item(TAB_WEBUI)->setIcon(UIThemeManager::instance()->getIcon("network-server"));
m_ui->tabSelection->item(TAB_WEBUI)->setIcon(UIThemeManager::instance()->getIcon(u"network-server"_qs));
#else
m_ui->tabSelection->item(TAB_WEBUI)->setHidden(true);
#endif
m_ui->tabSelection->item(TAB_ADVANCED)->setIcon(UIThemeManager::instance()->getIcon("preferences-other"));
m_ui->tabSelection->item(TAB_ADVANCED)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-other"_qs));
// set uniform size for all icons
int maxHeight = -1;
@ -216,10 +216,10 @@ OptionsDialog::OptionsDialog(QWidget *parent) @@ -216,10 +216,10 @@ OptionsDialog::OptionsDialog(QWidget *parent)
m_ui->tabSelection->item(i)->setSizeHint(size);
}
m_ui->IpFilterRefreshBtn->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
m_ui->IpFilterRefreshBtn->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_qs));
m_ui->labelGlobalRate->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(QLatin1String("slow_off")), this, Utils::Gui::mediumIconSize(this).height()));
m_ui->labelAltRate->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(QLatin1String("slow")), this, Utils::Gui::mediumIconSize(this).height()));
m_ui->labelGlobalRate->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(u"slow_off"_qs), this, Utils::Gui::mediumIconSize(this).height()));
m_ui->labelAltRate->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(u"slow"_qs), this, Utils::Gui::mediumIconSize(this).height()));
m_ui->deleteTorrentWarningIcon->setPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical).pixmap(16, 16));
m_ui->deleteTorrentWarningIcon->hide();
@ -391,7 +391,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) @@ -391,7 +391,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
connect(m_ui->lineEditAutoRun, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);
connect(m_ui->autoRunConsole, &QCheckBox::toggled, this, &ThisType::enableApplyButton);
const QString autoRunStr = QString("%1\n %2\n %3\n %4\n %5\n %6\n %7\n %8\n %9\n %10\n %11\n %12\n %13\n%14")
const auto autoRunStr = u"%1\n %2\n %3\n %4\n %5\n %6\n %7\n %8\n %9\n %10\n %11\n %12\n %13\n%14"_qs
.arg(tr("Supported parameters (case sensitive):")
, tr("%N: Torrent name")
, tr("%L: Category")
@ -584,22 +584,22 @@ OptionsDialog::OptionsDialog(QWidget *parent) @@ -584,22 +584,22 @@ OptionsDialog::OptionsDialog(QWidget *parent)
void OptionsDialog::initializeLanguageCombo()
{
// List language files
const QDir langDir(":/lang");
const QStringList langFiles = langDir.entryList(QStringList("qbittorrent_*.qm"), QDir::Files);
const QDir langDir(u":/lang"_qs);
const QStringList langFiles = langDir.entryList(QStringList(u"qbittorrent_*.qm"_qs), QDir::Files);
for (const QString &langFile : langFiles)
{
QString localeStr = langFile.mid(12); // remove "qbittorrent_"
localeStr.chop(3); // Remove ".qm"
QString languageName;
if (localeStr.startsWith("eo", Qt::CaseInsensitive))
if (localeStr.startsWith(u"eo", Qt::CaseInsensitive))
{
// QLocale doesn't work with that locale. Esperanto isn't a "real" language.
languageName = QString::fromUtf8(C_LOCALE_ESPERANTO);
languageName = C_LOCALE_ESPERANTO;
}
else if (localeStr.startsWith("ltg", Qt::CaseInsensitive))
else if (localeStr.startsWith(u"ltg", Qt::CaseInsensitive))
{
// QLocale doesn't work with that locale.
languageName = QString::fromUtf8(C_LOCALE_LATGALIAN);
languageName = C_LOCALE_LATGALIAN;
}
else
{
@ -733,7 +733,7 @@ void OptionsDialog::saveOptions() @@ -733,7 +733,7 @@ void OptionsDialog::saveOptions()
RSS::Session::instance()->setMaxArticlesPerFeed(m_ui->spinRSSMaxArticlesPerFeed->value());
RSS::Session::instance()->setProcessingEnabled(m_ui->checkRSSEnable->isChecked());
RSS::AutoDownloader::instance()->setProcessingEnabled(m_ui->checkRSSAutoDownloaderEnable->isChecked());
RSS::AutoDownloader::instance()->setSmartEpisodeFilters(m_ui->textSmartEpisodeFilters->toPlainText().split('\n', Qt::SkipEmptyParts));
RSS::AutoDownloader::instance()->setSmartEpisodeFilters(m_ui->textSmartEpisodeFilters->toPlainText().split(u'\n', Qt::SkipEmptyParts));
RSS::AutoDownloader::instance()->setDownloadRepacks(m_ui->checkSmartFilterDownloadRepacks->isChecked());
// Downloads preferences
@ -986,7 +986,7 @@ void OptionsDialog::loadOptions() @@ -986,7 +986,7 @@ void OptionsDialog::loadOptions()
m_ui->checkRSSEnable->setChecked(RSS::Session::instance()->isProcessingEnabled());
m_ui->checkRSSAutoDownloaderEnable->setChecked(RSS::AutoDownloader::instance()->isProcessingEnabled());
m_ui->textSmartEpisodeFilters->setPlainText(RSS::AutoDownloader::instance()->smartEpisodeFilters().join('\n'));
m_ui->textSmartEpisodeFilters->setPlainText(RSS::AutoDownloader::instance()->smartEpisodeFilters().join(u'\n'));
m_ui->checkSmartFilterDownloadRepacks->setChecked(RSS::AutoDownloader::instance()->downloadRepacks());
m_ui->spinRSSRefreshInterval->setValue(RSS::Session::instance()->refreshInterval());
@ -1605,21 +1605,21 @@ QString OptionsDialog::getLocale() const @@ -1605,21 +1605,21 @@ QString OptionsDialog::getLocale() const
void OptionsDialog::setLocale(const QString &localeStr)
{
QString name;
if (localeStr.startsWith("eo", Qt::CaseInsensitive))
if (localeStr.startsWith(u"eo", Qt::CaseInsensitive))
{
name = "eo";
name = u"eo"_qs;
}
else if (localeStr.startsWith("ltg", Qt::CaseInsensitive))
else if (localeStr.startsWith(u"ltg", Qt::CaseInsensitive))
{
name = "ltg";
name = u"ltg"_qs;
}
else
{
QLocale locale(localeStr);
if (locale.language() == QLocale::Uzbek)
name = "uz@Latn";
name = u"uz@Latn"_qs;
else if (locale.language() == QLocale::Azerbaijani)
name = "az@latin";
name = u"az@latin"_qs;
else
name = locale.name();
}
@ -1628,7 +1628,7 @@ void OptionsDialog::setLocale(const QString &localeStr) @@ -1628,7 +1628,7 @@ void OptionsDialog::setLocale(const QString &localeStr)
if (index < 0)
{
//Attempt to find a language match without a country
int pos = name.indexOf('_');
int pos = name.indexOf(u'_');
if (pos > -1)
{
QString lang = name.left(pos);
@ -1638,7 +1638,7 @@ void OptionsDialog::setLocale(const QString &localeStr) @@ -1638,7 +1638,7 @@ void OptionsDialog::setLocale(const QString &localeStr)
if (index < 0)
{
// Unrecognized, use US English
index = m_ui->comboI18n->findData("en", Qt::UserRole);
index = m_ui->comboI18n->findData(u"en", Qt::UserRole);
Q_ASSERT(index >= 0);
}
m_ui->comboI18n->setCurrentIndex(index);

39
src/gui/powermanagement/powermanagement_x11.cpp

@ -33,6 +33,8 @@ @@ -33,6 +33,8 @@
#include <QDBusPendingCall>
#include <QDBusPendingReply>
#include "base/global.h"
PowerManagementInhibitor::PowerManagementInhibitor(QObject *parent)
: QObject(parent)
{
@ -64,16 +66,16 @@ void PowerManagementInhibitor::requestIdle() @@ -64,16 +66,16 @@ void PowerManagementInhibitor::requestIdle()
QDBusMessage call;
if (!m_useGSM)
call = QDBusMessage::createMethodCall(
"org.freedesktop.PowerManagement",
"/org/freedesktop/PowerManagement/Inhibit",
"org.freedesktop.PowerManagement.Inhibit",
"UnInhibit");
u"org.freedesktop.PowerManagement"_qs,
u"/org/freedesktop/PowerManagement/Inhibit"_qs,
u"org.freedesktop.PowerManagement.Inhibit"_qs,
u"UnInhibit"_qs);
else
call = QDBusMessage::createMethodCall(
"org.gnome.SessionManager",
"/org/gnome/SessionManager",
"org.gnome.SessionManager",
"Uninhibit");
u"org.gnome.SessionManager"_qs,
u"/org/gnome/SessionManager"_qs,
u"org.gnome.SessionManager"_qs,
u"Uninhibit"_qs);
m_state = RequestIdle;
@ -98,23 +100,22 @@ void PowerManagementInhibitor::requestBusy() @@ -98,23 +100,22 @@ void PowerManagementInhibitor::requestBusy()
QDBusMessage call;
if (!m_useGSM)
call = QDBusMessage::createMethodCall(
"org.freedesktop.PowerManagement",
"/org/freedesktop/PowerManagement/Inhibit",
"org.freedesktop.PowerManagement.Inhibit",
"Inhibit");
u"org.freedesktop.PowerManagement"_qs,
u"/org/freedesktop/PowerManagement/Inhibit"_qs,
u"org.freedesktop.PowerManagement.Inhibit"_qs,
u"Inhibit"_qs);
else
call = QDBusMessage::createMethodCall(
"org.gnome.SessionManager",
"/org/gnome/SessionManager",
"org.gnome.SessionManager",
"Inhibit");
u"org.gnome.SessionManager"_qs,
u"/org/gnome/SessionManager"_qs,
u"org.gnome.SessionManager"_qs,
u"Inhibit"_qs);
m_state = RequestBusy;
QList<QVariant> args;
args << "qBittorrent";
QList<QVariant> args = {u"qBittorrent"_qs};
if (m_useGSM) args << 0u;
args << "Active torrents are presented";
args << u"Active torrents are presented"_qs;
if (m_useGSM) args << 8u;
call.setArguments(args);

2
src/gui/previewlistdelegate.cpp

@ -58,7 +58,7 @@ void PreviewListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o @@ -58,7 +58,7 @@ void PreviewListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
const qreal progress = (index.data().toReal() * 100);
const QString text = (progress >= 100)
? QString::fromLatin1("100%")
: (Utils::String::fromDouble(progress, 1) + '%');
: (Utils::String::fromDouble(progress, 1) + u'%');
m_progressBarPainter.paint(painter, option, text, static_cast<int>(progress));
}

20
src/gui/properties/peerlistwidget.cpp

@ -269,7 +269,7 @@ void PeerListWidget::showPeerListMenu() @@ -269,7 +269,7 @@ void PeerListWidget::showPeerListMenu()
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->setToolTipsVisible(true);
QAction *addNewPeer = menu->addAction(UIThemeManager::instance()->getIcon("user-group-new"), tr("Add peers...")
QAction *addNewPeer = menu->addAction(UIThemeManager::instance()->getIcon(u"user-group-new"_qs), tr("Add peers...")
, this, [this, torrent]()
{
const QVector<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this);
@ -282,10 +282,10 @@ void PeerListWidget::showPeerListMenu() @@ -282,10 +282,10 @@ void PeerListWidget::showPeerListMenu()
else if (peerCount > 0)
QMessageBox::information(this, tr("Adding peers"), tr("Peers are added to this torrent."));
});
QAction *copyPeers = menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy IP:port")
QAction *copyPeers = menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy IP:port")
, this, &PeerListWidget::copySelectedPeers);
menu->addSeparator();
QAction *banPeers = menu->addAction(UIThemeManager::instance()->getIcon("user-group-delete"), tr("Ban peer permanently")
QAction *banPeers = menu->addAction(UIThemeManager::instance()->getIcon(u"user-group-delete"_qs), tr("Ban peer permanently")
, this, &PeerListWidget::banSelectedPeers);
// disable actions
@ -352,13 +352,13 @@ void PeerListWidget::copySelectedPeers() @@ -352,13 +352,13 @@ void PeerListWidget::copySelectedPeers()
const QString ip = m_listModel->item(row, PeerListColumns::IP_HIDDEN)->text();
const QString port = m_listModel->item(row, PeerListColumns::PORT)->text();
if (!ip.contains('.')) // IPv6
selectedPeers << ('[' + ip + "]:" + port);
if (!ip.contains(u'.')) // IPv6
selectedPeers << (u'[' + ip + u"]:" + port);
else // IPv4
selectedPeers << (ip + ':' + port);
selectedPeers << (ip + u':' + port);
}
QApplication::clipboard()->setText(selectedPeers.join('\n'));
QApplication::clipboard()->setText(selectedPeers.join(u'\n'));
}
void PeerListWidget::clear()
@ -460,7 +460,7 @@ void PeerListWidget::updatePeer(const BitTorrent::Torrent *torrent, const BitTor @@ -460,7 +460,7 @@ void PeerListWidget::updatePeer(const BitTorrent::Torrent *torrent, const BitTor
setModelData(row, PeerListColumns::FLAGS, peer.flags(), peer.flags(), {}, peer.flagsDescription());
const QString client = peer.client().toHtmlEscaped();
setModelData(row, PeerListColumns::CLIENT, client, client, {}, client);
setModelData(row, PeerListColumns::PROGRESS, (Utils::String::fromDouble(peer.progress() * 100, 1) + '%'), peer.progress(), intDataTextAlignment);
setModelData(row, PeerListColumns::PROGRESS, (Utils::String::fromDouble(peer.progress() * 100, 1) + u'%'), peer.progress(), intDataTextAlignment);
const QString downSpeed = (hideValues && (peer.payloadDownSpeed() <= 0)) ? QString {} : Utils::Misc::friendlyUnit(peer.payloadDownSpeed(), true);
setModelData(row, PeerListColumns::DOWN_SPEED, downSpeed, peer.payloadDownSpeed(), intDataTextAlignment);
const QString upSpeed = (hideValues && (peer.payloadUpSpeed() <= 0)) ? QString {} : Utils::Misc::friendlyUnit(peer.payloadUpSpeed(), true);
@ -469,14 +469,14 @@ void PeerListWidget::updatePeer(const BitTorrent::Torrent *torrent, const BitTor @@ -469,14 +469,14 @@ void PeerListWidget::updatePeer(const BitTorrent::Torrent *torrent, const BitTor
setModelData(row, PeerListColumns::TOT_DOWN, totalDown, peer.totalDownload(), intDataTextAlignment);
const QString totalUp = (hideValues && (peer.totalUpload() <= 0)) ? QString {} : Utils::Misc::friendlyUnit(peer.totalUpload());
setModelData(row, PeerListColumns::TOT_UP, totalUp, peer.totalUpload(), intDataTextAlignment);
setModelData(row, PeerListColumns::RELEVANCE, (Utils::String::fromDouble(peer.relevance() * 100, 1) + '%'), peer.relevance(), intDataTextAlignment);
setModelData(row, PeerListColumns::RELEVANCE, (Utils::String::fromDouble(peer.relevance() * 100, 1) + u'%'), peer.relevance(), intDataTextAlignment);
const PathList filePaths = torrent->info().filesForPiece(peer.downloadingPieceIndex());
QStringList downloadingFiles;
downloadingFiles.reserve(filePaths.size());
for (const Path &filePath : filePaths)
downloadingFiles.append(filePath.toString());
const QString downloadingFilesDisplayValue = downloadingFiles.join(';');
const QString downloadingFilesDisplayValue = downloadingFiles.join(u';');
setModelData(row, PeerListColumns::DOWNLOADING_PIECE, downloadingFilesDisplayValue, downloadingFilesDisplayValue, {}, downloadingFiles.join(QLatin1Char('\n')));
if (m_resolver)

2
src/gui/properties/peersadditiondialog.cpp

@ -64,7 +64,7 @@ void PeersAdditionDialog::validateInput() @@ -64,7 +64,7 @@ void PeersAdditionDialog::validateInput()
QMessageBox::Ok);
return;
}
for (const QString &peer : asConst(m_ui->textEditPeers->toPlainText().trimmed().split('\n')))
for (const QString &peer : asConst(m_ui->textEditPeers->toPlainText().trimmed().split(u'\n')))
{
const BitTorrent::PeerAddress addr = BitTorrent::PeerAddress::parse(peer);
if (!addr.ip.isNull())

36
src/gui/properties/propertieswidget.cpp

@ -135,9 +135,9 @@ PropertiesWidget::PropertiesWidget(QWidget *parent) @@ -135,9 +135,9 @@ PropertiesWidget::PropertiesWidget(QWidget *parent)
// Tracker list
m_trackerList = new TrackerListWidget(this);
m_ui->trackerUpButton->setIcon(UIThemeManager::instance()->getIcon("go-up"));
m_ui->trackerUpButton->setIcon(UIThemeManager::instance()->getIcon(u"go-up"_qs));
m_ui->trackerUpButton->setIconSize(Utils::Gui::smallIconSize());
m_ui->trackerDownButton->setIcon(UIThemeManager::instance()->getIcon("go-down"));
m_ui->trackerDownButton->setIcon(UIThemeManager::instance()->getIcon(u"go-down"_qs));
m_ui->trackerDownButton->setIconSize(Utils::Gui::smallIconSize());
connect(m_ui->trackerUpButton, &QPushButton::clicked, m_trackerList, &TrackerListWidget::moveSelectionUp);
connect(m_ui->trackerDownButton, &QPushButton::clicked, m_trackerList, &TrackerListWidget::moveSelectionDown);
@ -385,7 +385,7 @@ void PropertiesWidget::readSettings() @@ -385,7 +385,7 @@ void PropertiesWidget::readSettings()
{
const Preferences *const pref = Preferences::instance();
// Restore splitter sizes
QStringList sizesStr = pref->getPropSplitterSizes().split(',');
QStringList sizesStr = pref->getPropSplitterSizes().split(u',');
if (sizesStr.size() == 2)
{
m_slideSizes << sizesStr.first().toInt();
@ -414,7 +414,7 @@ void PropertiesWidget::saveSettings() @@ -414,7 +414,7 @@ void PropertiesWidget::saveSettings()
sizes = m_slideSizes;
if (sizes.size() == 2)
pref->setPropSplitterSizes(QString::number(sizes.first()) + ',' + QString::number(sizes.last()));
pref->setPropSplitterSizes(QString::number(sizes.first()) + u',' + QString::number(sizes.last()));
pref->setPropFileListState(m_ui->filesList->header()->saveState());
// Remember current tab
pref->setPropCurTab(m_tabBar->currentIndex());
@ -445,9 +445,9 @@ void PropertiesWidget::loadDynamicData() @@ -445,9 +445,9 @@ void PropertiesWidget::loadDynamicData()
m_ui->labelDlTotalVal->setText(tr("%1 (%2 this session)").arg(Utils::Misc::friendlyUnit(m_torrent->totalDownload())
, Utils::Misc::friendlyUnit(m_torrent->totalPayloadDownload())));
m_ui->labelUpLimitVal->setText(m_torrent->uploadLimit() <= 0 ? QString::fromUtf8(C_INFINITY) : Utils::Misc::friendlyUnit(m_torrent->uploadLimit(), true));
m_ui->labelUpLimitVal->setText(m_torrent->uploadLimit() <= 0 ? C_INFINITY : Utils::Misc::friendlyUnit(m_torrent->uploadLimit(), true));
m_ui->labelDlLimitVal->setText(m_torrent->downloadLimit() <= 0 ? QString::fromUtf8(C_INFINITY) : Utils::Misc::friendlyUnit(m_torrent->downloadLimit(), true));
m_ui->labelDlLimitVal->setText(m_torrent->downloadLimit() <= 0 ? C_INFINITY : Utils::Misc::friendlyUnit(m_torrent->downloadLimit(), true));
QString elapsedString;
if (m_torrent->isSeed())
@ -460,7 +460,7 @@ void PropertiesWidget::loadDynamicData() @@ -460,7 +460,7 @@ void PropertiesWidget::loadDynamicData()
m_ui->labelConnectionsVal->setText(tr("%1 (%2 max)", "%1 and %2 are numbers, e.g. 3 (10 max)")
.arg(m_torrent->connectionsCount())
.arg(m_torrent->connectionsLimit() < 0 ? QString::fromUtf8(C_INFINITY) : QString::number(m_torrent->connectionsLimit())));
.arg(m_torrent->connectionsLimit() < 0 ? C_INFINITY : QString::number(m_torrent->connectionsLimit())));
m_ui->labelETAVal->setText(Utils::Misc::userFriendlyDuration(m_torrent->eta(), MAX_ETA));
@ -469,7 +469,7 @@ void PropertiesWidget::loadDynamicData() @@ -469,7 +469,7 @@ void PropertiesWidget::loadDynamicData()
// Update ratio info
const qreal ratio = m_torrent->realRatio();
m_ui->labelShareRatioVal->setText(ratio > BitTorrent::Torrent::MAX_RATIO ? QString::fromUtf8(C_INFINITY) : Utils::String::fromDouble(ratio, 2));
m_ui->labelShareRatioVal->setText(ratio > BitTorrent::Torrent::MAX_RATIO ? C_INFINITY : Utils::String::fromDouble(ratio, 2));
m_ui->labelSeedsVal->setText(tr("%1 (%2 total)", "%1 and %2 are numbers, e.g. 3 (10 total)")
.arg(QString::number(m_torrent->seedsCount())
@ -513,7 +513,7 @@ void PropertiesWidget::loadDynamicData() @@ -513,7 +513,7 @@ void PropertiesWidget::loadDynamicData()
// Progress
qreal progress = m_torrent->progress() * 100.;
m_ui->labelProgressVal->setText(Utils::String::fromDouble(progress, 1) + '%');
m_ui->labelProgressVal->setText(Utils::String::fromDouble(progress, 1) + u'%');
m_downloadedPieces->setProgress(m_torrent->pieces(), m_torrent->downloadingPieces());
}
else
@ -646,11 +646,11 @@ void PropertiesWidget::displayFilesListMenu() @@ -646,11 +646,11 @@ void PropertiesWidget::displayFilesListMenu()
{
const QModelIndex index = selectedRows[0];
menu->addAction(UIThemeManager::instance()->getIcon("folder-documents"), tr("Open")
menu->addAction(UIThemeManager::instance()->getIcon(u"folder-documents"_qs), tr("Open")
, this, [this, index]() { openItem(index); });
menu->addAction(UIThemeManager::instance()->getIcon("inode-directory"), tr("Open Containing Folder")
menu->addAction(UIThemeManager::instance()->getIcon(u"inode-directory"_qs), tr("Open Containing Folder")
, this, [this, index]() { openParentFolder(index); });
menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename...")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Rename...")
, this, [this]() { m_ui->filesList->renameSelectedFile(*m_torrent); });
menu->addSeparator();
}
@ -745,16 +745,16 @@ void PropertiesWidget::displayWebSeedListMenu() @@ -745,16 +745,16 @@ void PropertiesWidget::displayWebSeedListMenu()
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("New Web seed"), this, &PropertiesWidget::askWebSeed);
menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("New Web seed"), this, &PropertiesWidget::askWebSeed);
if (!rows.isEmpty())
{
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove Web seed")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Remove Web seed")
, this, &PropertiesWidget::deleteSelectedUrlSeeds);
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy Web seed URL")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy Web seed URL")
, this, &PropertiesWidget::copySelectedWebSeedsToClipboard);
menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Edit Web seed URL")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Edit Web seed URL")
, this, &PropertiesWidget::editWebSeed);
}
@ -817,7 +817,7 @@ void PropertiesWidget::askWebSeed() @@ -817,7 +817,7 @@ void PropertiesWidget::askWebSeed()
qDebug("Adding %s web seed", qUtf8Printable(urlSeed));
if (!m_ui->listWebSeeds->findItems(urlSeed, Qt::MatchFixedString).empty())
{
QMessageBox::warning(this, "qBittorrent",
QMessageBox::warning(this, u"qBittorrent"_qs,
tr("This URL seed is already in the list."),
QMessageBox::Ok);
return;
@ -853,7 +853,7 @@ void PropertiesWidget::copySelectedWebSeedsToClipboard() const @@ -853,7 +853,7 @@ void PropertiesWidget::copySelectedWebSeedsToClipboard() const
for (const QListWidgetItem *item : selectedItems)
urlsToCopy << item->text();
QApplication::clipboard()->setText(urlsToCopy.join('\n'));
QApplication::clipboard()->setText(urlsToCopy.join(u'\n'));
}
void PropertiesWidget::editWebSeed()

12
src/gui/properties/proptabbar.cpp

@ -46,7 +46,7 @@ PropTabBar::PropTabBar(QWidget *parent) @@ -46,7 +46,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// General tab
QPushButton *mainInfosButton = new QPushButton(
#ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon("document-properties"),
UIThemeManager::instance()->getIcon(u"document-properties"_qs),
#endif
tr("General"), parent);
mainInfosButton->setShortcut(Qt::ALT + Qt::Key_G);
@ -55,7 +55,7 @@ PropTabBar::PropTabBar(QWidget *parent) @@ -55,7 +55,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Trackers tab
QPushButton *trackersButton = new QPushButton(
#ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon("network-server"),
UIThemeManager::instance()->getIcon(u"network-server"_qs),
#endif
tr("Trackers"), parent);
trackersButton->setShortcut(Qt::ALT + Qt::Key_C);
@ -64,7 +64,7 @@ PropTabBar::PropTabBar(QWidget *parent) @@ -64,7 +64,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Peers tab
QPushButton *peersButton = new QPushButton(
#ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon("edit-find-user"),
UIThemeManager::instance()->getIcon(u"edit-find-user"_qs),
#endif
tr("Peers"), parent);
peersButton->setShortcut(Qt::ALT + Qt::Key_R);
@ -73,7 +73,7 @@ PropTabBar::PropTabBar(QWidget *parent) @@ -73,7 +73,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// URL seeds tab
QPushButton *URLSeedsButton = new QPushButton(
#ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon("network-server"),
UIThemeManager::instance()->getIcon(u"network-server"_qs),
#endif
tr("HTTP Sources"), parent);
URLSeedsButton->setShortcut(Qt::ALT + Qt::Key_B);
@ -82,7 +82,7 @@ PropTabBar::PropTabBar(QWidget *parent) @@ -82,7 +82,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Files tab
QPushButton *filesButton = new QPushButton(
#ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon("inode-directory"),
UIThemeManager::instance()->getIcon(u"inode-directory"_qs),
#endif
tr("Content"), parent);
filesButton->setShortcut(Qt::ALT + Qt::Key_Z);
@ -93,7 +93,7 @@ PropTabBar::PropTabBar(QWidget *parent) @@ -93,7 +93,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Speed tab
QPushButton *speedButton = new QPushButton(
#ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon("office-chart-line"),
UIThemeManager::instance()->getIcon(u"office-chart-line"_qs),
#endif
tr("Speed"), parent);
speedButton->setShortcut(Qt::ALT + Qt::Key_D);

2
src/gui/properties/speedplotview.cpp

@ -94,7 +94,7 @@ namespace @@ -94,7 +94,7 @@ namespace
// check is there need for digits after decimal separator
const int precision = (argValue < 10) ? friendlyUnitPrecision(unit) : 0;
return QLocale::system().toString(argValue, 'f', precision)
+ QString::fromUtf8(C_NON_BREAKING_SPACE)
+ C_NON_BREAKING_SPACE
+ unitString(unit, true);
}
}

2
src/gui/properties/speedwidget.cpp

@ -65,7 +65,7 @@ SpeedWidget::SpeedWidget(PropertiesWidget *parent) @@ -65,7 +65,7 @@ SpeedWidget::SpeedWidget(PropertiesWidget *parent)
m_hlayout = new QHBoxLayout();
m_hlayout->setContentsMargins(0, 0, 0, 0);
m_periodLabel = new QLabel("<b>" + tr("Period:") + "</b>");
m_periodLabel = new QLabel(u"<b>" + tr("Period:") + u"</b>");
m_periodCombobox = new QComboBox();
m_periodCombobox->addItem(tr("1 Minute"));

46
src/gui/properties/trackerlistwidget.cpp

@ -93,13 +93,13 @@ TrackerListWidget::TrackerListWidget(PropertiesWidget *properties) @@ -93,13 +93,13 @@ TrackerListWidget::TrackerListWidget(PropertiesWidget *properties)
connect(header(), &QHeaderView::sortIndicatorChanged, this, &TrackerListWidget::saveSettings);
// Set DHT, PeX, LSD items
m_DHTItem = new QTreeWidgetItem({ "", "** [DHT] **", "", "0", "", "", "0" });
m_DHTItem = new QTreeWidgetItem({ u""_qs, u"** [DHT] **"_qs, u""_qs, u"0"_qs, u""_qs, u""_qs, u"0"_qs });
insertTopLevelItem(0, m_DHTItem);
setRowColor(0, QColor("grey"));
m_PEXItem = new QTreeWidgetItem({ "", "** [PeX] **", "", "0", "", "", "0" });
m_PEXItem = new QTreeWidgetItem({ u""_qs, u"** [PeX] **"_qs, u""_qs, u"0"_qs, u""_qs, u""_qs, u"0"_qs });
insertTopLevelItem(1, m_PEXItem);
setRowColor(1, QColor("grey"));
m_LSDItem = new QTreeWidgetItem({ "", "** [LSD] **", "", "0", "", "", "0" });
m_LSDItem = new QTreeWidgetItem({ u""_qs, u"** [LSD] **"_qs, u""_qs, u"0"_qs, u""_qs, u""_qs, u"0"_qs });
insertTopLevelItem(2, m_LSDItem);
setRowColor(2, QColor("grey"));
@ -257,18 +257,18 @@ void TrackerListWidget::clear() @@ -257,18 +257,18 @@ void TrackerListWidget::clear()
qDeleteAll(m_trackerItems);
m_trackerItems.clear();
m_DHTItem->setText(COL_STATUS, "");
m_DHTItem->setText(COL_SEEDS, "");
m_DHTItem->setText(COL_LEECHES, "");
m_DHTItem->setText(COL_MSG, "");
m_PEXItem->setText(COL_STATUS, "");
m_PEXItem->setText(COL_SEEDS, "");
m_PEXItem->setText(COL_LEECHES, "");
m_PEXItem->setText(COL_MSG, "");
m_LSDItem->setText(COL_STATUS, "");
m_LSDItem->setText(COL_SEEDS, "");
m_LSDItem->setText(COL_LEECHES, "");
m_LSDItem->setText(COL_MSG, "");
m_DHTItem->setText(COL_STATUS, {});
m_DHTItem->setText(COL_SEEDS, {});
m_DHTItem->setText(COL_LEECHES, {});
m_DHTItem->setText(COL_MSG, {});
m_PEXItem->setText(COL_STATUS, {});
m_PEXItem->setText(COL_SEEDS, {});
m_PEXItem->setText(COL_LEECHES, {});
m_PEXItem->setText(COL_MSG, {});
m_LSDItem->setText(COL_STATUS, {});
m_LSDItem->setText(COL_SEEDS, {});
m_LSDItem->setText(COL_LEECHES, {});
m_LSDItem->setText(COL_MSG, {});
}
void TrackerListWidget::loadStickyItems(const BitTorrent::Torrent *torrent)
@ -445,10 +445,10 @@ void TrackerListWidget::copyTrackerUrl() @@ -445,10 +445,10 @@ void TrackerListWidget::copyTrackerUrl()
for (const QTreeWidgetItem *item : selectedTrackerItems)
{
QString trackerURL = item->data(COL_URL, Qt::DisplayRole).toString();
qDebug() << QString("Copy: ") + trackerURL;
qDebug() << "Copy: " + trackerURL;
urlsToCopy << trackerURL;
}
QApplication::clipboard()->setText(urlsToCopy.join('\n'));
QApplication::clipboard()->setText(urlsToCopy.join(u'\n'));
}
@ -578,25 +578,25 @@ void TrackerListWidget::showTrackerListMenu() @@ -578,25 +578,25 @@ void TrackerListWidget::showTrackerListMenu()
menu->setAttribute(Qt::WA_DeleteOnClose);
// Add actions
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add a new tracker...")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add a new tracker...")
, this, &TrackerListWidget::askForTrackers);
if (!getSelectedTrackerItems().isEmpty())
{
menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"),tr("Edit tracker URL...")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs),tr("Edit tracker URL...")
, this, &TrackerListWidget::editSelectedTracker);
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove tracker")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Remove tracker")
, this, &TrackerListWidget::deleteSelectedTrackers);
menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy tracker URL")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy tracker URL")
, this, &TrackerListWidget::copyTrackerUrl);
}
if (!torrent->isPaused())
{
menu->addAction(UIThemeManager::instance()->getIcon("view-refresh"), tr("Force reannounce to selected trackers")
menu->addAction(UIThemeManager::instance()->getIcon(u"view-refresh"_qs), tr("Force reannounce to selected trackers")
, this, &TrackerListWidget::reannounceSelected);
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon("view-refresh"), tr("Force reannounce to all trackers")
menu->addAction(UIThemeManager::instance()->getIcon(u"view-refresh"_qs), tr("Force reannounce to all trackers")
, this, [this]()
{
BitTorrent::Torrent *h = m_properties->getCurrentTorrent();

12
src/gui/properties/trackersadditiondialog.cpp

@ -46,7 +46,7 @@ TrackersAdditionDialog::TrackersAdditionDialog(QWidget *parent, BitTorrent::Torr @@ -46,7 +46,7 @@ TrackersAdditionDialog::TrackersAdditionDialog(QWidget *parent, BitTorrent::Torr
{
m_ui->setupUi(this);
// Icons
m_ui->uTorrentListButton->setIcon(UIThemeManager::instance()->getIcon("download"));
m_ui->uTorrentListButton->setIcon(UIThemeManager::instance()->getIcon(u"download"_qs));
}
TrackersAdditionDialog::~TrackersAdditionDialog()
@ -91,7 +91,7 @@ void TrackersAdditionDialog::torrentListDownloadFinished(const Net::DownloadResu @@ -91,7 +91,7 @@ void TrackersAdditionDialog::torrentListDownloadFinished(const Net::DownloadResu
return;
}
const QStringList trackersFromUser = m_ui->textEditTrackersList->toPlainText().split('\n');
const QStringList trackersFromUser = m_ui->textEditTrackersList->toPlainText().split(u'\n');
QVector<BitTorrent::TrackerEntry> existingTrackers = m_torrent->trackers();
existingTrackers.reserve(trackersFromUser.size());
for (const QString &userURL : trackersFromUser)
@ -102,21 +102,21 @@ void TrackersAdditionDialog::torrentListDownloadFinished(const Net::DownloadResu @@ -102,21 +102,21 @@ void TrackersAdditionDialog::torrentListDownloadFinished(const Net::DownloadResu
}
// Add new trackers to the list
if (!m_ui->textEditTrackersList->toPlainText().isEmpty() && !m_ui->textEditTrackersList->toPlainText().endsWith('\n'))
m_ui->textEditTrackersList->insertPlainText("\n");
if (!m_ui->textEditTrackersList->toPlainText().isEmpty() && !m_ui->textEditTrackersList->toPlainText().endsWith(u'\n'))
m_ui->textEditTrackersList->insertPlainText(u"\n"_qs);
int nb = 0;
QBuffer buffer;
buffer.setData(result.data);
buffer.open(QBuffer::ReadOnly);
while (!buffer.atEnd())
{
const QString line = buffer.readLine().trimmed();
const auto line = QString::fromUtf8(buffer.readLine().trimmed());
if (line.isEmpty()) continue;
BitTorrent::TrackerEntry newTracker {line};
if (!existingTrackers.contains(newTracker))
{
m_ui->textEditTrackersList->insertPlainText(line + '\n');
m_ui->textEditTrackersList->insertPlainText(line + u'\n');
++nb;
}
}

6
src/gui/rss/articlelistwidget.cpp

@ -103,7 +103,7 @@ void ArticleListWidget::handleArticleRead(RSS::Article *rssArticle) @@ -103,7 +103,7 @@ void ArticleListWidget::handleArticleRead(RSS::Article *rssArticle)
if (!item) return;
const QColor defaultColor {palette().color(QPalette::Inactive, QPalette::WindowText)};
const QBrush foregroundBrush {UIThemeManager::instance()->getColor("RSS.ReadArticle", defaultColor)};
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_qs, defaultColor)};
item->setData(Qt::ForegroundRole, foregroundBrush);
item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("sphere")));
@ -131,14 +131,14 @@ QListWidgetItem *ArticleListWidget::createItem(RSS::Article *article) const @@ -131,14 +131,14 @@ QListWidgetItem *ArticleListWidget::createItem(RSS::Article *article) const
if (article->isRead())
{
const QColor defaultColor {palette().color(QPalette::Inactive, QPalette::WindowText)};
const QBrush foregroundBrush {UIThemeManager::instance()->getColor("RSS.ReadArticle", defaultColor)};
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_qs, defaultColor)};
item->setData(Qt::ForegroundRole, foregroundBrush);
item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("sphere")));
}
else
{
const QColor defaultColor {palette().color(QPalette::Active, QPalette::Link)};
const QBrush foregroundBrush {UIThemeManager::instance()->getColor("RSS.UnreadArticle", defaultColor)};
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.UnreadArticle"_qs, defaultColor)};
item->setData(Qt::ForegroundRole, foregroundBrush);
item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("sphere")));
}

90
src/gui/rss/automatedrssdownloader.cpp

@ -68,9 +68,9 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent) @@ -68,9 +68,9 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
{
m_ui->setupUi(this);
// Icons
m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon("list-remove"));
m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon("list-add"));
m_ui->addCategoryBtn->setIcon(UIThemeManager::instance()->getIcon("list-add"));
m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-remove"_qs));
m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
m_ui->addCategoryBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
// Ui Settings
m_ui->listRules->setSortingEnabled(true);
@ -86,17 +86,17 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent) @@ -86,17 +86,17 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
connect(m_ui->checkRegex, &QAbstractButton::toggled, this, &AutomatedRssDownloader::updateFieldsToolTips);
connect(m_ui->listRules, &QWidget::customContextMenuRequested, this, &AutomatedRssDownloader::displayRulesListMenu);
m_episodeRegex = new QRegularExpression("^(^\\d{1,4}x(\\d{1,4}(-(\\d{1,4})?)?;){1,}){1,1}"
m_episodeRegex = new QRegularExpression(u"^(^\\d{1,4}x(\\d{1,4}(-(\\d{1,4})?)?;){1,}){1,1}"_qs
, QRegularExpression::CaseInsensitiveOption);
QString tip = "<p>" + tr("Matches articles based on episode filter.") + "</p><p><b>" + tr("Example: ")
+ "1x2;8-15;5;30-;</b>" + tr(" will match 2, 5, 8 through 15, 30 and onward episodes of season one", "example X will match") + "</p>";
tip += "<p>" + tr("Episode filter rules: ") + "</p><ul><li>" + tr("Season number is a mandatory non-zero value") + "</li>"
+ "<li>" + tr("Episode number is a mandatory positive value") + "</li>"
+ "<li>" + tr("Filter must end with semicolon") + "</li>"
+ "<li>" + tr("Three range types for episodes are supported: ") + "</li>" + "<li><ul>"
+ "<li>" + tr("Single number: <b>1x25;</b> matches episode 25 of season one") + "</li>"
+ "<li>" + tr("Normal range: <b>1x25-40;</b> matches episodes 25 through 40 of season one") + "</li>"
+ "<li>" + tr("Infinite range: <b>1x25-;</b> matches episodes 25 and upward of season one, and all episodes of later seasons") + "</li>" + "</ul></li></ul>";
const QString tip = u"<p>" + tr("Matches articles based on episode filter.") + u"</p><p><b>" + tr("Example: ")
+ u"1x2;8-15;5;30-;</b>" + tr(" will match 2, 5, 8 through 15, 30 and onward episodes of season one", "example X will match") + u"</p>"
+ u"<p>" + tr("Episode filter rules: ") + u"</p><ul><li>" + tr("Season number is a mandatory non-zero value") + u"</li>"
+ u"<li>" + tr("Episode number is a mandatory positive value") + u"</li>"
+ u"<li>" + tr("Filter must end with semicolon") + u"</li>"
+ u"<li>" + tr("Three range types for episodes are supported: ") + u"</li>" + u"<li><ul>"
+ u"<li>" + tr("Single number: <b>1x25;</b> matches episode 25 of season one") + u"</li>"
+ u"<li>" + tr("Normal range: <b>1x25-40;</b> matches episodes 25 through 40 of season one") + u"</li>"
+ u"<li>" + tr("Infinite range: <b>1x25-;</b> matches episodes 25 and upward of season one, and all episodes of later seasons") + u"</li>" + u"</ul></li></ul>";
m_ui->lineEFilter->setToolTip(tip);
initCategoryCombobox();
@ -332,7 +332,7 @@ void AutomatedRssDownloader::initCategoryCombobox() @@ -332,7 +332,7 @@ void AutomatedRssDownloader::initCategoryCombobox()
// Load torrent categories
QStringList categories = BitTorrent::Session::instance()->categories();
std::sort(categories.begin(), categories.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>());
m_ui->comboCategory->addItem("");
m_ui->comboCategory->addItem(u""_qs);
m_ui->comboCategory->addItems(categories);
}
@ -504,7 +504,7 @@ void AutomatedRssDownloader::displayRulesListMenu() @@ -504,7 +504,7 @@ void AutomatedRssDownloader::displayRulesListMenu()
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add new rule...")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add new rule...")
, this, &AutomatedRssDownloader::on_addRuleBtn_clicked);
const QList<QListWidgetItem *> selection = m_ui->listRules->selectedItems();
@ -513,20 +513,20 @@ void AutomatedRssDownloader::displayRulesListMenu() @@ -513,20 +513,20 @@ void AutomatedRssDownloader::displayRulesListMenu()
{
if (selection.count() == 1)
{
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Delete rule")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Delete rule")
, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename rule...")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Rename rule...")
, this, &AutomatedRssDownloader::renameSelectedRule);
}
else
{
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Delete selected rules")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Delete selected rules")
, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
}
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Clear downloaded episodes...")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Clear downloaded episodes...")
, this, &AutomatedRssDownloader::clearSelectedRuleDownloadedEpisodeList);
}
@ -656,7 +656,7 @@ void AutomatedRssDownloader::addFeedArticlesToTree(RSS::Feed *feed, const QStrin @@ -656,7 +656,7 @@ void AutomatedRssDownloader::addFeedArticlesToTree(RSS::Feed *feed, const QStrin
QFont f = treeFeedItem->font(0);
f.setBold(true);
treeFeedItem->setFont(0, f);
treeFeedItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon("inode-directory"));
treeFeedItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"inode-directory"_qs));
treeFeedItem->setData(0, Qt::UserRole, feed->url());
m_ui->treeMatchingArticles->addTopLevelItem(treeFeedItem);
}
@ -685,28 +685,28 @@ void AutomatedRssDownloader::updateFieldsToolTips(bool regex) @@ -685,28 +685,28 @@ void AutomatedRssDownloader::updateFieldsToolTips(bool regex)
QString tip;
if (regex)
{
tip = "<p>" + tr("Regex mode: use Perl-compatible regular expressions") + "</p>";
tip = u"<p>" + tr("Regex mode: use Perl-compatible regular expressions") + u"</p>";
}
else
{
tip = "<p>" + tr("Wildcard mode: you can use") + "<ul>"
+ "<li>" + tr("? to match any single character") + "</li>"
+ "<li>" + tr("* to match zero or more of any characters") + "</li>"
+ "<li>" + tr("Whitespaces count as AND operators (all words, any order)") + "</li>"
+ "<li>" + tr("| is used as OR operator") + "</li></ul></p>"
+ "<p>" + tr("If word order is important use * instead of whitespace.") + "</p>";
tip = u"<p>" + tr("Wildcard mode: you can use") + u"<ul>"
+ u"<li>" + tr("? to match any single character") + u"</li>"
+ u"<li>" + tr("* to match zero or more of any characters") + u"</li>"
+ u"<li>" + tr("Whitespaces count as AND operators (all words, any order)") + u"</li>"
+ u"<li>" + tr("| is used as OR operator") + u"</li></ul></p>"
+ u"<p>" + tr("If word order is important use * instead of whitespace.") + u"</p>";
}
// Whether regex or wildcard, warn about a potential gotcha for users.
// Explanatory string broken over multiple lines for readability (and multiple
// statements to prevent uncrustify indenting excessively.
tip += "<p>";
tip += u"<p>";
tip += tr("An expression with an empty %1 clause (e.g. %2)",
"We talk about regex/wildcards in the RSS filters section here."
" So a valid sentence would be: An expression with an empty | clause (e.g. expr|)"
).arg("<tt>|</tt>", "<tt>expr|</tt>");
m_ui->lineContains->setToolTip(tip + tr(" will match all articles.") + "</p>");
m_ui->lineNotContains->setToolTip(tip + tr(" will exclude all articles.") + "</p>");
).arg(u"<tt>|</tt>"_qs, u"<tt>expr|</tt>"_qs);
m_ui->lineContains->setToolTip(tip + tr(" will match all articles.") + u"</p>");
m_ui->lineNotContains->setToolTip(tip + tr(" will exclude all articles.") + u"</p>");
}
void AutomatedRssDownloader::updateMustLineValidity()
@ -725,7 +725,7 @@ void AutomatedRssDownloader::updateMustLineValidity() @@ -725,7 +725,7 @@ void AutomatedRssDownloader::updateMustLineValidity()
}
else
{
for (const QString &token : asConst(text.split('|')))
for (const QString &token : asConst(text.split(u'|')))
tokens << Utils::String::wildcardToRegexPattern(token);
}
@ -744,14 +744,14 @@ void AutomatedRssDownloader::updateMustLineValidity() @@ -744,14 +744,14 @@ void AutomatedRssDownloader::updateMustLineValidity()
if (valid)
{
m_ui->lineContains->setStyleSheet("");
m_ui->lineContains->setStyleSheet({});
m_ui->labelMustStat->setPixmap(QPixmap());
m_ui->labelMustStat->setToolTip("");
m_ui->labelMustStat->setToolTip({});
}
else
{
m_ui->lineContains->setStyleSheet("QLineEdit { color: #ff0000; }");
m_ui->labelMustStat->setPixmap(UIThemeManager::instance()->getIcon("task-attention").pixmap(16, 16));
m_ui->lineContains->setStyleSheet(u"QLineEdit { color: #ff0000; }"_qs);
m_ui->labelMustStat->setPixmap(UIThemeManager::instance()->getIcon(u"task-attention"_qs).pixmap(16, 16));
m_ui->labelMustStat->setToolTip(error);
}
}
@ -772,7 +772,7 @@ void AutomatedRssDownloader::updateMustNotLineValidity() @@ -772,7 +772,7 @@ void AutomatedRssDownloader::updateMustNotLineValidity()
}
else
{
for (const QString &token : asConst(text.split('|')))
for (const QString &token : asConst(text.split(u'|')))
tokens << Utils::String::wildcardToRegexPattern(token);
}
@ -791,14 +791,14 @@ void AutomatedRssDownloader::updateMustNotLineValidity() @@ -791,14 +791,14 @@ void AutomatedRssDownloader::updateMustNotLineValidity()
if (valid)
{
m_ui->lineNotContains->setStyleSheet("");
m_ui->lineNotContains->setStyleSheet({});
m_ui->labelMustNotStat->setPixmap(QPixmap());
m_ui->labelMustNotStat->setToolTip("");
m_ui->labelMustNotStat->setToolTip({});
}
else
{
m_ui->lineNotContains->setStyleSheet("QLineEdit { color: #ff0000; }");
m_ui->labelMustNotStat->setPixmap(UIThemeManager::instance()->getIcon("task-attention").pixmap(16, 16));
m_ui->lineNotContains->setStyleSheet(u"QLineEdit { color: #ff0000; }"_qs);
m_ui->labelMustNotStat->setPixmap(UIThemeManager::instance()->getIcon(u"task-attention"_qs).pixmap(16, 16));
m_ui->labelMustNotStat->setToolTip(error);
}
}
@ -810,13 +810,13 @@ void AutomatedRssDownloader::updateEpisodeFilterValidity() @@ -810,13 +810,13 @@ void AutomatedRssDownloader::updateEpisodeFilterValidity()
if (valid)
{
m_ui->lineEFilter->setStyleSheet("");
m_ui->labelEpFilterStat->setPixmap(QPixmap());
m_ui->lineEFilter->setStyleSheet({});
m_ui->labelEpFilterStat->setPixmap({});
}
else
{
m_ui->lineEFilter->setStyleSheet("QLineEdit { color: #ff0000; }");
m_ui->labelEpFilterStat->setPixmap(UIThemeManager::instance()->getIcon("task-attention").pixmap(16, 16));
m_ui->lineEFilter->setStyleSheet(u"QLineEdit { color: #ff0000; }"_qs);
m_ui->labelEpFilterStat->setPixmap(UIThemeManager::instance()->getIcon(u"task-attention"_qs).pixmap(16, 16));
}
}

2
src/gui/rss/feedlistwidget.cpp

@ -107,7 +107,7 @@ FeedListWidget::FeedListWidget(QWidget *parent) @@ -107,7 +107,7 @@ FeedListWidget::FeedListWidget(QWidget *parent)
m_unreadStickyItem = new FeedListItem(this);
m_unreadStickyItem->setData(0, Qt::UserRole, reinterpret_cast<quintptr>(RSS::Session::instance()->rootFolder()));
m_unreadStickyItem->setText(0, tr("Unread (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
m_unreadStickyItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon("mail-folder-inbox"));
m_unreadStickyItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"mail-folder-inbox"_qs));
m_unreadStickyItem->setData(0, StickyItemTagRole, true);

4
src/gui/rss/htmlbrowser.cpp

@ -64,7 +64,7 @@ QVariant HtmlBrowser::loadResource(int type, const QUrl &name) @@ -64,7 +64,7 @@ QVariant HtmlBrowser::loadResource(int type, const QUrl &name)
{
QUrl url(name);
if (url.scheme().isEmpty())
url.setScheme("http");
url.setScheme(u"http"_qs);
QIODevice *dev = m_diskCache->data(url);
if (dev)
@ -108,7 +108,7 @@ void HtmlBrowser::resourceLoaded(QNetworkReply *reply) @@ -108,7 +108,7 @@ void HtmlBrowser::resourceLoaded(QNetworkReply *reply)
metaData.setUrl(reply->request().url());
metaData.setSaveToDisk(true);
atts[QNetworkRequest::HttpStatusCodeAttribute] = 200;
atts[QNetworkRequest::HttpReasonPhraseAttribute] = "Ok";
atts[QNetworkRequest::HttpReasonPhraseAttribute] = u"Ok"_qs;
metaData.setAttributes(atts);
metaData.setLastModified(QDateTime::currentDateTime());
metaData.setExpirationDate(QDateTime::currentDateTime().addDays(1));

72
src/gui/rss/rsswidget.cpp

@ -62,21 +62,21 @@ RSSWidget::RSSWidget(QWidget *parent) @@ -62,21 +62,21 @@ RSSWidget::RSSWidget(QWidget *parent)
m_ui->setupUi(this);
// Icons
m_ui->actionCopyFeedURL->setIcon(UIThemeManager::instance()->getIcon("edit-copy"));
m_ui->actionDelete->setIcon(UIThemeManager::instance()->getIcon("edit-delete"));
m_ui->actionDownloadTorrent->setIcon(UIThemeManager::instance()->getIcon("download"));
m_ui->actionMarkItemsRead->setIcon(UIThemeManager::instance()->getIcon("mail-mark-read"));
m_ui->actionNewFolder->setIcon(UIThemeManager::instance()->getIcon("folder-new"));
m_ui->actionNewSubscription->setIcon(UIThemeManager::instance()->getIcon("list-add"));
m_ui->actionOpenNewsURL->setIcon(UIThemeManager::instance()->getIcon("application-x-mswinurl"));
m_ui->actionRename->setIcon(UIThemeManager::instance()->getIcon("edit-rename"));
m_ui->actionUpdate->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
m_ui->actionUpdateAllFeeds->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
m_ui->actionCopyFeedURL->setIcon(UIThemeManager::instance()->getIcon(u"edit-copy"_qs));
m_ui->actionDelete->setIcon(UIThemeManager::instance()->getIcon(u"edit-delete"_qs));
m_ui->actionDownloadTorrent->setIcon(UIThemeManager::instance()->getIcon(u"download"_qs));
m_ui->actionMarkItemsRead->setIcon(UIThemeManager::instance()->getIcon(u"mail-mark-read"_qs));
m_ui->actionNewFolder->setIcon(UIThemeManager::instance()->getIcon(u"folder-new"_qs));
m_ui->actionNewSubscription->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
m_ui->actionOpenNewsURL->setIcon(UIThemeManager::instance()->getIcon(u"application-x-mswinurl"_qs));
m_ui->actionRename->setIcon(UIThemeManager::instance()->getIcon(u"edit-rename"_qs));
m_ui->actionUpdate->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_qs));
m_ui->actionUpdateAllFeeds->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_qs));
#ifndef Q_OS_MACOS
m_ui->newFeedButton->setIcon(UIThemeManager::instance()->getIcon("list-add"));
m_ui->markReadButton->setIcon(UIThemeManager::instance()->getIcon("mail-mark-read"));
m_ui->updateAllButton->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
m_ui->rssDownloaderBtn->setIcon(UIThemeManager::instance()->getIcon("download"));
m_ui->newFeedButton->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
m_ui->markReadButton->setIcon(UIThemeManager::instance()->getIcon(u"mail-mark-read"_qs));
m_ui->updateAllButton->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_qs));
m_ui->rssDownloaderBtn->setIcon(UIThemeManager::instance()->getIcon(u"download"_qs));
#endif
m_articleListWidget = new ArticleListWidget(m_ui->splitterMain);
@ -249,7 +249,7 @@ void RSSWidget::askNewFolder() @@ -249,7 +249,7 @@ void RSSWidget::askNewFolder()
const QString newFolderPath = RSS::Item::joinPath(rssDestFolder->path(), newName);
const nonstd::expected<void, QString> result = RSS::Session::instance()->addFolder(newFolderPath);
if (!result)
QMessageBox::warning(this, "qBittorrent", result.error(), QMessageBox::Ok);
QMessageBox::warning(this, u"qBittorrent"_qs, result.error(), QMessageBox::Ok);
// Expand destination folder to display new feed
if (destItem && (destItem != m_feedListWidget->stickyUnreadItem()))
@ -263,7 +263,7 @@ void RSSWidget::on_newFeedButton_clicked() @@ -263,7 +263,7 @@ void RSSWidget::on_newFeedButton_clicked()
{
// Ask for feed URL
const QString clipText = qApp->clipboard()->text();
const QString defaultURL = Net::DownloadManager::hasSupportedScheme(clipText) ? clipText : "http://";
const QString defaultURL = Net::DownloadManager::hasSupportedScheme(clipText) ? clipText : u"http://"_qs;
bool ok = false;
QString newURL = AutoExpandableDialog::getText(
@ -291,7 +291,7 @@ void RSSWidget::on_newFeedButton_clicked() @@ -291,7 +291,7 @@ void RSSWidget::on_newFeedButton_clicked()
const QString newFeedPath = RSS::Item::joinPath(rssDestFolder->path(), newURL);
const nonstd::expected<void, QString> result = RSS::Session::instance()->addFeed(newURL, newFeedPath);
if (!result)
QMessageBox::warning(this, "qBittorrent", result.error(), QMessageBox::Ok);
QMessageBox::warning(this, u"qBittorrent"_qs, result.error(), QMessageBox::Ok);
// Expand destination folder to display new feed
if (destItem && (destItem != m_feedListWidget->stickyUnreadItem()))
@ -325,7 +325,7 @@ void RSSWidget::loadFoldersOpenState() @@ -325,7 +325,7 @@ void RSSWidget::loadFoldersOpenState()
for (const QString &varPath : openedFolders)
{
QTreeWidgetItem *parent = nullptr;
for (const QString &name : asConst(varPath.split('\\')))
for (const QString &name : asConst(varPath.split(u'\\')))
{
int nbChildren = (parent ? parent->childCount() : m_feedListWidget->topLevelItemCount());
for (int i = 0; i < nbChildren; ++i)
@ -442,7 +442,7 @@ void RSSWidget::copySelectedFeedsURL() @@ -442,7 +442,7 @@ void RSSWidget::copySelectedFeedsURL()
if (auto feed = qobject_cast<RSS::Feed *>(m_feedListWidget->getRSSItem(item)))
URLs << feed->url();
}
qApp->clipboard()->setText(URLs.join('\n'));
qApp->clipboard()->setText(URLs.join(u'\n'));
}
void RSSWidget::handleCurrentFeedItemChanged(QTreeWidgetItem *currentItem)
@ -489,8 +489,8 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL @@ -489,8 +489,8 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL
html += QString::fromLatin1("<div style='background-color: \"%1\";'><b>%2</b>%3</div>").arg(alternateBaseColor, tr("Date: "), QLocale::system().toString(article->date().toLocalTime()));
if (!article->author().isEmpty())
html += QString::fromLatin1("<div style='background-color: \"%1\";'><b>%2</b>%3</div>").arg(alternateBaseColor, tr("Author: "), article->author());
html += "</div>"
"<div style='margin-left: 5px; margin-right: 5px;'>";
html += u"</div>"
u"<div style='margin-left: 5px; margin-right: 5px;'>";
if (Qt::mightBeRichText(article->description()))
{
html += article->description();
@ -503,27 +503,27 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL @@ -503,27 +503,27 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL
rx.setPatternOptions(QRegularExpression::InvertedGreedinessOption
| QRegularExpression::CaseInsensitiveOption);
rx.setPattern("\\[img\\](.+)\\[/img\\]");
description = description.replace(rx, "<img src=\"\\1\">");
rx.setPattern(u"\\[img\\](.+)\\[/img\\]"_qs);
description = description.replace(rx, u"<img src=\"\\1\">"_qs);
rx.setPattern("\\[url=(\")?(.+)\\1\\]");
description = description.replace(rx, "<a href=\"\\2\">");
description = description.replace("[/url]", "</a>", Qt::CaseInsensitive);
rx.setPattern(u"\\[url=(\")?(.+)\\1\\]"_qs);
description = description.replace(rx, u"<a href=\"\\2\">"_qs);
description = description.replace(u"[/url]"_qs, u"</a>"_qs, Qt::CaseInsensitive);
rx.setPattern("\\[(/)?([bius])\\]");
description = description.replace(rx, "<\\1\\2>");
rx.setPattern(u"\\[(/)?([bius])\\]"_qs);
description = description.replace(rx, u"<\\1\\2>"_qs);
rx.setPattern("\\[color=(\")?(.+)\\1\\]");
description = description.replace(rx, "<span style=\"color:\\2\">");
description = description.replace("[/color]", "</span>", Qt::CaseInsensitive);
rx.setPattern(u"\\[color=(\")?(.+)\\1\\]"_qs);
description = description.replace(rx, u"<span style=\"color:\\2\">"_qs);
description = description.replace(u"[/color]"_qs, u"</span>"_qs, Qt::CaseInsensitive);
rx.setPattern("\\[size=(\")?(.+)\\d\\1\\]");
description = description.replace(rx, "<span style=\"font-size:\\2px\">");
description = description.replace("[/size]", "</span>", Qt::CaseInsensitive);
rx.setPattern(u"\\[size=(\")?(.+)\\d\\1\\]"_qs);
description = description.replace(rx, u"<span style=\"font-size:\\2px\">"_qs);
description = description.replace(u"[/size]"_qs, u"</span>"_qs, Qt::CaseInsensitive);
html += "<pre>" + description + "</pre>";
html += u"<pre>" + description + u"</pre>";
}
html += "</div>";
html += u"</div>";
m_ui->textBrowser->setHtml(html);
}

30
src/gui/search/pluginselectdialog.cpp

@ -73,7 +73,7 @@ PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidg @@ -73,7 +73,7 @@ PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidg
m_ui->pluginsTree->header()->setFirstSectionMovable(true);
m_ui->pluginsTree->header()->setSortIndicator(0, Qt::AscendingOrder);
m_ui->actionUninstall->setIcon(UIThemeManager::instance()->getIcon("list-remove"));
m_ui->actionUninstall->setIcon(UIThemeManager::instance()->getIcon(u"list-remove"_qs));
connect(m_ui->actionEnable, &QAction::toggled, this, &PluginSelectDialog::enableSelection);
connect(m_ui->pluginsTree, &QTreeWidget::customContextMenuRequested, this, &PluginSelectDialog::displayContextMenu);
@ -109,7 +109,7 @@ void PluginSelectDialog::dropEvent(QDropEvent *event) @@ -109,7 +109,7 @@ void PluginSelectDialog::dropEvent(QDropEvent *event)
{
if (!url.isEmpty())
{
if (url.scheme().compare("file", Qt::CaseInsensitive) == 0)
if (url.scheme().compare(u"file", Qt::CaseInsensitive) == 0)
files << url.toLocalFile();
else
files << url.toString();
@ -118,7 +118,7 @@ void PluginSelectDialog::dropEvent(QDropEvent *event) @@ -118,7 +118,7 @@ void PluginSelectDialog::dropEvent(QDropEvent *event)
}
else
{
files = event->mimeData()->text().split('\n');
files = event->mimeData()->text().split(u'\n');
}
if (files.isEmpty()) return;
@ -158,12 +158,12 @@ void PluginSelectDialog::togglePluginState(QTreeWidgetItem *item, int) @@ -158,12 +158,12 @@ void PluginSelectDialog::togglePluginState(QTreeWidgetItem *item, int)
if (plugin->enabled)
{
item->setText(PLUGIN_STATE, tr("Yes"));
setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), "green");
setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), u"green"_qs);
}
else
{
item->setText(PLUGIN_STATE, tr("No"));
setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), "red");
setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), u"red"_qs);
}
}
@ -208,7 +208,7 @@ void PluginSelectDialog::on_actionUninstall_triggered() @@ -208,7 +208,7 @@ void PluginSelectDialog::on_actionUninstall_triggered()
// Disable it instead
m_pluginManager->enablePlugin(id, false);
item->setText(PLUGIN_STATE, tr("No"));
setRowColor(index, "red");
setRowColor(index, u"red"_qs);
}
}
@ -229,12 +229,12 @@ void PluginSelectDialog::enableSelection(bool enable) @@ -229,12 +229,12 @@ void PluginSelectDialog::enableSelection(bool enable)
if (enable)
{
item->setText(PLUGIN_STATE, tr("Yes"));
setRowColor(index, "green");
setRowColor(index, u"green"_qs);
}
else
{
item->setText(PLUGIN_STATE, tr("No"));
setRowColor(index, "red");
setRowColor(index, u"red"_qs);
}
}
}
@ -294,12 +294,12 @@ void PluginSelectDialog::addNewPlugin(const QString &pluginName) @@ -294,12 +294,12 @@ void PluginSelectDialog::addNewPlugin(const QString &pluginName)
if (plugin->enabled)
{
item->setText(PLUGIN_STATE, tr("Yes"));
setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), "green");
setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), u"green"_qs);
}
else
{
item->setText(PLUGIN_STATE, tr("No"));
setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), "red");
setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), u"red"_qs);
}
// Handle icon
if (plugin->iconPath.exists())
@ -312,7 +312,7 @@ void PluginSelectDialog::addNewPlugin(const QString &pluginName) @@ -312,7 +312,7 @@ void PluginSelectDialog::addNewPlugin(const QString &pluginName)
// Icon is missing, we must download it
using namespace Net;
DownloadManager::instance()->download(
DownloadRequest(plugin->url + "/favicon.ico").saveToFile(true)
DownloadRequest(plugin->url + u"/favicon.ico").saveToFile(true)
, this, &PluginSelectDialog::iconDownloadFinished);
}
item->setText(PLUGIN_VERSION, plugin->version);
@ -338,7 +338,7 @@ void PluginSelectDialog::finishPluginUpdate() @@ -338,7 +338,7 @@ void PluginSelectDialog::finishPluginUpdate()
if ((m_pendingUpdates == 0) && !m_updatedPlugins.isEmpty())
{
m_updatedPlugins.sort(Qt::CaseInsensitive);
QMessageBox::information(this, tr("Search plugin update"), tr("Plugins installed or updated: %1").arg(m_updatedPlugins.join(", ")));
QMessageBox::information(this, tr("Search plugin update"), tr("Plugins installed or updated: %1").arg(m_updatedPlugins.join(u", ")));
m_updatedPlugins.clear();
}
}
@ -354,15 +354,15 @@ void PluginSelectDialog::askForPluginUrl() @@ -354,15 +354,15 @@ void PluginSelectDialog::askForPluginUrl()
{
bool ok = false;
QString clipTxt = qApp->clipboard()->text();
QString defaultUrl = "http://";
if (Net::DownloadManager::hasSupportedScheme(clipTxt) && clipTxt.endsWith(".py"))
auto defaultUrl = u"http://"_qs;
if (Net::DownloadManager::hasSupportedScheme(clipTxt) && clipTxt.endsWith(u".py"))
defaultUrl = clipTxt;
QString url = AutoExpandableDialog::getText(
this, tr("New search engine plugin URL"),
tr("URL:"), QLineEdit::Normal, defaultUrl, &ok
);
while (ok && !url.isEmpty() && !url.endsWith(".py"))
while (ok && !url.isEmpty() && !url.endsWith(u".py"))
{
QMessageBox::warning(this, tr("Invalid link"), tr("The link doesn't seem to point to a search engine plugin."));
url = AutoExpandableDialog::getText(

18
src/gui/search/searchjobwidget.cpp

@ -254,7 +254,7 @@ void SearchJobWidget::copyField(const int column) const @@ -254,7 +254,7 @@ void SearchJobWidget::copyField(const int column) const
}
if (!list.empty())
QApplication::clipboard()->setText(list.join('\n'));
QApplication::clipboard()->setText(list.join(u'\n'));
}
void SearchJobWidget::setStatus(Status value)
@ -273,7 +273,7 @@ void SearchJobWidget::downloadTorrent(const QModelIndex &rowIndex, const AddTorr @@ -273,7 +273,7 @@ void SearchJobWidget::downloadTorrent(const QModelIndex &rowIndex, const AddTorr
const QString siteUrl = m_proxyModel->data(
m_proxyModel->index(rowIndex.row(), SearchSortModel::ENGINE_URL)).toString();
if (torrentUrl.startsWith("magnet:", Qt::CaseInsensitive))
if (torrentUrl.startsWith(u"magnet:", Qt::CaseInsensitive))
{
addTorrentToSession(torrentUrl, option);
}
@ -390,22 +390,22 @@ void SearchJobWidget::contextMenuEvent(QContextMenuEvent *event) @@ -390,22 +390,22 @@ void SearchJobWidget::contextMenuEvent(QContextMenuEvent *event)
auto *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon("download"), tr("Open download window")
menu->addAction(UIThemeManager::instance()->getIcon(u"download"_qs), tr("Open download window")
, this, [this]() { downloadTorrents(AddTorrentOption::ShowDialog); });
menu->addAction(UIThemeManager::instance()->getIcon("download"), tr("Download")
menu->addAction(UIThemeManager::instance()->getIcon(u"download"_qs), tr("Download")
, this, [this]() { downloadTorrents(AddTorrentOption::SkipDialog); });
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon("application-x-mswinurl"), tr("Open description page")
menu->addAction(UIThemeManager::instance()->getIcon(u"application-x-mswinurl"_qs), tr("Open description page")
, this, &SearchJobWidget::openTorrentPages);
QMenu *copySubMenu = menu->addMenu(
UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy"));
UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy"));
copySubMenu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Name")
copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Name")
, this, &SearchJobWidget::copyTorrentNames);
copySubMenu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Download link")
copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Download link")
, this, &SearchJobWidget::copyTorrentDownloadLinks);
copySubMenu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Description page URL")
copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Description page URL")
, this, &SearchJobWidget::copyTorrentURLs);
menu->popup(event->globalPos());

22
src/gui/search/searchwidget.cpp

@ -113,8 +113,8 @@ SearchWidget::SearchWidget(MainWindow *mainWindow) @@ -113,8 +113,8 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
#ifndef Q_OS_MACOS
// Icons
m_ui->searchButton->setIcon(UIThemeManager::instance()->getIcon("edit-find"));
m_ui->pluginsButton->setIcon(UIThemeManager::instance()->getIcon("preferences-system-network"));
m_ui->searchButton->setIcon(UIThemeManager::instance()->getIcon(u"edit-find"_qs));
m_ui->pluginsButton->setIcon(UIThemeManager::instance()->getIcon(u"preferences-system-network"_qs));
#else
// On macOS the icons overlap the text otherwise
QSize iconSize = m_ui->tabWidget->iconSize();
@ -182,7 +182,7 @@ bool SearchWidget::eventFilter(QObject *object, QEvent *event) @@ -182,7 +182,7 @@ bool SearchWidget::eventFilter(QObject *object, QEvent *event)
void SearchWidget::fillCatCombobox()
{
m_ui->comboCategory->clear();
m_ui->comboCategory->addItem(SearchPluginManager::categoryFullName("all"), "all");
m_ui->comboCategory->addItem(SearchPluginManager::categoryFullName(u"all"_qs), u"all"_qs);
using QStrPair = std::pair<QString, QString>;
QVector<QStrPair> tmpList;
@ -203,9 +203,9 @@ void SearchWidget::fillCatCombobox() @@ -203,9 +203,9 @@ void SearchWidget::fillCatCombobox()
void SearchWidget::fillPluginComboBox()
{
m_ui->selectPlugin->clear();
m_ui->selectPlugin->addItem(tr("Only enabled"), "enabled");
m_ui->selectPlugin->addItem(tr("All plugins"), "all");
m_ui->selectPlugin->addItem(tr("Select..."), "multi");
m_ui->selectPlugin->addItem(tr("Only enabled"), u"enabled"_qs);
m_ui->selectPlugin->addItem(tr("All plugins"), u"all"_qs);
m_ui->selectPlugin->addItem(tr("Select..."), u"multi"_qs);
using QStrPair = std::pair<QString, QString>;
QVector<QStrPair> tmpList;
@ -266,7 +266,7 @@ void SearchWidget::tabChanged(int index) @@ -266,7 +266,7 @@ void SearchWidget::tabChanged(int index)
void SearchWidget::selectMultipleBox(int index)
{
Q_UNUSED(index);
if (selectedPlugin() == "multi")
if (selectedPlugin() == u"multi")
on_pluginsButton_clicked();
}
@ -331,11 +331,11 @@ void SearchWidget::on_searchButton_clicked() @@ -331,11 +331,11 @@ void SearchWidget::on_searchButton_clicked()
}
QStringList plugins;
if (selectedPlugin() == "all")
if (selectedPlugin() == u"all")
plugins = SearchPluginManager::instance()->allPlugins();
else if (selectedPlugin() == "enabled")
else if (selectedPlugin() == u"enabled")
plugins = SearchPluginManager::instance()->enabledPlugins();
else if (selectedPlugin() == "multi")
else if (selectedPlugin() == u"multi")
plugins = SearchPluginManager::instance()->enabledPlugins();
else
plugins << selectedPlugin();
@ -350,7 +350,7 @@ void SearchWidget::on_searchButton_clicked() @@ -350,7 +350,7 @@ void SearchWidget::on_searchButton_clicked()
m_allTabs.append(newTab);
QString tabName = pattern;
tabName.replace(QRegularExpression("&{1}"), "&&");
tabName.replace(QRegularExpression(u"&{1}"_qs), u"&&"_qs);
m_ui->tabWidget->addTab(newTab, tabName);
m_ui->tabWidget->setCurrentWidget(newTab);

4
src/gui/shutdownconfirmdialog.cpp

@ -130,12 +130,12 @@ void ShutdownConfirmDialog::initText() @@ -130,12 +130,12 @@ void ShutdownConfirmDialog::initText()
break;
}
m_msg += '\n';
m_msg += u'\n';
updateText();
}
void ShutdownConfirmDialog::updateText()
{
QString t = tr("You can cancel the action within %1 seconds.").arg(QString::number(m_timeout)) + '\n';
QString t = tr("You can cancel the action within %1 seconds.").arg(QString::number(m_timeout)) + u'\n';
m_ui->shutdownText->setText(m_msg + t);
}

2
src/gui/statsdialog.cpp

@ -86,7 +86,7 @@ void StatsDialog::update() @@ -86,7 +86,7 @@ void StatsDialog::update()
m_ui->labelGlobalRatio->setText(
((atd > 0) && (atu > 0))
? Utils::String::fromDouble(static_cast<qreal>(atu) / atd, 2)
: "-");
: u"-"_qs);
#ifndef QBT_USES_LIBTORRENT2
// Cache hits
const qreal readRatio = cs.readRatio;

16
src/gui/statusbar.cpp

@ -49,7 +49,7 @@ StatusBar::StatusBar(QWidget *parent) @@ -49,7 +49,7 @@ StatusBar::StatusBar(QWidget *parent)
#ifndef Q_OS_MACOS
// Redefining global stylesheet breaks certain elements on mac like tabs.
// Qt checks whether the stylesheet class inherts("QMacStyle") and this becomes false.
setStyleSheet("QStatusBar::item { border-width: 0; }");
setStyleSheet(u"QStatusBar::item { border-width: 0; }"_qs);
#endif
BitTorrent::Session *const session = BitTorrent::Session::instance();
@ -75,7 +75,7 @@ StatusBar::StatusBar(QWidget *parent) @@ -75,7 +75,7 @@ StatusBar::StatusBar(QWidget *parent)
m_dlSpeedLbl->setFlat(true);
m_dlSpeedLbl->setFocusPolicy(Qt::NoFocus);
m_dlSpeedLbl->setCursor(Qt::PointingHandCursor);
m_dlSpeedLbl->setStyleSheet("text-align:left;");
m_dlSpeedLbl->setStyleSheet(u"text-align:left;"_qs);
m_dlSpeedLbl->setMinimumWidth(200);
m_upSpeedLbl = new QPushButton(this);
@ -84,7 +84,7 @@ StatusBar::StatusBar(QWidget *parent) @@ -84,7 +84,7 @@ StatusBar::StatusBar(QWidget *parent)
m_upSpeedLbl->setFlat(true);
m_upSpeedLbl->setFocusPolicy(Qt::NoFocus);
m_upSpeedLbl->setCursor(Qt::PointingHandCursor);
m_upSpeedLbl->setStyleSheet("text-align:left;");
m_upSpeedLbl->setStyleSheet(u"text-align:left;"_qs);
m_upSpeedLbl->setMinimumWidth(200);
m_DHTLbl = new QLabel(tr("DHT: %1 nodes").arg(0), this);
@ -141,7 +141,7 @@ StatusBar::StatusBar(QWidget *parent) @@ -141,7 +141,7 @@ StatusBar::StatusBar(QWidget *parent)
layout->addWidget(m_upSpeedLbl);
addPermanentWidget(container);
setStyleSheet("QWidget {margin: 0;}");
setStyleSheet(u"QWidget {margin: 0;}"_qs);
container->adjustSize();
adjustSize();
// Is DHT enabled
@ -215,15 +215,15 @@ void StatusBar::updateSpeedLabels() @@ -215,15 +215,15 @@ void StatusBar::updateSpeedLabels()
QString dlSpeedLbl = Utils::Misc::friendlyUnit(sessionStatus.payloadDownloadRate, true);
const int dlSpeedLimit = BitTorrent::Session::instance()->downloadSpeedLimit();
if (dlSpeedLimit > 0)
dlSpeedLbl += " [" + Utils::Misc::friendlyUnit(dlSpeedLimit, true) + ']';
dlSpeedLbl += " (" + Utils::Misc::friendlyUnit(sessionStatus.totalPayloadDownload) + ')';
dlSpeedLbl += u" [" + Utils::Misc::friendlyUnit(dlSpeedLimit, true) + u']';
dlSpeedLbl += u" (" + Utils::Misc::friendlyUnit(sessionStatus.totalPayloadDownload) + u')';
m_dlSpeedLbl->setText(dlSpeedLbl);
QString upSpeedLbl = Utils::Misc::friendlyUnit(sessionStatus.payloadUploadRate, true);
const int upSpeedLimit = BitTorrent::Session::instance()->uploadSpeedLimit();
if (upSpeedLimit > 0)
upSpeedLbl += " [" + Utils::Misc::friendlyUnit(upSpeedLimit, true) + ']';
upSpeedLbl += " (" + Utils::Misc::friendlyUnit(sessionStatus.totalPayloadUpload) + ')';
upSpeedLbl += u" [" + Utils::Misc::friendlyUnit(upSpeedLimit, true) + u']';
upSpeedLbl += u" (" + Utils::Misc::friendlyUnit(sessionStatus.totalPayloadUpload) + u')';
m_upSpeedLbl->setText(upSpeedLbl);
}

2
src/gui/tagfiltermodel.cpp

@ -124,7 +124,7 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const @@ -124,7 +124,7 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const
switch (role)
{
case Qt::DecorationRole:
return UIThemeManager::instance()->getIcon("inode-directory");
return UIThemeManager::instance()->getIcon(u"inode-directory"_qs);
case Qt::DisplayRole:
return QString::fromLatin1("%1 (%2)")
.arg(tagDisplayName(item.tag())).arg(item.torrentsCount());

16
src/gui/tagfilterwidget.cpp

@ -47,7 +47,7 @@ namespace @@ -47,7 +47,7 @@ namespace
if (index.isValid())
{
if (index.row() == 1)
tagFilter = ""; // Untagged
tagFilter = u""_qs; // Untagged
else if (index.row() > 1)
tagFilter = model->tag(index);
}
@ -107,24 +107,24 @@ void TagFilterWidget::showMenu() @@ -107,24 +107,24 @@ void TagFilterWidget::showMenu()
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add tag...")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add tag...")
, this, &TagFilterWidget::addTag);
const auto selectedRows = selectionModel()->selectedRows();
if (!selectedRows.empty() && !TagFilterModel::isSpecialItem(selectedRows.first()))
{
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove tag")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Remove tag")
, this, &TagFilterWidget::removeTag);
}
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove unused tags")
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Remove unused tags")
, this, &TagFilterWidget::removeUnusedTags);
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-start"), tr("Resume torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"media-playback-start"_qs), tr("Resume torrents")
, this, &TagFilterWidget::actionResumeTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-pause"), tr("Pause torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"media-playback-pause"_qs), tr("Pause torrents")
, this, &TagFilterWidget::actionPauseTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon("edit-delete"), tr("Delete torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-delete"_qs), tr("Delete torrents")
, this, &TagFilterWidget::actionDeleteTorrentsTriggered);
menu->popup(QCursor::pos());
@ -162,7 +162,7 @@ void TagFilterWidget::rowsInserted(const QModelIndex &parent, int start, int end @@ -162,7 +162,7 @@ void TagFilterWidget::rowsInserted(const QModelIndex &parent, int start, int end
QString TagFilterWidget::askTagName()
{
bool ok = false;
QString tag = "";
QString tag = u""_qs;
bool invalid = true;
while (invalid)
{

2
src/gui/torrentcontentmodel.cpp

@ -74,7 +74,7 @@ namespace @@ -74,7 +74,7 @@ namespace
QIcon icon(const QFileInfo &info) const override
{
Q_UNUSED(info);
static QIcon cached = UIThemeManager::instance()->getIcon("text-plain");
static QIcon cached = UIThemeManager::instance()->getIcon(u"text-plain"_qs);
return cached;
}
};

8
src/gui/torrentcreatordialog.cpp

@ -158,7 +158,7 @@ void TorrentCreatorDialog::dropEvent(QDropEvent *event) @@ -158,7 +158,7 @@ void TorrentCreatorDialog::dropEvent(QDropEvent *event)
// only take the first one
const QUrl firstItem = event->mimeData()->urls().first();
const Path path {
(firstItem.scheme().compare("file", Qt::CaseInsensitive) == 0)
(firstItem.scheme().compare(u"file", Qt::CaseInsensitive) == 0)
? firstItem.toLocalFile() : firstItem.toString()
};
updateInputPath(path);
@ -167,7 +167,7 @@ void TorrentCreatorDialog::dropEvent(QDropEvent *event) @@ -167,7 +167,7 @@ void TorrentCreatorDialog::dropEvent(QDropEvent *event)
void TorrentCreatorDialog::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasFormat("text/plain") || event->mimeData()->hasFormat("text/uri-list"))
if (event->mimeData()->hasFormat(u"text/plain"_qs) || event->mimeData()->hasFormat(u"text/uri-list"_qs))
event->acceptProposedAction();
}
@ -197,7 +197,7 @@ void TorrentCreatorDialog::onCreateButtonClicked() @@ -197,7 +197,7 @@ void TorrentCreatorDialog::onCreateButtonClicked()
setCursor(QCursor(Qt::WaitCursor));
const QStringList trackers = m_ui->trackersList->toPlainText().trimmed()
.replace(QRegularExpression("\n\n[\n]+"), "\n\n").split('\n');
.replace(QRegularExpression(u"\n\n[\n]+"_qs), u"\n\n"_qs).split(u'\n');
const BitTorrent::TorrentCreatorParams params
{
m_ui->checkPrivate->isChecked()
@ -213,7 +213,7 @@ void TorrentCreatorDialog::onCreateButtonClicked() @@ -213,7 +213,7 @@ void TorrentCreatorDialog::onCreateButtonClicked()
, m_ui->txtComment->toPlainText()
, m_ui->lineEditSource->text()
, trackers
, m_ui->URLSeedsList->toPlainText().split('\n', Qt::SkipEmptyParts)
, m_ui->URLSeedsList->toPlainText().split(u'\n', Qt::SkipEmptyParts)
};
// run the creator thread

8
src/gui/torrentoptionsdialog.cpp

@ -251,7 +251,7 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTor @@ -251,7 +251,7 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTor
}
else
{
m_ui->spinUploadLimit->setSpecialValueText(QString::fromUtf8(C_INEQUALITY));
m_ui->spinUploadLimit->setSpecialValueText(C_INEQUALITY);
m_ui->spinUploadLimit->setMinimum(-1);
m_ui->spinUploadLimit->setValue(-1);
connect(m_ui->spinUploadLimit, qOverload<int>(&QSpinBox::valueChanged)
@ -266,7 +266,7 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTor @@ -266,7 +266,7 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTor
}
else
{
m_ui->spinDownloadLimit->setSpecialValueText(QString::fromUtf8(C_INEQUALITY));
m_ui->spinDownloadLimit->setSpecialValueText(C_INEQUALITY);
m_ui->spinDownloadLimit->setMinimum(-1);
m_ui->spinDownloadLimit->setValue(-1);
connect(m_ui->spinDownloadLimit, qOverload<int>(&QSpinBox::valueChanged)
@ -607,7 +607,7 @@ void TorrentOptionsDialog::handleRatioTypeChanged() @@ -607,7 +607,7 @@ void TorrentOptionsDialog::handleRatioTypeChanged()
void TorrentOptionsDialog::handleUpSpeedLimitChanged()
{
m_ui->spinUploadLimit->setMinimum(0);
m_ui->spinUploadLimit->setSpecialValueText(QString::fromUtf8(C_INFINITY));
m_ui->spinUploadLimit->setSpecialValueText(C_INFINITY);
disconnect(m_ui->spinUploadLimit, qOverload<int>(&QSpinBox::valueChanged)
, this, &TorrentOptionsDialog::handleUpSpeedLimitChanged);
}
@ -615,7 +615,7 @@ void TorrentOptionsDialog::handleUpSpeedLimitChanged() @@ -615,7 +615,7 @@ void TorrentOptionsDialog::handleUpSpeedLimitChanged()
void TorrentOptionsDialog::handleDownSpeedLimitChanged()
{
m_ui->spinDownloadLimit->setMinimum(0);
m_ui->spinDownloadLimit->setSpecialValueText(QString::fromUtf8(C_INFINITY));
m_ui->spinDownloadLimit->setSpecialValueText(C_INFINITY);
disconnect(m_ui->spinDownloadLimit, qOverload<int>(&QSpinBox::valueChanged)
, this, &TorrentOptionsDialog::handleDownSpeedLimitChanged);
}

4
src/gui/trackerentriesdialog.cpp

@ -66,14 +66,14 @@ void TrackerEntriesDialog::setTrackers(const QVector<BitTorrent::TrackerEntry> & @@ -66,14 +66,14 @@ void TrackerEntriesDialog::setTrackers(const QVector<BitTorrent::TrackerEntry> &
for (const BitTorrent::TrackerEntry &entry : trackers)
{
tiers[entry.tier] += (entry.url + '\n');
tiers[entry.tier] += (entry.url + u'\n');
maxTier = std::max(maxTier, entry.tier);
}
QString text = tiers.value(0);
for (int i = 1; i <= maxTier; ++i)
text += ('\n' + tiers.value(i));
text += (u'\n' + tiers.value(i));
m_ui->plainTextEdit->setPlainText(text);
}

46
src/gui/transferlistfilterswidget.cpp

@ -68,7 +68,7 @@ namespace @@ -68,7 +68,7 @@ namespace
const QUrl url {tracker};
QString scheme = url.scheme();
if (scheme.isEmpty())
scheme = "http";
scheme = u"http"_qs;
return scheme;
}
@ -82,7 +82,7 @@ namespace @@ -82,7 +82,7 @@ namespace
if (!QHostAddress(host).isNull())
return host;
return host.section('.', -2, -1);
return host.section(u'.', -2, -1);
}
class ArrowCheckBox final : public QCheckBox
@ -109,7 +109,7 @@ namespace @@ -109,7 +109,7 @@ namespace
}
};
const QString NULL_HOST {""};
const QString NULL_HOST = u""_qs;
}
BaseFilterWidget::BaseFilterWidget(QWidget *parent, TransferListWidget *transferList)
@ -306,11 +306,11 @@ void StatusFilterWidget::showMenu() @@ -306,11 +306,11 @@ void StatusFilterWidget::showMenu()
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-start"), tr("Resume torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"media-playback-start"_qs), tr("Resume torrents")
, transferList, &TransferListWidget::startVisibleTorrents);
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-pause"), tr("Pause torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"media-playback-pause"_qs), tr("Pause torrents")
, transferList, &TransferListWidget::pauseVisibleTorrents);
menu->addAction(UIThemeManager::instance()->getIcon("edit-delete"), tr("Delete torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-delete"_qs), tr("Delete torrents")
, transferList, &TransferListWidget::deleteVisibleTorrents);
menu->popup(QCursor::pos());
@ -366,10 +366,10 @@ TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *tran @@ -366,10 +366,10 @@ TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *tran
{
auto *allTrackers = new QListWidgetItem(this);
allTrackers->setData(Qt::DisplayRole, tr("All (0)", "this is for the tracker filter"));
allTrackers->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon("network-server"));
allTrackers->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"network-server"_qs));
auto *noTracker = new QListWidgetItem(this);
noTracker->setData(Qt::DisplayRole, tr("Trackerless (0)"));
noTracker->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon("network-server"));
noTracker->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"network-server"_qs));
auto *errorTracker = new QListWidgetItem(this);
errorTracker->setData(Qt::DisplayRole, tr("Error (0)"));
errorTracker->setData(Qt::DecorationRole, style()->standardIcon(QStyle::SP_MessageBoxCritical));
@ -407,10 +407,10 @@ void TrackerFiltersList::addItem(const QString &tracker, const BitTorrent::Torre @@ -407,10 +407,10 @@ void TrackerFiltersList::addItem(const QString &tracker, const BitTorrent::Torre
else
{
trackerItem = new QListWidgetItem();
trackerItem->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon("network-server"));
trackerItem->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"network-server"_qs));
const QString scheme = getScheme(tracker);
downloadFavicon(QString::fromLatin1("%1://%2/favicon.ico").arg((scheme.startsWith("http") ? scheme : "http"), host));
downloadFavicon(QString::fromLatin1("%1://%2/favicon.ico").arg((scheme.startsWith(u"http") ? scheme : u"http"_qs), host));
}
if (!trackerItem) return;
@ -538,8 +538,8 @@ void TrackerFiltersList::setDownloadTrackerFavicon(bool value) @@ -538,8 +538,8 @@ void TrackerFiltersList::setDownloadTrackerFavicon(bool value)
if (!tracker.isEmpty())
{
const QString scheme = getScheme(tracker);
downloadFavicon(QString("%1://%2/favicon.ico")
.arg((scheme.startsWith("http") ? scheme : "http"), getHost(tracker)));
downloadFavicon(u"%1://%2/favicon.ico"_qs
.arg((scheme.startsWith(u"http") ? scheme : u"http"_qs), getHost(tracker)));
}
}
}
@ -618,8 +618,8 @@ void TrackerFiltersList::handleFavicoDownloadFinished(const Net::DownloadResult @@ -618,8 +618,8 @@ void TrackerFiltersList::handleFavicoDownloadFinished(const Net::DownloadResult
{
if (result.status != Net::DownloadStatus::Success)
{
if (result.url.endsWith(".ico", Qt::CaseInsensitive))
downloadFavicon(result.url.left(result.url.size() - 4) + ".png");
if (result.url.endsWith(u".ico", Qt::CaseInsensitive))
downloadFavicon(result.url.left(result.url.size() - 4) + u".png");
return;
}
@ -640,8 +640,8 @@ void TrackerFiltersList::handleFavicoDownloadFinished(const Net::DownloadResult @@ -640,8 +640,8 @@ void TrackerFiltersList::handleFavicoDownloadFinished(const Net::DownloadResult
bool invalid = (sizes.isEmpty() || icon.pixmap(sizes.first()).isNull());
if (invalid)
{
if (result.url.endsWith(".ico", Qt::CaseInsensitive))
downloadFavicon(result.url.left(result.url.size() - 4) + ".png");
if (result.url.endsWith(u".ico", Qt::CaseInsensitive))
downloadFavicon(result.url.left(result.url.size() - 4) + u".png");
Utils::Fs::removeFile(result.filePath);
}
else
@ -656,11 +656,11 @@ void TrackerFiltersList::showMenu() @@ -656,11 +656,11 @@ void TrackerFiltersList::showMenu()
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-start"), tr("Resume torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"media-playback-start"_qs), tr("Resume torrents")
, transferList, &TransferListWidget::startVisibleTorrents);
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-pause"), tr("Pause torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"media-playback-pause"_qs), tr("Pause torrents")
, transferList, &TransferListWidget::pauseVisibleTorrents);
menu->addAction(UIThemeManager::instance()->getIcon("edit-delete"), tr("Delete torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-delete"_qs), tr("Delete torrents")
, transferList, &TransferListWidget::deleteVisibleTorrents);
menu->popup(QCursor::pos());
@ -706,10 +706,10 @@ QString TrackerFiltersList::trackerFromRow(int row) const @@ -706,10 +706,10 @@ QString TrackerFiltersList::trackerFromRow(int row) const
{
Q_ASSERT(row > 1);
const QString tracker = item(row)->text();
QStringList parts = tracker.split(' ');
QStringList parts = tracker.split(u' ');
Q_ASSERT(parts.size() >= 2);
parts.removeLast(); // Remove trailing number
return parts.join(' ');
return parts.join(u' ');
}
int TrackerFiltersList::rowFromTracker(const QString &tracker) const
@ -756,8 +756,8 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi @@ -756,8 +756,8 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi
scroll->setWidgetResizable(true);
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setStyleSheet("QFrame {background: transparent;}");
scroll->setStyleSheet("QFrame {border: none;}");
setStyleSheet(u"QFrame {background: transparent;}"_qs);
scroll->setStyleSheet(u"QFrame {border: none;}"_qs);
vLayout->setContentsMargins(0, 0, 0, 0);
frameLayout->setContentsMargins(0, 2, 0, 0);
frameLayout->setSpacing(2);

8
src/gui/transferlistmodel.cpp

@ -168,7 +168,7 @@ QVariant TransferListModel::headerData(int section, Qt::Orientation orientation, @@ -168,7 +168,7 @@ QVariant TransferListModel::headerData(int section, Qt::Orientation orientation,
{
switch (section)
{
case TR_QUEUE_POSITION: return QChar('#');
case TR_QUEUE_POSITION: return u'#';
case TR_NAME: return tr("Name", "i.e: torrent name");
case TR_SIZE: return tr("Size", "i.e: torrent size");
case TR_PROGRESS: return tr("Progress", "% Done");
@ -266,7 +266,7 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons @@ -266,7 +266,7 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
return (value > 0)
? Utils::Misc::friendlyUnit(value, true)
: QString::fromUtf8(C_INFINITY);
: C_INFINITY;
};
const auto amountString = [hideValues](const qint64 value, const qint64 total) -> QString
@ -289,7 +289,7 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons @@ -289,7 +289,7 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
return {};
return ((static_cast<int>(value) == -1) || (value > BitTorrent::Torrent::MAX_RATIO))
? QString::fromUtf8(C_INFINITY) : Utils::String::fromDouble(value, 2);
? C_INFINITY : Utils::String::fromDouble(value, 2);
};
const auto queuePositionString = [](const qint64 value) -> QString
@ -335,7 +335,7 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons @@ -335,7 +335,7 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
const auto statusString = [this](const BitTorrent::TorrentState state, const QString &errorMessage) -> QString
{
return (state == BitTorrent::TorrentState::Error)
? m_statusStrings[state] + ": " + errorMessage
? m_statusStrings[state] + u": " + errorMessage
: m_statusStrings[state];
};

76
src/gui/transferlistwidget.cpp

@ -488,7 +488,7 @@ void TransferListWidget::copySelectedMagnetURIs() const @@ -488,7 +488,7 @@ void TransferListWidget::copySelectedMagnetURIs() const
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
magnetUris << torrent->createMagnetURI();
qApp->clipboard()->setText(magnetUris.join('\n'));
qApp->clipboard()->setText(magnetUris.join(u'\n'));
}
void TransferListWidget::copySelectedNames() const
@ -497,7 +497,7 @@ void TransferListWidget::copySelectedNames() const @@ -497,7 +497,7 @@ void TransferListWidget::copySelectedNames() const
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
torrentNames << torrent->name();
qApp->clipboard()->setText(torrentNames.join('\n'));
qApp->clipboard()->setText(torrentNames.join(u'\n'));
}
void TransferListWidget::copySelectedInfohashes(const CopyInfohashPolicy policy) const
@ -523,7 +523,7 @@ void TransferListWidget::copySelectedInfohashes(const CopyInfohashPolicy policy) @@ -523,7 +523,7 @@ void TransferListWidget::copySelectedInfohashes(const CopyInfohashPolicy policy)
break;
}
qApp->clipboard()->setText(infoHashes.join('\n'));
qApp->clipboard()->setText(infoHashes.join(u'\n'));
}
void TransferListWidget::copySelectedIDs() const
@ -532,7 +532,7 @@ void TransferListWidget::copySelectedIDs() const @@ -532,7 +532,7 @@ void TransferListWidget::copySelectedIDs() const
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
torrentIDs << torrent->id().toString();
qApp->clipboard()->setText(torrentIDs.join('\n'));
qApp->clipboard()->setText(torrentIDs.join(u'\n'));
}
void TransferListWidget::hideQueuePosColumn(bool hide)
@ -776,10 +776,10 @@ QStringList TransferListWidget::askTagsForSelection(const QString &dialogTitle) @@ -776,10 +776,10 @@ QStringList TransferListWidget::askTagsForSelection(const QString &dialogTitle)
bool ok = false;
invalid = false;
const QString tagsInput = AutoExpandableDialog::getText(
this, dialogTitle, tr("Comma-separated tags:"), QLineEdit::Normal, "", &ok).trimmed();
this, dialogTitle, tr("Comma-separated tags:"), QLineEdit::Normal, {}, &ok).trimmed();
if (!ok || tagsInput.isEmpty())
return {};
tags = tagsInput.split(',', Qt::SkipEmptyParts);
tags = tagsInput.split(u',', Qt::SkipEmptyParts);
for (QString &tag : tags)
{
tag = tag.trimmed();
@ -818,7 +818,7 @@ void TransferListWidget::renameSelectedTorrent() @@ -818,7 +818,7 @@ void TransferListWidget::renameSelectedTorrent()
QString name = AutoExpandableDialog::getText(this, tr("Rename"), tr("New name:"), QLineEdit::Normal, torrent->name(), &ok);
if (ok && !name.isEmpty())
{
name.replace(QRegularExpression("\r?\n|\r"), " ");
name.replace(QRegularExpression(u"\r?\n|\r"_qs), u" "_qs);
// Rename the torrent
m_listModel->setData(mi, name, Qt::DisplayRole);
}
@ -856,47 +856,47 @@ void TransferListWidget::displayListMenu() @@ -856,47 +856,47 @@ void TransferListWidget::displayListMenu()
// Create actions
auto *actionStart = new QAction(UIThemeManager::instance()->getIcon("media-playback-start"), tr("Resume", "Resume/start the torrent"), listMenu);
auto *actionStart = new QAction(UIThemeManager::instance()->getIcon(u"media-playback-start"_qs), tr("Resume", "Resume/start the torrent"), listMenu);
connect(actionStart, &QAction::triggered, this, &TransferListWidget::startSelectedTorrents);
auto *actionPause = new QAction(UIThemeManager::instance()->getIcon("media-playback-pause"), tr("Pause", "Pause the torrent"), listMenu);
auto *actionPause = new QAction(UIThemeManager::instance()->getIcon(u"media-playback-pause"_qs), tr("Pause", "Pause the torrent"), listMenu);
connect(actionPause, &QAction::triggered, this, &TransferListWidget::pauseSelectedTorrents);
auto *actionForceStart = new QAction(UIThemeManager::instance()->getIcon("media-seek-forward"), tr("Force Resume", "Force Resume/start the torrent"), listMenu);
auto *actionForceStart = new QAction(UIThemeManager::instance()->getIcon(u"media-seek-forward"_qs), tr("Force Resume", "Force Resume/start the torrent"), listMenu);
connect(actionForceStart, &QAction::triggered, this, &TransferListWidget::forceStartSelectedTorrents);
auto *actionDelete = new QAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Delete", "Delete the torrent"), listMenu);
auto *actionDelete = new QAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Delete", "Delete the torrent"), listMenu);
connect(actionDelete, &QAction::triggered, this, &TransferListWidget::softDeleteSelectedTorrents);
auto *actionPreviewFile = new QAction(UIThemeManager::instance()->getIcon("view-preview"), tr("Preview file..."), listMenu);
auto *actionPreviewFile = new QAction(UIThemeManager::instance()->getIcon(u"view-preview"_qs), tr("Preview file..."), listMenu);
connect(actionPreviewFile, &QAction::triggered, this, &TransferListWidget::previewSelectedTorrents);
auto *actionTorrentOptions = new QAction(UIThemeManager::instance()->getIcon("configure"), tr("Torrent options..."), listMenu);
auto *actionTorrentOptions = new QAction(UIThemeManager::instance()->getIcon(u"configure"_qs), tr("Torrent options..."), listMenu);
connect(actionTorrentOptions, &QAction::triggered, this, &TransferListWidget::setTorrentOptions);
auto *actionOpenDestinationFolder = new QAction(UIThemeManager::instance()->getIcon("inode-directory"), tr("Open destination folder"), listMenu);
auto *actionOpenDestinationFolder = new QAction(UIThemeManager::instance()->getIcon(u"inode-directory"_qs), tr("Open destination folder"), listMenu);
connect(actionOpenDestinationFolder, &QAction::triggered, this, &TransferListWidget::openSelectedTorrentsFolder);
auto *actionIncreaseQueuePos = new QAction(UIThemeManager::instance()->getIcon("go-up"), tr("Move up", "i.e. move up in the queue"), listMenu);
auto *actionIncreaseQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-up"_qs), tr("Move up", "i.e. move up in the queue"), listMenu);
connect(actionIncreaseQueuePos, &QAction::triggered, this, &TransferListWidget::increaseQueuePosSelectedTorrents);
auto *actionDecreaseQueuePos = new QAction(UIThemeManager::instance()->getIcon("go-down"), tr("Move down", "i.e. Move down in the queue"), listMenu);
auto *actionDecreaseQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-down"_qs), tr("Move down", "i.e. Move down in the queue"), listMenu);
connect(actionDecreaseQueuePos, &QAction::triggered, this, &TransferListWidget::decreaseQueuePosSelectedTorrents);
auto *actionTopQueuePos = new QAction(UIThemeManager::instance()->getIcon("go-top"), tr("Move to top", "i.e. Move to top of the queue"), listMenu);
auto *actionTopQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-top"_qs), tr("Move to top", "i.e. Move to top of the queue"), listMenu);
connect(actionTopQueuePos, &QAction::triggered, this, &TransferListWidget::topQueuePosSelectedTorrents);
auto *actionBottomQueuePos = new QAction(UIThemeManager::instance()->getIcon("go-bottom"), tr("Move to bottom", "i.e. Move to bottom of the queue"), listMenu);
auto *actionBottomQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-bottom"_qs), tr("Move to bottom", "i.e. Move to bottom of the queue"), listMenu);
connect(actionBottomQueuePos, &QAction::triggered, this, &TransferListWidget::bottomQueuePosSelectedTorrents);
auto *actionSetTorrentPath = new QAction(UIThemeManager::instance()->getIcon("inode-directory"), tr("Set location..."), listMenu);
auto *actionSetTorrentPath = new QAction(UIThemeManager::instance()->getIcon(u"inode-directory"_qs), tr("Set location..."), listMenu);
connect(actionSetTorrentPath, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsLocation);
auto *actionForceRecheck = new QAction(UIThemeManager::instance()->getIcon("document-edit-verify"), tr("Force recheck"), listMenu);
auto *actionForceRecheck = new QAction(UIThemeManager::instance()->getIcon(u"document-edit-verify"_qs), tr("Force recheck"), listMenu);
connect(actionForceRecheck, &QAction::triggered, this, &TransferListWidget::recheckSelectedTorrents);
auto *actionForceReannounce = new QAction(UIThemeManager::instance()->getIcon("document-edit-verify"), tr("Force reannounce"), listMenu);
auto *actionForceReannounce = new QAction(UIThemeManager::instance()->getIcon(u"document-edit-verify"_qs), tr("Force reannounce"), listMenu);
connect(actionForceReannounce, &QAction::triggered, this, &TransferListWidget::reannounceSelectedTorrents);
auto *actionCopyMagnetLink = new QAction(UIThemeManager::instance()->getIcon("kt-magnet"), tr("Magnet link"), listMenu);
auto *actionCopyMagnetLink = new QAction(UIThemeManager::instance()->getIcon(u"kt-magnet"_qs), tr("Magnet link"), listMenu);
connect(actionCopyMagnetLink, &QAction::triggered, this, &TransferListWidget::copySelectedMagnetURIs);
auto *actionCopyID = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Torrent ID"), listMenu);
auto *actionCopyID = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Torrent ID"), listMenu);
connect(actionCopyID, &QAction::triggered, this, &TransferListWidget::copySelectedIDs);
auto *actionCopyName = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Name"), listMenu);
auto *actionCopyName = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Name"), listMenu);
connect(actionCopyName, &QAction::triggered, this, &TransferListWidget::copySelectedNames);
auto *actionCopyHash1 = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Info hash v1"), listMenu);
auto *actionCopyHash1 = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Info hash v1"), listMenu);
connect(actionCopyHash1, &QAction::triggered, this, [this]() { copySelectedInfohashes(CopyInfohashPolicy::Version1); });
auto *actionCopyHash2 = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Info hash v2"), listMenu);
auto *actionCopyHash2 = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Info hash v2"), listMenu);
connect(actionCopyHash2, &QAction::triggered, this, [this]() { copySelectedInfohashes(CopyInfohashPolicy::Version2); });
auto *actionSuperSeedingMode = new TriStateAction(tr("Super seeding mode"), listMenu);
connect(actionSuperSeedingMode, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsSuperSeeding);
auto *actionRename = new QAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename..."), listMenu);
auto *actionRename = new QAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Rename..."), listMenu);
connect(actionRename, &QAction::triggered, this, &TransferListWidget::renameSelectedTorrent);
auto *actionSequentialDownload = new TriStateAction(tr("Download in sequential order"), listMenu);
connect(actionSequentialDownload, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsSequentialDownload);
@ -905,7 +905,7 @@ void TransferListWidget::displayListMenu() @@ -905,7 +905,7 @@ void TransferListWidget::displayListMenu()
auto *actionAutoTMM = new TriStateAction(tr("Automatic Torrent Management"), listMenu);
actionAutoTMM->setToolTip(tr("Automatic mode means that various torrent properties (e.g. save path) will be decided by the associated category"));
connect(actionAutoTMM, &QAction::triggered, this, &TransferListWidget::setSelectedAutoTMMEnabled);
auto *actionEditTracker = new QAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Edit trackers..."), listMenu);
auto *actionEditTracker = new QAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Edit trackers..."), listMenu);
connect(actionEditTracker, &QAction::triggered, this, &TransferListWidget::editTorrentTrackers);
// End of actions
@ -1045,18 +1045,18 @@ void TransferListWidget::displayListMenu() @@ -1045,18 +1045,18 @@ void TransferListWidget::displayListMenu()
QStringList categories = BitTorrent::Session::instance()->categories();
std::sort(categories.begin(), categories.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>());
QMenu *categoryMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon("view-categories"), tr("Category"));
QMenu *categoryMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon(u"view-categories"_qs), tr("Category"));
categoryMenu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("New...", "New category...")
categoryMenu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("New...", "New category...")
, this, &TransferListWidget::askNewCategoryForSelection);
categoryMenu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Reset", "Reset category")
, this, [this]() { setSelectionCategory(""); });
categoryMenu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Reset", "Reset category")
, this, [this]() { setSelectionCategory(u""_qs); });
categoryMenu->addSeparator();
for (const QString &category : asConst(categories))
{
const QString escapedCategory = QString(category).replace('&', "&&"); // avoid '&' becomes accelerator key
QAction *categoryAction = categoryMenu->addAction(UIThemeManager::instance()->getIcon("inode-directory"), escapedCategory
const QString escapedCategory = QString(category).replace(u'&', u"&&"_qs); // avoid '&' becomes accelerator key
QAction *categoryAction = categoryMenu->addAction(UIThemeManager::instance()->getIcon(u"inode-directory"_qs), escapedCategory
, this, [this, category]() { setSelectionCategory(category); });
if (allSameCategory && (category == firstCategory))
@ -1070,11 +1070,11 @@ void TransferListWidget::displayListMenu() @@ -1070,11 +1070,11 @@ void TransferListWidget::displayListMenu()
QStringList tags(BitTorrent::Session::instance()->tags().values());
std::sort(tags.begin(), tags.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>());
QMenu *tagsMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon("view-categories"), tr("Tags"));
QMenu *tagsMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon(u"view-categories"_qs), tr("Tags"));
tagsMenu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add...", "Add / assign multiple tags...")
tagsMenu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add...", "Add / assign multiple tags...")
, this, &TransferListWidget::askAddTagsForSelection);
tagsMenu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Remove All", "Remove all tags")
tagsMenu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Remove All", "Remove all tags")
, this, [this]()
{
if (Preferences::instance()->confirmRemoveAllTags())
@ -1163,7 +1163,7 @@ void TransferListWidget::displayListMenu() @@ -1163,7 +1163,7 @@ void TransferListWidget::displayListMenu()
}
QMenu *copySubMenu = listMenu->addMenu(
UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy"));
UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy"));
copySubMenu->addAction(actionCopyName);
copySubMenu->addAction(actionCopyHash1);
actionCopyHash1->setEnabled(hasInfohashV1);

4
src/gui/uithememanager.cpp

@ -196,7 +196,7 @@ UIThemeManager *UIThemeManager::instance() @@ -196,7 +196,7 @@ UIThemeManager *UIThemeManager::instance()
void UIThemeManager::applyStyleSheet() const
{
qApp->setStyleSheet(m_themeSource->readStyleSheet());
qApp->setStyleSheet(QString::fromUtf8(m_themeSource->readStyleSheet()));
}
QIcon UIThemeManager::getIcon(const QString &iconId, const QString &fallback) const
@ -330,7 +330,7 @@ void UIThemeManager::loadColorsFromJSONConfig() @@ -330,7 +330,7 @@ void UIThemeManager::loadColorsFromJSONConfig()
return;
}
const QJsonObject colors = configJsonDoc.object().value("colors").toObject();
const QJsonObject colors = configJsonDoc.object().value(u"colors").toObject();
for (auto color = colors.constBegin(); color != colors.constEnd(); ++color)
{
const QColor providedColor(color.value().toString());

31
src/gui/utils.cpp

@ -47,6 +47,7 @@ @@ -47,6 +47,7 @@
#include <QWidget>
#include <QWindow>
#include "base/global.h"
#include "base/path.h"
#include "base/utils/fs.h"
#include "base/utils/version.h"
@ -140,7 +141,7 @@ QPoint Utils::Gui::screenCenter(const QWidget *w) @@ -140,7 +141,7 @@ QPoint Utils::Gui::screenCenter(const QWidget *w)
void Utils::Gui::openPath(const Path &path)
{
// Hack to access samba shares with QDesktopServices::openUrl
if (path.data().startsWith("//"))
if (path.data().startsWith(u"//"))
QDesktopServices::openUrl(QUrl(QString::fromLatin1("file:") + path.toString()));
else
QDesktopServices::openUrl(QUrl::fromLocalFile(path.data()));
@ -169,32 +170,32 @@ void Utils::Gui::openFolderSelect(const Path &path) @@ -169,32 +170,32 @@ void Utils::Gui::openFolderSelect(const Path &path)
::CoUninitialize();
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
QProcess proc;
proc.start("xdg-mime", {"query", "default", "inode/directory"});
proc.start(u"xdg-mime"_qs, {u"query"_qs, u"default"_qs, u"inode/directory"_qs});
proc.waitForFinished();
const QString output = proc.readLine().simplified();
if ((output == "dolphin.desktop") || (output == "org.kde.dolphin.desktop"))
const auto output = QString::fromLocal8Bit(proc.readLine().simplified());
if ((output == u"dolphin.desktop") || (output == u"org.kde.dolphin.desktop"))
{
proc.startDetached("dolphin", {"--select", path.toString()});
proc.startDetached(u"dolphin"_qs, {u"--select"_qs, path.toString()});
}
else if ((output == "nautilus.desktop") || (output == "org.gnome.Nautilus.desktop")
|| (output == "nautilus-folder-handler.desktop"))
else if ((output == u"nautilus.desktop") || (output == u"org.gnome.Nautilus.desktop")
|| (output == u"nautilus-folder-handler.desktop"))
{
proc.start("nautilus", {"--version"});
proc.start(u"nautilus"_qs, {u"--version"_qs});
proc.waitForFinished();
const QString nautilusVerStr = QString(proc.readLine()).remove(QRegularExpression("[^0-9.]"));
const auto nautilusVerStr = QString::fromLocal8Bit(proc.readLine()).remove(QRegularExpression(u"[^0-9.]"_qs));
using NautilusVersion = Utils::Version<int, 3>;
if (NautilusVersion::tryParse(nautilusVerStr, {1, 0, 0}) > NautilusVersion {3, 28})
proc.startDetached("nautilus", {(Fs::isDir(path) ? path.parentPath() : path).toString()});
proc.startDetached(u"nautilus"_qs, {(Fs::isDir(path) ? path.parentPath() : path).toString()});
else
proc.startDetached("nautilus", {"--no-desktop", (Fs::isDir(path) ? path.parentPath() : path).toString()});
proc.startDetached(u"nautilus"_qs, {u"--no-desktop"_qs, (Fs::isDir(path) ? path.parentPath() : path).toString()});
}
else if (output == "nemo.desktop")
else if (output == u"nemo.desktop")
{
proc.startDetached("nemo", {"--no-desktop", (Fs::isDir(path) ? path.parentPath() : path).toString()});
proc.startDetached(u"nemo"_qs, {u"--no-desktop"_qs, (Fs::isDir(path) ? path.parentPath() : path).toString()});
}
else if ((output == "konqueror.desktop") || (output == "kfmclient_dir.desktop"))
else if ((output == u"konqueror.desktop") || (output == u"kfmclient_dir.desktop"))
{
proc.startDetached("konqueror", {"--select", path.toString()});
proc.startDetached(u"konqueror"_qs, {u"--select"_qs, path.toString()});
}
else
{

2
src/gui/watchedfolderoptionsdialog.cpp

@ -77,7 +77,7 @@ WatchedFolderOptionsDialog::WatchedFolderOptionsDialog( @@ -77,7 +77,7 @@ WatchedFolderOptionsDialog::WatchedFolderOptionsDialog(
if (!torrentParams.category.isEmpty())
m_ui->categoryComboBox->addItem(torrentParams.category);
m_ui->categoryComboBox->addItem("");
m_ui->categoryComboBox->addItem(u""_qs);
for (const QString &category : asConst(categories))
{

Loading…
Cancel
Save