From edcfa4df12f8d9cdc705f312daa8477e5e85c9a8 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 26 Aug 2012 21:39:28 +0300 Subject: [PATCH] TorrentContentModel code clean up --- src/torrentcontentmodel.cpp | 2 +- src/torrentcontentmodelitem.cpp | 9 ++++----- src/torrentcontentmodelitem.h | 3 +-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/torrentcontentmodel.cpp b/src/torrentcontentmodel.cpp index 65768c3da..4e89a268d 100644 --- a/src/torrentcontentmodel.cpp +++ b/src/torrentcontentmodel.cpp @@ -297,7 +297,7 @@ void TorrentContentModel::setupModelData(const libtorrent::torrent_info& t) current_parent = new_parent; } // Actually create the file - m_filesIndex.push_back(new TorrentContentModelItem(t, fentry, current_parent, i)); + m_filesIndex.push_back(new TorrentContentModelItem(fentry, current_parent, i)); } emit layoutChanged(); } diff --git a/src/torrentcontentmodelitem.cpp b/src/torrentcontentmodelitem.cpp index 05a0de560..41a858f0a 100644 --- a/src/torrentcontentmodelitem.cpp +++ b/src/torrentcontentmodelitem.cpp @@ -33,16 +33,15 @@ #include "torrentcontentmodelitem.h" #include -TorrentContentModelItem::TorrentContentModelItem(const libtorrent::torrent_info &t, - const libtorrent::file_entry &f, - TorrentContentModelItem *parent, - int file_index): +TorrentContentModelItem::TorrentContentModelItem(const libtorrent::file_entry &f, + TorrentContentModelItem *parent, + int file_index): m_parentItem(parent), m_type(TFILE), m_fileIndex(file_index), m_totalDone(0) { Q_ASSERT(parent); #if LIBTORRENT_VERSION_MINOR >= 16 - QString name = fsutils::fileName(misc::toQStringU(t.files().file_path(f))); + QString name = fsutils::fileName(misc::toQStringU(f.path.c_str())); #else Q_UNUSED(t); QString name = misc::toQStringU(f.path.filename()); diff --git a/src/torrentcontentmodelitem.h b/src/torrentcontentmodelitem.h index c0a57da8f..8f9101507 100644 --- a/src/torrentcontentmodelitem.h +++ b/src/torrentcontentmodelitem.h @@ -45,8 +45,7 @@ public: enum FileType {TFILE, FOLDER, ROOT}; // File Construction - TorrentContentModelItem(const libtorrent::torrent_info &t, - const libtorrent::file_entry &f, + TorrentContentModelItem(const libtorrent::file_entry &f, TorrentContentModelItem *parent, int file_index); // Folder constructor