mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 21:52:32 -06:00
Replace single-character string with character literal
Also remove unnecessary dynamic allocation.
This commit is contained in:
@@ -100,7 +100,7 @@ public:
|
||||
case RELEVANCE: {
|
||||
qreal progress = index.data().toDouble();
|
||||
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, Utils::String::fromDouble(progress * 100.0, 1) + "%");
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, Utils::String::fromDouble(progress * 100.0, 1) + '%');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -304,9 +304,9 @@ void PeerListWidget::copySelectedPeers()
|
||||
QString ip = m_listModel->data(m_listModel->index(row, PeerListDelegate::IP_HIDDEN)).toString();
|
||||
QString myport = m_listModel->data(m_listModel->index(row, PeerListDelegate::PORT)).toString();
|
||||
if (ip.indexOf('.') == -1) // IPv6
|
||||
selectedPeers << "[" + ip + "]:" + myport;
|
||||
selectedPeers << '[' + ip + "]:" + myport;
|
||||
else // IPv4
|
||||
selectedPeers << ip + ":" + myport;
|
||||
selectedPeers << ip + ':' + myport;
|
||||
}
|
||||
QApplication::clipboard()->setText(selectedPeers.join('\n'));
|
||||
}
|
||||
@@ -404,8 +404,8 @@ QStandardItem *PeerListWidget::addPeer(const QString &ip, BitTorrent::TorrentHan
|
||||
m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload());
|
||||
m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance());
|
||||
QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex()));
|
||||
m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(";")));
|
||||
m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String("\n")), Qt::ToolTipRole);
|
||||
m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1Char(';')));
|
||||
m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1Char('\n')), Qt::ToolTipRole);
|
||||
|
||||
return m_listModel->item(row, PeerListDelegate::IP);
|
||||
}
|
||||
|
||||
@@ -474,7 +474,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) + '%');
|
||||
m_downloadedPieces->setProgress(m_torrent->pieces(), m_torrent->downloadingPieces());
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -87,7 +87,7 @@ void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
||||
QStyleOptionProgressBar newopt;
|
||||
qreal progress = index.data().toDouble() * 100.;
|
||||
newopt.rect = opt.rect;
|
||||
newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + "%");
|
||||
newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + '%');
|
||||
newopt.progress = int(progress);
|
||||
newopt.maximum = 100;
|
||||
newopt.minimum = 0;
|
||||
|
||||
@@ -371,9 +371,9 @@ void TrackerListWidget::loadTrackers()
|
||||
item->setText(COL_PEERS, QString::number(entry.nativeEntry().scrape_incomplete > 0 ? entry.nativeEntry().scrape_incomplete : 0));
|
||||
item->setText(COL_DOWNLOADED, QString::number(entry.nativeEntry().scrape_downloaded > 0 ? entry.nativeEntry().scrape_downloaded : 0));
|
||||
#else
|
||||
item->setText(COL_SEEDS, "0");
|
||||
item->setText(COL_PEERS, "0");
|
||||
item->setText(COL_DOWNLOADED, "0");
|
||||
item->setText(COL_SEEDS, '0');
|
||||
item->setText(COL_PEERS, '0');
|
||||
item->setText(COL_DOWNLOADED, '0');
|
||||
#endif
|
||||
|
||||
item->setTextAlignment(COL_TIER, (Qt::AlignRight | Qt::AlignVCenter));
|
||||
|
||||
Reference in New Issue
Block a user