mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 21:21:24 -07:00
parent
9f6130cbaa
commit
f44341a8e2
11 changed files with 63 additions and 105 deletions
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue