Browse Source

Fix torrent content sorting in torrent addition dialog (closes #1020160)

adaptive-webui-19844
Christophe Dumez 12 years ago
parent
commit
ee96f83211
  1. 9
      src/addnewtorrentdialog.cpp
  2. 4
      src/addnewtorrentdialog.h

9
src/addnewtorrentdialog.cpp

@ -32,6 +32,7 @@ @@ -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 @@ -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 @@ -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() @@ -272,7 +273,7 @@ void AddNewTorrentDialog::updateDiskSpaceLabel()
// Determine torrent size
qulonglong torrent_size = 0;
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());
for (uint i=0; i<priorities.size(); ++i) {
if (priorities[i] > 0)
@ -531,7 +532,7 @@ void AddNewTorrentDialog::on_buttonBox_accepted() @@ -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)

4
src/addnewtorrentdialog.h

@ -41,7 +41,7 @@ class AddNewTorrentDialog; @@ -41,7 +41,7 @@ class AddNewTorrentDialog;
}
QT_END_NAMESPACE
class TorrentContentModel;
class TorrentContentFilterModel;
class PropListDelegate;
class AddNewTorrentDialog : public QDialog
@ -75,7 +75,7 @@ private: @@ -75,7 +75,7 @@ private:
private:
Ui::AddNewTorrentDialog *ui;
TorrentContentModel *m_contentModel;
TorrentContentFilterModel *m_contentModel;
PropListDelegate *m_contentDelegate;
bool m_isMagnet;
QString m_filePath;

Loading…
Cancel
Save