From ee96f832117cdc5fc6de35a05df35f57b202353d Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Mon, 2 Jul 2012 19:31:51 +0300 Subject: [PATCH] Fix torrent content sorting in torrent addition dialog (closes #1020160) --- src/addnewtorrentdialog.cpp | 9 +++++---- src/addnewtorrentdialog.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/addnewtorrentdialog.cpp b/src/addnewtorrentdialog.cpp index 716d54e8d..1ba89aa31 100644 --- a/src/addnewtorrentdialog.cpp +++ b/src/addnewtorrentdialog.cpp @@ -32,6 +32,7 @@ #include "ui_addnewtorrentdialog.h" #include "proplistdelegate.h" #include "torrentcontentmodel.h" +#include "torrentcontentfiltermodel.h" #include "preferences.h" #include "qinisettings.h" #include "torrentpersistentdata.h" @@ -174,7 +175,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString // Prepare content tree if (m_torrentInfo->num_files() > 1) { - m_contentModel = new TorrentContentModel(this); + m_contentModel = new TorrentContentFilterModel(this); connect(m_contentModel, SIGNAL(filteredFilesChanged()), SLOT(updateDiskSpaceLabel())); ui->content_tree->setModel(m_contentModel); 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&))); // List files in torrent - m_contentModel->setupModelData(*m_torrentInfo); + m_contentModel->model()->setupModelData(*m_torrentInfo); // Expand root folder ui->content_tree->setExpanded(m_contentModel->index(0, 0), true); @@ -272,7 +273,7 @@ void AddNewTorrentDialog::updateDiskSpaceLabel() // Determine torrent size qulonglong torrent_size = 0; if (m_contentModel) { - const std::vector priorities = m_contentModel->getFilesPriorities(); + const std::vector priorities = m_contentModel->model()->getFilesPriorities(); Q_ASSERT(priorities.size() == (uint) m_torrentInfo->num_files()); for (uint i=0; i 0) @@ -531,7 +532,7 @@ void AddNewTorrentDialog::on_buttonBox_accepted() // Save file priorities if (m_contentModel) - TorrentTempData::setFilesPriority(m_hash, m_contentModel->getFilesPriorities()); + TorrentTempData::setFilesPriority(m_hash, m_contentModel->model()->getFilesPriorities()); // Rename files if necessary if (m_hasRenamedFile) diff --git a/src/addnewtorrentdialog.h b/src/addnewtorrentdialog.h index a1bea4339..fb4bde13a 100644 --- a/src/addnewtorrentdialog.h +++ b/src/addnewtorrentdialog.h @@ -41,7 +41,7 @@ class AddNewTorrentDialog; } QT_END_NAMESPACE -class TorrentContentModel; +class TorrentContentFilterModel; class PropListDelegate; class AddNewTorrentDialog : public QDialog @@ -75,7 +75,7 @@ private: private: Ui::AddNewTorrentDialog *ui; - TorrentContentModel *m_contentModel; + TorrentContentFilterModel *m_contentModel; PropListDelegate *m_contentDelegate; bool m_isMagnet; QString m_filePath;