mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-09 14:27:56 +00:00
Fix Preview for .!qB extended files
This commit is contained in:
parent
3e7329fb07
commit
c7efd0dd05
@ -81,8 +81,18 @@ QString fsutils::toDisplayPath(const QString& path)
|
|||||||
*/
|
*/
|
||||||
QString fsutils::fileExtension(const QString &filename)
|
QString fsutils::fileExtension(const QString &filename)
|
||||||
{
|
{
|
||||||
const int point_index = filename.lastIndexOf(".");
|
QString holder;
|
||||||
return (point_index >= 0) ? filename.mid(point_index + 1) : QString();
|
int point_index = filename.lastIndexOf(".");
|
||||||
|
if (point_index >= 0) {
|
||||||
|
QString holder = filename.mid(point_index + 1);
|
||||||
|
if (holder == "!qB") {
|
||||||
|
holder = filename.mid(0, point_index);
|
||||||
|
point_index = holder.lastIndexOf(".");
|
||||||
|
holder = (point_index >= 0) ? holder.mid(point_index + 1) : QString();
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
|
}
|
||||||
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString fsutils::fileName(const QString& file_path)
|
QString fsutils::fileName(const QString& file_path)
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "previewlistdelegate.h"
|
#include "previewlistdelegate.h"
|
||||||
#include "previewselect.h"
|
#include "previewselect.h"
|
||||||
|
#include "fs_utils.h"
|
||||||
|
|
||||||
PreviewSelect::PreviewSelect(QWidget* parent, QTorrentHandle h): QDialog(parent), h(h) {
|
PreviewSelect::PreviewSelect(QWidget* parent, QTorrentHandle h): QDialog(parent), h(h) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@ -58,7 +59,7 @@ PreviewSelect::PreviewSelect(QWidget* parent, QTorrentHandle h): QDialog(parent)
|
|||||||
unsigned int nbFiles = h.num_files();
|
unsigned int nbFiles = h.num_files();
|
||||||
for (unsigned int i=0; i<nbFiles; ++i) {
|
for (unsigned int i=0; i<nbFiles; ++i) {
|
||||||
QString fileName = h.filename_at(i);
|
QString fileName = h.filename_at(i);
|
||||||
QString extension = fileName.split(QString::fromUtf8(".")).last().toUpper();
|
QString extension = fsutils::fileExtension(fileName).toUpper();
|
||||||
if (misc::isPreviewable(extension)) {
|
if (misc::isPreviewable(extension)) {
|
||||||
int row = previewListModel->rowCount();
|
int row = previewListModel->rowCount();
|
||||||
previewListModel->insertRow(row);
|
previewListModel->insertRow(row);
|
||||||
|
Loading…
Reference in New Issue
Block a user