From deeead4008b048f086bea863599e8b4aea2c9fa5 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 31 Aug 2008 12:21:41 +0000 Subject: [PATCH] - Compilation fix for boost v1.36 - Fixed 'start seeding after torrent creation' feature --- src/createtorrent_imp.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/createtorrent_imp.cpp b/src/createtorrent_imp.cpp index eb3e2f40c..d6774537a 100644 --- a/src/createtorrent_imp.cpp +++ b/src/createtorrent_imp.cpp @@ -45,7 +45,7 @@ createtorrent::createtorrent(QWidget *parent): QDialog(parent){ setupUi(this); setAttribute(Qt::WA_DeleteOnClose); creatorThread = new torrentCreatorThread(); - connect(creatorThread, SIGNAL(creationSuccess(QString)), this, SLOT(handleCreationSucess(QString))); + connect(creatorThread, SIGNAL(creationSuccess(QString, const char*, QString)), this, SLOT(handleCreationSuccess(QString, const char*, QString))); connect(creatorThread, SIGNAL(creationFailure(QString)), this, SLOT(handleCreationFailure(QString))); connect(creatorThread, SIGNAL(updateProgress(int)), this, SLOT(updateProgressBar(int))); show(); @@ -128,13 +128,36 @@ void createtorrent::on_addURLSeed_button_clicked(){ // Subfunction to add files to a torrent_info structure // Written by Arvid Norberg (libtorrent Author) +//void add_files(torrent_info& t, path const& p, path const& l){ +// qDebug("p: %s, l: %s, l.leaf(): %s", p.string().c_str(), l.string().c_str(), l.leaf().c_str()); +// path f(p / l); +// if (is_directory(f)){ +// for (directory_iterator i(f), end; i != end; ++i) +// add_files(t, p, l / i->leaf()); +// }else{ +// qDebug("Adding %s", l.string().c_str()); +// t.add_file(l, file_size(f)); +// } +//} + void add_files(torrent_info& t, path const& p, path const& l){ - qDebug("p: %s, l: %s, l.leaf(): %s", p.string().c_str(), l.string().c_str(), l.leaf().c_str()); + using boost::filesystem::path; + using boost::filesystem::directory_iterator; +#if BOOST_VERSION < 103600 + std::string const& leaf = l.leaf(); +#else + std::string const& leaf = l.filename(); +#endif + if (leaf == ".." || leaf == ".") return; path f(p / l); - if (is_directory(f)){ + if (is_directory(f)) { for (directory_iterator i(f), end; i != end; ++i) +#if BOOST_VERSION < 103600 add_files(t, p, l / i->leaf()); - }else{ +#else + add_files(t, p, l / i->filename()); +#endif + } else { qDebug("Adding %s", l.string().c_str()); t.add_file(l, file_size(f)); }