1
mirror of https://github.com/qbittorrent/qBittorrent synced 2025-10-21 13:52:16 +02:00

Compare commits

..

53 Commits

Author SHA1 Message Date
sledgehammer999
2c65b79640 Bump to 4.2.5 2020-04-25 00:29:44 +03:00
sledgehammer999
1ef504631d Update Changelog 2020-04-25 00:25:01 +03:00
sledgehammer999
5468f10184 Bump Web API version 2020-04-25 00:21:06 +03:00
sledgehammer999
5e249c4898 Sync translations from Transifex and run lupdate 2020-04-25 00:11:49 +03:00
Chocobo1
c67d863c93 Register datatype properly
Qt 5.9.5 doesn't seem to recognize it, this patch fixes it.
Fix up: d8401c76f5.
Related: #12601.
2020-04-25 00:01:49 +03:00
Sepro
6e375a38ef WebAPI: Change delimiter from string to char in preferences API 2020-04-25 00:01:47 +03:00
Sepro
0f6768f6ad WebAPI: Expand RSS related API
Added markAsRead API method with optional parameter for specifying single article.
Added the rss_smart_episode_filters and rss_download_repack_proper_episodes keys to preference api.
Added matchingArticles API method for retrieving articles that match specified rule.
2020-04-25 00:01:46 +03:00
Vladimir Golovnev (Glassez)
bdeb662cb0 Fix crash when torrent is deleted on limit reached 2020-04-25 00:01:44 +03:00
Chocobo1
b9b06d5384 Suppress misleading warning message
QString::split() was giving a non-empty QStringList, and
that caused Session::setBannedIPs() to emit misleading warning message.
2020-04-25 00:01:43 +03:00
Chocobo1
6a174b594b Add ability to send custom HTTP headers 2020-04-25 00:01:41 +03:00
schnurlos
f7cd5ac7c7 NSIS: Update german translation 2020-04-25 00:01:21 +03:00
sledgehammer999
50f676c305 Bump to 4.2.4 2020-04-22 18:49:52 +03:00
sledgehammer999
7103ae73cd Update Changelog 2020-04-22 18:46:15 +03:00
sledgehammer999
7d4b8b010f Sync translations from Transifex and run lupdate 2020-04-22 18:45:26 +03:00
an0n666
09bf033226 Use configured net interface even when it is missing 2020-04-22 18:19:33 +03:00
NotTsunami
4e62608802 WebUI: Fix UPnP lease duration get/set
Add missing setProperty and getProperty calls for the new UPnP lease
duration setting.

