mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 15:07:22 -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user