Browse Source

- Upgraded to libtorrent svn (0.13)

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
658771612a
  1. 7
      INSTALL
  2. 6
      TODO
  3. 104
      configure
  4. 3
      qbittorrent.qc
  5. 6
      qcm/libtorrent.qcm
  6. 62
      qcm/libupnp.qcm
  7. 47
      src/allocationDlg.h
  8. 4
      src/createtorrent_imp.cpp
  9. 3
      src/src.pro

7
INSTALL

@ -16,8 +16,8 @@ will install and execute qBittorrent hopefully without any problems.
Dependencies: Dependencies:
- Qt >= 4.2 (libqt-devel, libqtgui, libqtcore, libqtnetwork, libqtxml) - Qt >= 4.2 (libqt-devel, libqtgui, libqtcore, libqtnetwork, libqtxml)
- libtorrent by Arvid Norberg (>= v0.12 REQUIRED) - libtorrent by Arvid Norberg (>= v0.13 REQUIRED)
-> http://libtorrent.sf.net -> http://www.libtorrent.net
Be carefull: another library (the one used by rtorrent) use the same name. Be carefull: another library (the one used by rtorrent) use the same name.
These are TWO different libraries and qBittorrent will only work with the one provided These are TWO different libraries and qBittorrent will only work with the one provided
on sourceforge (created by Arvid Norberg). The two libraries conflicts with each other. on sourceforge (created by Arvid Norberg). The two libraries conflicts with each other.
@ -26,9 +26,6 @@ Dependencies:
- libcurl - libcurl
- libupnp (>= 1.2.1) *OPTIONAL*
-> For Universal Plug 'n Play Port forwarding support
- python >= 2.3 (previous might work - not tested): needed by search engine. - python >= 2.3 (previous might work - not tested): needed by search engine.
NOTE FOR GNOME USERS: NOTE FOR GNOME USERS:

6
TODO

@ -40,10 +40,10 @@
- Display Url seeds in torrent properties and allow to edit them - Display Url seeds in torrent properties and allow to edit them
- Use tooltips to explain options? - Use tooltips to explain options?
- Display more info in log (UPnP) - Display more info in log (UPnP)
- Update to libtorrent SVN (0.13) - Update to libtorrent SVN (0.13) - DONE
- Use its UPnP/NAT-PMP built-in support instead of ours - Use its UPnP/NAT-PMP built-in support instead of ours ALMOST
- Use its piece prioritization support - Use its piece prioritization support
- Get upload/download limit per torrent (uncomment some code) - Get upload/download limit per torrent (uncomment some code) ALMOST
- Improve ratio display / calculation / saving / per torrent... - Improve ratio display / calculation / saving / per torrent...
- Display the sum of the size of the selected files in the torrent instead of the whole torrent size in download list - Display the sum of the size of the selected files in the torrent instead of the whole torrent size in download list
- Sorting in Download Status column should be smarter than just an alphabetical sort - Sorting in Download Status column should be smarter than just an alphabetical sort

104
configure vendored

