Browse Source

Merge pull request #3494 from glassez/drop_libtorrent_0

Drop libtorrent 0.16.x support.
adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
6985b553af
  1. 5
      .travis.yml
  2. 10
      INSTALL
  3. 282
      configure
  4. 29
      configure.ac
  5. 6
      src/core/bittorrent/infohash.h
  6. 2
      src/core/bittorrent/magneturi.cpp
  7. 21
      src/core/bittorrent/peerinfo.cpp
  8. 40
      src/core/bittorrent/session.cpp
  9. 1
      src/core/bittorrent/torrentcreatorthread.cpp
  10. 46
      src/core/bittorrent/torrenthandle.cpp
  11. 8
      src/core/bittorrent/torrenthandle.h
  12. 14
      src/core/logger.cpp
  13. 11
      src/core/logger.h
  14. 42
      src/core/net/portforwarder.cpp
  15. 11
      src/core/net/portforwarder.h
  16. 2
      src/core/preferences.cpp
  17. 4
      src/core/preferences.h
  18. 4
      src/gui/executionlog.cpp
  19. 17
      src/gui/options_imp.cpp
  20. 9
      src/gui/properties/trackerlist.cpp
  21. 3
      src/gui/properties/trackerlist.h
  22. 4
      src/webui/prefjson.cpp

5
.travis.yml

@ -6,8 +6,6 @@ env: @@ -6,8 +6,6 @@ env:
# Uncomment when Travis upgraded "Ubuntu 12.04 LTS" to a newer version whose repo will have a more up-to-date libtorrent package
#- lt_branch=dist gui=true
#- lt_branch=dist gui=false
- lt_branch=RC_0_16 gui=true
- lt_branch=RC_0_16 gui=false
- lt_branch=RC_1_0 gui=true
- lt_branch=RC_1_0 gui=false
global:
@ -38,9 +36,6 @@ before_install: @@ -38,9 +36,6 @@ before_install:
- qbtconf="$qbtconf --with-qt4"
- ltconf=" --with-libgeoip=system"
# Options for specific branches
- if [[ "$lt_branch" == "RC_0_16" ]]; then qbtconf="$qbtconf --with-libtorrent-rasterbar0.16" ; fi
# Print settings
- echo $lt_branch
- echo $gui

10
INSTALL

@ -14,15 +14,11 @@ qBittorrent - A BitTorrent client in C++ / Qt4 @@ -14,15 +14,11 @@ qBittorrent - A BitTorrent client in C++ / Qt4
- pkg-config executable
- libtorrent-rasterbar by Arvid Norberg (>= 0.15.0)
- libtorrent-rasterbar by Arvid Norberg (>= 1.0.0)
-> http://www.libtorrent.net
Be careful: another library (the one used by rTorrent) uses a similar name.
- libboost 1.34.x (libboost-filesystem°) + libasio
or
- libboost >= 1.35.x (libboost-system, libboost-filesystem°)
°libboost-filesystem is not needed if libtorrent-rasterbar >= v0.16.x is used
- libboost >= 1.35.x (libboost-system)
- python >= 2.3 (needed by search engine)
* Run time only dependency
@ -44,7 +40,7 @@ qBittorrent - A BitTorrent client in C++ / Qt4 @@ -44,7 +40,7 @@ qBittorrent - A BitTorrent client in C++ / Qt4
- pkg-config executable
- libtorrent-rasterbar by Arvid Norberg (>= v0.15.0)
- libtorrent-rasterbar by Arvid Norberg (>= v1.0.0)
-> http://www.libtorrent.net
Be careful: another library (the one used by rTorrent) uses a similar name.

282
configure vendored

