mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-09 09:02:31 -06:00
committed by
GitHub
parent
facfa26eed
commit
dd1bd8ad10
@@ -470,9 +470,11 @@ void PeerListWidget::updatePeer(const BitTorrent::Torrent *torrent, const BitTor
|
||||
setModelData(row, PeerListColumns::TOT_UP, totalUp, peer.totalUpload(), intDataTextAlignment);
|
||||
setModelData(row, PeerListColumns::RELEVANCE, (Utils::String::fromDouble(peer.relevance() * 100, 1) + '%'), peer.relevance(), intDataTextAlignment);
|
||||
|
||||
const QStringList downloadingFiles {torrent->hasMetadata()
|
||||
? torrent->info().filesForPiece(peer.downloadingPieceIndex())
|
||||
: QStringList()};
|
||||
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(';');
|
||||
setModelData(row, PeerListColumns::DOWNLOADING_PIECE, downloadingFilesDisplayValue, downloadingFilesDisplayValue, {}, downloadingFiles.join(QLatin1Char('\n')));
|
||||
|
||||
|
||||
@@ -37,9 +37,10 @@
|
||||
#include <QTextStream>
|
||||
#include <QToolTip>
|
||||
|
||||
#include "base/indexrange.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/bittorrent/torrentinfo.h"
|
||||
#include "base/indexrange.h"
|
||||
#include "base/path.h"
|
||||
#include "base/utils/misc.h"
|
||||
|
||||
namespace
|
||||
@@ -53,9 +54,8 @@ namespace
|
||||
{
|
||||
public:
|
||||
PieceIndexToImagePos(const BitTorrent::TorrentInfo &torrentInfo, const QImage &image)
|
||||
: m_bytesPerPixel
|
||||
{((image.width() > 0) && (torrentInfo.totalSize() >= image.width()))
|
||||
? torrentInfo.totalSize() / image.width() : -1}
|
||||
: m_bytesPerPixel {((image.width() > 0) && (torrentInfo.totalSize() >= image.width()))
|
||||
? torrentInfo.totalSize() / image.width() : -1}
|
||||
, m_torrentInfo {torrentInfo}
|
||||
{
|
||||
if ((m_bytesPerPixel > 0) && (m_bytesPerPixel < 10))
|
||||
@@ -100,9 +100,9 @@ namespace
|
||||
m_stream << "</table>";
|
||||
}
|
||||
|
||||
void operator()(const QString &size, const QString &path)
|
||||
void operator()(const QString &size, const Path &path)
|
||||
{
|
||||
m_stream << R"(<tr><td style="white-space:nowrap">)" << size << "</td><td>" << path << "</td></tr>";
|
||||
m_stream << R"(<tr><td style="white-space:nowrap">)" << size << "</td><td>" << path.toString() << "</td></tr>";
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -282,7 +282,7 @@ void PiecesBar::showToolTip(const QHelpEvent *e)
|
||||
|
||||
for (int f : files)
|
||||
{
|
||||
const QString filePath {torrentInfo.filePath(f)};
|
||||
const Path filePath = torrentInfo.filePath(f);
|
||||
renderer(Utils::Misc::friendlyUnit(torrentInfo.fileSize(f)), filePath);
|
||||
}
|
||||
stream << "</body></html>";
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <QClipboard>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QHeaderView>
|
||||
#include <QListWidgetItem>
|
||||
#include <QMenu>
|
||||
@@ -45,6 +44,7 @@
|
||||
#include "base/bittorrent/infohash.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/path.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "base/utils/fs.h"
|
||||
@@ -333,7 +333,7 @@ QTreeView *PropertiesWidget::getFilesList() const
|
||||
void PropertiesWidget::updateSavePath(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
if (torrent == m_torrent)
|
||||
m_ui->labelSavePathVal->setText(Utils::Fs::toNativePath(m_torrent->savePath()));
|
||||
m_ui->labelSavePathVal->setText(m_torrent->savePath().toString());
|
||||
}
|
||||
|
||||
void PropertiesWidget::loadTrackers(BitTorrent::Torrent *const torrent)
|
||||
@@ -593,25 +593,22 @@ void PropertiesWidget::loadUrlSeeds()
|
||||
}
|
||||
}
|
||||
|
||||
QString PropertiesWidget::getFullPath(const QModelIndex &index) const
|
||||
Path PropertiesWidget::getFullPath(const QModelIndex &index) const
|
||||
{
|
||||
const QDir saveDir {m_torrent->actualStorageLocation()};
|
||||
|
||||
if (m_propListModel->itemType(index) == TorrentContentModelItem::FileType)
|
||||
{
|
||||
const int fileIdx = m_propListModel->getFileIndex(index);
|
||||
const QString filename {m_torrent->actualFilePath(fileIdx)};
|
||||
const QString fullPath {Utils::Fs::expandPath(saveDir.absoluteFilePath(filename))};
|
||||
const Path fullPath = m_torrent->actualStorageLocation() / m_torrent->actualFilePath(fileIdx);
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
// folder type
|
||||
const QModelIndex nameIndex {index.sibling(index.row(), TorrentContentModelItem::COL_NAME)};
|
||||
QString folderPath {nameIndex.data().toString()};
|
||||
Path folderPath {nameIndex.data().toString()};
|
||||
for (QModelIndex modelIdx = m_propListModel->parent(nameIndex); modelIdx.isValid(); modelIdx = modelIdx.parent())
|
||||
folderPath.prepend(modelIdx.data().toString() + '/');
|
||||
folderPath = Path(modelIdx.data().toString()) / folderPath;
|
||||
|
||||
const QString fullPath {Utils::Fs::expandPath(saveDir.absoluteFilePath(folderPath))};
|
||||
const Path fullPath = m_torrent->actualStorageLocation() / folderPath;
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
@@ -626,7 +623,7 @@ void PropertiesWidget::openItem(const QModelIndex &index) const
|
||||
|
||||
void PropertiesWidget::openParentFolder(const QModelIndex &index) const
|
||||
{
|
||||
const QString path = getFullPath(index);
|
||||
const Path path = getFullPath(index);
|
||||
m_torrent->flushCache(); // Flush data
|
||||
#ifdef Q_OS_MACOS
|
||||
MacUtils::openFiles({path});
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include <QList>
|
||||
#include <QWidget>
|
||||
|
||||
#include "base/pathfwd.h"
|
||||
|
||||
class QPushButton;
|
||||
class QTreeView;
|
||||
|
||||
@@ -108,7 +110,7 @@ private:
|
||||
QPushButton *getButtonFromIndex(int index);
|
||||
void applyPriorities();
|
||||
void openParentFolder(const QModelIndex &index) const;
|
||||
QString getFullPath(const QModelIndex &index) const;
|
||||
Path getFullPath(const QModelIndex &index) const;
|
||||
|
||||
Ui::PropertiesWidget *m_ui;
|
||||
BitTorrent::Torrent *m_torrent;
|
||||
|
||||
Reference in New Issue
Block a user