Use QString literals

This patch covers src/gui and some leftovers from previous commit.
This commit is contained in:
Chocobo1
2022-03-12 22:00:58 +08:00
parent 5341478036
commit 802ec5a14e
59 changed files with 912 additions and 902 deletions

View File

@@ -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)

View File

@@ -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);

View File

@@ -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