mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
committed by
GitHub
parent
a8ade3a04b
commit
bc71827c01
@@ -407,8 +407,10 @@ void AddNewTorrentDialog::updateDiskSpaceLabel()
|
||||
const QVector<BitTorrent::DownloadPriority> priorities = m_contentModel->model()->getFilePriorities();
|
||||
Q_ASSERT(priorities.size() == m_torrentInfo.filesCount());
|
||||
for (int i = 0; i < priorities.size(); ++i)
|
||||
{
|
||||
if (priorities[i] > BitTorrent::DownloadPriority::Ignored)
|
||||
torrentSize += m_torrentInfo.fileSize(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -85,10 +85,9 @@ PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, const BitTorrent::Torr
|
||||
m_ui->previewList->setAlternatingRowColors(pref->useAlternatingRowColors());
|
||||
// Fill list in
|
||||
const QVector<qreal> fp = torrent->filesProgress();
|
||||
int nbFiles = torrent->filesCount();
|
||||
for (int i = 0; i < nbFiles; ++i)
|
||||
for (int i = 0; i <= torrent->filesCount(); ++i)
|
||||
{
|
||||
QString fileName = torrent->fileName(i);
|
||||
QString fileName = Utils::Fs::fileName(torrent->filePath(i));
|
||||
if (fileName.endsWith(QB_EXT))
|
||||
fileName.chop(QB_EXT.length());
|
||||
if (Utils::Misc::isPreviewable(fileName))
|
||||
|
||||
@@ -283,7 +283,7 @@ bool TorrentContentModel::setData(const QModelIndex &index, const QVariant &valu
|
||||
if ((index.column() == TorrentContentModelItem::COL_NAME) && (role == Qt::CheckStateRole))
|
||||
{
|
||||
auto *item = static_cast<TorrentContentModelItem*>(index.internalPointer());
|
||||
qDebug("setData(%s, %d", qUtf8Printable(item->name()), value.toInt());
|
||||
qDebug("setData(%s, %d)", qUtf8Printable(item->name()), value.toInt());
|
||||
if (static_cast<int>(item->priority()) != value.toInt())
|
||||
{
|
||||
BitTorrent::DownloadPriority prio = BitTorrent::DownloadPriority::Normal;
|
||||
@@ -349,7 +349,7 @@ QVariant TorrentContentModel::data(const QModelIndex &index, const int role) con
|
||||
switch (role)
|
||||
{
|
||||
case Qt::DecorationRole:
|
||||
{
|
||||
{
|
||||
if (index.column() != TorrentContentModelItem::COL_NAME)
|
||||
return {};
|
||||
|
||||
@@ -358,7 +358,7 @@ QVariant TorrentContentModel::data(const QModelIndex &index, const int role) con
|
||||
return m_fileIconProvider->icon(QFileInfo(item->name()));
|
||||
}
|
||||
case Qt::CheckStateRole:
|
||||
{
|
||||
{
|
||||
if (index.column() != TorrentContentModelItem::COL_NAME)
|
||||
return {};
|
||||
|
||||
@@ -519,7 +519,8 @@ void TorrentContentModel::setupModelData(const BitTorrent::TorrentInfo &info)
|
||||
currentParent = newParent;
|
||||
}
|
||||
// Actually create the file
|
||||
TorrentContentModelFile *fileItem = new TorrentContentModelFile(info.fileName(i), info.fileSize(i), currentParent, i);
|
||||
TorrentContentModelFile *fileItem = new TorrentContentModelFile(
|
||||
Utils::Fs::fileName(info.filePath(i)), info.fileSize(i), currentParent, i);
|
||||
currentParent->appendChild(fileItem);
|
||||
m_filesIndex.push_back(fileItem);
|
||||
}
|
||||
|
||||
@@ -139,8 +139,10 @@ void TorrentContentModelFolder::setPriority(BitTorrent::DownloadPriority newPrio
|
||||
|
||||
// Update children
|
||||
if (m_priority != BitTorrent::DownloadPriority::Mixed)
|
||||
{
|
||||
for (TorrentContentModelItem *child : asConst(m_childItems))
|
||||
child->setPriority(m_priority, false);
|
||||
}
|
||||
}
|
||||
|
||||
void TorrentContentModelFolder::recalculateProgress()
|
||||
|
||||
@@ -91,9 +91,9 @@ namespace
|
||||
if (!torrent->hasMetadata())
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < torrent->filesCount(); ++i)
|
||||
for (const QString &filePath : asConst(torrent->filePaths()))
|
||||
{
|
||||
QString fileName = torrent->fileName(i);
|
||||
QString fileName = Utils::Fs::fileName(filePath);
|
||||
if (fileName.endsWith(QB_EXT))
|
||||
fileName.chop(QB_EXT.length());
|
||||
if (Utils::Misc::isPreviewable(fileName))
|
||||
|
||||
Reference in New Issue
Block a user