Merge pull request #3494 from glassez/drop_libtorrent_0

Drop libtorrent 0.16.x support.
This commit is contained in:
sledgehammer999 2015-07-29 22:15:45 +03:00
commit 6985b553af
22 changed files with 115 additions and 498 deletions

View file

@ -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 # 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=true
#- lt_branch=dist gui=false #- 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=true
- lt_branch=RC_1_0 gui=false - lt_branch=RC_1_0 gui=false
global: global:
@ -38,9 +36,6 @@ before_install:
- qbtconf="$qbtconf --with-qt4" - qbtconf="$qbtconf --with-qt4"
- ltconf=" --with-libgeoip=system" - ltconf=" --with-libgeoip=system"
# Options for specific branches
- if [[ "$lt_branch" == "RC_0_16" ]]; then qbtconf="$qbtconf --with-libtorrent-rasterbar0.16" ; fi
# Print settings # Print settings
- echo $lt_branch - echo $lt_branch
- echo $gui - echo $gui

10
INSTALL
View file

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

324
configure vendored
View file

@ -601,10 +601,10 @@ EXPAND_BINDIR
EXPAND_PREFIX EXPAND_PREFIX
zlib_LIBS zlib_LIBS
zlib_CFLAGS zlib_CFLAGS
qjson_LIBS
qjson_CFLAGS
libtorrent_LIBS libtorrent_LIBS
libtorrent_CFLAGS libtorrent_CFLAGS
qjson_LIBS
qjson_CFLAGS
BOOST_SYSTEM_LIB BOOST_SYSTEM_LIB
BOOST_LDFLAGS BOOST_LDFLAGS
BOOST_CPPFLAGS BOOST_CPPFLAGS
@ -715,7 +715,6 @@ enable_option_checking
enable_dependency_tracking enable_dependency_tracking
enable_silent_rules enable_silent_rules
with_qt5 with_qt5
with_libtorrent_rasterbar0_16
with_qtsingleapplication with_qtsingleapplication
with_qjson with_qjson
enable_debug enable_debug
@ -742,10 +741,10 @@ PKG_CONFIG
PKG_CONFIG_PATH PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR PKG_CONFIG_LIBDIR
QT_QMAKE QT_QMAKE
libtorrent_CFLAGS
libtorrent_LIBS
qjson_CFLAGS qjson_CFLAGS
qjson_LIBS qjson_LIBS
libtorrent_CFLAGS
libtorrent_LIBS
zlib_CFLAGS zlib_CFLAGS
zlib_LIBS' zlib_LIBS'
@ -1383,9 +1382,6 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-qt5 Compile using Qt5 (default=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] --with-qtsingleapplication=[system|shipped]
Use the shipped qtsingleapplication library or the Use the shipped qtsingleapplication library or the
system one (default=shipped) system one (default=shipped)
@ -1422,13 +1418,13 @@ Some influential environment variables:
PKG_CONFIG_LIBDIR PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path path overriding pkg-config's built-in search path
QT_QMAKE value of moc_location for QtCore >= 4.8.0, overriding pkg-config 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 libtorrent_CFLAGS
C compiler flags for libtorrent, overriding pkg-config C compiler flags for libtorrent, overriding pkg-config
libtorrent_LIBS libtorrent_LIBS
linker flags for libtorrent, overriding pkg-config 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_CFLAGS C compiler flags for zlib, overriding pkg-config
zlib_LIBS linker 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'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Expand $ac_aux_dir to an absolute path. # expand $ac_aux_dir to an absolute path
am_aux_dir=`cd "$ac_aux_dir" && pwd` am_aux_dir=`cd $ac_aux_dir && pwd`
ac_ext=c ac_ext=c
ac_cpp='$CPP $CPPFLAGS' ac_cpp='$CPP $CPPFLAGS'
@ -4167,7 +4163,6 @@ fi
# Define --wth-* and --enable-* arguments # Define --wth-* and --enable-* arguments
@ -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. # Check whether --with-qtsingleapplication was given.
if test "${with_qtsingleapplication+set}" = set; then : if test "${with_qtsingleapplication+set}" = set; then :
withval=$with_qtsingleapplication; withval=$with_qtsingleapplication;
@ -5279,205 +5265,6 @@ $as_echo "$as_me: Boost.System LIB: $BOOST_SYSTEM_LIB" >&6;}
LIBS="$BOOST_SYSTEM_LIB $LIBS" LIBS="$BOOST_SYSTEM_LIB $LIBS"
fi 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; }
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtorrent" >&5
$as_echo_n "checking for libtorrent... " >&6; }
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 >= 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 >= 1.0.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
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 >= 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 >= 1.0.0" 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
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 >= 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 >= 1.0.0) were not met:
$libtorrent_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.
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 libtorrent_CFLAGS
and libtorrent_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") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtorrent" >&5
$as_echo_n "checking for libtorrent... " >&6; }
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
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`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
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
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`
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
libtorrent_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtorrent-rasterbar >= 0.16.0" 2>&1`
else
libtorrent_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtorrent-rasterbar >= 0.16.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:
$libtorrent_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.
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 libtorrent_CFLAGS
and libtorrent_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 ;; #(
*) :
{ $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 "$as_me:${as_lineno-$LINENO}: checking which qtsingleapplication to use" >&5
$as_echo_n "checking which qtsingleapplication to use... " >&6; } $as_echo_n "checking which qtsingleapplication to use... " >&6; }
case "x$with_qtsingleapplication" in #( case "x$with_qtsingleapplication" in #(
@ -5608,6 +5395,99 @@ esac
fi fi
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtorrent" >&5
$as_echo_n "checking for libtorrent... " >&6; }
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 >= 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 >= 1.0.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
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 >= 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 >= 1.0.0" 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
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 >= 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 >= 1.0.0) were not met:
$libtorrent_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.
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 libtorrent_CFLAGS
and libtorrent_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
pkg_failed=no pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib" >&5
$as_echo_n "checking for zlib... " >&6; } $as_echo_n "checking for zlib... " >&6; }

