From d85c14864b56552dffbbc773c7904c609f12ed88 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Thu, 8 Jul 2021 14:13:26 +0800 Subject: [PATCH 1/3] Add tooltip for "client ID" column Sometimes the client ID could be quite long and this patch helps showing it. --- src/gui/properties/peerlistwidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/properties/peerlistwidget.cpp b/src/gui/properties/peerlistwidget.cpp index 9f9402528..4ee922846 100644 --- a/src/gui/properties/peerlistwidget.cpp +++ b/src/gui/properties/peerlistwidget.cpp @@ -447,7 +447,7 @@ void PeerListWidget::updatePeer(const BitTorrent::Torrent *torrent, const BitTor setModelData(row, PeerListColumns::CONNECTION, peer.connectionType(), peer.connectionType()); setModelData(row, PeerListColumns::FLAGS, peer.flags(), peer.flags(), {}, peer.flagsDescription()); const QString client = peer.client().toHtmlEscaped(); - setModelData(row, PeerListColumns::CLIENT, client, client); + setModelData(row, PeerListColumns::CLIENT, client, client, {}, client); setModelData(row, PeerListColumns::PROGRESS, (Utils::String::fromDouble(peer.progress() * 100, 1) + '%'), 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); @@ -461,7 +461,7 @@ void PeerListWidget::updatePeer(const BitTorrent::Torrent *torrent, const BitTor const QStringList downloadingFiles {torrent->info().filesForPiece(peer.downloadingPieceIndex())}; const QString downloadingFilesDisplayValue = downloadingFiles.join(';'); - setModelData(row, PeerListColumns::DOWNLOADING_PIECE, downloadingFilesDisplayValue, downloadingFilesDisplayValue, {}, downloadingFiles.join('\n')); + setModelData(row, PeerListColumns::DOWNLOADING_PIECE, downloadingFilesDisplayValue, downloadingFilesDisplayValue, {}, downloadingFiles.join(QLatin1Char('\n'))); if (m_resolver) m_resolver->resolve(peerEndpoint.address.ip); From 4b0a2d050aedb4fe2bbcacce1ee19aa4d639d895 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Thu, 8 Jul 2021 14:21:25 +0800 Subject: [PATCH 2/3] Display tooltip for all columns in torrent content widget It is primary useful for showing long file names. --- src/gui/torrentcontentmodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/torrentcontentmodel.cpp b/src/gui/torrentcontentmodel.cpp index c26f2c9bd..a37643de8 100644 --- a/src/gui/torrentcontentmodel.cpp +++ b/src/gui/torrentcontentmodel.cpp @@ -339,7 +339,7 @@ int TorrentContentModel::getFileIndex(const QModelIndex &index) return -1; } -QVariant TorrentContentModel::data(const QModelIndex &index, int role) const +QVariant TorrentContentModel::data(const QModelIndex &index, const int role) const { if (!index.isValid()) return {}; @@ -375,6 +375,7 @@ QVariant TorrentContentModel::data(const QModelIndex &index, int role) const return {}; case Qt::DisplayRole: + case Qt::ToolTipRole: return item->displayData(index.column()); case Roles::UnderlyingDataRole: From fd3d4d479af903ee5edf0b7757dcbf6bcd8c9a62 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Thu, 8 Jul 2021 14:24:50 +0800 Subject: [PATCH 3/3] Suppress type narrowing warning on MSVC Fix up 45e31a153cf65390041059eb0a524ac296992629. --- src/base/bittorrent/torrentimpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index a697bb30e..b4512d1b2 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -797,7 +797,7 @@ QVector TorrentImpl::filePriorities() const const std::vector fp = m_nativeHandle.get_file_priorities(); QVector ret; - ret.reserve(fp.size()); + ret.reserve(static_cast(fp.size())); std::transform(fp.cbegin(), fp.cend(), std::back_inserter(ret), [](const lt::download_priority_t priority) { return static_cast(toLTUnderlyingType(priority));