Skip to content

Commit

Permalink
- rough port to libtorrent v0.14.0. This is probably buggy but it com…
Browse files Browse the repository at this point in the history
…piles without warnings
  • Loading branch information
Christophe Dumez committed Nov 1, 2008
1 parent 19dd210 commit 764b4e7
Show file tree
Hide file tree
Showing 21 changed files with 262 additions and 611 deletions.
2 changes: 1 addition & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Dependencies:
- Qt >= 4.3.0 (libqt-devel, libqtgui, libqtcore, libqtnetwork, libqtxml)
Qt >= 4.4.0 is advised

- libtorrent-rasterbar by Arvid Norberg (>= v0.13.1 REQUIRED)
- libtorrent-rasterbar by Arvid Norberg (>= v0.14.0 REQUIRED)
-> http:https://www.qbittorrent.org/download.php (advised)
-> http:https://www.libtorrent.net
Be careful: another library (the one used by rTorrent) uses a similar name.
Expand Down
6 changes: 3 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,13 @@ class qc_libtorrent_rasterbar : public ConfObj
{
public:
qc_libtorrent_rasterbar(Conf *c) : ConfObj(c) {}
QString name() const { return "libtorrent-rasterbar >= 0.13"; }
QString name() const { return "libtorrent-rasterbar >= 0.14"; }
QString shortname() const { return "libtorrent-rasterbar"; }
bool exec(){
QString s;
s = conf->getenv("QC_WITH_LIBTORRENT_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "libtorrent/lsd.hpp")) {
if(!conf->checkHeader(s, "libtorrent/magnet_uri.hpp")) {
return false;
}
}else{
Expand All @@ -391,7 +391,7 @@ public:
sl << "/usr/local/include";
bool found = false;
foreach(s, sl){
if(conf->checkHeader(s, "libtorrent/lsd.hpp")){
if(conf->checkHeader(s, "libtorrent/magnet_uri.hpp")){
found = true;
break;
}
Expand Down
6 changes: 3 additions & 3 deletions qcm/libtorrent-rasterbar.qcm
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class qc_libtorrent_rasterbar : public ConfObj
{
public:
qc_libtorrent_rasterbar(Conf *c) : ConfObj(c) {}
QString name() const { return "libtorrent-rasterbar >= 0.13"; }
QString name() const { return "libtorrent-rasterbar >= 0.14"; }
QString shortname() const { return "libtorrent-rasterbar"; }
bool exec(){
QString s;
s = conf->getenv("QC_WITH_LIBTORRENT_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "libtorrent/lsd.hpp")) {
if(!conf->checkHeader(s, "libtorrent/magnet_uri.hpp")) {
return false;
}
}else{
Expand All @@ -25,7 +25,7 @@ public:
sl << "/usr/local/include";
bool found = false;
foreach(s, sl){
if(conf->checkHeader(s, "libtorrent/lsd.hpp")){
if(conf->checkHeader(s, "libtorrent/magnet_uri.hpp")){
found = true;
break;
}
Expand Down
Binary file removed src/Icons/skin/connecting.png
Binary file not shown.
22 changes: 11 additions & 11 deletions src/arborescence.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,41 +172,41 @@ class arborescence {
torrent_file *root;

public:
arborescence(torrent_info t) {
torrent_info::file_iterator fi = t.begin_files();
if(t.num_files() > 1) {
root = new torrent_file(0, misc::toQString(t.name()), true);
arborescence(boost::intrusive_ptr<torrent_info> t) {
torrent_info::file_iterator fi = t->begin_files();
if(t->num_files() > 1) {
root = new torrent_file(0, misc::toQString(t->name()), true);
} else {
// XXX: Will crash if there is no file in torrent
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0);
root = new torrent_file(0, misc::toQString(t->name()), false, fi->size, 0);
return;
}
int i = 0;
while(fi != t.end_files()) {
while(fi != t->end_files()) {
QString path = QDir::cleanPath(misc::toQString(fi->path.string()));
addFile(path, fi->size, i);
fi++;
++i;
}
qDebug("real size: %ld, tree size: %ld", (long)t.total_size(), (long)root->getSize());
Q_ASSERT(root->getSize() == t.total_size());
qDebug("real size: %ld, tree size: %ld", (long)t->total_size(), (long)root->getSize());
Q_ASSERT(root->getSize() == t->total_size());
}

arborescence(torrent_info t, std::vector<float> fp, int *prioritiesTab) {
arborescence(torrent_info const& t, std::vector<size_type> fp, int *prioritiesTab) {
torrent_info::file_iterator fi = t.begin_files();
if(t.num_files() > 1) {
qDebug("More than one file in the torrent, setting a folder as root");
root = new torrent_file(0, misc::toQString(t.name()), true);
} else {
// XXX: Will crash if there is no file in torrent
qDebug("one file in the torrent, setting it as root with index 0");
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0, fp[0], prioritiesTab[0]);
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0, fp[0]/t.file_at(0).size, prioritiesTab[0]);
return;
}
int i = 0;
while(fi != t.end_files()) {
QString path = QDir::cleanPath(misc::toQString(fi->path.string()));
addFile(path, fi->size, i, fp[i], prioritiesTab[i]);
addFile(path, fi->size, i, fp[i]/t.file_at(i).size, prioritiesTab[i]);
fi++;
++i;
}
Expand Down
Loading

0 comments on commit 764b4e7

Please sign in to comment.