mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-30 03:28:41 -07:00
Fix torrent content sorting in torrent addition dialog (closes #1020160)
This commit is contained in:
parent
b095a1e3fe
commit
ee96f83211
2 changed files with 7 additions and 6 deletions
|
@ -32,6 +32,7 @@
|
||||||
#include "ui_addnewtorrentdialog.h"
|
#include "ui_addnewtorrentdialog.h"
|
||||||
#include "proplistdelegate.h"
|
#include "proplistdelegate.h"
|
||||||
#include "torrentcontentmodel.h"
|
#include "torrentcontentmodel.h"
|
||||||
|
#include "torrentcontentfiltermodel.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "qinisettings.h"
|
#include "qinisettings.h"
|
||||||
#include "torrentpersistentdata.h"
|
#include "torrentpersistentdata.h"
|
||||||
|
@ -174,7 +175,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString
|
||||||
|
|
||||||
// Prepare content tree
|
// Prepare content tree
|
||||||
if (m_torrentInfo->num_files() > 1) {
|
if (m_torrentInfo->num_files() > 1) {
|
||||||
m_contentModel = new TorrentContentModel(this);
|
m_contentModel = new TorrentContentFilterModel(this);
|
||||||
connect(m_contentModel, SIGNAL(filteredFilesChanged()), SLOT(updateDiskSpaceLabel()));
|
connect(m_contentModel, SIGNAL(filteredFilesChanged()), SLOT(updateDiskSpaceLabel()));
|
||||||
ui->content_tree->setModel(m_contentModel);
|
ui->content_tree->setModel(m_contentModel);
|
||||||
ui->content_tree->hideColumn(PROGRESS);
|
ui->content_tree->hideColumn(PROGRESS);
|
||||||
|
@ -184,7 +185,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString
|
||||||
connect(ui->content_tree, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayContentTreeMenu(const QPoint&)));
|
connect(ui->content_tree, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayContentTreeMenu(const QPoint&)));
|
||||||
|
|
||||||
// List files in torrent
|
// List files in torrent
|
||||||
m_contentModel->setupModelData(*m_torrentInfo);
|
m_contentModel->model()->setupModelData(*m_torrentInfo);
|
||||||
|
|
||||||
// Expand root folder
|
// Expand root folder
|
||||||
ui->content_tree->setExpanded(m_contentModel->index(0, 0), true);
|
ui->content_tree->setExpanded(m_contentModel->index(0, 0), true);
|
||||||
|
@ -272,7 +273,7 @@ void AddNewTorrentDialog::updateDiskSpaceLabel()
|
||||||
// Determine torrent size
|
// Determine torrent size
|
||||||
qulonglong torrent_size = 0;
|
qulonglong torrent_size = 0;
|
||||||
if (m_contentModel) {
|
if (m_contentModel) {
|
||||||
const std::vector<int> priorities = m_contentModel->getFilesPriorities();
|
const std::vector<int> priorities = m_contentModel->model()->getFilesPriorities();
|
||||||
Q_ASSERT(priorities.size() == (uint) m_torrentInfo->num_files());
|
Q_ASSERT(priorities.size() == (uint) m_torrentInfo->num_files());
|
||||||
for (uint i=0; i<priorities.size(); ++i) {
|
for (uint i=0; i<priorities.size(); ++i) {
|
||||||
if (priorities[i] > 0)
|
if (priorities[i] > 0)
|
||||||
|
@ -531,7 +532,7 @@ void AddNewTorrentDialog::on_buttonBox_accepted()
|
||||||
|
|
||||||
// Save file priorities
|
// Save file priorities
|
||||||
if (m_contentModel)
|
if (m_contentModel)
|
||||||
TorrentTempData::setFilesPriority(m_hash, m_contentModel->getFilesPriorities());
|
TorrentTempData::setFilesPriority(m_hash, m_contentModel->model()->getFilesPriorities());
|
||||||
|
|
||||||
// Rename files if necessary
|
// Rename files if necessary
|
||||||
if (m_hasRenamedFile)
|
if (m_hasRenamedFile)
|
||||||
|
|
|
@ -41,7 +41,7 @@ class AddNewTorrentDialog;
|
||||||
}
|
}
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class TorrentContentModel;
|
class TorrentContentFilterModel;
|
||||||
class PropListDelegate;
|
class PropListDelegate;
|
||||||
|
|
||||||
class AddNewTorrentDialog : public QDialog
|
class AddNewTorrentDialog : public QDialog
|
||||||
|
@ -75,7 +75,7 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AddNewTorrentDialog *ui;
|
Ui::AddNewTorrentDialog *ui;
|
||||||
TorrentContentModel *m_contentModel;
|
TorrentContentFilterModel *m_contentModel;
|
||||||
PropListDelegate *m_contentDelegate;
|
PropListDelegate *m_contentDelegate;
|
||||||
bool m_isMagnet;
|
bool m_isMagnet;
|
||||||
QString m_filePath;
|
QString m_filePath;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue