Initial port to libtorrent v0.16

This commit is contained in:
Christophe Dumez
2011-04-17 10:29:44 +00:00
parent 4412476109
commit 3995af6489
15 changed files with 382 additions and 154 deletions

View File

@@ -558,14 +558,13 @@ public:
TorrentFileItem *current_parent;
// Iterate over files
int i = 0;
libtorrent::torrent_info::file_iterator fi = t.begin_files();
while(fi != t.end_files()) {
for(int i=0; i<t.num_files(); ++i) {
libtorrent::file_entry fentry = t.file_at(i);
current_parent = root_folder;
#if LIBTORRENT_VERSION_MINOR >= 16
QString path = QDir::cleanPath(misc::toQStringU(t.files().file_path(*fi))).replace("\\", "/");
QString path = QDir::cleanPath(misc::toQStringU(fentry.path)).replace("\\", "/");
#else
QString path = QDir::cleanPath(misc::toQStringU(fi->path.string())).replace("\\", "/");
QString path = QDir::cleanPath(misc::toQStringU(fentry.path.string())).replace("\\", "/");
#endif
// Iterate of parts of the path to create necessary folders
QStringList pathFolders = path.split("/");
@@ -579,10 +578,8 @@ public:
current_parent = new_parent;
}
// Actually create the file
TorrentFileItem *f = new TorrentFileItem(t, *fi, current_parent, i);
TorrentFileItem *f = new TorrentFileItem(t, fentry, current_parent, i);
files_index[i] = f;
fi++;
++i;
}
emit layoutChanged();
}