From 802ec5a14e8eb659549cc606b4a1920cdbf5c6d1 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 12 Mar 2022 22:00:58 +0800 Subject: [PATCH] Use QString literals This patch covers src/gui and some leftovers from previous commit. --- src/base/bittorrent/peeraddress.cpp | 4 +- src/base/bittorrent/peerinfo.cpp | 4 +- src/base/bittorrent/session.cpp | 2 +- src/base/http/server.cpp | 3 +- src/base/net/smtp.cpp | 2 +- src/base/rss/rss_item.cpp | 10 +- src/base/rss/rss_parser.cpp | 533 +++++++++--------- src/base/torrentfilter.cpp | 24 +- src/base/unicodestrings.h | 126 +++-- src/base/utils/foreignapps.cpp | 11 +- src/base/utils/misc.cpp | 6 +- src/base/utils/net.cpp | 2 +- src/gui/aboutdialog.cpp | 39 +- src/gui/addnewtorrentdialog.cpp | 6 +- src/gui/advancedsettings.cpp | 86 +-- src/gui/categoryfiltermodel.cpp | 5 +- src/gui/categoryfilterwidget.cpp | 18 +- src/gui/cookiesdialog.cpp | 6 +- src/gui/deletionconfirmationdialog.cpp | 5 +- src/gui/downloadfromurldialog.cpp | 14 +- src/gui/executionlogwidget.cpp | 9 +- src/gui/fspathedit_p.cpp | 2 +- src/gui/lineedit.cpp | 5 +- src/gui/log/loglistview.cpp | 2 +- src/gui/mainwindow.cpp | 78 +-- src/gui/optionsdialog.cpp | 166 +++--- .../powermanagement/powermanagement_x11.cpp | 39 +- src/gui/previewlistdelegate.cpp | 2 +- src/gui/properties/peerlistwidget.cpp | 20 +- src/gui/properties/peersadditiondialog.cpp | 2 +- src/gui/properties/propertieswidget.cpp | 36 +- src/gui/properties/proptabbar.cpp | 12 +- src/gui/properties/speedplotview.cpp | 2 +- src/gui/properties/speedwidget.cpp | 2 +- src/gui/properties/trackerlistwidget.cpp | 46 +- src/gui/properties/trackersadditiondialog.cpp | 12 +- src/gui/rss/articlelistwidget.cpp | 6 +- src/gui/rss/automatedrssdownloader.cpp | 90 +-- src/gui/rss/feedlistwidget.cpp | 2 +- src/gui/rss/htmlbrowser.cpp | 4 +- src/gui/rss/rsswidget.cpp | 72 +-- src/gui/search/pluginselectdialog.cpp | 30 +- src/gui/search/searchjobwidget.cpp | 18 +- src/gui/search/searchwidget.cpp | 22 +- src/gui/shutdownconfirmdialog.cpp | 4 +- src/gui/statsdialog.cpp | 2 +- src/gui/statusbar.cpp | 16 +- src/gui/tagfiltermodel.cpp | 2 +- src/gui/tagfilterwidget.cpp | 16 +- src/gui/torrentcontentmodel.cpp | 2 +- src/gui/torrentcreatordialog.cpp | 8 +- src/gui/torrentoptionsdialog.cpp | 8 +- src/gui/trackerentriesdialog.cpp | 4 +- src/gui/transferlistfilterswidget.cpp | 46 +- src/gui/transferlistmodel.cpp | 8 +- src/gui/transferlistwidget.cpp | 76 +-- src/gui/uithememanager.cpp | 4 +- src/gui/utils.cpp | 31 +- src/gui/watchedfolderoptionsdialog.cpp | 2 +- 59 files changed, 912 insertions(+), 902 deletions(-) diff --git a/src/base/bittorrent/peeraddress.cpp b/src/base/bittorrent/peeraddress.cpp index 3785bfbf5..614229fd3 100644 --- a/src/base/bittorrent/peeraddress.cpp +++ b/src/base/bittorrent/peeraddress.cpp @@ -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) diff --git a/src/base/bittorrent/peerinfo.cpp b/src/base/bittorrent/peerinfo.cpp index 0e04f5460..bc3b3ea1a 100644 --- a/src/base/bittorrent/peerinfo.cpp +++ b/src/base/bittorrent/peerinfo.cpp @@ -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() // 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); diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index c66ec614d..914ec9273 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -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 diff --git a/src/base/http/server.cpp b/src/base/http/server.cpp index 48ca74356..5fec3d5e3 100644 --- a/src/base/http/server.cpp +++ b/src/base/http/server.cpp @@ -40,6 +40,7 @@ #include #include "base/algorithm.h" +#include "base/global.h" #include "base/utils/net.h" #include "connection.h" @@ -51,7 +52,7 @@ namespace QList safeCipherList() { - const QStringList badCiphers {"idea", "rc4"}; + const QStringList badCiphers {u"idea"_qs, u"rc4"_qs}; const QList allCiphers {QSslConfiguration::supportedCiphers()}; QList safeCiphers; std::copy_if(allCiphers.cbegin(), allCiphers.cend(), std::back_inserter(safeCiphers), [&badCiphers](const QSslCipher &cipher) diff --git a/src/base/net/smtp.cpp b/src/base/net/smtp.cpp index 5607ba844..7476d4460 100644 --- a/src/base/net/smtp.cpp +++ b/src/base/net/smtp.cpp @@ -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: diff --git a/src/base/rss/rss_item.cpp b/src/base/rss/rss_item.cpp index f1a337154..2179b3a22 100644 --- a/src/base/rss/rss_item.cpp +++ b/src/base/rss/rss_item.cpp @@ -34,9 +34,11 @@ #include #include +#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 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) 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) diff --git a/src/base/rss/rss_parser.cpp b/src/base/rss/rss_parser.cpp index 4adbdf239..a1c838872 100644 --- a/src/base/rss/rss_parser.cpp +++ b/src/base/rss/rss_parser.cpp @@ -40,6 +40,7 @@ #include #include +#include "base/global.h" #include "rss_article.h" namespace @@ -55,303 +56,303 @@ namespace // http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent static const QHash HTMLEntities { - {"nbsp", " "}, // no-break space = non-breaking space, U+00A0 ISOnum - {"iexcl", "¡"}, // inverted exclamation mark, U+00A1 ISOnum - {"cent", "¢"}, // cent sign, U+00A2 ISOnum - {"pound", "£"}, // pound sign, U+00A3 ISOnum - {"curren", "¤"}, // currency sign, U+00A4 ISOnum - {"yen", "¥"}, // yen sign = yuan sign, U+00A5 ISOnum - {"brvbar", "¦"}, // broken bar = broken vertical bar, U+00A6 ISOnum - {"sect", "§"}, // section sign, U+00A7 ISOnum - {"uml", "¨"}, // diaeresis = spacing diaeresis, U+00A8 ISOdia - {"copy", "©"}, // copyright sign, U+00A9 ISOnum - {"ordf", "ª"}, // feminine ordinal indicator, U+00AA ISOnum - {"laquo", "«"}, // left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum - {"not", "¬"}, // not sign = angled dash, U+00AC ISOnum - {"shy", "­"}, // soft hyphen = discretionary hyphen, U+00AD ISOnum - {"reg", "®"}, // registered sign = registered trade mark sign, U+00AE ISOnum - {"macr", "¯"}, // macron = spacing macron = overline = APL overbar, U+00AF ISOdia - {"deg", "°"}, // degree sign, U+00B0 ISOnum - {"plusmn", "±"}, // plus-minus sign = plus-or-minus sign, U+00B1 ISOnum - {"sup2", "²"}, // superscript two = superscript digit two = squared, U+00B2 ISOnum - {"sup3", "³"}, // superscript three = superscript digit three = cubed, U+00B3 ISOnum - {"acute", "´"}, // acute accent = spacing acute, U+00B4 ISOdia - {"micro", "µ"}, // micro sign, U+00B5 ISOnum - {"para", "¶"}, // pilcrow sign = paragraph sign, U+00B6 ISOnum - {"middot", "·"}, // middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum - {"cedil", "¸"}, // cedilla = spacing cedilla, U+00B8 ISOdia - {"sup1", "¹"}, // superscript one = superscript digit one, U+00B9 ISOnum - {"ordm", "º"}, // masculine ordinal indicator, U+00BA ISOnum - {"raquo", "»"}, // right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum - {"frac14", "¼"}, // vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum - {"frac12", "½"}, // vulgar fraction one half = fraction one half, U+00BD ISOnum - {"frac34", "¾"}, // vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum - {"iquest", "¿"}, // inverted question mark = turned question mark, U+00BF ISOnum - {"Agrave", "À"}, // latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1 - {"Aacute", "Á"}, // latin capital letter A with acute, U+00C1 ISOlat1 - {"Acirc", "Â"}, // latin capital letter A with circumflex, U+00C2 ISOlat1 - {"Atilde", "Ã"}, // latin capital letter A with tilde, U+00C3 ISOlat1 - {"Auml", "Ä"}, // latin capital letter A with diaeresis, U+00C4 ISOlat1 - {"Aring", "Å"}, // latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1 - {"AElig", "Æ"}, // latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 - {"Ccedil", "Ç"}, // latin capital letter C with cedilla, U+00C7 ISOlat1 - {"Egrave", "È"}, // latin capital letter E with grave, U+00C8 ISOlat1 - {"Eacute", "É"}, // latin capital letter E with acute, U+00C9 ISOlat1 - {"Ecirc", "Ê"}, // latin capital letter E with circumflex, U+00CA ISOlat1 - {"Euml", "Ë"}, // latin capital letter E with diaeresis, U+00CB ISOlat1 - {"Igrave", "Ì"}, // latin capital letter I with grave, U+00CC ISOlat1 - {"Iacute", "Í"}, // latin capital letter I with acute, U+00CD ISOlat1 - {"Icirc", "Î"}, // latin capital letter I with circumflex, U+00CE ISOlat1 - {"Iuml", "Ï"}, // latin capital letter I with diaeresis, U+00CF ISOlat1 - {"ETH", "Ð"}, // latin capital letter ETH, U+00D0 ISOlat1 - {"Ntilde", "Ñ"}, // latin capital letter N with tilde, U+00D1 ISOlat1 - {"Ograve", "Ò"}, // latin capital letter O with grave, U+00D2 ISOlat1 - {"Oacute", "Ó"}, // latin capital letter O with acute, U+00D3 ISOlat1 - {"Ocirc", "Ô"}, // latin capital letter O with circumflex, U+00D4 ISOlat1 - {"Otilde", "Õ"}, // latin capital letter O with tilde, U+00D5 ISOlat1 - {"Ouml", "Ö"}, // latin capital letter O with diaeresis, U+00D6 ISOlat1 - {"times", "×"}, // multiplication sign, U+00D7 ISOnum - {"Oslash", "Ø"}, // latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1 - {"Ugrave", "Ù"}, // latin capital letter U with grave, U+00D9 ISOlat1 - {"Uacute", "Ú"}, // latin capital letter U with acute, U+00DA ISOlat1 - {"Ucirc", "Û"}, // latin capital letter U with circumflex, U+00DB ISOlat1 - {"Uuml", "Ü"}, // latin capital letter U with diaeresis, U+00DC ISOlat1 - {"Yacute", "Ý"}, // latin capital letter Y with acute, U+00DD ISOlat1 - {"THORN", "Þ"}, // latin capital letter THORN, U+00DE ISOlat1 - {"szlig", "ß"}, // latin small letter sharp s = ess-zed, U+00DF ISOlat1 - {"agrave", "à"}, // latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1 - {"aacute", "á"}, // latin small letter a with acute, U+00E1 ISOlat1 - {"acirc", "â"}, // latin small letter a with circumflex, U+00E2 ISOlat1 - {"atilde", "ã"}, // latin small letter a with tilde, U+00E3 ISOlat1 - {"auml", "ä"}, // latin small letter a with diaeresis, U+00E4 ISOlat1 - {"aring", "å"}, // latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1 - {"aelig", "æ"}, // latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 - {"ccedil", "ç"}, // latin small letter c with cedilla, U+00E7 ISOlat1 - {"egrave", "è"}, // latin small letter e with grave, U+00E8 ISOlat1 - {"eacute", "é"}, // latin small letter e with acute, U+00E9 ISOlat1 - {"ecirc", "ê"}, // latin small letter e with circumflex, U+00EA ISOlat1 - {"euml", "ë"}, // latin small letter e with diaeresis, U+00EB ISOlat1 - {"igrave", "ì"}, // latin small letter i with grave, U+00EC ISOlat1 - {"iacute", "í"}, // latin small letter i with acute, U+00ED ISOlat1 - {"icirc", "î"}, // latin small letter i with circumflex, U+00EE ISOlat1 - {"iuml", "ï"}, // latin small letter i with diaeresis, U+00EF ISOlat1 - {"eth", "ð"}, // latin small letter eth, U+00F0 ISOlat1 - {"ntilde", "ñ"}, // latin small letter n with tilde, U+00F1 ISOlat1 - {"ograve", "ò"}, // latin small letter o with grave, U+00F2 ISOlat1 - {"oacute", "ó"}, // latin small letter o with acute, U+00F3 ISOlat1 - {"ocirc", "ô"}, // latin small letter o with circumflex, U+00F4 ISOlat1 - {"otilde", "õ"}, // latin small letter o with tilde, U+00F5 ISOlat1 - {"ouml", "ö"}, // latin small letter o with diaeresis, U+00F6 ISOlat1 - {"divide", "÷"}, // division sign, U+00F7 ISOnum - {"oslash", "ø"}, // latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1 - {"ugrave", "ù"}, // latin small letter u with grave, U+00F9 ISOlat1 - {"uacute", "ú"}, // latin small letter u with acute, U+00FA ISOlat1 - {"ucirc", "û"}, // latin small letter u with circumflex, U+00FB ISOlat1 - {"uuml", "ü"}, // latin small letter u with diaeresis, U+00FC ISOlat1 - {"yacute", "ý"}, // latin small letter y with acute, U+00FD ISOlat1 - {"thorn", "þ"}, // latin small letter thorn, U+00FE ISOlat1 - {"yuml", "ÿ"}, // latin small letter y with diaeresis, U+00FF ISOlat1 + {u"nbsp"_qs, u" "_qs}, // no-break space = non-breaking space, U+00A0 ISOnum + {u"iexcl"_qs, u"¡"_qs}, // inverted exclamation mark, U+00A1 ISOnum + {u"cent"_qs, u"¢"_qs}, // cent sign, U+00A2 ISOnum + {u"pound"_qs, u"£"_qs}, // pound sign, U+00A3 ISOnum + {u"curren"_qs, u"¤"_qs}, // currency sign, U+00A4 ISOnum + {u"yen"_qs, u"¥"_qs}, // yen sign = yuan sign, U+00A5 ISOnum + {u"brvbar"_qs, u"¦"_qs}, // broken bar = broken vertical bar, U+00A6 ISOnum + {u"sect"_qs, u"§"_qs}, // section sign, U+00A7 ISOnum + {u"uml"_qs, u"¨"_qs}, // diaeresis = spacing diaeresis, U+00A8 ISOdia + {u"copy"_qs, u"©"_qs}, // copyright sign, U+00A9 ISOnum + {u"ordf"_qs, u"ª"_qs}, // feminine ordinal indicator, U+00AA ISOnum + {u"laquo"_qs, u"«"_qs}, // left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum + {u"not"_qs, u"¬"_qs}, // not sign = angled dash, U+00AC ISOnum + {u"shy"_qs, u"­"_qs}, // soft hyphen = discretionary hyphen, U+00AD ISOnum + {u"reg"_qs, u"®"_qs}, // registered sign = registered trade mark sign, U+00AE ISOnum + {u"macr"_qs, u"¯"_qs}, // macron = spacing macron = overline = APL overbar, U+00AF ISOdia + {u"deg"_qs, u"°"_qs}, // degree sign, U+00B0 ISOnum + {u"plusmn"_qs, u"±"_qs}, // plus-minus sign = plus-or-minus sign, U+00B1 ISOnum + {u"sup2"_qs, u"²"_qs}, // superscript two = superscript digit two = squared, U+00B2 ISOnum + {u"sup3"_qs, u"³"_qs}, // superscript three = superscript digit three = cubed, U+00B3 ISOnum + {u"acute"_qs, u"´"_qs}, // acute accent = spacing acute, U+00B4 ISOdia + {u"micro"_qs, u"µ"_qs}, // micro sign, U+00B5 ISOnum + {u"para"_qs, u"¶"_qs}, // pilcrow sign = paragraph sign, U+00B6 ISOnum + {u"middot"_qs, u"·"_qs}, // middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum + {u"cedil"_qs, u"¸"_qs}, // cedilla = spacing cedilla, U+00B8 ISOdia + {u"sup1"_qs, u"¹"_qs}, // superscript one = superscript digit one, U+00B9 ISOnum + {u"ordm"_qs, u"º"_qs}, // masculine ordinal indicator, U+00BA ISOnum + {u"raquo"_qs, u"»"_qs}, // right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum + {u"frac14"_qs, u"¼"_qs}, // vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum + {u"frac12"_qs, u"½"_qs}, // vulgar fraction one half = fraction one half, U+00BD ISOnum + {u"frac34"_qs, u"¾"_qs}, // vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum + {u"iquest"_qs, u"¿"_qs}, // inverted question mark = turned question mark, U+00BF ISOnum + {u"Agrave"_qs, u"À"_qs}, // latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1 + {u"Aacute"_qs, u"Á"_qs}, // latin capital letter A with acute, U+00C1 ISOlat1 + {u"Acirc"_qs, u"Â"_qs}, // latin capital letter A with circumflex, U+00C2 ISOlat1 + {u"Atilde"_qs, u"Ã"_qs}, // latin capital letter A with tilde, U+00C3 ISOlat1 + {u"Auml"_qs, u"Ä"_qs}, // latin capital letter A with diaeresis, U+00C4 ISOlat1 + {u"Aring"_qs, u"Å"_qs}, // latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1 + {u"AElig"_qs, u"Æ"_qs}, // latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 + {u"Ccedil"_qs, u"Ç"_qs}, // latin capital letter C with cedilla, U+00C7 ISOlat1 + {u"Egrave"_qs, u"È"_qs}, // latin capital letter E with grave, U+00C8 ISOlat1 + {u"Eacute"_qs, u"É"_qs}, // latin capital letter E with acute, U+00C9 ISOlat1 + {u"Ecirc"_qs, u"Ê"_qs}, // latin capital letter E with circumflex, U+00CA ISOlat1 + {u"Euml"_qs, u"Ë"_qs}, // latin capital letter E with diaeresis, U+00CB ISOlat1 + {u"Igrave"_qs, u"Ì"_qs}, // latin capital letter I with grave, U+00CC ISOlat1 + {u"Iacute"_qs, u"Í"_qs}, // latin capital letter I with acute, U+00CD ISOlat1 + {u"Icirc"_qs, u"Î"_qs}, // latin capital letter I with circumflex, U+00CE ISOlat1 + {u"Iuml"_qs, u"Ï"_qs}, // latin capital letter I with diaeresis, U+00CF ISOlat1 + {u"ETH"_qs, u"Ð"_qs}, // latin capital letter ETH, U+00D0 ISOlat1 + {u"Ntilde"_qs, u"Ñ"_qs}, // latin capital letter N with tilde, U+00D1 ISOlat1 + {u"Ograve"_qs, u"Ò"_qs}, // latin capital letter O with grave, U+00D2 ISOlat1 + {u"Oacute"_qs, u"Ó"_qs}, // latin capital letter O with acute, U+00D3 ISOlat1 + {u"Ocirc"_qs, u"Ô"_qs}, // latin capital letter O with circumflex, U+00D4 ISOlat1 + {u"Otilde"_qs, u"Õ"_qs}, // latin capital letter O with tilde, U+00D5 ISOlat1 + {u"Ouml"_qs, u"Ö"_qs}, // latin capital letter O with diaeresis, U+00D6 ISOlat1 + {u"times"_qs, u"×"_qs}, // multiplication sign, U+00D7 ISOnum + {u"Oslash"_qs, u"Ø"_qs}, // latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1 + {u"Ugrave"_qs, u"Ù"_qs}, // latin capital letter U with grave, U+00D9 ISOlat1 + {u"Uacute"_qs, u"Ú"_qs}, // latin capital letter U with acute, U+00DA ISOlat1 + {u"Ucirc"_qs, u"Û"_qs}, // latin capital letter U with circumflex, U+00DB ISOlat1 + {u"Uuml"_qs, u"Ü"_qs}, // latin capital letter U with diaeresis, U+00DC ISOlat1 + {u"Yacute"_qs, u"Ý"_qs}, // latin capital letter Y with acute, U+00DD ISOlat1 + {u"THORN"_qs, u"Þ"_qs}, // latin capital letter THORN, U+00DE ISOlat1 + {u"szlig"_qs, u"ß"_qs}, // latin small letter sharp s = ess-zed, U+00DF ISOlat1 + {u"agrave"_qs, u"à"_qs}, // latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1 + {u"aacute"_qs, u"á"_qs}, // latin small letter a with acute, U+00E1 ISOlat1 + {u"acirc"_qs, u"â"_qs}, // latin small letter a with circumflex, U+00E2 ISOlat1 + {u"atilde"_qs, u"ã"_qs}, // latin small letter a with tilde, U+00E3 ISOlat1 + {u"auml"_qs, u"ä"_qs}, // latin small letter a with diaeresis, U+00E4 ISOlat1 + {u"aring"_qs, u"å"_qs}, // latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1 + {u"aelig"_qs, u"æ"_qs}, // latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 + {u"ccedil"_qs, u"ç"_qs}, // latin small letter c with cedilla, U+00E7 ISOlat1 + {u"egrave"_qs, u"è"_qs}, // latin small letter e with grave, U+00E8 ISOlat1 + {u"eacute"_qs, u"é"_qs}, // latin small letter e with acute, U+00E9 ISOlat1 + {u"ecirc"_qs, u"ê"_qs}, // latin small letter e with circumflex, U+00EA ISOlat1 + {u"euml"_qs, u"ë"_qs}, // latin small letter e with diaeresis, U+00EB ISOlat1 + {u"igrave"_qs, u"ì"_qs}, // latin small letter i with grave, U+00EC ISOlat1 + {u"iacute"_qs, u"í"_qs}, // latin small letter i with acute, U+00ED ISOlat1 + {u"icirc"_qs, u"î"_qs}, // latin small letter i with circumflex, U+00EE ISOlat1 + {u"iuml"_qs, u"ï"_qs}, // latin small letter i with diaeresis, U+00EF ISOlat1 + {u"eth"_qs, u"ð"_qs}, // latin small letter eth, U+00F0 ISOlat1 + {u"ntilde"_qs, u"ñ"_qs}, // latin small letter n with tilde, U+00F1 ISOlat1 + {u"ograve"_qs, u"ò"_qs}, // latin small letter o with grave, U+00F2 ISOlat1 + {u"oacute"_qs, u"ó"_qs}, // latin small letter o with acute, U+00F3 ISOlat1 + {u"ocirc"_qs, u"ô"_qs}, // latin small letter o with circumflex, U+00F4 ISOlat1 + {u"otilde"_qs, u"õ"_qs}, // latin small letter o with tilde, U+00F5 ISOlat1 + {u"ouml"_qs, u"ö"_qs}, // latin small letter o with diaeresis, U+00F6 ISOlat1 + {u"divide"_qs, u"÷"_qs}, // division sign, U+00F7 ISOnum + {u"oslash"_qs, u"ø"_qs}, // latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1 + {u"ugrave"_qs, u"ù"_qs}, // latin small letter u with grave, U+00F9 ISOlat1 + {u"uacute"_qs, u"ú"_qs}, // latin small letter u with acute, U+00FA ISOlat1 + {u"ucirc"_qs, u"û"_qs}, // latin small letter u with circumflex, U+00FB ISOlat1 + {u"uuml"_qs, u"ü"_qs}, // latin small letter u with diaeresis, U+00FC ISOlat1 + {u"yacute"_qs, u"ý"_qs}, // latin small letter y with acute, U+00FD ISOlat1 + {u"thorn"_qs, u"þ"_qs}, // latin small letter thorn, U+00FE ISOlat1 + {u"yuml"_qs, u"ÿ"_qs}, // latin small letter y with diaeresis, U+00FF ISOlat1 // Latin Extended-A - {"OElig", "Œ"}, // latin capital ligature OE, U+0152 ISOlat2 - {"oelig", "œ"}, // latin small ligature oe, U+0153 ISOlat2 + {u"OElig"_qs, u"Œ"_qs}, // latin capital ligature OE, U+0152 ISOlat2 + {u"oelig"_qs, u"œ"_qs}, // latin small ligature oe, U+0153 ISOlat2 // ligature is a misnomer, this is a separate character in some languages - {"Scaron", "Š"}, // latin capital letter S with caron, U+0160 ISOlat2 - {"scaron", "š"}, // latin small letter s with caron, U+0161 ISOlat2 - {"Yuml", "Ÿ"}, // latin capital letter Y with diaeresis, U+0178 ISOlat2 + {u"Scaron"_qs, u"Š"_qs}, // latin capital letter S with caron, U+0160 ISOlat2 + {u"scaron"_qs, u"š"_qs}, // latin small letter s with caron, U+0161 ISOlat2 + {u"Yuml"_qs, u"Ÿ"_qs}, // latin capital letter Y with diaeresis, U+0178 ISOlat2 // Spacing Modifier Letters - {"circ", "ˆ"}, // modifier letter circumflex accent, U+02C6 ISOpub - {"tilde", "˜"}, // small tilde, U+02DC ISOdia + {u"circ"_qs, u"ˆ"_qs}, // modifier letter circumflex accent, U+02C6 ISOpub + {u"tilde"_qs, u"˜"_qs}, // small tilde, U+02DC ISOdia // General Punctuation - {"ensp", " "}, // en space, U+2002 ISOpub - {"emsp", " "}, // em space, U+2003 ISOpub - {"thinsp", " "}, // thin space, U+2009 ISOpub - {"zwnj", "‌"}, // zero width non-joiner, U+200C NEW RFC 2070 - {"zwj", "‍"}, // zero width joiner, U+200D NEW RFC 2070 - {"lrm", "‎"}, // left-to-right mark, U+200E NEW RFC 2070 - {"rlm", "‏"}, // right-to-left mark, U+200F NEW RFC 2070 - {"ndash", "–"}, // en dash, U+2013 ISOpub - {"mdash", "—"}, // em dash, U+2014 ISOpub - {"lsquo", "‘"}, // left single quotation mark, U+2018 ISOnum - {"rsquo", "’"}, // right single quotation mark, U+2019 ISOnum - {"sbquo", "‚"}, // single low-9 quotation mark, U+201A NEW - {"ldquo", "“"}, // left double quotation mark, U+201C ISOnum - {"rdquo", "”"}, // right double quotation mark, U+201D ISOnum - {"bdquo", "„"}, // double low-9 quotation mark, U+201E NEW - {"dagger", "†"}, // dagger, U+2020 ISOpub - {"Dagger", "‡"}, // double dagger, U+2021 ISOpub - {"permil", "‰"}, // per mille sign, U+2030 ISOtech - {"lsaquo", "‹"}, // single left-pointing angle quotation mark, U+2039 ISO proposed + {u"ensp"_qs, u" "_qs}, // en space, U+2002 ISOpub + {u"emsp"_qs, u" "_qs}, // em space, U+2003 ISOpub + {u"thinsp"_qs, u" "_qs}, // thin space, U+2009 ISOpub + {u"zwnj"_qs, u"‌"_qs}, // zero width non-joiner, U+200C NEW RFC 2070 + {u"zwj"_qs, u"‍"_qs}, // zero width joiner, U+200D NEW RFC 2070 + {u"lrm"_qs, u"‎"_qs}, // left-to-right mark, U+200E NEW RFC 2070 + {u"rlm"_qs, u"‏"_qs}, // right-to-left mark, U+200F NEW RFC 2070 + {u"ndash"_qs, u"–"_qs}, // en dash, U+2013 ISOpub + {u"mdash"_qs, u"—"_qs}, // em dash, U+2014 ISOpub + {u"lsquo"_qs, u"‘"_qs}, // left single quotation mark, U+2018 ISOnum + {u"rsquo"_qs, u"’"_qs}, // right single quotation mark, U+2019 ISOnum + {u"sbquo"_qs, u"‚"_qs}, // single low-9 quotation mark, U+201A NEW + {u"ldquo"_qs, u"“"_qs}, // left double quotation mark, U+201C ISOnum + {u"rdquo"_qs, u"”"_qs}, // right double quotation mark, U+201D ISOnum + {u"bdquo"_qs, u"„"_qs}, // double low-9 quotation mark, U+201E NEW + {u"dagger"_qs, u"†"_qs}, // dagger, U+2020 ISOpub + {u"Dagger"_qs, u"‡"_qs}, // double dagger, U+2021 ISOpub + {u"permil"_qs, u"‰"_qs}, // per mille sign, U+2030 ISOtech + {u"lsaquo"_qs, u"‹"_qs}, // single left-pointing angle quotation mark, U+2039 ISO proposed // lsaquo is proposed but not yet ISO standardized - {"rsaquo", "›"}, // single right-pointing angle quotation mark, U+203A ISO proposed + {u"rsaquo"_qs, u"›"_qs}, // single right-pointing angle quotation mark, U+203A ISO proposed // rsaquo is proposed but not yet ISO standardized // Currency Symbols - {"euro", "€"}, // euro sign, U+20AC NEW + {u"euro"_qs, u"€"_qs}, // euro sign, U+20AC NEW // Latin Extended-B - {"fnof", "ƒ"}, // latin small letter f with hook = function = florin, U+0192 ISOtech + {u"fnof"_qs, u"ƒ"_qs}, // latin small letter f with hook = function = florin, U+0192 ISOtech // Greek - {"Alpha", "Α"}, // greek capital letter alpha, U+0391 - {"Beta", "Β"}, // greek capital letter beta, U+0392 - {"Gamma", "Γ"}, // greek capital letter gamma, U+0393 ISOgrk3 - {"Delta", "Δ"}, // greek capital letter delta, U+0394 ISOgrk3 - {"Epsilon", "Ε"}, // greek capital letter epsilon, U+0395 - {"Zeta", "Ζ"}, // greek capital letter zeta, U+0396 - {"Eta", "Η"}, // greek capital letter eta, U+0397 - {"Theta", "Θ"}, // greek capital letter theta, U+0398 ISOgrk3 - {"Iota", "Ι"}, // greek capital letter iota, U+0399 - {"Kappa", "Κ"}, // greek capital letter kappa, U+039A - {"Lambda", "Λ"}, // greek capital letter lamda, U+039B ISOgrk3 - {"Mu", "Μ"}, // greek capital letter mu, U+039C - {"Nu", "Ν"}, // greek capital letter nu, U+039D - {"Xi", "Ξ"}, // greek capital letter xi, U+039E ISOgrk3 - {"Omicron", "Ο"}, // greek capital letter omicron, U+039F - {"Pi", "Π"}, // greek capital letter pi, U+03A0 ISOgrk3 - {"Rho", "Ρ"}, // greek capital letter rho, U+03A1 - {"Sigma", "Σ"}, // greek capital letter sigma, U+03A3 ISOgrk3 - {"Tau", "Τ"}, // greek capital letter tau, U+03A4 - {"Upsilon", "Υ"}, // greek capital letter upsilon, U+03A5 ISOgrk3 - {"Phi", "Φ"}, // greek capital letter phi, U+03A6 ISOgrk3 - {"Chi", "Χ"}, // greek capital letter chi, U+03A7 - {"Psi", "Ψ"}, // greek capital letter psi, U+03A8 ISOgrk3 - {"Omega", "Ω"}, // greek capital letter omega, U+03A9 ISOgrk3 - {"alpha", "α"}, // greek small letter alpha, U+03B1 ISOgrk3 - {"beta", "β"}, // greek small letter beta, U+03B2 ISOgrk3 - {"gamma", "γ"}, // greek small letter gamma, U+03B3 ISOgrk3 - {"delta", "δ"}, // greek small letter delta, U+03B4 ISOgrk3 - {"epsilon", "ε"}, // greek small letter epsilon, U+03B5 ISOgrk3 - {"zeta", "ζ"}, // greek small letter zeta, U+03B6 ISOgrk3 - {"eta", "η"}, // greek small letter eta, U+03B7 ISOgrk3 - {"theta", "θ"}, // greek small letter theta, U+03B8 ISOgrk3 - {"iota", "ι"}, // greek small letter iota, U+03B9 ISOgrk3 - {"kappa", "κ"}, // greek small letter kappa, U+03BA ISOgrk3 - {"lambda", "λ"}, // greek small letter lamda, U+03BB ISOgrk3 - {"mu", "μ"}, // greek small letter mu, U+03BC ISOgrk3 - {"nu", "ν"}, // greek small letter nu, U+03BD ISOgrk3 - {"xi", "ξ"}, // greek small letter xi, U+03BE ISOgrk3 - {"omicron", "ο"}, // greek small letter omicron, U+03BF NEW - {"pi", "π"}, // greek small letter pi, U+03C0 ISOgrk3 - {"rho", "ρ"}, // greek small letter rho, U+03C1 ISOgrk3 - {"sigmaf", "ς"}, // greek small letter final sigma, U+03C2 ISOgrk3 - {"sigma", "σ"}, // greek small letter sigma, U+03C3 ISOgrk3 - {"tau", "τ"}, // greek small letter tau, U+03C4 ISOgrk3 - {"upsilon", "υ"}, // greek small letter upsilon, U+03C5 ISOgrk3 - {"phi", "φ"}, // greek small letter phi, U+03C6 ISOgrk3 - {"chi", "χ"}, // greek small letter chi, U+03C7 ISOgrk3 - {"psi", "ψ"}, // greek small letter psi, U+03C8 ISOgrk3 - {"omega", "ω"}, // greek small letter omega, U+03C9 ISOgrk3 - {"thetasym", "ϑ"}, // greek theta symbol, U+03D1 NEW - {"upsih", "ϒ"}, // greek upsilon with hook symbol, U+03D2 NEW - {"piv", "ϖ"}, // greek pi symbol, U+03D6 ISOgrk3 + {u"Alpha"_qs, u"Α"_qs}, // greek capital letter alpha, U+0391 + {u"Beta"_qs, u"Β"_qs}, // greek capital letter beta, U+0392 + {u"Gamma"_qs, u"Γ"_qs}, // greek capital letter gamma, U+0393 ISOgrk3 + {u"Delta"_qs, u"Δ"_qs}, // greek capital letter delta, U+0394 ISOgrk3 + {u"Epsilon"_qs, u"Ε"_qs}, // greek capital letter epsilon, U+0395 + {u"Zeta"_qs, u"Ζ"_qs}, // greek capital letter zeta, U+0396 + {u"Eta"_qs, u"Η"_qs}, // greek capital letter eta, U+0397 + {u"Theta"_qs, u"Θ"_qs}, // greek capital letter theta, U+0398 ISOgrk3 + {u"Iota"_qs, u"Ι"_qs}, // greek capital letter iota, U+0399 + {u"Kappa"_qs, u"Κ"_qs}, // greek capital letter kappa, U+039A + {u"Lambda"_qs, u"Λ"_qs}, // greek capital letter lamda, U+039B ISOgrk3 + {u"Mu"_qs, u"Μ"_qs}, // greek capital letter mu, U+039C + {u"Nu"_qs, u"Ν"_qs}, // greek capital letter nu, U+039D + {u"Xi"_qs, u"Ξ"_qs}, // greek capital letter xi, U+039E ISOgrk3 + {u"Omicron"_qs, u"Ο"_qs}, // greek capital letter omicron, U+039F + {u"Pi"_qs, u"Π"_qs}, // greek capital letter pi, U+03A0 ISOgrk3 + {u"Rho"_qs, u"Ρ"_qs}, // greek capital letter rho, U+03A1 + {u"Sigma"_qs, u"Σ"_qs}, // greek capital letter sigma, U+03A3 ISOgrk3 + {u"Tau"_qs, u"Τ"_qs}, // greek capital letter tau, U+03A4 + {u"Upsilon"_qs, u"Υ"_qs}, // greek capital letter upsilon, U+03A5 ISOgrk3 + {u"Phi"_qs, u"Φ"_qs}, // greek capital letter phi, U+03A6 ISOgrk3 + {u"Chi"_qs, u"Χ"_qs}, // greek capital letter chi, U+03A7 + {u"Psi"_qs, u"Ψ"_qs}, // greek capital letter psi, U+03A8 ISOgrk3 + {u"Omega"_qs, u"Ω"_qs}, // greek capital letter omega, U+03A9 ISOgrk3 + {u"alpha"_qs, u"α"_qs}, // greek small letter alpha, U+03B1 ISOgrk3 + {u"beta"_qs, u"β"_qs}, // greek small letter beta, U+03B2 ISOgrk3 + {u"gamma"_qs, u"γ"_qs}, // greek small letter gamma, U+03B3 ISOgrk3 + {u"delta"_qs, u"δ"_qs}, // greek small letter delta, U+03B4 ISOgrk3 + {u"epsilon"_qs, u"ε"_qs}, // greek small letter epsilon, U+03B5 ISOgrk3 + {u"zeta"_qs, u"ζ"_qs}, // greek small letter zeta, U+03B6 ISOgrk3 + {u"eta"_qs, u"η"_qs}, // greek small letter eta, U+03B7 ISOgrk3 + {u"theta"_qs, u"θ"_qs}, // greek small letter theta, U+03B8 ISOgrk3 + {u"iota"_qs, u"ι"_qs}, // greek small letter iota, U+03B9 ISOgrk3 + {u"kappa"_qs, u"κ"_qs}, // greek small letter kappa, U+03BA ISOgrk3 + {u"lambda"_qs, u"λ"_qs}, // greek small letter lamda, U+03BB ISOgrk3 + {u"mu"_qs, u"μ"_qs}, // greek small letter mu, U+03BC ISOgrk3 + {u"nu"_qs, u"ν"_qs}, // greek small letter nu, U+03BD ISOgrk3 + {u"xi"_qs, u"ξ"_qs}, // greek small letter xi, U+03BE ISOgrk3 + {u"omicron"_qs, u"ο"_qs}, // greek small letter omicron, U+03BF NEW + {u"pi"_qs, u"π"_qs}, // greek small letter pi, U+03C0 ISOgrk3 + {u"rho"_qs, u"ρ"_qs}, // greek small letter rho, U+03C1 ISOgrk3 + {u"sigmaf"_qs, u"ς"_qs}, // greek small letter final sigma, U+03C2 ISOgrk3 + {u"sigma"_qs, u"σ"_qs}, // greek small letter sigma, U+03C3 ISOgrk3 + {u"tau"_qs, u"τ"_qs}, // greek small letter tau, U+03C4 ISOgrk3 + {u"upsilon"_qs, u"υ"_qs}, // greek small letter upsilon, U+03C5 ISOgrk3 + {u"phi"_qs, u"φ"_qs}, // greek small letter phi, U+03C6 ISOgrk3 + {u"chi"_qs, u"χ"_qs}, // greek small letter chi, U+03C7 ISOgrk3 + {u"psi"_qs, u"ψ"_qs}, // greek small letter psi, U+03C8 ISOgrk3 + {u"omega"_qs, u"ω"_qs}, // greek small letter omega, U+03C9 ISOgrk3 + {u"thetasym"_qs, u"ϑ"_qs}, // greek theta symbol, U+03D1 NEW + {u"upsih"_qs, u"ϒ"_qs}, // greek upsilon with hook symbol, U+03D2 NEW + {u"piv"_qs, u"ϖ"_qs}, // greek pi symbol, U+03D6 ISOgrk3 // General Punctuation - {"bull", "•"}, // bullet = black small circle, U+2022 ISOpub + {u"bull"_qs, u"•"_qs}, // bullet = black small circle, U+2022 ISOpub // bullet is NOT the same as bullet operator, U+2219 - {"hellip", "…"}, // horizontal ellipsis = three dot leader, U+2026 ISOpub - {"prime", "′"}, // prime = minutes = feet, U+2032 ISOtech - {"Prime", "″"}, // double prime = seconds = inches, U+2033 ISOtech - {"oline", "‾"}, // overline = spacing overscore, U+203E NEW - {"frasl", "⁄"}, // fraction slash, U+2044 NEW + {u"hellip"_qs, u"…"_qs}, // horizontal ellipsis = three dot leader, U+2026 ISOpub + {u"prime"_qs, u"′"_qs}, // prime = minutes = feet, U+2032 ISOtech + {u"Prime"_qs, u"″"_qs}, // double prime = seconds = inches, U+2033 ISOtech + {u"oline"_qs, u"‾"_qs}, // overline = spacing overscore, U+203E NEW + {u"frasl"_qs, u"⁄"_qs}, // fraction slash, U+2044 NEW // Letterlike Symbols - {"weierp", "℘"}, // script capital P = power set = Weierstrass p, U+2118 ISOamso - {"image", "ℑ"}, // black-letter capital I = imaginary part, U+2111 ISOamso - {"real", "ℜ"}, // black-letter capital R = real part symbol, U+211C ISOamso - {"trade", "™"}, // trade mark sign, U+2122 ISOnum - {"alefsym", "ℵ"}, // alef symbol = first transfinite cardinal, U+2135 NEW + {u"weierp"_qs, u"℘"_qs}, // script capital P = power set = Weierstrass p, U+2118 ISOamso + {u"image"_qs, u"ℑ"_qs}, // black-letter capital I = imaginary part, U+2111 ISOamso + {u"real"_qs, u"ℜ"_qs}, // black-letter capital R = real part symbol, U+211C ISOamso + {u"trade"_qs, u"™"_qs}, // trade mark sign, U+2122 ISOnum + {u"alefsym"_qs, u"ℵ"_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", "←"}, // leftwards arrow, U+2190 ISOnum - {"uarr", "↑"}, // upwards arrow, U+2191 ISOnum - {"rarr", "→"}, // rightwards arrow, U+2192 ISOnum - {"darr", "↓"}, // downwards arrow, U+2193 ISOnum - {"harr", "↔"}, // left right arrow, U+2194 ISOamsa - {"crarr", "↵"}, // downwards arrow with corner leftwards = carriage return, U+21B5 NEW - {"lArr", "⇐"}, // leftwards double arrow, U+21D0 ISOtech + {u"larr"_qs, u"←"_qs}, // leftwards arrow, U+2190 ISOnum + {u"uarr"_qs, u"↑"_qs}, // upwards arrow, U+2191 ISOnum + {u"rarr"_qs, u"→"_qs}, // rightwards arrow, U+2192 ISOnum + {u"darr"_qs, u"↓"_qs}, // downwards arrow, U+2193 ISOnum + {u"harr"_qs, u"↔"_qs}, // left right arrow, U+2194 ISOamsa + {u"crarr"_qs, u"↵"_qs}, // downwards arrow with corner leftwards = carriage return, U+21B5 NEW + {u"lArr"_qs, u"⇐"_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", "⇑"}, // upwards double arrow, U+21D1 ISOamsa - {"rArr", "⇒"}, // rightwards double arrow, U+21D2 ISOtech + {u"uArr"_qs, u"⇑"_qs}, // upwards double arrow, U+21D1 ISOamsa + {u"rArr"_qs, u"⇒"_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", "⇓"}, // downwards double arrow, U+21D3 ISOamsa - {"hArr", "⇔"}, // left right double arrow, U+21D4 ISOamsa + {u"dArr"_qs, u"⇓"_qs}, // downwards double arrow, U+21D3 ISOamsa + {u"hArr"_qs, u"⇔"_qs}, // left right double arrow, U+21D4 ISOamsa // Mathematical Operators - {"forall", "∀"}, // for all, U+2200 ISOtech - {"part", "∂"}, // partial differential, U+2202 ISOtech - {"exist", "∃"}, // there exists, U+2203 ISOtech - {"empty", "∅"}, // empty set = null set, U+2205 ISOamso - {"nabla", "∇"}, // nabla = backward difference, U+2207 ISOtech - {"isin", "∈"}, // element of, U+2208 ISOtech - {"notin", "∉"}, // not an element of, U+2209 ISOtech - {"ni", "∋"}, // contains as member, U+220B ISOtech - {"prod", "∏"}, // n-ary product = product sign, U+220F ISOamsb + {u"forall"_qs, u"∀"_qs}, // for all, U+2200 ISOtech + {u"part"_qs, u"∂"_qs}, // partial differential, U+2202 ISOtech + {u"exist"_qs, u"∃"_qs}, // there exists, U+2203 ISOtech + {u"empty"_qs, u"∅"_qs}, // empty set = null set, U+2205 ISOamso + {u"nabla"_qs, u"∇"_qs}, // nabla = backward difference, U+2207 ISOtech + {u"isin"_qs, u"∈"_qs}, // element of, U+2208 ISOtech + {u"notin"_qs, u"∉"_qs}, // not an element of, U+2209 ISOtech + {u"ni"_qs, u"∋"_qs}, // contains as member, U+220B ISOtech + {u"prod"_qs, u"∏"_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", "∑"}, // n-ary summation, U+2211 ISOamsb + {u"sum"_qs, u"∑"_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", "−"}, // minus sign, U+2212 ISOtech - {"lowast", "∗"}, // asterisk operator, U+2217 ISOtech - {"radic", "√"}, // square root = radical sign, U+221A ISOtech - {"prop", "∝"}, // proportional to, U+221D ISOtech - {"infin", "∞"}, // infinity, U+221E ISOtech - {"ang", "∠"}, // angle, U+2220 ISOamso - {"and", "∧"}, // logical and = wedge, U+2227 ISOtech - {"or", "∨"}, // logical or = vee, U+2228 ISOtech - {"cap", "∩"}, // intersection = cap, U+2229 ISOtech - {"cup", "∪"}, // union = cup, U+222A ISOtech - {"int", "∫"}, // integral, U+222B ISOtech - {"there4", "∴"}, // therefore, U+2234 ISOtech - {"sim", "∼"}, // tilde operator = varies with = similar to, U+223C ISOtech + {u"minus"_qs, u"−"_qs}, // minus sign, U+2212 ISOtech + {u"lowast"_qs, u"∗"_qs}, // asterisk operator, U+2217 ISOtech + {u"radic"_qs, u"√"_qs}, // square root = radical sign, U+221A ISOtech + {u"prop"_qs, u"∝"_qs}, // proportional to, U+221D ISOtech + {u"infin"_qs, u"∞"_qs}, // infinity, U+221E ISOtech + {u"ang"_qs, u"∠"_qs}, // angle, U+2220 ISOamso + {u"and"_qs, u"∧"_qs}, // logical and = wedge, U+2227 ISOtech + {u"or"_qs, u"∨"_qs}, // logical or = vee, U+2228 ISOtech + {u"cap"_qs, u"∩"_qs}, // intersection = cap, U+2229 ISOtech + {u"cup"_qs, u"∪"_qs}, // union = cup, U+222A ISOtech + {u"int"_qs, u"∫"_qs}, // integral, U+222B ISOtech + {u"there4"_qs, u"∴"_qs}, // therefore, U+2234 ISOtech + {u"sim"_qs, u"∼"_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", "≅"}, // approximately equal to, U+2245 ISOtech - {"asymp", "≈"}, // almost equal to = asymptotic to, U+2248 ISOamsr - {"ne", "≠"}, // not equal to, U+2260 ISOtech - {"equiv", "≡"}, // identical to, U+2261 ISOtech - {"le", "≤"}, // less-than or equal to, U+2264 ISOtech - {"ge", "≥"}, // greater-than or equal to, U+2265 ISOtech - {"sub", "⊂"}, // subset of, U+2282 ISOtech - {"sup", "⊃"}, // superset of, U+2283 ISOtech - {"nsub", "⊄"}, // not a subset of, U+2284 ISOamsn - {"sube", "⊆"}, // subset of or equal to, U+2286 ISOtech - {"supe", "⊇"}, // superset of or equal to, U+2287 ISOtech - {"oplus", "⊕"}, // circled plus = direct sum, U+2295 ISOamsb - {"otimes", "⊗"}, // circled times = vector product, U+2297 ISOamsb - {"perp", "⊥"}, // up tack = orthogonal to = perpendicular, U+22A5 ISOtech - {"sdot", "⋅"}, // dot operator, U+22C5 ISOamsb + {u"cong"_qs, u"≅"_qs}, // approximately equal to, U+2245 ISOtech + {u"asymp"_qs, u"≈"_qs}, // almost equal to = asymptotic to, U+2248 ISOamsr + {u"ne"_qs, u"≠"_qs}, // not equal to, U+2260 ISOtech + {u"equiv"_qs, u"≡"_qs}, // identical to, U+2261 ISOtech + {u"le"_qs, u"≤"_qs}, // less-than or equal to, U+2264 ISOtech + {u"ge"_qs, u"≥"_qs}, // greater-than or equal to, U+2265 ISOtech + {u"sub"_qs, u"⊂"_qs}, // subset of, U+2282 ISOtech + {u"sup"_qs, u"⊃"_qs}, // superset of, U+2283 ISOtech + {u"nsub"_qs, u"⊄"_qs}, // not a subset of, U+2284 ISOamsn + {u"sube"_qs, u"⊆"_qs}, // subset of or equal to, U+2286 ISOtech + {u"supe"_qs, u"⊇"_qs}, // superset of or equal to, U+2287 ISOtech + {u"oplus"_qs, u"⊕"_qs}, // circled plus = direct sum, U+2295 ISOamsb + {u"otimes"_qs, u"⊗"_qs}, // circled times = vector product, U+2297 ISOamsb + {u"perp"_qs, u"⊥"_qs}, // up tack = orthogonal to = perpendicular, U+22A5 ISOtech + {u"sdot"_qs, u"⋅"_qs}, // dot operator, U+22C5 ISOamsb // dot operator is NOT the same character as U+00B7 middle dot // Miscellaneous Technical - {"lceil", "⌈"}, // left ceiling = APL upstile, U+2308 ISOamsc - {"rceil", "⌉"}, // right ceiling, U+2309 ISOamsc - {"lfloor", "⌊"}, // left floor = APL downstile, U+230A ISOamsc - {"rfloor", "⌋"}, // right floor, U+230B ISOamsc - {"lang", "〈"}, // left-pointing angle bracket = bra, U+2329 ISOtech + {u"lceil"_qs, u"⌈"_qs}, // left ceiling = APL upstile, U+2308 ISOamsc + {u"rceil"_qs, u"⌉"_qs}, // right ceiling, U+2309 ISOamsc + {u"lfloor"_qs, u"⌊"_qs}, // left floor = APL downstile, U+230A ISOamsc + {u"rfloor"_qs, u"⌋"_qs}, // right floor, U+230B ISOamsc + {u"lang"_qs, u"〈"_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", "〉"}, // right-pointing angle bracket = ket, U+232A ISOtech + {u"rang"_qs, u"〉"_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", "◊"}, // lozenge, U+25CA ISOpub + {u"loz"_qs, u"◊"_qs}, // lozenge, U+25CA ISOpub // Miscellaneous Symbols - {"spades", "♠"}, // black spade suit, U+2660 ISOpub - {"clubs", "♣"}, // black club suit = shamrock, U+2663 ISOpub - {"hearts", "♥"}, // black heart suit = valentine, U+2665 ISOpub - {"diams", "♦"} // black diamond suit, U+2666 ISOpub + {u"spades"_qs, u"♠"_qs}, // black spade suit, U+2660 ISOpub + {u"clubs"_qs, u"♣"_qs}, // black club suit = shamrock, U+2663 ISOpub + {u"hearts"_qs, u"♥"_qs}, // black heart suit = valentine, U+2665 ISOpub + {u"diams"_qs, u"♦"_qs} // black diamond suit, U+2666 ISOpub }; return HTMLEntities.value(name); } @@ -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 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 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 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) } 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) 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()) { diff --git a/src/base/torrentfilter.cpp b/src/base/torrentfilter.cpp index 0738455ec..0e1bf5e1c 100644 --- a/src/base/torrentfilter.cpp +++ b/src/base/torrentfilter.cpp @@ -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); diff --git a/src/base/unicodestrings.h b/src/base/unicodestrings.h index 6ca396f4d..de48d408b 100644 --- a/src/base/unicodestrings.h +++ b/src/base/unicodestrings.h @@ -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; diff --git a/src/base/utils/foreignapps.cpp b/src/base/utils/foreignapps.cpp index 9020bac2a..cbe6f68e6 100644 --- a/src/base/utils/foreignapps.cpp +++ b/src/base/utils/foreignapps.cpp @@ -42,6 +42,7 @@ #include #endif +#include "base/global.h" #include "base/logger.h" #include "base/utils/bytearray.h" @@ -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 // 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() 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) diff --git a/src/base/utils/misc.cpp b/src/base/utils/misc.cpp index c0d97e42c..c516f4848 100644 --- a/src/base/utils/misc.cpp +++ b/src/base/utils/misc.cpp @@ -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) 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; diff --git a/src/base/utils/net.cpp b/src/base/utils/net.cpp index d95c4a636..c08fc50e3 100644 --- a/src/base/utils/net.cpp +++ b/src/base/utils/net.cpp @@ -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) diff --git a/src/gui/aboutdialog.cpp b/src/gui/aboutdialog.cpp index a90daefc0..b5fc9be33 100644 --- a/src/gui/aboutdialog.cpp +++ b/src/gui/aboutdialog.cpp @@ -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( - "