@ -23,10 +23,6 @@ Dependency options:
--with-libboost-inc=[path] Path to libboost include files --with-libboost-inc=[path] Path to libboost include files
--with-libcurl-inc=[path] Path to libcurl include files --with-libcurl-inc=[path] Path to libcurl include files
--with-libcurl-lib=[path] Path to libcurl library files --with-libcurl-lib=[path] Path to libcurl library files
--disable-libupnp Disable use of libupnp
--disable-upnp disable UPnP support
--with-libupnp-inc=[path] Path to libupnp include files
--with-libupnp-lib=[path] Path to libupnp library files
EOT EOT
} }
@ -168,26 +164,6 @@ while [ $# -gt 0 ]; do
shift shift
;; ;;
--disable-libupnp)
QC_DISABLE_libupnp="Y"
shift
;;
--disable-upnp)
QC_DISABLE_UPNP="Y"
shift
;;
--with-libupnp-inc=*)
QC_WITH_LIBUPNP_INC=$optarg
shift
;;
--with-libupnp-lib=*)
QC_WITH_LIBUPNP_LIB=$optarg
shift
;;
--verbose) --verbose)
QC_DEBUG="Y" QC_DEBUG="Y"
shift shift
@ -214,10 +190,6 @@ echo QC_WITH_LIBTORRENT_LIB=$QC_WITH_LIBTORRENT_LIB
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
echo QC_WITH_LIBCURL_INC=$QC_WITH_LIBCURL_INC echo QC_WITH_LIBCURL_INC=$QC_WITH_LIBCURL_INC
echo QC_WITH_LIBCURL_LIB=$QC_WITH_LIBCURL_LIB echo QC_WITH_LIBCURL_LIB=$QC_WITH_LIBCURL_LIB
echo QC_DISABLE_libupnp=$QC_DISABLE_libupnp
echo QC_DISABLE_UPNP=$QC_DISABLE_UPNP
echo QC_WITH_LIBUPNP_INC=$QC_WITH_LIBUPNP_INC
echo QC_WITH_LIBUPNP_LIB=$QC_WITH_LIBUPNP_LIB
echo echo
fi fi
@ -323,13 +295,13 @@ class qc_libtorrent : public ConfObj
{ {
public: public:
qc_libtorrent(Conf *c) : ConfObj(c) {} qc_libtorrent(Conf *c) : ConfObj(c) {}
QString name() const { return "libtorrent >= 0.12"; } QString name() const { return "libtorrent >= 0.13"; }
QString shortname() const { return "libtorrent"; } QString shortname() const { return "libtorrent"; }
bool exec(){ bool exec(){
QString s; QString s;
s = conf->getenv("QC_WITH_LIBTORRENT_INC"); s = conf->getenv("QC_WITH_LIBTORRENT_INC");
if(!s.isEmpty()) { if(!s.isEmpty()) {
if(!conf->checkHeader(s, "libtorrent/extensions/ut_pex.hpp")) { if(!conf->checkHeader(s, "libtorrent/lsd.hpp")) {
return false; return false;
} }
}else{ }else{
@ -338,7 +310,7 @@ public:
sl << "/usr/local/include"; sl << "/usr/local/include";
bool found = false; bool found = false;
foreach(s, sl){ foreach(s, sl){
if(conf->checkHeader(s, "libtorrent/extensions/ut_pex.hpp")){ if(conf->checkHeader(s, "libtorrent/lsd.hpp")){
found = true; found = true;
break; break;
} }
@ -513,69 +485,6 @@ public:
return false; return false;
} }
}; };
#line 1 "libupnp.qcm"
/*
-----BEGIN QCMOD-----
name: libupnp
arg: disable-upnp, disable UPnP support
arg: with-libupnp-inc=[path], Path to libupnp include files
arg: with-libupnp-lib=[path], Path to libupnp library files
-----END QCMOD-----
*/
class qc_libupnp : public ConfObj
{
public:
qc_libupnp(Conf *c) : ConfObj(c) {}
QString name() const { return "libupnp"; }
QString shortname() const { return "libupnp"; }
bool exec(){
QString s;
s = conf->getenv("QC_DISABLE_UPNP");
if(!s.isEmpty()){
conf->addDefine("NO_UPNP");
return false;
}
s = conf->getenv("QC_WITH_LIBUPNP_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "upnp/upnp.h")) {
//qWarning("libupnp includes not found!");
conf->addDefine("NO_UPNP");
return false;
}
conf->addIncludePath(s);
}else{
QStringList sl;
sl += "/usr/include";
sl += "/usr/local/include";
if(!conf->findHeader("upnp/upnp.h", sl, &s)) {
//qWarning("libupnp includes not found!");
conf->addDefine("NO_UPNP");
return false;
}
conf->addIncludePath(s);
}
s = conf->getenv("QC_WITH_LIBUPNP_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "upnp")) {
qWarning("libupnp library not found!");
return false;
}
conf->addLib(QString("-L") + s);
}else{
if(!conf->findLibrary("upnp", &s)) {
qWarning("libupnp library not found!");
return false;
}
if (!s.isEmpty())
conf->addLib(QString("-L") + s);
}
conf->addLib("-lupnp");
return true;
}
};
EOT EOT
cat >$1/modules_new.cpp <<EOT cat >$1/modules_new.cpp <<EOT
@ -594,9 +503,6 @@ cat >$1/modules_new.cpp <<EOT
o = new qc_python(conf); o = new qc_python(conf);
o->required = true; o->required = true;
o->disabled = false; o->disabled = false;
o = new qc_libupnp(conf);
o->required = false;
o->disabled = false;
EOT EOT
cat >$1/conf4.h <<EOT cat >$1/conf4.h <<EOT
@ -1528,10 +1434,6 @@ export QC_WITH_LIBTORRENT_LIB
export QC_WITH_LIBBOOST_INC export QC_WITH_LIBBOOST_INC
export QC_WITH_LIBCURL_INC export QC_WITH_LIBCURL_INC
export QC_WITH_LIBCURL_LIB export QC_WITH_LIBCURL_LIB
export QC_DISABLE_libupnp
export QC_DISABLE_UPNP
export QC_WITH_LIBUPNP_INC
export QC_WITH_LIBUPNP_LIB
export QC_DEBUG export QC_DEBUG
rm -rf .qconftemp rm -rf .qconftemp
( (

3
qbittorrent.qc

@ -17,7 +17,4 @@
<dep type='python'> <dep type='python'>
<required/> <required/>
</dep> </dep>
<dep type='libupnp'>
<optional/>
</dep>
</qconf> </qconf>

6
qcm/libtorrent.qcm

@ -9,13 +9,13 @@ class qc_libtorrent : public ConfObj
{ {
public: public:
qc_libtorrent(Conf *c) : ConfObj(c) {} qc_libtorrent(Conf *c) : ConfObj(c) {}
QString name() const { return "libtorrent >= 0.12"; } QString name() const { return "libtorrent >= 0.13"; }
QString shortname() const { return "libtorrent"; } QString shortname() const { return "libtorrent"; }
bool exec(){ bool exec(){
QString s; QString s;
s = conf->getenv("QC_WITH_LIBTORRENT_INC"); s = conf->getenv("QC_WITH_LIBTORRENT_INC");
if(!s.isEmpty()) { if(!s.isEmpty()) {
if(!conf->checkHeader(s, "libtorrent/extensions/ut_pex.hpp")) { if(!conf->checkHeader(s, "libtorrent/lsd.hpp")) {
return false; return false;
} }
}else{ }else{
@ -24,7 +24,7 @@ public:
sl << "/usr/local/include"; sl << "/usr/local/include";
bool found = false; bool found = false;
foreach(s, sl){ foreach(s, sl){
if(conf->checkHeader(s, "libtorrent/extensions/ut_pex.hpp")){ if(conf->checkHeader(s, "libtorrent/lsd.hpp")){
found = true; found = true;
break; break;
} }

62
qcm/libupnp.qcm

@ -1,62 +0,0 @@
/*
-----BEGIN QCMOD-----
name: libupnp
arg: disable-upnp, disable UPnP support
arg: with-libupnp-inc=[path], Path to libupnp include files
arg: with-libupnp-lib=[path], Path to libupnp library files
-----END QCMOD-----
*/
class qc_libupnp : public ConfObj
{
public:
qc_libupnp(Conf *c) : ConfObj(c) {}
QString name() const { return "libupnp"; }
QString shortname() const { return "libupnp"; }
bool exec(){
QString s;
s = conf->getenv("QC_DISABLE_UPNP");
if(!s.isEmpty()){
conf->addDefine("NO_UPNP");
return false;
}
s = conf->getenv("QC_WITH_LIBUPNP_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "upnp/upnp.h")) {
//qWarning("libupnp includes not found!");
conf->addDefine("NO_UPNP");
return false;
}
conf->addIncludePath(s);
}else{
QStringList sl;
sl += "/usr/include";
sl += "/usr/local/include";
if(!conf->findHeader("upnp/upnp.h", sl, &s)) {
//qWarning("libupnp includes not found!");
conf->addDefine("NO_UPNP");
return false;
}
conf->addIncludePath(s);
}
s = conf->getenv("QC_WITH_LIBUPNP_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "upnp")) {
qWarning("libupnp library not found!");
return false;
}
conf->addLib(QString("-L") + s);
}else{
if(!conf->findLibrary("upnp", &s)) {
qWarning("libupnp library not found!");
return false;
}
if (!s.isEmpty())
conf->addLib(QString("-L") + s);
}
conf->addLib("-lupnp");
return true;
}
};

47
src/allocationDlg.h

@ -55,23 +55,28 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
} }
unsigned int nbTorrents = handles.size(); unsigned int nbTorrents = handles.size();
if(!nbTorrents) close(); if(!nbTorrents) close();
// TODO: Uncomment the following lines as soon as we upgrade int val;
// to libtorrent svn to correctly initialize the bandwidth slider. if(nbTorrents == 1){
// if(nbTorrents == 1){ torrent_handle h = handles[0];
// if(uploadMode) { if(uploadMode)
// int val = h.upload_limit(); val = h.upload_limit();
// if(val > bandwidthSlider->maximum() || val < bandwidthSlider->minimum()) else
// val = -1; val = h.download_limit();
// bandwidthSlider->setValue(val); if(val > bandwidthSlider->maximum() || val < bandwidthSlider->minimum())
// } else { val = -1;
// int val = h.download_limit(); bandwidthSlider->setValue(val);
// if(val > bandwidthSlider->maximum() || val < bandwidthSlider->minimum()) if(val == -1) {
// val = -1; limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
// bandwidthSlider->setValue(val); kb_lbl->setText("");
// } } else {
// }else{ limit_lbl->setText(QString(misc::toString(val).c_str()));
// bandwidthSlider->setValue(-1); }
// } }else{
qDebug("More than one torrent selected, no initilization");
bandwidthSlider->setValue(-1);
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
kb_lbl->setText("");
}
connect(buttonBox, SIGNAL(accepted()), this, SLOT(setBandwidth())); connect(buttonBox, SIGNAL(accepted()), this, SLOT(setBandwidth()));
show(); show();
} }
@ -95,11 +100,15 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
int val = bandwidthSlider->value(); int val = bandwidthSlider->value();
torrent_handle h; torrent_handle h;
if(uploadMode) { if(uploadMode) {
foreach(h, handles) foreach(h, handles) {
h.set_upload_limit(val); h.set_upload_limit(val);
qDebug("Setting upload limit");
}
} else { } else {
foreach(h, handles) foreach(h, handles) {
h.set_download_limit(val); h.set_download_limit(val);
qDebug("Setting download limit");
}
} }
close(); close();
} }

4
src/createtorrent_imp.cpp

@ -182,11 +182,11 @@ void createtorrent::on_createButton_clicked(){
// calculate the hash for all pieces // calculate the hash for all pieces
file_pool fp; file_pool fp;
storage st(t, full_path.branch_path(), fp); boost::scoped_ptr<storage_interface> st(default_storage_constructor(t, full_path.branch_path(), fp));
int num = t.num_pieces(); int num = t.num_pieces();
std::vector<char> buf(piece_size); std::vector<char> buf(piece_size);
for (int i = 0; i < num; ++i) { for (int i = 0; i < num; ++i) {
st.read(&buf[0], i, 0, t.piece_size(i)); st->read(&buf[0], i, 0, t.piece_size(i));
hasher h(&buf[0], t.piece_size(i)); hasher h(&buf[0], t.piece_size(i));
t.set_hash(i, h.final()); t.set_hash(i, h.final());
} }

3
src/src.pro

@ -16,6 +16,9 @@ DEFINES += VERSION_MAJOR=0
DEFINES += VERSION_MINOR=10 DEFINES += VERSION_MINOR=10
DEFINES += VERSION_BUGFIX=0 DEFINES += VERSION_BUGFIX=0
# Temporary hack
DEFINES += NO_UPNP
contains(DEBUG_MODE, 1){ contains(DEBUG_MODE, 1){
CONFIG += debug CONFIG += debug
message(Debug build!) message(Debug build!)

Loading…
Cancel
Save