Fixes 6b4925d222.
Closes #12566.
2020-04-22 18:19:32 +03:00
Chocobo1
37b29bf91a Reduce ambiguity for selecting icons
Related: #12554.
2020-04-22 18:19:31 +03:00
thalieht
d67037136b Don't uncheck Authentication checkbox when changing proxy type
Closes #12525
2020-04-22 18:19:29 +03:00
thalieht
73292137b7 Make a few cosmetic changes in code 2020-04-22 18:19:28 +03:00
C.W. Betts
56f7a4e803 Update Info.plist
Wrap the UTTypeTagSpecifications in arrays, as Xcode does.
2020-04-22 18:19:26 +03:00
Chocobo1
1cea6a25af Add final specifier to GUI classes
Follow up d3d3f7dbb3.
2020-04-22 18:19:23 +03:00
Chocobo1
ebc704ef14 Reduce padding in class
TorrentHandleImpl size is reduced from 768 bytes to 736 bytes.
CreateTorrentParams size didn't change.
Size numbers are from x64.
2020-04-22 18:19:22 +03:00
Chocobo1
a2a1a78f44 Move initialization default values to header 2020-04-22 18:19:21 +03:00
Chocobo1
3a54d574b0 Reduce padding in structure
Log::Msg originally takes 32 bytes, now shrinks to 24 bytes.
Log::Peer originally takes 40 bytes, now shrinks to 32 bytes.
2020-04-22 18:19:20 +03:00
an0n666
d0be71c225 Change default upload slot choking limits 2020-04-22 18:19:19 +03:00
Chocobo1
7c04b4acd8 Add final specifier to classes
This allow compilers to generate more efficient code.
2020-04-22 18:19:18 +03:00
sledgehammer999
eda3747c08 Use static_cast for explicit type conversions 2020-04-22 18:19:17 +03:00
sledgehammer999
7d23ea1f80 TravisCI: Use libtorrent with deprecated functions disabled for Linux builds 2020-04-22 18:19:16 +03:00
Vladimir Golovnev (Glassez)
698ee94d0b Split TorrentHandle interface and implementation 2020-04-22 18:19:14 +03:00
jagannatharjun
65d1b588d9 Convert the Log widget to use custom View/Model
Co-authored-by: sledgehammer999 <hammered999@gmail.com>
2020-04-22 18:19:13 +03:00
an0n666
eea693979a Change default stop_tracker_timeout settings 2020-04-22 18:19:12 +03:00
Raif Atef
654bf85a71 Do not use 0.0.0.0 or [::] for outgoing interfaces
Fixes #12443
2020-04-22 18:19:11 +03:00
an0n666
8706a7c973 Remove deprecated strict super seeding mode from advanced settings 2020-04-22 18:19:10 +03:00
Chocobo1
439a2ef597 Fix date format for "Last seen complete"
Closes #12462.
2020-04-22 18:19:08 +03:00
Sepro
c5a7aa7668 Fix unable to add multiple peers in WebUI
Wrong delimiter was used.
2020-04-22 18:19:07 +03:00
Chocobo1
e5bf83a594 Preallocate output buffer 2020-04-22 18:19:06 +03:00
Chocobo1
2a3e64933b Fix header inclusion order 2020-04-22 18:19:05 +03:00
Chocobo1
35f8af32a3 Suppress unused variable warning on macOS 2020-04-22 18:19:04 +03:00
Chocobo1
37354a9e29 Avoid holding encoded resume data in memory
Now it the encoded resume data will be streamed to file instead of a
temporary buffer holding the whole of it.
2020-04-22 18:19:02 +03:00
József Sallai
7cb14e2a5b Detect python3 executable on Windows 2020-04-22 18:19:01 +03:00
Vladimir Golovnev (Glassez)
4aae7266a5 Save "resume data" when torrent storage is moved 2020-04-22 18:19:00 +03:00
Raif Atef
075245c915 Fix outgoing interface is not getting assigned
Assignment was missing in main branch of condition statement.
Closes https://github.com/qbittorrent/qBittorrent/issues/12421
2020-04-22 18:18:59 +03:00
adem
476707cc80 Remove white outline around mascot.png 2020-04-22 18:18:58 +03:00
Chocobo1
7b0b5e3d7f Avoid inefficient behavior
Since the class needs to be copy-constructible, there may be many
copies of an instance. So instead of writing to the device on every
destructor call, only flush buffer on the last destructor call.
2020-04-22 18:18:56 +03:00
Chocobo1
4142722303 Sort locale language list 2020-04-22 18:18:55 +03:00
NotTsunami
8ebb11f981 Set disk cache size for older libtorrent versions
Libtorrent versions older than 1.2.6 have a bug when setting disk
cache size to auto.

See 6c880159c9.
2020-04-22 18:18:54 +03:00
Chocobo1
80016db781 Fix wrong logic that disables "prevent sleeping" timer
Also update power management state early so we don't need to wait for
the timer timeout to have the effect.
2020-04-22 18:18:53 +03:00
Chocobo1
a9f43bd5d2 Clean up coding style 2020-04-22 18:18:52 +03:00
Chocobo1
2f0c3f047a Avoid holding entire file in memory
Previously we need a file buffer that is as large as the file size and
this could be a problem when user has less free memory available or
having very large data. Now with the help of `FileOutputIterator`,
we can have a much smaller, fixed size immediate file buffer and also
the code looks nice with `lt::bencode()`.
2020-04-22 18:18:50 +03:00
Vladimir Golovnev (Glassez)
f40a36ecb3 Fix sub-sorting of Transfer list
Closes #12330.
2020-04-22 18:18:50 +03:00
Chocobo1
a1ee1c0448 Remove redundant type attribute
It already defaults to `text/css` if value is absent (in HTML5).
2020-04-22 18:18:49 +03:00
Chocobo1
939f83bdd5 Fix mismatch ID 2020-04-22 18:18:48 +03:00
Chocobo1
e98a887286 Improve logging for errors
This commit also allows the strings to be translated.
2020-04-22 18:18:37 +03:00
233 changed files with 31786 additions and 29427 deletions

View File

