mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 15:37:26 -06:00
Use QString literals
This patch covers src/gui and some leftovers from previous commit.
This commit is contained in:
@@ -269,7 +269,7 @@ void PeerListWidget::showPeerListMenu()
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
menu->setToolTipsVisible(true);
|
||||
|
||||
QAction *addNewPeer = menu->addAction(UIThemeManager::instance()->getIcon("user-group-new"), tr("Add peers...")
|
||||
QAction *addNewPeer = menu->addAction(UIThemeManager::instance()->getIcon(u"user-group-new"_qs), tr("Add peers...")
|
||||
, this, [this, torrent]()
|
||||
{
|
||||
const QVector<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this);
|
||||
@@ -282,10 +282,10 @@ void PeerListWidget::showPeerListMenu()
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user