View file

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

View file

@ -29,13 +29,7 @@
#ifndef BITTORRENT_INFOHASH_H #ifndef BITTORRENT_INFOHASH_H
#define 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> #include <libtorrent/sha1_hash.hpp>
#endif
#include <QString> #include <QString>
namespace BitTorrent namespace BitTorrent

View file

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

View file

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

View file

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

View file

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

View file

@ -34,7 +34,6 @@
#include <QByteArray> #include <QByteArray>
#include <QBitArray> #include <QBitArray>
#include <libtorrent/version.hpp>
#include <libtorrent/entry.hpp> #include <libtorrent/entry.hpp>
#include <libtorrent/bencode.hpp> #include <libtorrent/bencode.hpp>
#include <libtorrent/address.hpp> #include <libtorrent/address.hpp>
@ -230,13 +229,8 @@ InfoHash TorrentHandle::hash() const
QString TorrentHandle::name() const QString TorrentHandle::name() const
{ {
QString name = m_name; QString name = m_name;
if (name.isEmpty()) { if (name.isEmpty())
#if LIBTORRENT_VERSION_NUM < 10000
name = m_nativeName;
#else
name = Utils::String::fromStdString(m_nativeStatus.name); name = Utils::String::fromStdString(m_nativeStatus.name);
#endif
}
if (name.isEmpty()) if (name.isEmpty())
name = m_hash; name = m_hash;
@ -319,11 +313,7 @@ QString TorrentHandle::rootPath() const
QString TorrentHandle::nativeActualSavePath() const QString TorrentHandle::nativeActualSavePath() const
{ {
#if LIBTORRENT_VERSION_NUM < 10000
return m_nativeSavePath;
#else
return Utils::String::fromStdString(m_nativeStatus.save_path); return Utils::String::fromStdString(m_nativeStatus.save_path);
#endif
} }
QString TorrentHandle::actualSavePath() const QString TorrentHandle::actualSavePath() const
@ -1014,12 +1004,7 @@ QBitArray TorrentHandle::pieces() const
{ {
QBitArray result(m_nativeStatus.pieces.size()); QBitArray result(m_nativeStatus.pieces.size());
#if LIBTORRENT_VERSION_NUM < 10000 for (int i = 0; i < m_nativeStatus.pieces.size(); ++i)
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)
result.setBit(i, m_nativeStatus.pieces.get_bit(i)); result.setBit(i, m_nativeStatus.pieces.get_bit(i));
return result; return result;
@ -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) void TorrentHandle::forceReannounce(int index)
{ {
SAFE_CALL(force_reannounce, 0, index); SAFE_CALL(force_reannounce, 0, index);
} }
#endif
void TorrentHandle::forceDHTAnnounce() void TorrentHandle::forceDHTAnnounce()
{ {
@ -1753,16 +1729,7 @@ void TorrentHandle::updateTorrentInfo()
{ {
if (!hasMetadata()) return; 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); m_torrentInfo = TorrentInfo(m_nativeStatus.torrent_file);
#endif
} }
void TorrentHandle::initialize() void TorrentHandle::initialize()
@ -1801,15 +1768,6 @@ void TorrentHandle::updateStatus()
void TorrentHandle::updateStatus(const libtorrent::torrent_status &nativeStatus) void TorrentHandle::updateStatus(const libtorrent::torrent_status &nativeStatus)
{ {
m_nativeStatus = 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(); updateState();
updateTorrentInfo(); updateTorrentInfo();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -98,11 +98,7 @@ void ExecutionLog::addPeerMessage(const Log::Peer& peer)
QDateTime time = QDateTime::fromMSecsSinceEpoch(peer.timestamp); QDateTime time = QDateTime::fromMSecsSinceEpoch(peer.timestamp);
if (peer.blocked) 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); 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 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); 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);

View file

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

View file

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

View file

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

View file

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