@ -601,10 +601,10 @@ EXPAND_BINDIR @@ -601,10 +601,10 @@ EXPAND_BINDIR
EXPAND_PREFIX
zlib_LIBS
zlib_CFLAGS
qjson_LIBS
qjson_CFLAGS
libtorrent_LIBS
libtorrent_CFLAGS
qjson_LIBS
qjson_CFLAGS
BOOST_SYSTEM_LIB
BOOST_LDFLAGS
BOOST_CPPFLAGS
@ -715,7 +715,6 @@ enable_option_checking @@ -715,7 +715,6 @@ enable_option_checking
enable_dependency_tracking
enable_silent_rules
with_qt5
with_libtorrent_rasterbar0_16
with_qtsingleapplication
with_qjson
enable_debug
@ -742,10 +741,10 @@ PKG_CONFIG @@ -742,10 +741,10 @@ PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
QT_QMAKE
libtorrent_CFLAGS
libtorrent_LIBS
qjson_CFLAGS
qjson_LIBS
libtorrent_CFLAGS
libtorrent_LIBS
zlib_CFLAGS
zlib_LIBS'
@ -1383,9 +1382,6 @@ Optional Packages: @@ -1383,9 +1382,6 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-qt5 Compile using Qt5 (default=no)
--with-libtorrent-rasterbar0.16
Compile using libtorrent-rasterbar 0.16.x series
(default=no)
--with-qtsingleapplication=[system|shipped]
Use the shipped qtsingleapplication library or the
system one (default=shipped)
@ -1422,13 +1418,13 @@ Some influential environment variables: @@ -1422,13 +1418,13 @@ Some influential environment variables:
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
QT_QMAKE value of moc_location for QtCore >= 4.8.0, overriding pkg-config
qjson_CFLAGS
C compiler flags for qjson, overriding pkg-config
qjson_LIBS linker flags for qjson, overriding pkg-config
libtorrent_CFLAGS
C compiler flags for libtorrent, overriding pkg-config
libtorrent_LIBS
linker flags for libtorrent, overriding pkg-config
qjson_CFLAGS
C compiler flags for qjson, overriding pkg-config
qjson_LIBS linker flags for qjson, overriding pkg-config
zlib_CFLAGS C compiler flags for zlib, overriding pkg-config
zlib_LIBS linker flags for zlib, overriding pkg-config
@ -2805,8 +2801,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2805,8 +2801,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@ -4167,7 +4163,6 @@ fi @@ -4167,7 +4163,6 @@ fi
# Define --wth-* and --enable-* arguments
@ -4180,15 +4175,6 @@ fi @@ -4180,15 +4175,6 @@ fi
# Check whether --with-libtorrent-rasterbar0.16 was given.
if test "${with_libtorrent_rasterbar0_16+set}" = set; then :
withval=$with_libtorrent_rasterbar0_16;
else
with_libtorrent_rasterbar0_16=no
fi
# Check whether --with-qtsingleapplication was given.
if test "${with_qtsingleapplication+set}" = set; then :
withval=$with_qtsingleapplication;
@ -5279,27 +5265,49 @@ $as_echo "$as_me: Boost.System LIB: $BOOST_SYSTEM_LIB" >&6;} @@ -5279,27 +5265,49 @@ $as_echo "$as_me: Boost.System LIB: $BOOST_SYSTEM_LIB" >&6;}
LIBS="$BOOST_SYSTEM_LIB $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to compile using libtorrent-rasterbar 0.16.x" >&5
$as_echo_n "checking whether to compile using libtorrent-rasterbar 0.16.x... " >&6; }
case "x$with_libtorrent_rasterbar0_16" in #(
"xno") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which qtsingleapplication to use" >&5
$as_echo_n "checking which qtsingleapplication to use... " >&6; }
case "x$with_qtsingleapplication" in #(
"xshipped") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: shipped" >&5
$as_echo "shipped" >&6; }
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG usesystemqtsingleapplication" ;; #(
"xsystem") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: system" >&5
$as_echo "system" >&6; }
QBT_ADD_CONFIG="$QBT_ADD_CONFIG usesystemqtsingleapplication" ;; #(
*) :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_qtsingleapplication" >&5
$as_echo "$with_qtsingleapplication" >&6; }
as_fn_error $? "Unknown option \"$with_qtsingleapplication\". Use either \"system\" or \"shipped\"." "$LINENO" 5 ;;
esac
if test "x$with_qt5" = "xno"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which qjson to use" >&5
$as_echo_n "checking which qjson to use... " >&6; }
case "x$with_qjson" in #(
"xshipped") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: shipped" >&5
$as_echo "shipped" >&6; }
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG usesystemqjson" ;; #(
"xsystem") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: system" >&5
$as_echo "system" >&6; }
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtorrent" >&5
$as_echo_n "checking for libtorrent... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for qjson" >&5
$as_echo_n "checking for qjson... " >&6; }
if test -n "$libtorrent_CFLAGS"; then
pkg_cv_libtorrent_CFLAGS="$libtorrent_CFLAGS"
if test -n "$qjson_CFLAGS"; then
pkg_cv_qjson_CFLAGS="$qjson_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.0.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.0.0") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"QJson >= 0.8.1\""; } >&5
($PKG_CONFIG --exists --print-errors "QJson >= 0.8.1") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_libtorrent_CFLAGS=`$PKG_CONFIG --cflags "libtorrent-rasterbar >= 1.0.0" 2>/dev/null`
pkg_cv_qjson_CFLAGS=`$PKG_CONFIG --cflags "QJson >= 0.8.1" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -5307,16 +5315,16 @@ fi @@ -5307,16 +5315,16 @@ fi
else
pkg_failed=untried
fi
if test -n "$libtorrent_LIBS"; then
pkg_cv_libtorrent_LIBS="$libtorrent_LIBS"
if test -n "$qjson_LIBS"; then
pkg_cv_qjson_LIBS="$qjson_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.0.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.0.0") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"QJson >= 0.8.1\""; } >&5
($PKG_CONFIG --exists --print-errors "QJson >= 0.8.1") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_libtorrent_LIBS=`$PKG_CONFIG --libs "libtorrent-rasterbar >= 1.0.0" 2>/dev/null`
pkg_cv_qjson_LIBS=`$PKG_CONFIG --libs "QJson >= 0.8.1" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -5337,22 +5345,22 @@ else @@ -5337,22 +5345,22 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
libtorrent_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtorrent-rasterbar >= 1.0.0" 2>&1`
qjson_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "QJson >= 0.8.1" 2>&1`
else
libtorrent_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtorrent-rasterbar >= 1.0.0" 2>&1`
qjson_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "QJson >= 0.8.1" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$libtorrent_PKG_ERRORS" >&5
echo "$qjson_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (libtorrent-rasterbar >= 1.0.0) were not met:
as_fn_error $? "Package requirements (QJson >= 0.8.1) were not met:
$libtorrent_PKG_ERRORS
$qjson_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables libtorrent_CFLAGS
and libtorrent_LIBS to avoid the need to call pkg-config.
Alternatively, you may set the environment variables qjson_CFLAGS
and qjson_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@ -5363,23 +5371,29 @@ as_fn_error $? "The pkg-config script could not be found or is too old. Make su @@ -5363,23 +5371,29 @@ as_fn_error $? "The pkg-config script could not be found or is too old. Make su
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables libtorrent_CFLAGS
and libtorrent_LIBS to avoid the need to call pkg-config.
Alternatively, you may set the environment variables qjson_CFLAGS
and qjson_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
libtorrent_CFLAGS=$pkg_cv_libtorrent_CFLAGS
libtorrent_LIBS=$pkg_cv_libtorrent_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CPPFLAGS="$libtorrent_CFLAGS $CPPFLAGS"
LIBS="$libtorrent_LIBS $LIBS"
fi ;; #(
"xyes") :
qjson_CFLAGS=$pkg_cv_qjson_CFLAGS
qjson_LIBS=$pkg_cv_qjson_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CPPFLAGS="$qjson_CFLAGS $CPPFLAGS"
LIBS="$qjson_LIBS $LIBS"
fi
QBT_ADD_CONFIG="$QBT_ADD_CONFIG usesystemqjson" ;; #(
*) :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_qjson" >&5
$as_echo "$with_qjson" >&6; }
as_fn_error $? "Unknown option \"$with_qjson\". Use either \"system\" or \"shipped\"." "$LINENO" 5 ;;
esac
fi
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtorrent" >&5
@ -5389,12 +5403,12 @@ if test -n "$libtorrent_CFLAGS"; then @@ -5389,12 +5403,12 @@ if test -n "$libtorrent_CFLAGS"; then
pkg_cv_libtorrent_CFLAGS="$libtorrent_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 0.16.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 0.16.0") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.0.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.0.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_libtorrent_CFLAGS=`$PKG_CONFIG --cflags "libtorrent-rasterbar >= 0.16.0" 2>/dev/null`
pkg_cv_libtorrent_CFLAGS=`$PKG_CONFIG --cflags "libtorrent-rasterbar >= 1.0.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -5406,12 +5420,12 @@ if test -n "$libtorrent_LIBS"; then @@ -5406,12 +5420,12 @@ if test -n "$libtorrent_LIBS"; then
pkg_cv_libtorrent_LIBS="$libtorrent_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 0.16.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 0.16.0") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.0.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.0.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_libtorrent_LIBS=`$PKG_CONFIG --libs "libtorrent-rasterbar >= 0.16.0" 2>/dev/null`
pkg_cv_libtorrent_LIBS=`$PKG_CONFIG --libs "libtorrent-rasterbar >= 1.0.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -5432,14 +5446,14 @@ else @@ -5432,14 +5446,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
libtorrent_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtorrent-rasterbar >= 0.16.0" 2>&1`
libtorrent_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtorrent-rasterbar >= 1.0.0" 2>&1`
else
libtorrent_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtorrent-rasterbar >= 0.16.0" 2>&1`
libtorrent_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtorrent-rasterbar >= 1.0.0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$libtorrent_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (libtorrent-rasterbar >= 0.16.0) were not met:
as_fn_error $? "Package requirements (libtorrent-rasterbar >= 1.0.0) were not met:
$libtorrent_PKG_ERRORS
@ -5471,140 +5485,6 @@ else @@ -5471,140 +5485,6 @@ else
$as_echo "yes" >&6; }
CPPFLAGS="$libtorrent_CFLAGS $CPPFLAGS"
LIBS="$libtorrent_LIBS $LIBS"
fi ;; #(
*) :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_libtorrent_rasterbar0_16" >&5
$as_echo "$with_libtorrent_rasterbar0_16" >&6; }
as_fn_error $? "Unknown option \"$with_libtorrent_rasterbar0_16\". Use either \"yes\" or \"no\"." "$LINENO" 5 ;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which qtsingleapplication to use" >&5
$as_echo_n "checking which qtsingleapplication to use... " >&6; }
case "x$with_qtsingleapplication" in #(
"xshipped") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: shipped" >&5
$as_echo "shipped" >&6; }
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG usesystemqtsingleapplication" ;; #(
"xsystem") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: system" >&5
$as_echo "system" >&6; }
QBT_ADD_CONFIG="$QBT_ADD_CONFIG usesystemqtsingleapplication" ;; #(
*) :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_qtsingleapplication" >&5
$as_echo "$with_qtsingleapplication" >&6; }
as_fn_error $? "Unknown option \"$with_qtsingleapplication\". Use either \"system\" or \"shipped\"." "$LINENO" 5 ;;
esac
if test "x$with_qt5" = "xno"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which qjson to use" >&5
$as_echo_n "checking which qjson to use... " >&6; }
case "x$with_qjson" in #(
"xshipped") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: shipped" >&5
$as_echo "shipped" >&6; }
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG usesystemqjson" ;; #(
"xsystem") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: system" >&5
$as_echo "system" >&6; }
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for qjson" >&5
$as_echo_n "checking for qjson... " >&6; }
if test -n "$qjson_CFLAGS"; then
pkg_cv_qjson_CFLAGS="$qjson_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"QJson >= 0.8.1\""; } >&5
($PKG_CONFIG --exists --print-errors "QJson >= 0.8.1") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_qjson_CFLAGS=`$PKG_CONFIG --cflags "QJson >= 0.8.1" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$qjson_LIBS"; then
pkg_cv_qjson_LIBS="$qjson_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"QJson >= 0.8.1\""; } >&5
($PKG_CONFIG --exists --print-errors "QJson >= 0.8.1") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_qjson_LIBS=`$PKG_CONFIG --libs "QJson >= 0.8.1" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
qjson_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "QJson >= 0.8.1" 2>&1`
else
qjson_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "QJson >= 0.8.1" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$qjson_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (QJson >= 0.8.1) were not met:
$qjson_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables qjson_CFLAGS
and qjson_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables qjson_CFLAGS
and qjson_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
qjson_CFLAGS=$pkg_cv_qjson_CFLAGS
qjson_LIBS=$pkg_cv_qjson_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CPPFLAGS="$qjson_CFLAGS $CPPFLAGS"
LIBS="$qjson_LIBS $LIBS"
fi
QBT_ADD_CONFIG="$QBT_ADD_CONFIG usesystemqjson" ;; #(
*) :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_qjson" >&5
$as_echo "$with_qjson" >&6; }
as_fn_error $? "Unknown option \"$with_qjson\". Use either \"system\" or \"shipped\"." "$LINENO" 5 ;;
esac
fi

29
configure.ac

@ -18,12 +18,6 @@ AC_ARG_WITH(qt5, @@ -18,12 +18,6 @@ AC_ARG_WITH(qt5,
[],
[with_qt5=no])
AC_ARG_WITH(libtorrent-rasterbar0.16,
[AS_HELP_STRING([--with-libtorrent-rasterbar0.16],
[Compile using libtorrent-rasterbar 0.16.x series (default=no)])],
[],
[with_libtorrent_rasterbar0_16=no])
AC_ARG_WITH(qtsingleapplication,
[AS_HELP_STRING([--with-qtsingleapplication=@<:@system|shipped@:>@],
[Use the shipped qtsingleapplication library or the system one (default=shipped)])],
@ -101,7 +95,6 @@ AS_CASE(["x$enable_gui"], @@ -101,7 +95,6 @@ AS_CASE(["x$enable_gui"],
["xno"],
[AC_MSG_RESULT([no])
enable_qt_dbus=[no]
enable_geoip_database=[no]
QBT_ADD_CONFIG="$QBT_ADD_CONFIG nogui"],
[AC_MSG_RESULT([$enable_gui])
AC_MSG_ERROR([Unknown option "$enable_gui". Use either "yes" or "no".])])
@ -175,23 +168,6 @@ AS_IF([test "x$BOOST_SYSTEM_LIB" = "x"], @@ -175,23 +168,6 @@ AS_IF([test "x$BOOST_SYSTEM_LIB" = "x"],
[AC_MSG_NOTICE([Boost.System LIB: $BOOST_SYSTEM_LIB])
LIBS="$BOOST_SYSTEM_LIB $LIBS"])
AC_MSG_CHECKING([whether to compile using libtorrent-rasterbar 0.16.x])
AS_CASE(["x$with_libtorrent_rasterbar0_16"],
["xno"],
[AC_MSG_RESULT([no])
PKG_CHECK_MODULES(libtorrent,
[libtorrent-rasterbar >= 1.0.0],
[CPPFLAGS="$libtorrent_CFLAGS $CPPFLAGS"
LIBS="$libtorrent_LIBS $LIBS"])],
["xyes"],
[AC_MSG_RESULT([yes])
PKG_CHECK_MODULES(libtorrent,
[libtorrent-rasterbar >= 0.16.0],
[CPPFLAGS="$libtorrent_CFLAGS $CPPFLAGS"
LIBS="$libtorrent_LIBS $LIBS"])],
[AC_MSG_RESULT([$with_libtorrent_rasterbar0_16])
AC_MSG_ERROR([Unknown option "$with_libtorrent_rasterbar0_16". Use either "yes" or "no".])])
AC_MSG_CHECKING([which qtsingleapplication to use])
AS_CASE(["x$with_qtsingleapplication"],
["xshipped"],
@ -220,6 +196,11 @@ AS_IF([test "x$with_qt5" = "xno"], @@ -220,6 +196,11 @@ AS_IF([test "x$with_qt5" = "xno"],
AC_MSG_ERROR([Unknown option "$with_qjson". Use either "system" or "shipped".])])
])
PKG_CHECK_MODULES(libtorrent,
[libtorrent-rasterbar >= 1.0.0],
[CPPFLAGS="$libtorrent_CFLAGS $CPPFLAGS"
LIBS="$libtorrent_LIBS $LIBS"])
PKG_CHECK_MODULES(zlib,
[zlib],
[CPPFLAGS="$zlib_CFLAGS $CPPFLAGS"

6
src/core/bittorrent/infohash.h

@ -29,13 +29,7 @@ @@ -29,13 +29,7 @@
#ifndef BITTORRENT_INFOHASH_H
#define BITTORRENT_INFOHASH_H
#include <libtorrent/version.hpp>
#if LIBTORRENT_VERSION_NUM < 10000
#include <libtorrent/peer_id.hpp>
#else
#include <libtorrent/sha1_hash.hpp>
#endif
#include <QString>
namespace BitTorrent

2
src/core/bittorrent/magneturi.cpp

@ -53,10 +53,8 @@ MagnetUri::MagnetUri(const QString &url) @@ -53,10 +53,8 @@ MagnetUri::MagnetUri(const QString &url)
foreach (const std::string &tracker, m_addTorrentParams.trackers)
m_trackers.append(Utils::String::fromStdString(tracker));
#if LIBTORRENT_VERSION_NUM >= 10000
foreach (const std::string &urlSeed, m_addTorrentParams.url_seeds)
m_urlSeeds.append(QUrl(urlSeed.c_str()));
#endif
}
bool MagnetUri::isValid() const

21
src/core/bittorrent/peerinfo.cpp

@ -26,8 +26,6 @@ @@ -26,8 +26,6 @@
* exception statement from your version.
*/
#include <libtorrent/version.hpp>
#include "core/net/geoipmanager.h"
#include "core/utils/string.h"
#include "peerinfo.h"
@ -169,20 +167,12 @@ bool PeerInfo::useI2PSocket() const @@ -169,20 +167,12 @@ bool PeerInfo::useI2PSocket() const
bool PeerInfo::useUTPSocket() const
{
#if LIBTORRENT_VERSION_NUM < 10000
return (m_nativeInfo.connection_type & libt::peer_info::bittorrent_utp);
#else
return (m_nativeInfo.flags & libt::peer_info::utp_socket);
#endif
}
bool PeerInfo::useSSLSocket() const
{
#if LIBTORRENT_VERSION_NUM < 10000
return false;
#else
return (m_nativeInfo.flags & libt::peer_info::ssl_socket);
#endif
}
bool PeerInfo::isRC4Encrypted() const
@ -239,12 +229,7 @@ QBitArray PeerInfo::pieces() const @@ -239,12 +229,7 @@ QBitArray PeerInfo::pieces() const
{
QBitArray result(m_nativeInfo.pieces.size());
#if LIBTORRENT_VERSION_NUM < 10000
typedef size_t pieces_size_t;
#else
typedef int pieces_size_t;
#endif
for (pieces_size_t i = 0; i < m_nativeInfo.pieces.size(); ++i)
for (int i = 0; i < m_nativeInfo.pieces.size(); ++i)
result.setBit(i, m_nativeInfo.pieces.get_bit(i));
return result;
@ -252,11 +237,7 @@ QBitArray PeerInfo::pieces() const @@ -252,11 +237,7 @@ QBitArray PeerInfo::pieces() const
QString PeerInfo::connectionType() const
{
#if LIBTORRENT_VERSION_NUM < 10000
if (m_nativeInfo.connection_type & libt::peer_info::bittorrent_utp)
#else
if (m_nativeInfo.flags & libt::peer_info::utp_socket)
#endif
return QString::fromUtf8("μTP");
QString connection;

40
src/core/bittorrent/session.cpp

@ -46,7 +46,6 @@ using namespace BitTorrent; @@ -46,7 +46,6 @@ using namespace BitTorrent;
#include <queue>
#include <vector>
#include <libtorrent/version.hpp>
#include <libtorrent/session.hpp>
#include <libtorrent/lazy_entry.hpp>
#include <libtorrent/bencode.hpp>
@ -430,12 +429,10 @@ void Session::setSessionSettings() @@ -430,12 +429,10 @@ void Session::setSessionSettings()
else
sessionSettings.mixed_mode_algorithm = libt::session_settings::peer_proportional;
sessionSettings.connection_speed = 20; //default is 10
#if LIBTORRENT_VERSION_NUM >= 10000
if (pref->isProxyEnabled())
sessionSettings.force_proxy = pref->getForceProxy();
else
sessionSettings.force_proxy = false;
#endif
sessionSettings.no_connect_privileged_ports = false;
sessionSettings.seed_choking_algorithm = libt::session_settings::fastest_upload;
qDebug() << "Set session settings";
@ -1070,21 +1067,13 @@ bool Session::addTorrent_impl(const AddTorrentData &addData, const MagnetUri &ma @@ -1070,21 +1067,13 @@ bool Session::addTorrent_impl(const AddTorrentData &addData, const MagnetUri &ma
if (addData.resumed && !fromMagnetUri) {
// Set torrent fast resume data
#if LIBTORRENT_VERSION_NUM < 10000
p.resume_data = &buf;
#else
p.resume_data = buf;
p.flags |= libt::add_torrent_params::flag_use_resume_save_path;
#endif
}
else {
foreach (int prio, addData.filePriorities)
filePriorities.push_back(prio);
#if LIBTORRENT_VERSION_NUM < 10000
p.file_priorities = &filePriorities;
#else
p.file_priorities = filePriorities;
#endif
}
// We should not add torrent if it already
@ -1118,12 +1107,10 @@ bool Session::addTorrent_impl(const AddTorrentData &addData, const MagnetUri &ma @@ -1118,12 +1107,10 @@ bool Session::addTorrent_impl(const AddTorrentData &addData, const MagnetUri &ma
else
p.flags &= ~libt::add_torrent_params::flag_seed_mode;
#if LIBTORRENT_VERSION_NUM >= 10000
// Limits
Preferences *const pref = Preferences::instance();
p.max_connections = pref->getMaxConnecsPerTorrent();
p.max_uploads = pref->getMaxUploadsPerTorrent();
#endif
QString savePath;
// Set actual save path (e.g. temporary folder)
@ -1184,11 +1171,9 @@ bool Session::loadMetadata(const QString &magnetUri) @@ -1184,11 +1171,9 @@ bool Session::loadMetadata(const QString &magnetUri)
p.storage_mode = libt::storage_mode_sparse;
Preferences *const pref = Preferences::instance();
#if LIBTORRENT_VERSION_NUM >= 10000
// Limits
p.max_connections = pref->getMaxConnecsPerTorrent();
p.max_uploads = pref->getMaxUploadsPerTorrent();
#endif
QString savePath = QString("%1/%2").arg(QDir::tempPath()).arg(hash);
p.save_path = Utils::String::toStdString(Utils::Fs::toNativePath(savePath));
@ -1207,11 +1192,6 @@ bool Session::loadMetadata(const QString &magnetUri) @@ -1207,11 +1192,6 @@ bool Session::loadMetadata(const QString &magnetUri)
libt::torrent_handle h = m_nativeSession->add_torrent(p, ec);
if (ec) return false;
#if LIBTORRENT_VERSION_NUM < 10000
h.set_max_connections(pref->getMaxConnecsPerTorrent());
h.set_max_uploads(pref->getMaxUploadsPerTorrent());
#endif
// waiting for metadata...
m_loadedMetadata.insert(h.info_hash(), TorrentInfo());
++m_extraLimit;
@ -2079,13 +2059,6 @@ void Session::handleAddTorrentAlert(libtorrent::add_torrent_alert *p) @@ -2079,13 +2059,6 @@ void Session::handleAddTorrentAlert(libtorrent::add_torrent_alert *p)
m_torrents.insert(torrent->hash(), torrent);
Preferences *const pref = Preferences::instance();
#if LIBTORRENT_VERSION_NUM < 10000
try {
p->handle.set_max_connections(pref->getMaxConnecsPerTorrent());
p->handle.set_max_uploads(pref->getMaxUploadsPerTorrent());
}
catch (std::exception &) {}
#endif
bool fromMagnetUri = !torrent->hasMetadata();
@ -2158,11 +2131,7 @@ void Session::handleMetadataReceivedAlert(libt::metadata_received_alert *p) @@ -2158,11 +2131,7 @@ void Session::handleMetadataReceivedAlert(libt::metadata_received_alert *p)
if (m_loadedMetadata.contains(hash)) {
--m_extraLimit;
adjustLimits();
#if LIBTORRENT_VERSION_NUM < 10000
m_loadedMetadata[hash] = TorrentInfo(&p->handle.get_torrent_info());
#else
m_loadedMetadata[hash] = TorrentInfo(p->handle.torrent_file());
#endif
m_nativeSession->remove_torrent(p->handle, libt::session::delete_files);
}
}
@ -2195,10 +2164,6 @@ void Session::handlePeerBlockedAlert(libt::peer_blocked_alert *p) @@ -2195,10 +2164,6 @@ void Session::handlePeerBlockedAlert(libt::peer_blocked_alert *p)
{
boost::system::error_code ec;
std::string ip = p->ip.to_string(ec);
#if LIBTORRENT_VERSION_NUM < 10000
if (!ec)
Logger::instance()->addPeer(QString::fromLatin1(ip.c_str()), true);
#else
QString reason;
switch (p->reason) {
case libt::peer_blocked_alert::ip_filter:
@ -2223,7 +2188,6 @@ void Session::handlePeerBlockedAlert(libt::peer_blocked_alert *p) @@ -2223,7 +2188,6 @@ void Session::handlePeerBlockedAlert(libt::peer_blocked_alert *p)
if (!ec)
Logger::instance()->addPeer(QString::fromLatin1(ip.c_str()), true, reason);
#endif
}
void Session::handlePeerBanAlert(libt::peer_ban_alert *p)
@ -2243,14 +2207,12 @@ void Session::handleListenSucceededAlert(libt::listen_succeeded_alert *p) @@ -2243,14 +2207,12 @@ void Session::handleListenSucceededAlert(libt::listen_succeeded_alert *p)
{
boost::system::error_code ec;
QString proto = "TCP";
#if LIBTORRENT_VERSION_NUM >= 10000
if (p->sock_type == libt::listen_succeeded_alert::udp)
proto = "UDP";
else if (p->sock_type == libt::listen_succeeded_alert::tcp)
proto = "TCP";
else if (p->sock_type == libt::listen_succeeded_alert::tcp_ssl)
proto = "TCP_SSL";
#endif
qDebug() << "Successfully listening on " << proto << p->endpoint.address().to_string(ec).c_str() << "/" << p->endpoint.port();
Logger::instance()->addMessage(tr("qBittorrent is successfully listening on interface %1 port: %2/%3", "e.g: qBittorrent is successfully listening on interface 192.168.0.1 port: TCP/6881").arg(p->endpoint.address().to_string(ec).c_str()).arg(proto).arg(QString::number(p->endpoint.port())), Log::INFO);
@ -2266,7 +2228,6 @@ void Session::handleListenFailedAlert(libt::listen_failed_alert *p) @@ -2266,7 +2228,6 @@ void Session::handleListenFailedAlert(libt::listen_failed_alert *p)
{
boost::system::error_code ec;
QString proto = "TCP";
#if LIBTORRENT_VERSION_NUM >= 10000
if (p->sock_type == libt::listen_failed_alert::udp)
proto = "UDP";
else if (p->sock_type == libt::listen_failed_alert::tcp)
@ -2277,7 +2238,6 @@ void Session::handleListenFailedAlert(libt::listen_failed_alert *p) @@ -2277,7 +2238,6 @@ void Session::handleListenFailedAlert(libt::listen_failed_alert *p)
proto = "I2P";
else if (p->sock_type == libt::listen_failed_alert::socks5)
proto = "SOCKS5";
#endif
qDebug() << "Failed listening on " << proto << p->endpoint.address().to_string(ec).c_str() << "/" << p->endpoint.port();
Logger::instance()->addMessage(
tr("qBittorrent failed listening on interface %1 port: %2/%3. Reason: %4",

1
src/core/bittorrent/torrentcreatorthread.cpp

@ -28,7 +28,6 @@ @@ -28,7 +28,6 @@
* Contact : chris@qbittorrent.org
*/
#include <libtorrent/version.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/torrent_info.hpp>

46
src/core/bittorrent/torrenthandle.cpp

@ -34,7 +34,6 @@ @@ -34,7 +34,6 @@
#include <QByteArray>
#include <QBitArray>
#include <libtorrent/version.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/address.hpp>
@ -230,13 +229,8 @@ InfoHash TorrentHandle::hash() const @@ -230,13 +229,8 @@ InfoHash TorrentHandle::hash() const
QString TorrentHandle::name() const
{
QString name = m_name;
if (name.isEmpty()) {
#if LIBTORRENT_VERSION_NUM < 10000
name = m_nativeName;
#else
if (name.isEmpty())
name = Utils::String::fromStdString(m_nativeStatus.name);
#endif
}
if (name.isEmpty())
name = m_hash;
@ -319,11 +313,7 @@ QString TorrentHandle::rootPath() const @@ -319,11 +313,7 @@ QString TorrentHandle::rootPath() const
QString TorrentHandle::nativeActualSavePath() const
{
#if LIBTORRENT_VERSION_NUM < 10000
return m_nativeSavePath;
#else
return Utils::String::fromStdString(m_nativeStatus.save_path);
#endif
}
QString TorrentHandle::actualSavePath() const
@ -1014,12 +1004,7 @@ QBitArray TorrentHandle::pieces() const @@ -1014,12 +1004,7 @@ QBitArray TorrentHandle::pieces() const
{
QBitArray result(m_nativeStatus.pieces.size());
#if LIBTORRENT_VERSION_NUM < 10000
typedef size_t pieces_size_t;
#else
typedef int pieces_size_t;
#endif
for (pieces_size_t i = 0; i < m_nativeStatus.pieces.size(); ++i)
for (int i = 0; i < m_nativeStatus.pieces.size(); ++i)
result.setBit(i, m_nativeStatus.pieces.get_bit(i));
return result;
@ -1162,19 +1147,10 @@ void TorrentHandle::move(QString path) @@ -1162,19 +1147,10 @@ void TorrentHandle::move(QString path)
}
}
#if LIBTORRENT_VERSION_NUM < 10000
void TorrentHandle::forceReannounce()
{
SAFE_CALL(force_reannounce);
}
#else
void TorrentHandle::forceReannounce(int index)
{
SAFE_CALL(force_reannounce, 0, index);
}
#endif
void TorrentHandle::forceDHTAnnounce()
{
@ -1753,16 +1729,7 @@ void TorrentHandle::updateTorrentInfo() @@ -1753,16 +1729,7 @@ void TorrentHandle::updateTorrentInfo()
{
if (!hasMetadata()) return;
#if LIBTORRENT_VERSION_NUM < 10000
try {
m_torrentInfo = TorrentInfo(&m_nativeHandle.get_torrent_info());
}
catch (std::exception &exc) {
qDebug("torrent_handle::get_torrent_info() throws exception: %s", exc.what()); \
}
#else
m_torrentInfo = TorrentInfo(m_nativeStatus.torrent_file);
#endif
}
void TorrentHandle::initialize()
@ -1801,15 +1768,6 @@ void TorrentHandle::updateStatus() @@ -1801,15 +1768,6 @@ void TorrentHandle::updateStatus()
void TorrentHandle::updateStatus(const libtorrent::torrent_status &nativeStatus)
{
m_nativeStatus = nativeStatus;
#if LIBTORRENT_VERSION_NUM < 10000
try {
m_nativeName = Utils::String::fromStdString(m_nativeHandle.name());
m_nativeSavePath = Utils::Fs::fromNativePath(Utils::String::fromStdString(m_nativeHandle.save_path()));
}
catch (std::exception &exc) {
qDebug("torrent_handle method inside TorrentHandleImpl::updateStatus() throws exception: %s", exc.what());
}
#endif
updateState();
updateTorrentInfo();

8
src/core/bittorrent/torrenthandle.h

@ -272,11 +272,7 @@ namespace BitTorrent @@ -272,11 +272,7 @@ namespace BitTorrent
void pause();
void resume(bool forced = false);
void move(QString path);
#if LIBTORRENT_VERSION_NUM < 10000
void forceReannounce();
#else
void forceReannounce(int index = -1);
#endif
void forceDHTAnnounce();
void forceRecheck();
void setTrackerLogin(const QString &username, const QString &password);
@ -354,10 +350,6 @@ namespace BitTorrent @@ -354,10 +350,6 @@ namespace BitTorrent
TorrentState m_state;
TorrentInfo m_torrentInfo;
SpeedMonitor m_speedMonitor;
#if LIBTORRENT_VERSION_NUM < 10000
QString m_nativeName;
QString m_nativeSavePath;
#endif
InfoHash m_hash;

14
src/core/logger.cpp

@ -16,18 +16,12 @@ namespace Log @@ -16,18 +16,12 @@ namespace Log
Peer::Peer() {}
#if LIBTORRENT_VERSION_NUM < 10000
Peer::Peer(int id, const QString &ip, bool blocked)
#else
Peer::Peer(int id, const QString &ip, bool blocked, const QString &reason)
#endif
: id(id)
, timestamp(QDateTime::currentMSecsSinceEpoch())
, ip(ip)
, blocked(blocked)
#if LIBTORRENT_VERSION_NUM >= 10000
, reason(reason)
#endif
{
}
@ -76,19 +70,11 @@ void Logger::addMessage(const QString &message, const Log::MsgType &type) @@ -76,19 +70,11 @@ void Logger::addMessage(const QString &message, const Log::MsgType &type)
emit newLogMessage(temp);
}
#if LIBTORRENT_VERSION_NUM < 10000
void Logger::addPeer(const QString &ip, bool blocked)
#else
void Logger::addPeer(const QString &ip, bool blocked, const QString &reason)
#endif
{
QWriteLocker locker(&lock);
#if LIBTORRENT_VERSION_NUM < 10000
Log::Peer temp(peerCounter++, ip, blocked);
#else
Log::Peer temp(peerCounter++, ip, blocked, reason);
#endif
m_peers.push_back(temp);
if (m_peers.size() >= MAX_LOG_MESSAGES)

11
src/core/logger.h

@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
#include <QVector>
#include <QReadWriteLock>
#include <QObject>
#include <libtorrent/version.hpp>
const int MAX_LOG_MESSAGES = 1000;
@ -31,19 +30,13 @@ namespace Log @@ -31,19 +30,13 @@ namespace Log
struct Peer
{
#if LIBTORRENT_VERSION_NUM < 10000
Peer(int id, const QString &ip, bool blocked);
#else
Peer(int id, const QString &ip, bool blocked, const QString &reason);
#endif
Peer();
int id;
qint64 timestamp;
QString ip;
bool blocked;
#if LIBTORRENT_VERSION_NUM >= 10000
QString reason;
#endif
};
}
@ -58,11 +51,7 @@ public: @@ -58,11 +51,7 @@ public:
static Logger *instance();
void addMessage(const QString &message, const Log::MsgType &type = Log::NORMAL);
#if LIBTORRENT_VERSION_NUM < 10000
void addPeer(const QString &ip, bool blocked);
#else
void addPeer(const QString &ip, bool blocked, const QString &reason = QString());
#endif
QVector<Log::Msg> getMessages(int lastKnownId = -1) const;
QVector<Log::Peer> getPeers(int lastKnownId = -1) const;

42
src/core/net/portforwarder.cpp

@ -29,10 +29,6 @@ @@ -29,10 +29,6 @@
#include <QDebug>
#include <libtorrent/session.hpp>
#if LIBTORRENT_VERSION_NUM < 10000
#include <libtorrent/upnp.hpp>
#include <libtorrent/natpmp.hpp>
#endif
#include "core/logger.h"
#include "core/preferences.h"
@ -45,10 +41,6 @@ PortForwarder::PortForwarder(libtorrent::session *provider, QObject *parent) @@ -45,10 +41,6 @@ PortForwarder::PortForwarder(libtorrent::session *provider, QObject *parent)
: QObject(parent)
, m_active(false)
, m_provider(provider)
#if LIBTORRENT_VERSION_NUM < 10000
, m_upnp(0)
, m_natpmp(0)
#endif
{
configure();
connect(Preferences::instance(), SIGNAL(changed()), SLOT(configure()));
@ -81,33 +73,17 @@ PortForwarder *PortForwarder::instance() @@ -81,33 +73,17 @@ PortForwarder *PortForwarder::instance()
void PortForwarder::addPort(qint16 port)
{
if (!m_mappedPorts.contains(port)) {
#if LIBTORRENT_VERSION_NUM < 10000
m_mappedPorts.insert(port, qMakePair(0, 0));
#else
m_mappedPorts.insert(port, 0);
#endif
if (m_active) {
#if LIBTORRENT_VERSION_NUM < 10000
m_mappedPorts[port].first = m_upnp->add_mapping(libt::upnp::tcp, port, port);
m_mappedPorts[port].second = m_natpmp->add_mapping(libt::natpmp::tcp, port, port);
#else
if (m_active)
m_mappedPorts[port] = m_provider->add_port_mapping(libt::session::tcp, port, port);
#endif
}
}
}
void PortForwarder::deletePort(qint16 port)
{
if (m_mappedPorts.contains(port)) {
if (m_active) {
#if LIBTORRENT_VERSION_NUM < 10000
m_upnp->delete_mapping(m_mappedPorts[port].first);
m_natpmp->delete_mapping(m_mappedPorts[port].second);
#else
if (m_active)
m_provider->delete_port_mapping(m_mappedPorts[port]);
#endif
}
m_mappedPorts.remove(port);
}
}
@ -126,19 +102,10 @@ void PortForwarder::configure() @@ -126,19 +102,10 @@ void PortForwarder::configure()
void PortForwarder::start()
{
qDebug("Enabling UPnP / NAT-PMP");
#if LIBTORRENT_VERSION_NUM < 10000
m_upnp = m_provider->start_upnp();
m_natpmp = m_provider->start_natpmp();
foreach (qint16 port, m_mappedPorts.keys()) {
m_mappedPorts[port].first = m_upnp->add_mapping(libt::upnp::tcp, port, port);
m_mappedPorts[port].second = m_natpmp->add_mapping(libt::natpmp::tcp, port, port);
}
#else
m_provider->start_upnp();
m_provider->start_natpmp();
foreach (qint16 port, m_mappedPorts.keys())
m_mappedPorts[port] = m_provider->add_port_mapping(libt::session::tcp, port, port);
#endif
m_active = true;
Logger::instance()->addMessage(tr("UPnP / NAT-PMP support [ON]"), Log::INFO);
}
@ -148,11 +115,6 @@ void PortForwarder::stop() @@ -148,11 +115,6 @@ void PortForwarder::stop()
qDebug("Disabling UPnP / NAT-PMP");
m_provider->stop_upnp();
m_provider->stop_natpmp();
#if LIBTORRENT_VERSION_NUM < 10000
m_upnp = 0;
m_natpmp = 0;
#endif
m_active = false;
Logger::instance()->addMessage(tr("UPnP / NAT-PMP support [OFF]"), Log::INFO);
}

11
src/core/net/portforwarder.h

@ -31,14 +31,9 @@ @@ -31,14 +31,9 @@
#include <QObject>
#include <QHash>
#include <libtorrent/version.hpp>
namespace libtorrent
{
#if LIBTORRENT_VERSION_NUM < 10000
class upnp;
class natpmp;
#endif
class session;
}
@ -69,13 +64,7 @@ namespace Net @@ -69,13 +64,7 @@ namespace Net
bool m_active;
libtorrent::session *m_provider;
#if LIBTORRENT_VERSION_NUM < 10000
libtorrent::upnp *m_upnp;
libtorrent::natpmp *m_natpmp;
QHash<qint16, QPair<int, int> > m_mappedPorts;
#else
QHash<qint16, int> m_mappedPorts;
#endif
static PortForwarder *m_instance;
};

2
src/core/preferences.cpp

@ -822,7 +822,6 @@ void Preferences::setProxyPeerConnections(bool enabled) @@ -822,7 +822,6 @@ void Preferences::setProxyPeerConnections(bool enabled)
setValue("Preferences/Connection/ProxyPeerConnections", enabled);
}
#if LIBTORRENT_VERSION_NUM >= 10000
bool Preferences::getForceProxy() const
{
return value("Preferences/Connection/ProxyForce", true).toBool();
@ -832,7 +831,6 @@ void Preferences::setForceProxy(bool enabled) @@ -832,7 +831,6 @@ void Preferences::setForceProxy(bool enabled)
{
setValue("Preferences/Connection/ProxyForce", enabled);
}
#endif
// Bittorrent options
int Preferences::getMaxConnecs() const

4
src/core/preferences.h

@ -41,8 +41,6 @@ @@ -41,8 +41,6 @@
#include <QNetworkCookie>
#include <QVariant>
#include <libtorrent/version.hpp>
#include "core/types.h"
enum scheduler_days
@ -246,10 +244,8 @@ public: @@ -246,10 +244,8 @@ public:
void setProxyType(int type);
bool proxyPeerConnections() const;
void setProxyPeerConnections(bool enabled);
#if LIBTORRENT_VERSION_NUM >= 10000
bool getForceProxy() const;
void setForceProxy(bool enabled);
#endif
// Bittorrent options
int getMaxConnecs() const;

4
src/gui/executionlog.cpp

@ -98,11 +98,7 @@ void ExecutionLog::addPeerMessage(const Log::Peer& peer) @@ -98,11 +98,7 @@ void ExecutionLog::addPeerMessage(const Log::Peer& peer)
QDateTime time = QDateTime::fromMSecsSinceEpoch(peer.timestamp);
if (peer.blocked)
#if LIBTORRENT_VERSION_NUM < 10000
text = "<font color='grey'>" + time.toString(Qt::SystemLocaleShortDate) + "</font> - " + tr("<font color='red'>%1</font> was blocked", "x.y.z.w was blocked").arg(peer.ip);
#else
text = "<font color='grey'>" + time.toString(Qt::SystemLocaleShortDate) + "</font> - " + tr("<font color='red'>%1</font> was blocked %2", "x.y.z.w was blocked").arg(peer.ip).arg(peer.reason);
#endif
else
text = "<font color='grey'>" + time.toString(Qt::SystemLocaleShortDate) + "</font> - " + tr("<font color='red'>%1</font> was banned", "x.y.z.w was banned").arg(peer.ip);

17
src/gui/options_imp.cpp

@ -40,8 +40,6 @@ @@ -40,8 +40,6 @@
#include <QDesktopServices>
#include <QDebug>
#include <libtorrent/version.hpp>
#include <cstdlib>
#include "options_imp.h"
#include "core/preferences.h"
@ -221,9 +219,7 @@ options_imp::options_imp(QWidget *parent): @@ -221,9 +219,7 @@ options_imp::options_imp(QWidget *parent):
connect(textProxyIP, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinProxyPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkProxyPeerConnecs, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
#if LIBTORRENT_VERSION_NUM >= 10000
connect(checkForceProxy, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
#endif
connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(textProxyUsername, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(textProxyPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
@ -264,11 +260,6 @@ options_imp::options_imp(QWidget *parent): @@ -264,11 +260,6 @@ options_imp::options_imp(QWidget *parent):
scrollArea_advanced->setLayout(adv_layout);
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
//Hide incompatible options
#if LIBTORRENT_VERSION_NUM < 10000
checkForceProxy->setVisible(false);
#endif
// Adapt size
show();
loadWindowState();
@ -436,9 +427,7 @@ void options_imp::saveOptions() { @@ -436,9 +427,7 @@ void options_imp::saveOptions() {
pref->setProxyIp(getProxyIp());
pref->setProxyPort(getProxyPort());
pref->setProxyPeerConnections(checkProxyPeerConnecs->isChecked());
#if LIBTORRENT_VERSION_NUM >= 10000
pref->setForceProxy(checkForceProxy->isChecked());
#endif
pref->setProxyAuthEnabled(isProxyAuthEnabled());
pref->setProxyUsername(getProxyUsername());
pref->setProxyPassword(getProxyPassword());
@ -691,9 +680,7 @@ void options_imp::loadOptions() { @@ -691,9 +680,7 @@ void options_imp::loadOptions() {
textProxyIP->setText(pref->getProxyIp());
spinProxyPort->setValue(pref->getProxyPort());
checkProxyPeerConnecs->setChecked(pref->proxyPeerConnections());
#if LIBTORRENT_VERSION_NUM >= 10000
checkForceProxy->setChecked(pref->getForceProxy());
#endif
checkProxyAuth->setChecked(pref->isProxyAuthEnabled());
textProxyUsername->setText(pref->getProxyUsername());
textProxyPassword->setText(pref->getProxyPassword());
@ -995,9 +982,7 @@ void options_imp::enableProxy(int index) { @@ -995,9 +982,7 @@ void options_imp::enableProxy(int index) {
lblProxyPort->setEnabled(true);
spinProxyPort->setEnabled(true);
checkProxyPeerConnecs->setEnabled(true);
#if LIBTORRENT_VERSION_NUM >= 10000
checkForceProxy->setEnabled(true);
#endif
if (index > 1) {
checkProxyAuth->setEnabled(true);
} else {
@ -1011,9 +996,7 @@ void options_imp::enableProxy(int index) { @@ -1011,9 +996,7 @@ void options_imp::enableProxy(int index) {
lblProxyPort->setEnabled(false);
spinProxyPort->setEnabled(false);
checkProxyPeerConnecs->setEnabled(false);
#if LIBTORRENT_VERSION_NUM >= 10000
checkForceProxy->setEnabled(false);
#endif
checkProxyAuth->setEnabled(false);
checkProxyAuth->setChecked(false);
}

9
src/gui/properties/trackerlist.cpp

@ -399,7 +399,6 @@ void TrackerList::editSelectedTracker() { @@ -399,7 +399,6 @@ void TrackerList::editSelectedTracker() {
}
}
#if LIBTORRENT_VERSION_NUM >= 10000
void TrackerList::reannounceSelected() {
QList<QTreeWidgetItem *> selected_items = selectedItems();
if (selected_items.isEmpty()) return;
@ -427,8 +426,6 @@ void TrackerList::reannounceSelected() { @@ -427,8 +426,6 @@ void TrackerList::reannounceSelected() {
loadTrackers();
}
#endif
void TrackerList::showTrackerListMenu(QPoint) {
BitTorrent::TorrentHandle *const torrent = properties->getCurrentTorrent();
if (!torrent) return;
@ -444,14 +441,10 @@ void TrackerList::showTrackerListMenu(QPoint) { @@ -444,14 +441,10 @@ void TrackerList::showTrackerListMenu(QPoint) {
copyAct = menu.addAction(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy tracker URL"));
editAct = menu.addAction(GuiIconProvider::instance()->getIcon("edit-rename"),tr("Edit selected tracker URL"));
}
#if LIBTORRENT_VERSION_NUM >= 10000
QAction *reannounceSelAct = NULL;
#endif
QAction *reannounceAct = NULL;
if (!torrent->isPaused()) {
#if LIBTORRENT_VERSION_NUM >= 10000
reannounceSelAct = menu.addAction(GuiIconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to selected trackers"));
#endif
menu.addSeparator();
reannounceAct = menu.addAction(GuiIconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to all trackers"));
}
@ -469,12 +462,10 @@ void TrackerList::showTrackerListMenu(QPoint) { @@ -469,12 +462,10 @@ void TrackerList::showTrackerListMenu(QPoint) {
deleteSelectedTrackers();
return;
}
#if LIBTORRENT_VERSION_NUM >= 10000
if (act == reannounceSelAct) {
reannounceSelected();
return;
}
#endif
if (act == reannounceAct) {
BitTorrent::TorrentHandle *h = properties->getCurrentTorrent();
h->forceReannounce();

3
src/gui/properties/trackerlist.h

@ -36,7 +36,6 @@ @@ -36,7 +36,6 @@
#include <QList>
#include <QClipboard>
#include <libtorrent/version.hpp>
#include "propertieswidget.h"
enum TrackerListColumn {COL_TIER, COL_URL, COL_STATUS, COL_PEERS, COL_MSG};
@ -79,9 +78,7 @@ public slots: @@ -79,9 +78,7 @@ public slots:
void loadTrackers();
void askForTrackers();
void copyTrackerUrl();
#if LIBTORRENT_VERSION_NUM >= 10000
void reannounceSelected();
#endif
void deleteSelectedTrackers();
void editSelectedTracker();
void showTrackerListMenu(QPoint);

4
src/webui/prefjson.cpp

@ -97,9 +97,7 @@ QByteArray prefjson::getPreferences() @@ -97,9 +97,7 @@ QByteArray prefjson::getPreferences()
data["proxy_ip"] = pref->getProxyIp();
data["proxy_port"] = pref->getProxyPort();
data["proxy_peer_connections"] = pref->proxyPeerConnections();
#if LIBTORRENT_VERSION_NUM >= 10000
data["force_proxy"] = pref->getForceProxy();
#endif
data["proxy_auth_enabled"] = pref->isProxyAuthEnabled();
data["proxy_username"] = pref->getProxyUsername();
data["proxy_password"] = pref->getProxyPassword();
@ -264,10 +262,8 @@ void prefjson::setPreferences(const QString& json) @@ -264,10 +262,8 @@ void prefjson::setPreferences(const QString& json)
pref->setProxyPort(m["proxy_port"].toUInt());
if (m.contains("proxy_peer_connections"))
pref->setProxyPeerConnections(m["proxy_peer_connections"].toBool());
#if LIBTORRENT_VERSION_NUM >= 10000
if (m.contains("force_proxy"))
pref->setForceProxy(m["force_proxy"].toBool());
#endif
if (m.contains("proxy_auth_enabled"))
pref->setProxyAuthEnabled(m["proxy_auth_enabled"].toBool());
if (m.contains("proxy_username"))

Loading…
Cancel
Save