mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-04 22:52:33 -06:00
committed by
GitHub
parent
9f6130cbaa
commit
f44341a8e2
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "previewselectdialog.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QHeaderView>
|
||||
#include <QMessageBox>
|
||||
@@ -36,7 +37,6 @@
|
||||
#include <QStandardItemModel>
|
||||
#include <QTableView>
|
||||
|
||||
#include "base/bittorrent/common.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/utils/fs.h"
|
||||
@@ -91,9 +91,7 @@ PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, const BitTorrent::Torr
|
||||
const QVector<qreal> fp = torrent->filesProgress();
|
||||
for (int i = 0; i < torrent->filesCount(); ++i)
|
||||
{
|
||||
QString fileName = Utils::Fs::fileName(torrent->filePath(i));
|
||||
if (fileName.endsWith(QB_EXT))
|
||||
fileName.chop(QB_EXT.length());
|
||||
const QString fileName = Utils::Fs::fileName(torrent->filePath(i));
|
||||
if (Utils::Misc::isPreviewable(fileName))
|
||||
{
|
||||
int row = m_previewListModel->rowCount();
|
||||
@@ -128,9 +126,9 @@ void PreviewSelectDialog::previewButtonClicked()
|
||||
// Flush data
|
||||
m_torrent->flushCache();
|
||||
|
||||
const QStringList absolutePaths = m_torrent->absoluteFilePaths();
|
||||
// Only one file should be selected
|
||||
const QString path = absolutePaths.at(selectedIndexes.at(0).data().toInt());
|
||||
const int fileIndex = selectedIndexes.at(0).data().toInt();
|
||||
const QString path = QDir(m_torrent->actualStorageLocation()).absoluteFilePath(m_torrent->actualFilePath(fileIndex));
|
||||
// File
|
||||
if (!QFile::exists(path))
|
||||
{
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "torrentcontentmodelfile.h"
|
||||
|
||||
#include "base/bittorrent/common.h"
|
||||
#include "torrentcontentmodelfolder.h"
|
||||
|
||||
TorrentContentModelFile::TorrentContentModelFile(const QString &fileName, qulonglong fileSize,
|
||||
@@ -39,11 +38,6 @@ TorrentContentModelFile::TorrentContentModelFile(const QString &fileName, qulong
|
||||
Q_ASSERT(parent);
|
||||
|
||||
m_name = fileName;
|
||||
|
||||
// Do not display incomplete extensions
|
||||
if (m_name.endsWith(QB_EXT))
|
||||
m_name.chop(4);
|
||||
|
||||
m_size = fileSize;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
#include "base/bittorrent/common.h"
|
||||
#include "base/global.h"
|
||||
|
||||
TorrentContentModelFolder::TorrentContentModelFolder(const QString &name, TorrentContentModelFolder *parent)
|
||||
@@ -38,9 +37,6 @@ TorrentContentModelFolder::TorrentContentModelFolder(const QString &name, Torren
|
||||
{
|
||||
Q_ASSERT(parent);
|
||||
m_name = name;
|
||||
// Do not display incomplete extensions
|
||||
if (m_name.endsWith(QB_EXT))
|
||||
m_name.chop(4);
|
||||
}
|
||||
|
||||
TorrentContentModelFolder::TorrentContentModelFolder(const QVector<QString> &data)
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include <QVector>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include "base/bittorrent/common.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/bittorrent/trackerentry.h"
|
||||
@@ -93,9 +92,7 @@ namespace
|
||||
|
||||
for (const QString &filePath : asConst(torrent->filePaths()))
|
||||
{
|
||||
QString fileName = Utils::Fs::fileName(filePath);
|
||||
if (fileName.endsWith(QB_EXT))
|
||||
fileName.chop(QB_EXT.length());
|
||||
const QString fileName = Utils::Fs::fileName(filePath);
|
||||
if (Utils::Misc::isPreviewable(fileName))
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user