@@ -55,14 +55,13 @@ addons:
apt:
sources:
# sources list: https://github.com/travis-ci/apt-source-safelist/blob/master/ubuntu.json
- sourceline: 'ppa:qbittorrent-team/qbittorrent-stable'
- sourceline: 'ppa:qbittorrent-team/qbt-libtorrent-travisci'
- sourceline: 'ppa:beineri/opt-qt59-xenial'
packages:
# packages list: https://github.com/travis-ci/apt-package-safelist/blob/master/ubuntu-trusty
- [autoconf, automake, colormake]
- [libboost-dev, libboost-system-dev]
- libssl-dev
- libtorrent-rasterbar-dev
- [qt59base, qt59svg, qt59tools]
- zlib1g-dev
# required for Qt 5.9 from 'beineri' PPA
@@ -132,7 +131,7 @@ install:
ccache -V && ccache --show-stats && ccache --zero-stats
fi
- |
if [ "$libt_branch" = "RC_1_2" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then
if [ "$libt_branch" = "RC_1_1" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then
wget https://builds.shiki.hu/travis/deb/version
if ! cmp --quiet "version" "$HOME/travis/deb/version" ; then
echo "Cached files are different from server. Downloading new ones."
@@ -141,11 +140,16 @@ install:
mkdir "$HOME/travis/deb"
cp "version" $HOME/travis/deb
cd "$HOME/travis/deb"
wget https://builds.shiki.hu/travis/deb/libtorrent-rasterbar-dev_1.2.x_amd64.deb
wget https://builds.shiki.hu/travis/deb/libtorrent-rasterbar10_1.2.x_amd64.deb
wget https://builds.shiki.hu/travis/deb/libtorrent-rasterbar-dev_1.1.x_amd64.deb
wget https://builds.shiki.hu/travis/deb/libtorrent-rasterbar9_1.1.x_amd64.deb
fi
sudo dpkg -i "$HOME/travis/deb/libtorrent-rasterbar-dev_1.2.x_amd64.deb" "$HOME/travis/deb/libtorrent-rasterbar10_1.2.x_amd64.deb"
sudo dpkg -i "$HOME/travis/deb/libtorrent-rasterbar-dev_1.1.x_amd64.deb" "$HOME/travis/deb/libtorrent-rasterbar9_1.1.x_amd64.deb"
fi
- |
if [ "$libt_branch" = "RC_1_2" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then
# Will install latest 1.2.x daily build from the PPA
sudo apt-get -y install libtorrent-rasterbar-dev
fi
- |
if [ "$libt_branch" = "RC_1_1" ] && [ "$TRAVIS_OS_NAME" = "osx" ]; then

View File

@@ -1,3 +1,30 @@
Sat Apr 25 2020 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.2.5
- BUGFIX: Fix crash when torrent is deleted on limit reached (glassez)
- BUGFIX: Register datatype properly (Chocobo1)
- WEBUI: Add ability to send custom HTTP headers (Chocobo1)
- WEBUI: Expand RSS related API (Sepro)
- WINDOWS: Installer: Update german translation (schnurlos)
Wed Apr 22 2020 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.2.4
- BUGFIX: Fix sub-sorting of Transfer list (glassez)
- BUGFIX: Fix wrong logic that disables "prevent sleeping" timer (Chocobo1)
- BUGFIX: Set disk cache size for older libtorrent versions (NotTsunami)
- BUGFIX: Sort locale language list (Chocobo1)
- BUGFIX: Remove white outline around mascot.png (adem)
- BUGFIX: Various fixes in configuring the chosen network interface and not leaking the IP (Raif Atef, an0n666)
- BUGFIX: Save "resume data" when torrent storage is moved (glassez)
- BUGFIX: Avoid holding encoded resume data in memory (Chocobo1)
- BUGFIX: Fix date format for "Last seen complete" (Chocobo1)
- BUGFIX: Remove deprecated strict super seeding mode from advanced settings (an0n666)
- BUGFIX: Change default stop_tracker_timeout settings (an0n666)
- BUGFIX: Convert the Log widget to use custom View/Model (jagannatharjun)
- BUGFIX: Change default upload slot choking limits (an0n666)
- BUGFIX: Don't uncheck Authentication checkbox when changing proxy type (thalieht)
- BUGFIX: Reduce ambiguity for selecting tray icons (Chocobo1)
- WEBUI: Fix unable to add multiple peers in WebUI (Sepro)
- WEBUI: Fix UPnP lease duration get/set (NotTsunami)
- SEARCH: Detect python3 executable on Windows (József Sallai)
Wed Apr 01 2020 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.2.3
- FEATURE: Add logging for SOCKS5 proxy errors (Chocobo1)
- FEATURE: Add UPnP lease duration advanced option (NotTsunami)

24
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for qbittorrent v4.2.3.
# Generated by GNU Autoconf 2.69 for qbittorrent v4.2.5.
#
# Report bugs to <bugs.qbittorrent.org>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='qbittorrent'
PACKAGE_TARNAME='qbittorrent'
PACKAGE_VERSION='v4.2.3'
PACKAGE_STRING='qbittorrent v4.2.3'
PACKAGE_VERSION='v4.2.5'
PACKAGE_STRING='qbittorrent v4.2.5'
PACKAGE_BUGREPORT='bugs.qbittorrent.org'
PACKAGE_URL='https://www.qbittorrent.org/'
@@ -1302,7 +1302,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures qbittorrent v4.2.3 to adapt to many kinds of systems.
\`configure' configures qbittorrent v4.2.5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1373,7 +1373,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of qbittorrent v4.2.3:";;
short | recursive ) echo "Configuration of qbittorrent v4.2.5:";;
esac
cat <<\_ACEOF
@@ -1509,7 +1509,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
qbittorrent configure v4.2.3
qbittorrent configure v4.2.5
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1648,7 +1648,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by qbittorrent $as_me v4.2.3, which was
It was created by qbittorrent $as_me v4.2.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3826,7 +3826,7 @@ fi
# Define the identity of the package.
PACKAGE='qbittorrent'
VERSION='v4.2.3'
VERSION='v4.2.5'
cat >>confdefs.h <<_ACEOF
@@ -6343,7 +6343,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by qbittorrent $as_me v4.2.3, which was
This file was extended by qbittorrent $as_me v4.2.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6401,7 +6401,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
qbittorrent config.status v4.2.3
qbittorrent config.status v4.2.5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -7659,7 +7659,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by qbittorrent $as_me v4.2.3, which was
This file was extended by qbittorrent $as_me v4.2.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -7717,7 +7717,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
qbittorrent config.status v4.2.3
qbittorrent config.status v4.2.5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@@ -1,4 +1,4 @@
AC_INIT([qbittorrent], [v4.2.3], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
AC_INIT([qbittorrent], [v4.2.5], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC

10
dist/mac/Info.plist vendored
View File

@@ -55,7 +55,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>4.2.3</string>
<string>4.2.5</string>
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
@@ -88,13 +88,17 @@
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>TORR</string>
<array>
<string>TORR</string>
</array>
<key>public.filename-extension</key>
<array>
<string>torrent</string>
</array>
<key>public.mime-type</key>
<string>application/x-bittorrent</string>
<array>
<string>application/x-bittorrent</string>
</array>
</dict>
</dict>
</array>

View File

@@ -74,6 +74,6 @@
<url type="translate">https://github.com/qbittorrent/qBittorrent/wiki/How-to-translate-qBittorrent</url>
<content_rating type="oars-1.1"/>
<releases>
<release version="4.2.3" date="2020-04-01"/>
<release version="4.2.5" date="2020-04-25"/>
</releases>
</component>

View File

@@ -15,7 +15,7 @@ LangString inst_magnet ${LANG_GERMAN} "Öffne Magnet-Links mit qBittorrent"
;LangString inst_firewall ${LANG_ENGLISH} "Add Windows Firewall rule"
LangString inst_firewall ${LANG_GERMAN} "Regel in der Windows Firewall hinzufügen"
;LangString inst_pathlimit ${LANG_ENGLISH} "Disable Windows path length limit (260 character MAX_PATH limitation, requires Windows 10 1607 or later)"
LangString inst_pathlimit ${LANG_GERMAN} "Disable Windows path length limit (260 character MAX_PATH limitation, requires Windows 10 1607 or later)"
LangString inst_pathlimit ${LANG_GERMAN} "Deaktiviere die Windows-Pfadlängenbeschränkung (260 Zeichen Beschränkung von MAX_PATH - erfordert Windows 10 1607 oder höher)"
;LangString inst_firewallinfo ${LANG_ENGLISH} "Adding Windows Firewall rule"
LangString inst_firewallinfo ${LANG_GERMAN} "Füge Regel in der Windows Firewall hinzu"
;LangString inst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before installing."

View File

@@ -28,7 +28,7 @@ XPStyle on
!define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
; Program specific
!define PROG_VERSION "4.2.3"
!define PROG_VERSION "4.2.5"
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun

View File

@@ -61,6 +61,7 @@
#endif // Q_OS_MACOS
#endif
#include "base/bittorrent/infohash.h"
#include "base/bittorrent/session.h"
#include "base/bittorrent/torrenthandle.h"
#include "base/exceptions.h"
@@ -133,6 +134,7 @@ Application::Application(int &argc, char **argv)
, m_commandLineArgs(parseCommandLine(this->arguments()))
{
qRegisterMetaType<Log::Msg>("Log::Msg");
qRegisterMetaType<Log::Peer>("Log::Peer");
setApplicationName("qBittorrent");
setOrganizationDomain("qbittorrent.org");

View File

@@ -68,7 +68,7 @@ namespace RSS
class AutoDownloader;
}
class Application : public BaseApplication
class Application final : public BaseApplication
{
Q_OBJECT
Q_DISABLE_COPY(Application)

View File

@@ -77,7 +77,7 @@
namespace QtLP_Private
{
class QtLockedFile : public QFile
class QtLockedFile final : public QFile
{
public:
enum LockMode

View File

@@ -22,6 +22,7 @@ bittorrent/session.h
bittorrent/sessionstatus.h
bittorrent/torrentcreatorthread.h
bittorrent/torrenthandle.h
bittorrent/torrenthandleimpl.h
bittorrent/torrentinfo.h
bittorrent/tracker.h
bittorrent/trackerentry.h
@@ -58,6 +59,7 @@ utils/bytearray.h
utils/foreignapps.h
utils/fs.h
utils/gzip.h
utils/io.h
utils/misc.h
utils/net.h
utils/password.h
@@ -99,6 +101,7 @@ bittorrent/private/statistics.cpp
bittorrent/session.cpp
bittorrent/torrentcreatorthread.cpp
bittorrent/torrenthandle.cpp
bittorrent/torrenthandleimpl.cpp
bittorrent/torrentinfo.cpp
bittorrent/tracker.cpp
bittorrent/trackerentry.cpp
@@ -133,6 +136,7 @@ utils/bytearray.cpp
utils/foreignapps.cpp
utils/fs.cpp
utils/gzip.cpp
utils/io.cpp
utils/misc.cpp
utils/net.cpp
utils/password.cpp

View File

@@ -21,6 +21,7 @@ HEADERS += \
$$PWD/bittorrent/sessionstatus.h \
$$PWD/bittorrent/torrentcreatorthread.h \
$$PWD/bittorrent/torrenthandle.h \
$$PWD/bittorrent/torrenthandleimpl.h \
$$PWD/bittorrent/torrentinfo.h \
$$PWD/bittorrent/tracker.h \
$$PWD/bittorrent/trackerentry.h \
@@ -73,6 +74,7 @@ HEADERS += \
$$PWD/utils/foreignapps.h \
$$PWD/utils/fs.h \
$$PWD/utils/gzip.h \
$$PWD/utils/io.h \
$$PWD/utils/misc.h \
$$PWD/utils/net.h \
$$PWD/utils/password.h \
@@ -98,6 +100,7 @@ SOURCES += \
$$PWD/bittorrent/session.cpp \
$$PWD/bittorrent/torrentcreatorthread.cpp \
$$PWD/bittorrent/torrenthandle.cpp \
$$PWD/bittorrent/torrenthandleimpl.cpp \
$$PWD/bittorrent/torrentinfo.cpp \
$$PWD/bittorrent/tracker.cpp \
$$PWD/bittorrent/trackerentry.cpp \
@@ -143,6 +146,7 @@ SOURCES += \
$$PWD/utils/foreignapps.cpp \
$$PWD/utils/fs.cpp \
$$PWD/utils/gzip.cpp \
$$PWD/utils/io.cpp \
$$PWD/utils/misc.cpp \
$$PWD/utils/net.cpp \
$$PWD/utils/password.cpp \

View File

@@ -28,6 +28,8 @@
#include "peerinfo.h"
#include <libtorrent/version.hpp>
#include <QBitArray>
#include "base/bittorrent/torrenthandle.h"

View File

@@ -35,7 +35,7 @@
class QDataStream;
class FilterParserThread : public QThread
class FilterParserThread final : public QThread
{
Q_OBJECT

View File

@@ -31,7 +31,7 @@
#include <libtorrent/extensions.hpp>
#include <libtorrent/version.hpp>
class NativeSessionExtension : public lt::plugin
class NativeSessionExtension final : public lt::plugin
{
#if (LIBTORRENT_VERSION_NUM >= 10200)
lt::feature_flags_t implemented_features() override;

View File

@@ -47,7 +47,7 @@ namespace
#if (LIBTORRENT_VERSION_NUM < 10200)
return torrentStatus.auto_managed;
#else
return bool {torrentStatus.flags & lt::torrent_flags::auto_managed};
return static_cast<bool>(torrentStatus.flags & lt::torrent_flags::auto_managed);
#endif
}
}

View File

@@ -32,7 +32,7 @@
#include <libtorrent/torrent_handle.hpp>
#include <libtorrent/version.hpp>
class NativeTorrentExtension : public lt::torrent_plugin
class NativeTorrentExtension final : public lt::torrent_plugin
{
public:
explicit NativeTorrentExtension(const lt::torrent_handle &torrentHandle);

View File

@@ -44,7 +44,7 @@ using LTPortMapping = int;
using LTPortMapping = lt::port_mapping_t;
#endif
class PortForwarderImpl : public Net::PortForwarder
class PortForwarderImpl final : public Net::PortForwarder
{
Q_OBJECT
Q_DISABLE_COPY(PortForwarderImpl)

View File

@@ -28,11 +28,15 @@
#include "resumedatasavingmanager.h"
#include <libtorrent/bencode.hpp>
#include <libtorrent/entry.hpp>
#include <QByteArray>
#include <QSaveFile>
#include "base/logger.h"
#include "base/utils/fs.h"
#include "base/utils/io.h"
ResumeDataSavingManager::ResumeDataSavingManager(const QString &resumeFolderPath)
: m_resumeDataDir(resumeFolderPath)
@@ -44,12 +48,27 @@ void ResumeDataSavingManager::save(const QString &filename, const QByteArray &da
const QString filepath = m_resumeDataDir.absoluteFilePath(filename);
QSaveFile file {filepath};
if (file.open(QIODevice::WriteOnly)) {
file.write(data);
if (!file.commit()) {
Logger::instance()->addMessage(QString("Couldn't save data in '%1'. Error: %2")
.arg(filepath, file.errorString()), Log::WARNING);
}
if (!file.open(QIODevice::WriteOnly) || (file.write(data) != data.size()) || !file.commit()) {
LogMsg(tr("Couldn't save data to '%1'. Error: %2")
.arg(filepath, file.errorString()), Log::CRITICAL);
}
}
void ResumeDataSavingManager::save(const QString &filename, const std::shared_ptr<lt::entry> &data) const
{
const QString filepath = m_resumeDataDir.absoluteFilePath(filename);
QSaveFile file {filepath};
if (!file.open(QIODevice::WriteOnly)) {
LogMsg(tr("Couldn't save data to '%1'. Error: %2")
.arg(filepath, file.errorString()), Log::CRITICAL);
return;
}
lt::bencode(Utils::IO::FileDeviceOutputIterator {file}, *data);
if ((file.error() != QFileDevice::NoError) || !file.commit()) {
LogMsg(tr("Couldn't save data to '%1'. Error: %2")
.arg(filepath, file.errorString()), Log::CRITICAL);
}
}

View File

@@ -28,6 +28,10 @@
#pragma once
#include <memory>
#include <libtorrent/fwd.hpp>
#include <QDir>
#include <QObject>
@@ -43,8 +47,9 @@ public:
public slots:
void save(const QString &filename, const QByteArray &data) const;
void save(const QString &filename, const std::shared_ptr<lt::entry> &data) const;
void remove(const QString &filename) const;
private:
QDir m_resumeDataDir;
const QDir m_resumeDataDir;
};

File diff suppressed because it is too large Load Diff

View File

@@ -30,6 +30,7 @@
#ifndef BITTORRENT_SESSION_H
#define BITTORRENT_SESSION_H
#include <memory>
#include <vector>
#include <libtorrent/fwd.hpp>
@@ -92,6 +93,7 @@ namespace BitTorrent
class InfoHash;
class MagnetUri;
class TorrentHandle;
class TorrentHandleImpl;
class Tracker;
class TrackerEntry;
struct CreateTorrentParams;
@@ -377,8 +379,6 @@ namespace BitTorrent
void setAnnounceIP(const QString &ip);
int stopTrackerTimeout() const;
void setStopTrackerTimeout(int value);
bool isSuperSeedingEnabled() const;
void setSuperSeedingEnabled(bool enabled);
int maxConnections() const;
void setMaxConnections(int max);
int maxConnectionsPerTorrent() const;
@@ -412,7 +412,7 @@ namespace BitTorrent
void startUpTorrents();
TorrentHandle *findTorrent(const InfoHash &hash) const;
QHash<InfoHash, TorrentHandle *> torrents() const;
QVector<TorrentHandle *> torrents() const;
bool hasActiveTorrents() const;
bool hasUnfinishedTorrents() const;
bool hasRunningSeed() const;
@@ -441,31 +441,31 @@ namespace BitTorrent
void bottomTorrentsQueuePos(const QVector<InfoHash> &hashes);
// TorrentHandle interface
void handleTorrentSaveResumeDataRequested(const TorrentHandle *torrent);
void handleTorrentShareLimitChanged(TorrentHandle *const torrent);
void handleTorrentNameChanged(TorrentHandle *const torrent);
void handleTorrentSavePathChanged(TorrentHandle *const torrent);
void handleTorrentCategoryChanged(TorrentHandle *const torrent, const QString &oldCategory);
void handleTorrentTagAdded(TorrentHandle *const torrent, const QString &tag);
void handleTorrentTagRemoved(TorrentHandle *const torrent, const QString &tag);
void handleTorrentSavingModeChanged(TorrentHandle *const torrent);
void handleTorrentMetadataReceived(TorrentHandle *const torrent);
void handleTorrentPaused(TorrentHandle *const torrent);
void handleTorrentResumed(TorrentHandle *const torrent);
void handleTorrentChecked(TorrentHandle *const torrent);
void handleTorrentFinished(TorrentHandle *const torrent);
void handleTorrentTrackersAdded(TorrentHandle *const torrent, const QVector<TrackerEntry> &newTrackers);
void handleTorrentTrackersRemoved(TorrentHandle *const torrent, const QVector<TrackerEntry> &deletedTrackers);
void handleTorrentTrackersChanged(TorrentHandle *const torrent);
void handleTorrentUrlSeedsAdded(TorrentHandle *const torrent, const QVector<QUrl> &newUrlSeeds);
void handleTorrentUrlSeedsRemoved(TorrentHandle *const torrent, const QVector<QUrl> &urlSeeds);
void handleTorrentResumeDataReady(TorrentHandle *const torrent, const lt::entry &data);
void handleTorrentResumeDataFailed(TorrentHandle *const torrent);
void handleTorrentTrackerReply(TorrentHandle *const torrent, const QString &trackerUrl);
void handleTorrentTrackerWarning(TorrentHandle *const torrent, const QString &trackerUrl);
void handleTorrentTrackerError(TorrentHandle *const torrent, const QString &trackerUrl);
void handleTorrentSaveResumeDataRequested(const TorrentHandleImpl *torrent);
void handleTorrentShareLimitChanged(TorrentHandleImpl *const torrent);
void handleTorrentNameChanged(TorrentHandleImpl *const torrent);
void handleTorrentSavePathChanged(TorrentHandleImpl *const torrent);
void handleTorrentCategoryChanged(TorrentHandleImpl *const torrent, const QString &oldCategory);
void handleTorrentTagAdded(TorrentHandleImpl *const torrent, const QString &tag);
void handleTorrentTagRemoved(TorrentHandleImpl *const torrent, const QString &tag);
void handleTorrentSavingModeChanged(TorrentHandleImpl *const torrent);
void handleTorrentMetadataReceived(TorrentHandleImpl *const torrent);
void handleTorrentPaused(TorrentHandleImpl *const torrent);
void handleTorrentResumed(TorrentHandleImpl *const torrent);
void handleTorrentChecked(TorrentHandleImpl *const torrent);
void handleTorrentFinished(TorrentHandleImpl *const torrent);
void handleTorrentTrackersAdded(TorrentHandleImpl *const torrent, const QVector<TrackerEntry> &newTrackers);
void handleTorrentTrackersRemoved(TorrentHandleImpl *const torrent, const QVector<TrackerEntry> &deletedTrackers);
void handleTorrentTrackersChanged(TorrentHandleImpl *const torrent);
void handleTorrentUrlSeedsAdded(TorrentHandleImpl *const torrent, const QVector<QUrl> &newUrlSeeds);
void handleTorrentUrlSeedsRemoved(TorrentHandleImpl *const torrent, const QVector<QUrl> &urlSeeds);
void handleTorrentResumeDataReady(TorrentHandleImpl *const torrent, const std::shared_ptr<lt::entry> &data);
void handleTorrentResumeDataFailed(TorrentHandleImpl *const torrent);
void handleTorrentTrackerReply(TorrentHandleImpl *const torrent, const QString &trackerUrl);
void handleTorrentTrackerWarning(TorrentHandleImpl *const torrent, const QString &trackerUrl);
void handleTorrentTrackerError(TorrentHandleImpl *const torrent, const QString &trackerUrl);
bool addMoveTorrentStorageJob(TorrentHandle *torrent, const QString &newPath, MoveStorageMode mode);
bool addMoveTorrentStorageJob(TorrentHandleImpl *torrent, const QString &newPath, MoveStorageMode mode);
signals:
void addTorrentFailed(const QString &error);
@@ -522,7 +522,7 @@ namespace BitTorrent
private:
struct MoveStorageJob
{
TorrentHandle *torrent;
TorrentHandleImpl *torrent;
QString path;
MoveStorageMode mode;
};
@@ -572,7 +572,7 @@ namespace BitTorrent
bool findIncompleteFiles(TorrentInfo &torrentInfo, QString &savePath) const;
void updateSeedingLimitTimer();
void exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolder folder = TorrentExportFolder::Regular);
void exportTorrentFile(const TorrentHandle *torrent, TorrentExportFolder folder = TorrentExportFolder::Regular);
void handleAlert(const lt::alert *a);
void dispatchTorrentAlert(const lt::alert *a);
@@ -657,7 +657,6 @@ namespace BitTorrent
CachedSettingValue<bool> m_includeOverheadInLimits;
CachedSettingValue<QString> m_announceIP;
CachedSettingValue<int> m_stopTrackerTimeout;
CachedSettingValue<bool> m_isSuperSeedingEnabled;
CachedSettingValue<int> m_maxConnections;
CachedSettingValue<int> m_maxUploads;
CachedSettingValue<int> m_maxConnectionsPerTorrent;
@@ -735,7 +734,7 @@ namespace BitTorrent
ResumeDataSavingManager *m_resumeDataSavingManager = nullptr;
QHash<InfoHash, TorrentInfo> m_loadedMetadata;
QHash<InfoHash, TorrentHandle *> m_torrents;
QHash<InfoHash, TorrentHandleImpl *> m_torrents;
QHash<InfoHash, CreateTorrentParams> m_addingTorrents;
QHash<QString, AddTorrentParams> m_downloadedTorrents;
QHash<InfoHash, RemovingTorrentData> m_removingTorrents;
@@ -760,4 +759,9 @@ namespace BitTorrent
};
}
#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
Q_DECLARE_METATYPE(std::shared_ptr<lt::entry>)
const int sharedPtrLtEntryTypeID = qRegisterMetaType<std::shared_ptr<lt::entry>>();
#endif
#endif // BITTORRENT_SESSION_H

View File

@@ -41,8 +41,10 @@
#include <QFileInfo>
#include <QHash>
#include "base/exceptions.h"
#include "base/global.h"
#include "base/utils/fs.h"
#include "base/utils/io.h"
#include "base/utils/string.h"
#include "private/ltunderlyingtype.h"
@@ -162,7 +164,7 @@ void TorrentCreatorThread::run()
lt::set_piece_hashes(newTorrent, Utils::Fs::toNativePath(parentPath).toStdString()
, [this, &newTorrent](const LTPieceIndex n)
{
sendProgressSignal(LTUnderlyingType<LTPieceIndex> {n}, newTorrent.num_pieces());
sendProgressSignal(static_cast<LTUnderlyingType<LTPieceIndex>>(n), newTorrent.num_pieces());
});
// Set qBittorrent as creator and add user comment to
// torrent_info structure
@@ -182,19 +184,19 @@ void TorrentCreatorThread::run()
if (isInterruptionRequested()) return;
// create the torrent
std::ofstream outfile(
#ifdef _MSC_VER
Utils::Fs::toNativePath(m_params.savePath).toStdWString().c_str()
#else
Utils::Fs::toNativePath(m_params.savePath).toUtf8().constData()
#endif
, (std::ios_base::out | std::ios_base::binary | std::ios_base::trunc));
if (outfile.fail())
throw std::runtime_error(tr("create new torrent file failed").toStdString());
QFile outfile {m_params.savePath};
if (!outfile.open(QIODevice::WriteOnly)) {
throw RuntimeError {tr("Create new torrent file failed. Reason: %1")
.arg(outfile.errorString())};
}
if (isInterruptionRequested()) return;
lt::bencode(std::ostream_iterator<char>(outfile), entry);
lt::bencode(Utils::IO::FileDeviceOutputIterator {outfile}, entry);
if (outfile.error() != QFileDevice::NoError) {
throw RuntimeError {tr("Create new torrent file failed. Reason: %1")
.arg(outfile.errorString())};
}
outfile.close();
emit updateProgress(100);

View File

@@ -48,7 +48,7 @@ namespace BitTorrent
QStringList urlSeeds;
};
class TorrentCreatorThread : public QThread
class TorrentCreatorThread final : public QThread
{
Q_OBJECT

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -47,6 +47,7 @@
#include "base/exceptions.h"
#include "base/global.h"
#include "base/utils/fs.h"
#include "base/utils/io.h"
#include "base/utils/misc.h"
#include "infohash.h"
#include "trackerentry.h"
@@ -166,12 +167,12 @@ void TorrentInfo::saveToFile(const QString &path) const
#endif
const lt::entry torrentEntry = torrentCreator.generate();
QByteArray out;
out.reserve(1024 * 1024); // most torrent file sizes are under 1 MB
lt::bencode(std::back_inserter(out), torrentEntry);
QFile torrentFile {path};
if (!torrentFile.open(QIODevice::WriteOnly))
throw RuntimeError {torrentFile.errorString()};
QFile torrentFile{path};
if (!torrentFile.open(QIODevice::WriteOnly) || (torrentFile.write(out) != out.size()))
lt::bencode(Utils::IO::FileDeviceOutputIterator {torrentFile}, torrentEntry);
if (torrentFile.error() != QFileDevice::NoError)
throw RuntimeError {torrentFile.errorString()};
}

View File

@@ -70,7 +70,7 @@ namespace BitTorrent
// *Basic* Bittorrent tracker implementation
// [BEP-3] The BitTorrent Protocol Specification
// also see: https://wiki.theory.org/index.php/BitTorrentSpecification#Tracker_HTTP.2FHTTPS_Protocol
class Tracker : public QObject, public Http::IRequestHandler, private Http::ResponseBuilder
class Tracker final : public QObject, public Http::IRequestHandler, private Http::ResponseBuilder
{
Q_OBJECT
Q_DISABLE_COPY(Tracker)

View File

@@ -41,7 +41,7 @@ namespace Http
class IRequestHandler;
class Connection;
class Server : public QTcpServer
class Server final : public QTcpServer
{
Q_OBJECT
Q_DISABLE_COPY(Server)

Some files were not shown because too many files have changed in this diff Show More