Browse Source

TorrentContentModel clean up

adaptive-webui-19844
Christophe Dumez 12 years ago
parent
commit
f73f267997
  1. 8
      src/torrentcontentmodel.cpp
  2. 3
      src/torrentcontentmodelfile.cpp
  3. 3
      src/torrentcontentmodelfolder.cpp

8
src/torrentcontentmodel.cpp

@ -291,12 +291,16 @@ void TorrentContentModel::setupModelData(const libtorrent::torrent_info& t)
if (pathPart == ".unwanted") if (pathPart == ".unwanted")
continue; continue;
TorrentContentModelFolder* new_parent = current_parent->childFolderWithName(pathPart); TorrentContentModelFolder* new_parent = current_parent->childFolderWithName(pathPart);
if (!new_parent) if (!new_parent) {
new_parent = new TorrentContentModelFolder(pathPart, current_parent); new_parent = new TorrentContentModelFolder(pathPart, current_parent);
current_parent->appendChild(new_parent);
}
current_parent = new_parent; current_parent = new_parent;
} }
// Actually create the file // Actually create the file
m_filesIndex.push_back(new TorrentContentModelFile(fentry, current_parent, i)); TorrentContentModelFile* fileItem = new TorrentContentModelFile(fentry, current_parent, i);
current_parent->appendChild(fileItem);
m_filesIndex.push_back(fileItem);
} }
emit layoutChanged(); emit layoutChanged();
} }

3
src/torrentcontentmodelfile.cpp

@ -52,9 +52,6 @@ TorrentContentModelFile::TorrentContentModelFile(const libtorrent::file_entry& f
m_name.chop(4); m_name.chop(4);
m_size = (qulonglong)f.size; m_size = (qulonglong)f.size;
// Add to parent
m_parentItem->appendChild(this);
} }
int TorrentContentModelFile::fileIndex() const int TorrentContentModelFile::fileIndex() const

3
src/torrentcontentmodelfolder.cpp

@ -38,9 +38,6 @@ TorrentContentModelFolder::TorrentContentModelFolder(const QString& name, Torren
// Do not display incomplete extensions // Do not display incomplete extensions
if (m_name.endsWith(".!qB")) if (m_name.endsWith(".!qB"))
m_name.chop(4); m_name.chop(4);
// Add to parent
m_parentItem->appendChild(this);
} }
TorrentContentModelFolder::TorrentContentModelFolder(const QList<QVariant>& data) TorrentContentModelFolder::TorrentContentModelFolder(const QList<QVariant>& data)

Loading…
Cancel
Save