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. @@ -16,8 +16,8 @@ will install and execute qBittorrent hopefully without any problems.
Dependencies:
- Qt >= 4.2 (libqt-devel, libqtgui, libqtcore, libqtnetwork, libqtxml)
- libtorrent by Arvid Norberg (>= v0.12 REQUIRED)
-> http://libtorrent.sf.net
- libtorrent by Arvid Norberg (>= v0.13 REQUIRED)
-> http://www.libtorrent.net
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
on sourceforge (created by Arvid Norberg). The two libraries conflicts with each other.
@ -26,9 +26,6 @@ Dependencies: @@ -26,9 +26,6 @@ Dependencies:
- 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.
NOTE FOR GNOME USERS:

6
TODO

@ -40,10 +40,10 @@ @@ -40,10 +40,10 @@
- Display Url seeds in torrent properties and allow to edit them
- Use tooltips to explain options?
- Display more info in log (UPnP)
- Update to libtorrent SVN (0.13)
- Use its UPnP/NAT-PMP built-in support instead of ours
- Update to libtorrent SVN (0.13) - DONE
- Use its UPnP/NAT-PMP built-in support instead of ours ALMOST
- 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...
- 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

104
configure vendored

@ -23,10 +23,6 @@ Dependency options: @@ -23,10 +23,6 @@ Dependency options:
--with-libboost-inc=[path] Path to libboost include files
--with-libcurl-inc=[path] Path to libcurl include 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
}
@ -168,26 +164,6 @@ while [ $# -gt 0 ]; do @@ -168,26 +164,6 @@ while [ $# -gt 0 ]; do
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)
QC_DEBUG="Y"
shift
@ -214,10 +190,6 @@ echo QC_WITH_LIBTORRENT_LIB=$QC_WITH_LIBTORRENT_LIB @@ -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_LIBCURL_INC=$QC_WITH_LIBCURL_INC
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
fi
@ -323,13 +295,13 @@ class qc_libtorrent : public ConfObj @@ -323,13 +295,13 @@ class qc_libtorrent : public ConfObj
{
public:
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"; }
bool exec(){
QString s;
s = conf->getenv("QC_WITH_LIBTORRENT_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "libtorrent/extensions/ut_pex.hpp")) {
if(!conf->checkHeader(s, "libtorrent/lsd.hpp")) {
return false;
}
}else{
@ -338,7 +310,7 @@ public: @@ -338,7 +310,7 @@ public:
sl << "/usr/local/include";
bool found = false;
foreach(s, sl){
if(conf->checkHeader(s, "libtorrent/extensions/ut_pex.hpp")){
if(conf->checkHeader(s, "libtorrent/lsd.hpp")){
found = true;
break;
}
@ -513,69 +485,6 @@ public: @@ -513,69 +485,6 @@ public:
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
cat >$1/modules_new.cpp <<EOT
@ -594,9 +503,6 @@ cat >$1/modules_new.cpp <<EOT @@ -594,9 +503,6 @@ cat >$1/modules_new.cpp <<EOT
o = new qc_python(conf);
o->required = true;
o->disabled = false;
o = new qc_libupnp(conf);
o->required = false;
o->disabled = false;
EOT
cat >$1/conf4.h <<EOT
@ -1528,10 +1434,6 @@ export QC_WITH_LIBTORRENT_LIB @@ -1528,10 +1434,6 @@ export QC_WITH_LIBTORRENT_LIB
export QC_WITH_LIBBOOST_INC
export QC_WITH_LIBCURL_INC
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
rm -rf .qconftemp
(

3
qbittorrent.qc

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

6
qcm/libtorrent.qcm

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

62
qcm/libupnp.qcm

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

4
src/createtorrent_imp.cpp

@ -182,11 +182,11 @@ void createtorrent::on_createButton_clicked(){ @@ -182,11 +182,11 @@ void createtorrent::on_createButton_clicked(){
// calculate the hash for all pieces
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();
std::vector<char> buf(piece_size);
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));
t.set_hash(i, h.final());
}

3
src/src.pro

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

Loading…
Cancel
Save