" - "%1\n\n" - "%2\n\n" - "" - "" - "" - "" - "
%3https://www.qbittorrent.org
%4http://forum.qbittorrent.org
%5http://bugs.qbittorrent.org
" - "

") + const QString aboutText = + u"

" + u"%1\n\n" + u"%2\n\n" + u"" + u"" + u"" + u"" + u"
%3https://www.qbittorrent.org
%4http://forum.qbittorrent.org
%5http://bugs.qbittorrent.org
" + u"

"_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) 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) } // 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) } // 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) } // 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( - "

" - "%1" - " (https://db-ip.com/)

") + const QString DBIPText = u"

" + u"%1 (https://db-ip.com/)" + u"

"_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); diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index 3b0572453..536d9f395 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -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) 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() 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")); diff --git a/src/gui/advancedsettings.cpp b/src/gui/advancedsettings.cpp index 1474ccb5c..75e2d66c0 100644 --- a/src/gui/advancedsettings.cpp +++ b/src/gui/advancedsettings.cpp @@ -47,7 +47,7 @@ namespace { QString makeLink(const QString &url, const QString &linkLabel) { - return QStringLiteral("%2").arg(url, linkLabel); + return u"%2"_qs.arg(url, linkLabel); } enum AdvSettingsCols @@ -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() m_spinBoxMemoryWorkingSetLimit.setValue(static_cast(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() 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() 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() m_spinBoxFilePoolSize.setMinimum(1); m_spinBoxFilePoolSize.setMaximum(std::numeric_limits::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() #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() updateCacheSpinSuffix(m_spinBoxCache.value()); connect(&m_spinBoxCache, qOverload(&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::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() m_spinBoxDiskQueueSize.setMaximum(std::numeric_limits::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::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::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::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::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::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() 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::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(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() // 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::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() // Choking algorithm m_comboBoxChokingAlgorithm.addItems({tr("Fixed slots"), tr("Upload rate based")}); m_comboBoxChokingAlgorithm.setCurrentIndex(static_cast(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(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() // 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::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); } diff --git a/src/gui/categoryfiltermodel.cpp b/src/gui/categoryfiltermodel.cpp index af09ae8db..87ba579da 100644 --- a/src/gui/categoryfiltermodel.cpp +++ b/src/gui/categoryfiltermodel.cpp @@ -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)) diff --git a/src/gui/categoryfilterwidget.cpp b/src/gui/categoryfilterwidget.cpp index 396f2c458..02302fa79 100644 --- a/src/gui/categoryfilterwidget.cpp +++ b/src/gui/categoryfilterwidget.cpp @@ -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() 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() { 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()); diff --git a/src/gui/cookiesdialog.cpp b/src/gui/cookiesdialog.cpp index 15d780e24..e75a9f831 100644 --- a/src/gui/cookiesdialog.cpp +++ b/src/gui/cookiesdialog.cpp @@ -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()); diff --git a/src/gui/deletionconfirmationdialog.cpp b/src/gui/deletionconfirmationdialog.cpp index 431b245dc..7a421f78a 100644 --- a/src/gui/deletionconfirmationdialog.cpp +++ b/src/gui/deletionconfirmationdialog.cpp @@ -30,6 +30,7 @@ #include +#include "base/global.h" #include "base/preferences.h" #include "uithememanager.h" #include "utils.h" @@ -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()); diff --git a/src/gui/downloadfromurldialog.cpp b/src/gui/downloadfromurldialog.cpp index 08859f0e4..cacce5f76 100644 --- a/src/gui/downloadfromurldialog.cpp +++ b/src/gui/downloadfromurldialog.cpp @@ -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 } } diff --git a/src/gui/executionlogwidget.cpp b/src/gui/executionlogwidget.cpp index 25f42959d..455beb848 100644 --- a/src/gui/executionlogwidget.cpp +++ b/src/gui/executionlogwidget.cpp @@ -32,6 +32,7 @@ #include #include +#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 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 // 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()); diff --git a/src/gui/fspathedit_p.cpp b/src/gui/fspathedit_p.cpp index 26e54ddd1..d11469dfa 100644 --- a/src/gui/fspathedit_p.cpp +++ b/src/gui/fspathedit_p.cpp @@ -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); diff --git a/src/gui/lineedit.cpp b/src/gui/lineedit.cpp index f1cbb9f9c..896019d40 100644 --- a/src/gui/lineedit.cpp +++ b/src/gui/lineedit.cpp @@ -16,15 +16,16 @@ #include #include +#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())); diff --git a/src/gui/log/loglistview.cpp b/src/gui/log/loglistview.cpp index 881a31fc5..95ec09cfd 100644 --- a/src/gui/log/loglistview.cpp +++ b/src/gui/log/loglistview.cpp @@ -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')); } diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index ca966a76b..b90677090 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -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) 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) 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) 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) 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() 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) 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) 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) 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) { 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() 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) { 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) } 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() 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() 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) 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 diff --git a/src/gui/optionsdialog.cpp b/src/gui/optionsdialog.cpp index f165aaddd..1ff60726d 100644 --- a/src/gui/optionsdialog.cpp +++ b/src/gui/optionsdialog.cpp @@ -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 { 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) #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) 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) 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) 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() 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() 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 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) 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) 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); diff --git a/src/gui/powermanagement/powermanagement_x11.cpp b/src/gui/powermanagement/powermanagement_x11.cpp index 841bae4fd..c3027d8b4 100644 --- a/src/gui/powermanagement/powermanagement_x11.cpp +++ b/src/gui/powermanagement/powermanagement_x11.cpp @@ -33,6 +33,8 @@ #include #include +#include "base/global.h" + PowerManagementInhibitor::PowerManagementInhibitor(QObject *parent) : QObject(parent) { @@ -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() 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 args; - args << "qBittorrent"; + QList 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); diff --git a/src/gui/previewlistdelegate.cpp b/src/gui/previewlistdelegate.cpp index 8a17ad715..6d85b0120 100644 --- a/src/gui/previewlistdelegate.cpp +++ b/src/gui/previewlistdelegate.cpp @@ -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(progress)); } diff --git a/src/gui/properties/peerlistwidget.cpp b/src/gui/properties/peerlistwidget.cpp index 3ce1392f1..841674722 100644 --- a/src/gui/properties/peerlistwidget.cpp +++ b/src/gui/properties/peerlistwidget.cpp @@ -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 peersList = PeersAdditionDialog::askForPeers(this); @@ -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() 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 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 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) diff --git a/src/gui/properties/peersadditiondialog.cpp b/src/gui/properties/peersadditiondialog.cpp index f0349ed85..7baff0984 100644 --- a/src/gui/properties/peersadditiondialog.cpp +++ b/src/gui/properties/peersadditiondialog.cpp @@ -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()) diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index acd5428be..d40fa53b5 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -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() { 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() 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() 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() 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() // 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() // 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() { 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() 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() 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 for (const QListWidgetItem *item : selectedItems) urlsToCopy << item->text(); - QApplication::clipboard()->setText(urlsToCopy.join('\n')); + QApplication::clipboard()->setText(urlsToCopy.join(u'\n')); } void PropertiesWidget::editWebSeed() diff --git a/src/gui/properties/proptabbar.cpp b/src/gui/properties/proptabbar.cpp index 9130c6619..200849ac0 100644 --- a/src/gui/properties/proptabbar.cpp +++ b/src/gui/properties/proptabbar.cpp @@ -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) // 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) // 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) // 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) // 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) // 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); diff --git a/src/gui/properties/speedplotview.cpp b/src/gui/properties/speedplotview.cpp index 2d53c1fe2..9cf7a1f12 100644 --- a/src/gui/properties/speedplotview.cpp +++ b/src/gui/properties/speedplotview.cpp @@ -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); } } diff --git a/src/gui/properties/speedwidget.cpp b/src/gui/properties/speedwidget.cpp index 06aafa786..0df6fbb9f 100644 --- a/src/gui/properties/speedwidget.cpp +++ b/src/gui/properties/speedwidget.cpp @@ -65,7 +65,7 @@ SpeedWidget::SpeedWidget(PropertiesWidget *parent) m_hlayout = new QHBoxLayout(); m_hlayout->setContentsMargins(0, 0, 0, 0); - m_periodLabel = new QLabel("" + tr("Period:") + ""); + m_periodLabel = new QLabel(u"" + tr("Period:") + u""); m_periodCombobox = new QComboBox(); m_periodCombobox->addItem(tr("1 Minute")); diff --git a/src/gui/properties/trackerlistwidget.cpp b/src/gui/properties/trackerlistwidget.cpp index 0c9b1c226..5cc6d1d02 100644 --- a/src/gui/properties/trackerlistwidget.cpp +++ b/src/gui/properties/trackerlistwidget.cpp @@ -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() 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() 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() 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(); diff --git a/src/gui/properties/trackersadditiondialog.cpp b/src/gui/properties/trackersadditiondialog.cpp index f9f4557b5..92f5b1490 100644 --- a/src/gui/properties/trackersadditiondialog.cpp +++ b/src/gui/properties/trackersadditiondialog.cpp @@ -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 return; } - const QStringList trackersFromUser = m_ui->textEditTrackersList->toPlainText().split('\n'); + const QStringList trackersFromUser = m_ui->textEditTrackersList->toPlainText().split(u'\n'); QVector existingTrackers = m_torrent->trackers(); existingTrackers.reserve(trackersFromUser.size()); for (const QString &userURL : trackersFromUser) @@ -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; } } diff --git a/src/gui/rss/articlelistwidget.cpp b/src/gui/rss/articlelistwidget.cpp index bb43ee919..1dbe8addc 100644 --- a/src/gui/rss/articlelistwidget.cpp +++ b/src/gui/rss/articlelistwidget.cpp @@ -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 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"))); } diff --git a/src/gui/rss/automatedrssdownloader.cpp b/src/gui/rss/automatedrssdownloader.cpp index 7607910bd..989cb46d9 100644 --- a/src/gui/rss/automatedrssdownloader.cpp +++ b/src/gui/rss/automatedrssdownloader.cpp @@ -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) 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 = "

" + tr("Matches articles based on episode filter.") + "

" + tr("Example: ") - + "1x2;8-15;5;30-;" + tr(" will match 2, 5, 8 through 15, 30 and onward episodes of season one", "example X will match") + "

"; - tip += "

" + tr("Episode filter rules: ") + "

  • " + tr("Season number is a mandatory non-zero value") + "
  • " - + "
  • " + tr("Episode number is a mandatory positive value") + "
  • " - + "
  • " + tr("Filter must end with semicolon") + "
  • " - + "
  • " + tr("Three range types for episodes are supported: ") + "
  • " + "
    • " - + "
    • " + tr("Single number: 1x25; matches episode 25 of season one") + "
    • " - + "
    • " + tr("Normal range: 1x25-40; matches episodes 25 through 40 of season one") + "
    • " - + "
    • " + tr("Infinite range: 1x25-; matches episodes 25 and upward of season one, and all episodes of later seasons") + "
    • " + "
"; + const QString tip = u"

" + tr("Matches articles based on episode filter.") + u"

" + tr("Example: ") + + u"1x2;8-15;5;30-;" + tr(" will match 2, 5, 8 through 15, 30 and onward episodes of season one", "example X will match") + u"

" + + u"

" + tr("Episode filter rules: ") + u"

  • " + tr("Season number is a mandatory non-zero value") + u"
  • " + + u"
  • " + tr("Episode number is a mandatory positive value") + u"
  • " + + u"
  • " + tr("Filter must end with semicolon") + u"
  • " + + u"
  • " + tr("Three range types for episodes are supported: ") + u"
  • " + u"
    • " + + u"
    • " + tr("Single number: 1x25; matches episode 25 of season one") + u"
    • " + + u"
    • " + tr("Normal range: 1x25-40; matches episodes 25 through 40 of season one") + u"
    • " + + u"
    • " + tr("Infinite range: 1x25-; matches episodes 25 and upward of season one, and all episodes of later seasons") + u"
    • " + u"
"; m_ui->lineEFilter->setToolTip(tip); 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()); - m_ui->comboCategory->addItem(""); + m_ui->comboCategory->addItem(u""_qs); m_ui->comboCategory->addItems(categories); } @@ -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 selection = m_ui->listRules->selectedItems(); @@ -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 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) QString tip; if (regex) { - tip = "

" + tr("Regex mode: use Perl-compatible regular expressions") + "

"; + tip = u"

" + tr("Regex mode: use Perl-compatible regular expressions") + u"

"; } else { - tip = "

" + tr("Wildcard mode: you can use") + "

    " - + "
  • " + tr("? to match any single character") + "
  • " - + "
  • " + tr("* to match zero or more of any characters") + "
  • " - + "
  • " + tr("Whitespaces count as AND operators (all words, any order)") + "
  • " - + "
  • " + tr("| is used as OR operator") + "

" - + "

" + tr("If word order is important use * instead of whitespace.") + "

"; + tip = u"

" + tr("Wildcard mode: you can use") + u"

    " + + u"
  • " + tr("? to match any single character") + u"
  • " + + u"
  • " + tr("* to match zero or more of any characters") + u"
  • " + + u"
  • " + tr("Whitespaces count as AND operators (all words, any order)") + u"
  • " + + u"
  • " + tr("| is used as OR operator") + u"

" + + u"

" + tr("If word order is important use * instead of whitespace.") + u"

"; } // 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 += "

"; + tip += u"

"; 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("|", "expr|"); - m_ui->lineContains->setToolTip(tip + tr(" will match all articles.") + "

"); - m_ui->lineNotContains->setToolTip(tip + tr(" will exclude all articles.") + "

"); + ).arg(u"|"_qs, u"expr|"_qs); + m_ui->lineContains->setToolTip(tip + tr(" will match all articles.") + u"

"); + m_ui->lineNotContains->setToolTip(tip + tr(" will exclude all articles.") + u"

"); } 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() 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() } 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() 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() 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)); } } diff --git a/src/gui/rss/feedlistwidget.cpp b/src/gui/rss/feedlistwidget.cpp index 2f1ee04e6..44ba23d63 100644 --- a/src/gui/rss/feedlistwidget.cpp +++ b/src/gui/rss/feedlistwidget.cpp @@ -107,7 +107,7 @@ FeedListWidget::FeedListWidget(QWidget *parent) m_unreadStickyItem = new FeedListItem(this); m_unreadStickyItem->setData(0, Qt::UserRole, reinterpret_cast(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); diff --git a/src/gui/rss/htmlbrowser.cpp b/src/gui/rss/htmlbrowser.cpp index 6bd4c49cb..d2797192a 100644 --- a/src/gui/rss/htmlbrowser.cpp +++ b/src/gui/rss/htmlbrowser.cpp @@ -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) 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)); diff --git a/src/gui/rss/rsswidget.cpp b/src/gui/rss/rsswidget.cpp index 68179fbcd..71e923ab0 100644 --- a/src/gui/rss/rsswidget.cpp +++ b/src/gui/rss/rsswidget.cpp @@ -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() const QString newFolderPath = RSS::Item::joinPath(rssDestFolder->path(), newName); const nonstd::expected 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() { // 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() const QString newFeedPath = RSS::Item::joinPath(rssDestFolder->path(), newURL); const nonstd::expected 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() 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() if (auto feed = qobject_cast(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 html += QString::fromLatin1("
%2%3
").arg(alternateBaseColor, tr("Date: "), QLocale::system().toString(article->date().toLocalTime())); if (!article->author().isEmpty()) html += QString::fromLatin1("
%2%3
").arg(alternateBaseColor, tr("Author: "), article->author()); - html += "" - "
"; + html += u"
" + u"
"; if (Qt::mightBeRichText(article->description())) { html += article->description(); @@ -503,27 +503,27 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL rx.setPatternOptions(QRegularExpression::InvertedGreedinessOption | QRegularExpression::CaseInsensitiveOption); - rx.setPattern("\\[img\\](.+)\\[/img\\]"); - description = description.replace(rx, ""); + rx.setPattern(u"\\[img\\](.+)\\[/img\\]"_qs); + description = description.replace(rx, u""_qs); - rx.setPattern("\\[url=(\")?(.+)\\1\\]"); - description = description.replace(rx, ""); - description = description.replace("[/url]", "", Qt::CaseInsensitive); + rx.setPattern(u"\\[url=(\")?(.+)\\1\\]"_qs); + description = description.replace(rx, u""_qs); + description = description.replace(u"[/url]"_qs, u""_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, ""); - description = description.replace("[/color]", "", Qt::CaseInsensitive); + rx.setPattern(u"\\[color=(\")?(.+)\\1\\]"_qs); + description = description.replace(rx, u""_qs); + description = description.replace(u"[/color]"_qs, u""_qs, Qt::CaseInsensitive); - rx.setPattern("\\[size=(\")?(.+)\\d\\1\\]"); - description = description.replace(rx, ""); - description = description.replace("[/size]", "", Qt::CaseInsensitive); + rx.setPattern(u"\\[size=(\")?(.+)\\d\\1\\]"_qs); + description = description.replace(rx, u""_qs); + description = description.replace(u"[/size]"_qs, u""_qs, Qt::CaseInsensitive); - html += "
" + description + "
"; + html += u"
" + description + u"
"; } - html += "
"; + html += u""; m_ui->textBrowser->setHtml(html); } diff --git a/src/gui/search/pluginselectdialog.cpp b/src/gui/search/pluginselectdialog.cpp index 878ccb26a..76031f93c 100644 --- a/src/gui/search/pluginselectdialog.cpp +++ b/src/gui/search/pluginselectdialog.cpp @@ -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) { 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) } 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) 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() // 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) 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) 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) // 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() 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() { 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( diff --git a/src/gui/search/searchjobwidget.cpp b/src/gui/search/searchjobwidget.cpp index dbd05dfef..f75f879f5 100644 --- a/src/gui/search/searchjobwidget.cpp +++ b/src/gui/search/searchjobwidget.cpp @@ -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 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) 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()); diff --git a/src/gui/search/searchwidget.cpp b/src/gui/search/searchwidget.cpp index 6e4b84ef9..0a5b10651 100644 --- a/src/gui/search/searchwidget.cpp +++ b/src/gui/search/searchwidget.cpp @@ -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) 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; QVector tmpList; @@ -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; QVector tmpList; @@ -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() } 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() 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); diff --git a/src/gui/shutdownconfirmdialog.cpp b/src/gui/shutdownconfirmdialog.cpp index 878d7342b..3355e783e 100644 --- a/src/gui/shutdownconfirmdialog.cpp +++ b/src/gui/shutdownconfirmdialog.cpp @@ -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); } diff --git a/src/gui/statsdialog.cpp b/src/gui/statsdialog.cpp index a595b5ac6..16532a54a 100644 --- a/src/gui/statsdialog.cpp +++ b/src/gui/statsdialog.cpp @@ -86,7 +86,7 @@ void StatsDialog::update() m_ui->labelGlobalRatio->setText( ((atd > 0) && (atu > 0)) ? Utils::String::fromDouble(static_cast(atu) / atd, 2) - : "-"); + : u"-"_qs); #ifndef QBT_USES_LIBTORRENT2 // Cache hits const qreal readRatio = cs.readRatio; diff --git a/src/gui/statusbar.cpp b/src/gui/statusbar.cpp index c990cca89..4710b48a4 100644 --- a/src/gui/statusbar.cpp +++ b/src/gui/statusbar.cpp @@ -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) 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) 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) 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() 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); } diff --git a/src/gui/tagfiltermodel.cpp b/src/gui/tagfiltermodel.cpp index a0a13e667..8cdac0369 100644 --- a/src/gui/tagfiltermodel.cpp +++ b/src/gui/tagfiltermodel.cpp @@ -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()); diff --git a/src/gui/tagfilterwidget.cpp b/src/gui/tagfilterwidget.cpp index 075ab1346..293e88991 100644 --- a/src/gui/tagfilterwidget.cpp +++ b/src/gui/tagfilterwidget.cpp @@ -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() 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 QString TagFilterWidget::askTagName() { bool ok = false; - QString tag = ""; + QString tag = u""_qs; bool invalid = true; while (invalid) { diff --git a/src/gui/torrentcontentmodel.cpp b/src/gui/torrentcontentmodel.cpp index 6e7cca157..fe098389c 100644 --- a/src/gui/torrentcontentmodel.cpp +++ b/src/gui/torrentcontentmodel.cpp @@ -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; } }; diff --git a/src/gui/torrentcreatordialog.cpp b/src/gui/torrentcreatordialog.cpp index 9d9327173..6e4137b7c 100644 --- a/src/gui/torrentcreatordialog.cpp +++ b/src/gui/torrentcreatordialog.cpp @@ -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) 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() 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() , 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 diff --git a/src/gui/torrentoptionsdialog.cpp b/src/gui/torrentoptionsdialog.cpp index 43cac7a96..3d13155e3 100644 --- a/src/gui/torrentoptionsdialog.cpp +++ b/src/gui/torrentoptionsdialog.cpp @@ -251,7 +251,7 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVectorspinUploadLimit->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(&QSpinBox::valueChanged) @@ -266,7 +266,7 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVectorspinDownloadLimit->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(&QSpinBox::valueChanged) @@ -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(&QSpinBox::valueChanged) , this, &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(&QSpinBox::valueChanged) , this, &TorrentOptionsDialog::handleDownSpeedLimitChanged); } diff --git a/src/gui/trackerentriesdialog.cpp b/src/gui/trackerentriesdialog.cpp index 0ac23c49b..633919142 100644 --- a/src/gui/trackerentriesdialog.cpp +++ b/src/gui/trackerentriesdialog.cpp @@ -66,14 +66,14 @@ void TrackerEntriesDialog::setTrackers(const QVector & 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); } diff --git a/src/gui/transferlistfilterswidget.cpp b/src/gui/transferlistfilterswidget.cpp index 1ecfa6c3e..7b617b98a 100644 --- a/src/gui/transferlistfilterswidget.cpp +++ b/src/gui/transferlistfilterswidget.cpp @@ -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 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 } }; - const QString NULL_HOST {""}; + const QString NULL_HOST = u""_qs; } BaseFilterWidget::BaseFilterWidget(QWidget *parent, TransferListWidget *transferList) @@ -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 { 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 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) 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 { 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 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() 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 { 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 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); diff --git a/src/gui/transferlistmodel.cpp b/src/gui/transferlistmodel.cpp index 4e6485d42..eb74e75eb 100644 --- a/src/gui/transferlistmodel.cpp +++ b/src/gui/transferlistmodel.cpp @@ -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 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 return {}; return ((static_cast(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 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]; }; diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp index 7d3e2d6f5..33b44ca81 100644 --- a/src/gui/transferlistwidget.cpp +++ b/src/gui/transferlistwidget.cpp @@ -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 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) 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 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) 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() 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() // 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() 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() QStringList categories = BitTorrent::Session::instance()->categories(); std::sort(categories.begin(), categories.end(), Utils::Compare::NaturalLessThan()); - 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() QStringList tags(BitTorrent::Session::instance()->tags().values()); std::sort(tags.begin(), tags.end(), Utils::Compare::NaturalLessThan()); - 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() } 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); diff --git a/src/gui/uithememanager.cpp b/src/gui/uithememanager.cpp index 5dea4e9ac..a1c7ce6e1 100644 --- a/src/gui/uithememanager.cpp +++ b/src/gui/uithememanager.cpp @@ -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() 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()); diff --git a/src/gui/utils.cpp b/src/gui/utils.cpp index e2eab7456..ad9c9ba37 100644 --- a/src/gui/utils.cpp +++ b/src/gui/utils.cpp @@ -47,6 +47,7 @@ #include #include +#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) 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) ::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; 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 { diff --git a/src/gui/watchedfolderoptionsdialog.cpp b/src/gui/watchedfolderoptionsdialog.cpp index a32620c43..9f89dfed0 100644 --- a/src/gui/watchedfolderoptionsdialog.cpp +++ b/src/gui/watchedfolderoptionsdialog.cpp @@ -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)) {