Compare commits

..

54 Commits

Author SHA1 Message Date
sledgehammer999
abb854a1e6 Bump to 4.3.2 2020-12-27 13:42:41 +02:00
sledgehammer999
4ee17a73d0 Update Changelog 2020-12-27 13:42:40 +02:00
sledgehammer999
faf6e82274 Sync translations from Transifex and run lupdate 2020-12-26 21:18:40 +02:00
Vladimir Golovnev (Glassez)
c08ec1ac5e Allow to add root folder to torrent content 2020-12-26 20:27:34 +02:00
Vladimir Golovnev (Glassez)
cd0b6d9a43 Extract enum serialization/parsing functions 2020-12-26 20:27:33 +02:00
Vladimir Golovnev (Glassez)
b8f1142abe Improve torrent name handling 2020-12-26 20:27:31 +02:00
Chocobo1
78859415d6 Use a helper function to look up stat indexes 2020-12-26 20:27:29 +02:00
Chocobo1
ef92c17192 Don't use removed stat metric in libtorrent 2.0
For now, the metric is not entirely removed due to WebAPI still needs to
access it.
2020-12-26 20:27:28 +02:00
Chocobo1
22f3abc4b5 Initialize stat indices to -1
When the index is initialized it will be set to a number >= 0, so we use
-1 to denote its uninitialized status.
2020-12-26 20:27:27 +02:00
Chocobo1
a56e6294c1 Fix wrong JSON type returned
Fix up 78638a15be.
Closes #14041.
2020-12-26 20:27:26 +02:00
Chocobo1
77909e0093 Don't use default CFLAGS, CXXFLAGS from autotools
Before this commit, autotools will inject `-g -O2` to debug build
(`--enable-debug=yes`) and rendering the result binary useless. This
commit fixes it.
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/C_002b_002b-Compiler.html

Closes #14032.
2020-12-26 20:27:25 +02:00
Vladimir Golovnev (Glassez)
2c2bb14b2a Fix bug of "move storage job" can be performed multiple times 2020-12-26 20:27:16 +02:00
Chocobo1
73c8b77464 Migrate away from deprecated QVariant comparison operators
Fortunately, serializing to JSON limits the data types to a very small
subset and thus we are able to implement the comparison without much
hassle.

Fix up cba8d83b21.
2020-12-26 20:27:14 +02:00
Alessandro Simonelli
042238db87 NSIS: Fixed italian.nsi after 4.3.0.1 update
Merged my previous fixes (discussed in #13607) with the suggestions by @glassez (#13615).
2020-12-26 20:27:13 +02:00
FranciscoPombal
6e267f8e81 Update coding guidelines policy for include guards 2020-12-26 20:27:11 +02:00
FranciscoPombal
fdc64d9b38 Use #pragma once instead of include guards 2020-12-26 20:27:10 +02:00
Chocobo1
0b42425db5 Add support for allow_idna option
Upstream PR: https://github.com/arvidn/libtorrent/pull/5316
2020-12-26 20:27:08 +02:00
Chocobo1
e5d7738127 Update "HTTPS tracker validation" enablement conditional
https://github.com/arvidn/libtorrent/pull/5313
2020-12-26 20:27:06 +02:00
Chocobo1
422489e2a1 Revise Utils::Version comparison operators 2020-12-26 20:27:04 +02:00
Chocobo1
7de983b4e5 Add operator< for InfoHash class 2020-12-26 20:27:03 +02:00
Chocobo1
e4e55d2a80 Migrate away from deprecated QVariant comparison operators
Another idea would be manually define a custom comparison function for
QVariant. However, having the function would be excessive due to its
limited usage count, also note that we are already casting
various QVariant to its underlying type in existing code.
2020-12-26 20:27:01 +02:00
Vladimir Golovnev (Glassez)
926012ce71 Fix bug of torrents don't save "stopped" state 2020-12-26 20:27:00 +02:00
Chocobo1
487eb554c9 Fix coding style 2020-12-26 20:26:59 +02:00
Chocobo1
5a96e1fc7a Use Qt provided forward declaration header 2020-12-26 20:26:58 +02:00
FranciscoPombal
2fe698ee60 CMake: detect required header for STACKTRACE feature
musl does not provide execinfo.h, so our current stacktrace-related
code cannot be used with it.
2020-12-26 20:26:57 +02:00
Chocobo1
177ac32a5e Use the correct type when referring to info hash 2020-12-26 20:26:55 +02:00
Vladimir Golovnev (Glassez)
5f34d1555b Fix received metadata handling 2020-12-26 20:26:54 +02:00
FranciscoPombal
7cfe68f46c Bump dependency versions in CI
- Bump vcpkg version in GitHub Actions CI
- Bump libtorrent version in Travis CI

Co-authored-by: Vladimir Golovnev <glassez@yandex.ru>
2020-12-26 20:26:53 +02:00
Vladimir Golovnev
f94f4d2391 Drop support for building with libtorrent < 1.2.11
Co-authored-by: Vladimir Golovnev <glassez@yandex.ru>
2020-12-26 20:26:52 +02:00
FranciscoPombal
73b18d7ef3 Update minimum depedency versions 2020-12-26 20:26:51 +02:00
FranciscoPombal
817e9c4747 Fix method invocation on Qt < 5.10
Fixup 0c3fe54b0b
2020-12-26 20:26:48 +02:00
Vladimir Golovnev (Glassez)
28844eff44 Search for existing files in separate thread 2020-12-26 20:26:47 +02:00
Vladimir Golovnev (Glassez)
389664213b Don't rewrite TorrentInfo instance if it's valid 2020-12-26 20:26:46 +02:00
Vladimir Golovnev (Glassez)
953b6fd6f8 Properly handle "Append extension" option changing 2020-12-26 20:26:45 +02:00
Vladimir Golovnev (Glassez)
9b4f3fcbf8 Clean up metadata downloading code 2020-12-26 20:26:43 +02:00
Chocobo1
80743180be Remove unnecessary restriction on input length
Closes #13884.
2020-12-26 20:26:42 +02:00
Chocobo1
b2847b2381 Update URL to libtorrent settings 2020-12-26 20:26:41 +02:00
Chocobo1
eb657ec032 Move "embedded tracker" options to qbt section 2020-12-26 20:26:39 +02:00
Chocobo1
fc2be601df Add links to libtorrent documentation 2020-12-26 20:26:38 +02:00
Chocobo1
5786c7ff11 Lift upper limit of "Max concurrent HTTP announces" option
Closes #13800.
2020-12-26 20:26:37 +02:00
Jesse Chan
4a183dd968 WebAPI: bump version to 2.6.2 2020-12-26 20:26:36 +02:00
Jesse Chan
7c10dba10c WebAPI: allow to attach tags while adding torrents 2020-12-26 20:26:35 +02:00
sledgehammer999
894446d308 Don't try to remove folders for a torrent without metadata 2020-12-26 20:26:34 +02:00
sledgehammer999
47e9c5ac08 Fix status of torrents without metadata 2020-12-26 20:26:33 +02:00
Chocobo1
7f47ac11f1 Add libtorrent 2.0 to TravisCI script
Also bumping to ubuntu focal as libtorrent requires boost >= 1.66.
2020-12-26 20:26:32 +02:00
Chocobo1
67b17891fa Simplify the calculation of speed graph scale 2020-12-26 20:26:31 +02:00
Chocobo1
dd5b7ba05b Avoid potential rounding to integer issues 2020-12-26 20:26:30 +02:00
Chocobo1
61aa4d9f1c Fix coding style 2020-12-26 20:26:29 +02:00
Chocobo1
6e924b668e Fix availability value
Closes #13869.
Fix up 02f19bfbee.
2020-12-26 20:26:27 +02:00
FranciscoPombal
618ce33fa0 Detect .ts file issues with file health workflow
Also adjust newlines to improve output
2020-12-26 20:26:26 +02:00
Chocobo1
ac413c76b9 Update to use latest macOS image for TravisCI
The default version is so outdated that it needs to rebuild many
dependencies. Now we bump it to the latest version so that it can use
prebuilt packages.
2020-12-26 20:26:25 +02:00
Chocobo1
f266184514 Add ability to use 'shift+delete' to delete torrents in WebUI
Closes #13827.
2020-12-26 20:26:24 +02:00
Chocobo1
8c48bf4a70 Fix wrong data used for comparison
In torrent transfer list we should use underlying data for sorting, not
displayed values.

Closes #13818.
2020-12-26 20:26:23 +02:00
Andrei Stepanov
8bee69c9fc NSIS: Update Russian translation 2020-12-26 20:26:14 +02:00
325 changed files with 49309 additions and 50756 deletions

View File

@@ -12,12 +12,12 @@ on:
branches: [ master ]
env:
# Qt: 5.15.0
# libtorrent: RC_1_2 HEAD, 1.2.10
VCPKG_COMMIT: 32eccc18191fbb57b159784a1724d2d00613ae82
# Qt: 5.15.1
# libtorrent: RC_1_2 HEAD, 1.2.11
VCPKG_COMMIT: 133051b793486ef14e67e9d1f48c9cfe64dc127e
VCPKG_DEST_MACOS: /Users/runner/qbt_tools/vcpkg
VCPKG_DEST_WIN: C:\qbt_tools\vcpkg
LIBTORRENT_VERSION_TAG: libtorrent-1.2.10
LIBTORRENT_VERSION_TAG: v1.2.11
jobs:
@@ -178,11 +178,11 @@ jobs:
uses: actions/checkout@v2
# - ninja is needed for building qBittorrent (because it's preferrable, not a hard requirement)
# - pkg-config is needed for some vcpkg installations
# - automake is needed for the installation the vcpkg installation of fontconfig, a dependency of qt5-base
- name: install additional required packages with homebrew
shell: bash
run: |
brew install ninja pkg-config
brew install automake ninja
- name: setup vcpkg (cached, if possible)
uses: lukka/run-vcpkg@v4
@@ -197,7 +197,7 @@ jobs:
Copy-Item ${{ env.RUNVCPKG_VCPKG_ROOT }}/triplets/x64-osx.cmake `
${{ github.workspace }}/triplets_overlay/x64-osx-release.cmake
Add-Content ${{ github.workspace }}/triplets_overlay/x64-osx-release.cmake `
-Value "set(VCPKG_BUILD_TYPE release)"
-Value "set(VCPKG_BUILD_TYPE release)","set(VCPKG_OSX_DEPLOYMENT_TARGET 10.15)"
# NOTE: Avoids a libtorrent ABI issue. See https://github.com/arvidn/libtorrent/issues/4965
- name: force AppleClang to compile libtorrent with C++14

View File

@@ -14,60 +14,68 @@ exclusions_bom='src/base/unicodestrings.h'
exclusions_tw='(*.ts)|src/webui/www/private/scripts/lib/mootools-1.2-more.js'
exclusions_no_lf='(*.ts)|(.*svg)|compile_commands.json|src/webui/www/private/scripts/lib/mootools-1.2-(core-yc.js|more.js)'
echo -e "*** Detect files not encoded in UTF-8 ***\n"
echo -e "\n*** Detect files not encoded in UTF-8 ***\n"
find . -path ./build -prune -false -o -path ./.git -prune -false -o -type f -exec file --mime {} \; | sort \
| grep -v -e "charset=us-ascii" -e "charset=utf-8" | cut -d ":" -f 1 \
| grep -E -v -e "${exclusions_nonutf8}" \
| tee >(echo -e "\n--> Files not encoded in UTF-8: found" "$(wc -l < /dev/stdin)" "regression(s)") \
| tee >(echo -e "--> Files not encoded in UTF-8: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0'
regressions=$((regressions+$?))
echo -e "*** Detect files encoded in UTF-8 with BOM ***\n"
echo -e "\n*** Detect files encoded in UTF-8 with BOM ***\n"
grep --exclude-dir={.git,build} -rIl $'\xEF\xBB\xBF' | sort \
| grep -E -v -e "${exclusions_bom}" \
| tee >(echo -e "\n--> Files encoded in UTF-8 with BOM: found" "$(wc -l < /dev/stdin)" "regression(s)") \
| tee >(echo -e "--> Files encoded in UTF-8 with BOM: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0'
regressions=$((regressions+$?))
echo -e "*** Detect usage of CR byte ***\n"
echo -e "\n*** Detect usage of CR byte ***\n"
grep --exclude-dir={.git,build} -rIlU $'\x0D' | sort \
| tee >(echo -e "\n--> Usage of CR byte: found" "$(wc -l < /dev/stdin)" "regression(s)") \
| tee >(echo -e "--> Usage of CR byte: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0'
regressions=$((regressions+$?))
echo -e "*** Detect trailing whitespace in lines ***\n"
echo -e "\n*** Detect trailing whitespace in lines ***\n"
grep --exclude-dir={.git,build} -rIl "[[:blank:]]$" | sort \
| grep -E -v -e "${exclusions_tw}" \
| tee >(echo -e "\n--> Trailing whitespace in lines: found" "$(wc -l < /dev/stdin)" "regression(s)") \
| tee >(echo -e "--> Trailing whitespace in lines: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0';
regressions=$((regressions+$?))
echo -e "*** Detect too many trailing newlines ***\n"
echo -e "\n*** Detect too many trailing newlines ***\n"
find . -path ./build -prune -false -o -path ./.git -prune -false -o -type f -exec file --mime {} \; | sort \
| grep -e "charset=us-ascii" -e "charset=utf-8" | cut -d ":" -f 1 \
| xargs -L1 -I my_input bash -c 'test "$(tail -q -c2 "my_input" | hexdump -C | grep "0a 0a")" && echo "my_input"' \
| tee >(echo -e "\n--> Too many trailing newlines: found" "$(wc -l < /dev/stdin)" "regression(s)") \
| tee >(echo -e "--> Too many trailing newlines: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0'
regressions=$((regressions+$?))
echo -e "*** Detect no trailing newline ***\n"
echo -e "\n*** Detect no trailing newline ***\n"
find . -path ./build -prune -false -o -path ./.git -prune -false -o -type f -exec file --mime {} \; | sort \
| grep -e "charset=us-ascii" -e "charset=utf-8" | cut -d ":" -f 1 \
| grep -E -v -e "${exclusions_no_lf}" \
| xargs -L1 -I my_input bash -c 'test "$(tail -q -c1 "my_input" | hexdump -C | grep "0a")" || echo "my_input"' \
| tee >(echo -e "\n--> No trailing newline: found" "$(wc -l < /dev/stdin)" "regression(s)") \
| tee >(echo -e "--> No trailing newline: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0'
regressions=$((regressions+$?))
echo -e "\n*** Detect translation closing tag in new line ***\n"
grep --exclude-dir={.git,build} -nri "^</translation>" | sort \
| cut -d ":" -f 1,2 \
| tee >(echo -e "--> Translation closing tag in new line: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0'
regressions=$((regressions+$?))
if [ "$regressions" -ne 0 ]; then
regressions=1
echo "File health regressions found. Please fix them (or add them as exclusions)."
echo "\nFile health regressions found. Please fix them (or add them as exclusions)."
else
echo "All OK, no file health regressions found."
fi

View File

@@ -11,7 +11,7 @@ jobs:
check_file_health:
name: Check file health
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: checkout repository

View File

@@ -4,7 +4,8 @@ os:
- linux
- osx
dist: bionic
dist: focal
osx_image: xcode12.2
env:
matrix:
@@ -16,6 +17,11 @@ env:
- secure: "OI9CUjj4lTb0HwwIZU5PbECU3hLlAL6KC8KsbwohG8/O3j5fLcnmDsK4Ad9us5cC39sS11Jcd1kDP2qRcCuST/glVNhLkcjKkiQerOfd5nQ/qL4JYfz/1mfP5mdpz9jHKzpLUIG+TXkbSTjP6VVmsb5KPT+3pKEdRFZB+Pu9+J8="
- coverity_branch: coverity_scan
jobs:
include:
- env: libt_branch=RC_2_0 gui=true build_system=qmake
os: linux
notifications:
email:
on_success: change
@@ -39,8 +45,7 @@ addons:
apt:
sources:
# sources list: https://github.com/travis-ci/apt-source-safelist/blob/master/ubuntu.json
- sourceline: 'ppa:qbittorrent-team/qbt-libtorrent-travisci'
- sourceline: 'deb https://apt.kitware.com/ubuntu/ bionic main'
- sourceline: 'deb https://apt.kitware.com/ubuntu/ focal main'
key_url: 'https://apt.kitware.com/keys/kitware-archive-latest.asc'
packages:
# packages list: https://github.com/travis-ci/apt-package-safelist/blob/master/ubuntu-trusty
@@ -69,6 +74,8 @@ before_install:
# TravisCI installs its own cmake to another location which ovverides other installations
# if they don't call the new binary directly
alias cmake="/usr/bin/cmake"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
fi
- |
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
@@ -114,20 +121,34 @@ install:
ccache -V && ccache --show-stats && ccache --zero-stats
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_2" ] && [ "$TRAVIS_OS_NAME" = "osx" ]; then
# building libtorrent manually should be faster than using the official bottle
# because the bottle will also pull in a lot of updated dependencies and prolong the overall time
if [ "$libt_branch" = "RC_1_2" ]; then
pushd "$HOME"
git clone --single-branch --branch RC_1_2 https://github.com/arvidn/libtorrent.git
cd libtorrent
git checkout tags/v1.2.10
git checkout tags/v1.2.11
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=14 -Ddeprecated-functions=OFF -DOPENSSL_ROOT_DIR="$openssl_root_path" ./
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=14 \
-Ddeprecated-functions=OFF \
-DOPENSSL_ROOT_DIR="$openssl_root_path" \
./
make
sudo make install
popd
elif [ "$libt_branch" = "RC_2_0" ]; then
pushd "$HOME"
git clone --single-branch --branch RC_2_0 https://github.com/arvidn/libtorrent.git
cd libtorrent
git checkout tags/v2.0.1
git submodule update --init --recursive
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=14 \
-Ddeprecated-functions=ON \
-DOPENSSL_ROOT_DIR="$openssl_root_path" \
./
make
sudo make install
popd

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) # Policies <= CMP0097 default t
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
project(qBittorrent
VERSION 4.3.1.0
VERSION 4.3.2.0
DESCRIPTION "The qBittorrent BitTorrent client"
HOMEPAGE_URL "https://www.qbittorrent.org/"
LANGUAGES CXX
@@ -11,14 +11,15 @@ project(qBittorrent
# use CONFIG mode first in find_package
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
# version requirements
set(requiredBoostVersion 1.40)
set(requiredQtVersion 5.9.0)
set(requiredOpenSSLVersion 1.0)
set(requiredLibtorrentVersion 1.2.0)
set(requiredZlibVersion 1.2.5.2)
# version requirements - older vesions may work, but you are on your own
set(minBoostVersion 1.65)
set(minQtVersion 5.9.5)
set(minOpenSSLVersion 1.1.1)
set(minLibtorrentVersion 1.2.11)
set(minZlibVersion 1.2.11)
# features (some are platform-specific)
include(CheckCXXSourceCompiles) # TODO: migrate to CheckSourceCompiles in CMake >= 3.19
include(FeatureSummary)
include(FeatureOptionsSetup)
feature_option(STACKTRACE "Enable stacktraces" ON)
@@ -34,6 +35,18 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
"Install systemd service file to a directory manually overridable with Systemd_SERVICES_INSTALL_DIR"
OFF "NOT GUI" OFF
)
if (STACKTRACE)
check_cxx_source_compiles(
"#include <execinfo.h>
int main(){return 0;}"
QBITTORRENT_HAS_EXECINFO_H
)
if (NOT QBITTORRENT_HAS_EXECINFO_H)
message(FATAL_ERROR "execinfo.h header file not found.\n"
"Please either disable the STACKTRACE feature or use a libc that has this header file, such as glibc (GNU libc)."
)
endif()
endif()
elseif (MSVC)
feature_option(MSVC_RUNTIME_DYNAMIC "Use MSVC dynamic runtime library (-MD) instead of static (-MT)" ON)
endif()

View File

@@ -372,7 +372,7 @@ Example:
## 8. Include guard
`#pragma once` should be used instead of "include guard" in new code:
`#pragma once` must be used instead of a "classic include guard":
```c++
// examplewidget.h

View File

@@ -1,3 +1,25 @@
Sun Dec 27 2020 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.3.2
- FEATURE: Allow to add root folder to torrent content (glassez)
- FEATURE: "HTTPS tracker validation" option is available on all platforms with latest libtorrent (Chocobo1)
- FEATURE: Option for supporting internationalized domain names (IDNs) (Chocobo1)
- BUGFIX: Fix broken sorting on some columns (Chocobo1)
- BUGFIX: Fix availability per file value (Chocobo1)
- BUGFIX: Fix status of torrents without metadata (sledgehammer999)
- BUGFIX: Don't try to remove folders for a torrent without metadata (sledgehammer999)
- BUGFIX: Lift upper limit of "Max concurrent HTTP announces" option (Chocobo1)
- BUGFIX: Add links to libtorrent documentation (Chocobo1)
- BUGFIX: Move "embedded tracker" options to qbt section (Chocobo1)
- BUGFIX: Properly handle "Append extension" option changing (glassez)
- BUGFIX: Correctly save paused torrent state (glassez)
- BUGFIX: Fix bug of "move storage job" can be performed multiple times (glassez)
- WEBUI: Add ability to use 'shift+delete' to delete torrents (Chocobo1)
- WEBUI: Allow to attach tags while adding torrents (Jesse Chan)
- WEBUI: Bump version to 2.6.2 (Jesse Chan)
- WEBUI: Remove unnecessary restriction on input length (Chocobo1)
- WINDOWS: NSIS: Update Russian translation (Andrei Stepanov)
- WINDOWS: NSIS: Update Italian translation (Alessandro Simonelli)
- OTHER: Drop support for building with libtorrent < 1.2.11 (Vladimir Golovnev)
Wed Nov 25 2020 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.3.1
- FEATURE: Allow progress bar styling from custom themes (jagannatharjun)
- FEATURE: Allow adding torrents using "Paste" key sequence (Chocobo1)

16
INSTALL
View File

@@ -3,23 +3,27 @@ qBittorrent - A BitTorrent client in C++ / Qt
1) Install these dependencies:
- Boost >= 1.40
- Boost >= 1.65
- libtorrent-rasterbar >= 1.2 (by Arvid Norberg)
- libtorrent-rasterbar >= 1.2.11 (by Arvid Norberg)
* https://www.libtorrent.org/
* Be careful: another library (the one used by rTorrent) uses a similar name
- OpenSSL >= 1.0
- OpenSSL >= 1.1.1
- Qt >= 5.9.0
- Qt >= 5.9.5
- zlib >= 1.2.5.2
- zlib >= 1.2.11
- pkg-config (compile-time only)
- pkg-config (compile-time only on *nix systems)
- Python >= 3.5.0 (optional, runtime only)
* Required by the internal search engine
Dependency version numbers are bumped every once in a while to keep the range of properly tested configurations manageable, even if not strictly required to build.
You may be able to build with older versions of (some of) the dependencies other than the minimum versions specified in the build scripts, but support for such builds is not provided - you are on your own.
Please ensure you are building with an officially supported configuration when reporting bugs.
2a) Compile and install qBittorrent with Qt graphical interface
$ ./configure

124
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.3.1.
# Generated by GNU Autoconf 2.69 for qbittorrent v4.3.2.
#
# Report bugs to <bugs.qbittorrent.org>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='qbittorrent'
PACKAGE_TARNAME='qbittorrent'
PACKAGE_VERSION='v4.3.1'
PACKAGE_STRING='qbittorrent v4.3.1'
PACKAGE_VERSION='v4.3.2'
PACKAGE_STRING='qbittorrent v4.3.2'
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.3.1 to adapt to many kinds of systems.
\`configure' configures qbittorrent v4.3.2 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.3.1:";;
short | recursive ) echo "Configuration of qbittorrent v4.3.2:";;
esac
cat <<\_ACEOF
@@ -1427,7 +1427,7 @@ Some influential environment variables:
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
QT_QMAKE value of host_bins for Qt5Core >= 5.9.0, overriding pkg-config
QT_QMAKE value of host_bins for Qt5Core >= 5.9.5, overriding pkg-config
Qt5Svg_CFLAGS
C compiler flags for Qt5Svg, overriding pkg-config
Qt5Svg_LIBS linker flags for Qt5Svg, overriding pkg-config
@@ -1509,7 +1509,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
qbittorrent configure v4.3.1
qbittorrent configure v4.3.2
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.3.1, which was
It was created by qbittorrent $as_me v4.3.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2026,6 +2026,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
: ${CFLAGS=""}
: ${CXXFLAGS=""}
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3826,7 +3828,7 @@ fi
# Define the identity of the package.
PACKAGE='qbittorrent'
VERSION='v4.3.1'
VERSION='v4.3.2'
cat >>confdefs.h <<_ACEOF
@@ -4485,8 +4487,8 @@ $as_echo "$enable_webui" >&6; }
esac
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.9.0\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.9.0") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.9.5\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.9.5") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
@@ -4495,12 +4497,12 @@ if test -n "$QT_QMAKE"; then
pkg_cv_QT_QMAKE="$QT_QMAKE"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.9.0\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.9.0") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.9.5\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.9.5") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_QT_QMAKE=`$PKG_CONFIG --variable="host_bins" "Qt5Core >= 5.9.0" 2>/dev/null`
pkg_cv_QT_QMAKE=`$PKG_CONFIG --variable="host_bins" "Qt5Core >= 5.9.5" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -4527,8 +4529,8 @@ fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt5 qmake >= 5.9.0" >&5
$as_echo_n "checking for Qt5 qmake >= 5.9.0... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt5 qmake >= 5.9.5" >&5
$as_echo_n "checking for Qt5 qmake >= 5.9.5... " >&6; }
if test "x$QT_QMAKE" != "x"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $QT_QMAKE" >&5
$as_echo "$QT_QMAKE" >&6; }
@@ -4642,11 +4644,11 @@ case "x$enable_qt_dbus" in #(
"xyes") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt5DBus >= 5.9.0" >&5
$as_echo_n "checking for Qt5DBus >= 5.9.0... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt5DBus >= 5.9.5" >&5
$as_echo_n "checking for Qt5DBus >= 5.9.5... " >&6; }
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5DBus >= 5.9.0\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5DBus >= 5.9.0") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5DBus >= 5.9.5\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5DBus >= 5.9.5") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
@@ -4716,10 +4718,10 @@ BOOST_CPPFLAGS=""
if test "x$want_boost" = "xyes"; then :
if test "x1.40" = "x"; then :
if test "x1.65" = "x"; then :
_AX_BOOST_BASE_TONUMERICVERSION_req="1.20.0"
else
_AX_BOOST_BASE_TONUMERICVERSION_req="1.40"
_AX_BOOST_BASE_TONUMERICVERSION_req="1.65"
fi
_AX_BOOST_BASE_TONUMERICVERSION_req_shorten=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([0-9]*\.[0-9]*\)'`
_AX_BOOST_BASE_TONUMERICVERSION_req_major=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([0-9]*\)'`
@@ -4763,16 +4765,16 @@ esac
if test "x$_AX_BOOST_BASE_boost_path" != "x"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= 1.40 ($WANT_BOOST_VERSION) includes in \"$_AX_BOOST_BASE_boost_path/include\"" >&5
$as_echo_n "checking for boostlib >= 1.40 ($WANT_BOOST_VERSION) includes in \"$_AX_BOOST_BASE_boost_path/include\"... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= 1.65 ($WANT_BOOST_VERSION) includes in \"$_AX_BOOST_BASE_boost_path/include\"" >&5
$as_echo_n "checking for boostlib >= 1.65 ($WANT_BOOST_VERSION) includes in \"$_AX_BOOST_BASE_boost_path/include\"... " >&6; }
if test -d "$_AX_BOOST_BASE_boost_path/include" && test -r "$_AX_BOOST_BASE_boost_path/include"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include"
for _AX_BOOST_BASE_boost_path_tmp in $multiarch_libsubdir $libsubdirs; do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= 1.40 ($WANT_BOOST_VERSION) lib path in \"$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp\"" >&5
$as_echo_n "checking for boostlib >= 1.40 ($WANT_BOOST_VERSION) lib path in \"$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp\"... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= 1.65 ($WANT_BOOST_VERSION) lib path in \"$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp\"" >&5
$as_echo_n "checking for boostlib >= 1.65 ($WANT_BOOST_VERSION) lib path in \"$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp\"... " >&6; }
if test -d "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" && test -r "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" ; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -4815,8 +4817,8 @@ fi
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_lib_path"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= 1.40 ($WANT_BOOST_VERSION)" >&5
$as_echo_n "checking for boostlib >= 1.40 ($WANT_BOOST_VERSION)... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= 1.65 ($WANT_BOOST_VERSION)" >&5
$as_echo_n "checking for boostlib >= 1.65 ($WANT_BOOST_VERSION)... " >&6; }
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
@@ -4985,8 +4987,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test "x$succeeded" != "xyes" ; then
if test "x$_version" = "x0" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: We could not detect the boost libraries (version 1.40 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&5
$as_echo "$as_me: We could not detect the boost libraries (version 1.40 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: We could not detect the boost libraries (version 1.65 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&5
$as_echo "$as_me: We could not detect the boost libraries (version 1.65 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&6;}
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: Your boost libraries seems to old (version $_version)." >&5
$as_echo "$as_me: Your boost libraries seems to old (version $_version)." >&6;}
@@ -5292,12 +5294,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 >= 1.2\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.2") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.2.11\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.2.11") 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.2" 2>/dev/null`
pkg_cv_libtorrent_CFLAGS=`$PKG_CONFIG --cflags "libtorrent-rasterbar >= 1.2.11" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -5309,12 +5311,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 >= 1.2\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.2") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.2.11\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.2.11") 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.2" 2>/dev/null`
pkg_cv_libtorrent_LIBS=`$PKG_CONFIG --libs "libtorrent-rasterbar >= 1.2.11" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -5335,14 +5337,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 >= 1.2" 2>&1`
libtorrent_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtorrent-rasterbar >= 1.2.11" 2>&1`
else
libtorrent_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtorrent-rasterbar >= 1.2" 2>&1`
libtorrent_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtorrent-rasterbar >= 1.2.11" 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.2) were not met:
as_fn_error $? "Package requirements (libtorrent-rasterbar >= 1.2.11) were not met:
$libtorrent_PKG_ERRORS
@@ -5385,12 +5387,12 @@ if test -n "$openssl_CFLAGS"; then
pkg_cv_openssl_CFLAGS="$openssl_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl >= 1.0\""; } >&5
($PKG_CONFIG --exists --print-errors "openssl >= 1.0") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl >= 1.1.1\""; } >&5
($PKG_CONFIG --exists --print-errors "openssl >= 1.1.1") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_openssl_CFLAGS=`$PKG_CONFIG --cflags "openssl >= 1.0" 2>/dev/null`
pkg_cv_openssl_CFLAGS=`$PKG_CONFIG --cflags "openssl >= 1.1.1" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -5402,12 +5404,12 @@ if test -n "$openssl_LIBS"; then
pkg_cv_openssl_LIBS="$openssl_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl >= 1.0\""; } >&5
($PKG_CONFIG --exists --print-errors "openssl >= 1.0") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl >= 1.1.1\""; } >&5
($PKG_CONFIG --exists --print-errors "openssl >= 1.1.1") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_openssl_LIBS=`$PKG_CONFIG --libs "openssl >= 1.0" 2>/dev/null`
pkg_cv_openssl_LIBS=`$PKG_CONFIG --libs "openssl >= 1.1.1" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -5428,14 +5430,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
openssl_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl >= 1.0" 2>&1`
openssl_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl >= 1.1.1" 2>&1`
else
openssl_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl >= 1.0" 2>&1`
openssl_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl >= 1.1.1" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$openssl_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (openssl >= 1.0) were not met:
as_fn_error $? "Package requirements (openssl >= 1.1.1) were not met:
$openssl_PKG_ERRORS
@@ -5478,12 +5480,12 @@ if test -n "$zlib_CFLAGS"; then
pkg_cv_zlib_CFLAGS="$zlib_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.5.2\""; } >&5
($PKG_CONFIG --exists --print-errors "zlib >= 1.2.5.2") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.11\""; } >&5
($PKG_CONFIG --exists --print-errors "zlib >= 1.2.11") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_zlib_CFLAGS=`$PKG_CONFIG --cflags "zlib >= 1.2.5.2" 2>/dev/null`
pkg_cv_zlib_CFLAGS=`$PKG_CONFIG --cflags "zlib >= 1.2.11" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -5495,12 +5497,12 @@ if test -n "$zlib_LIBS"; then
pkg_cv_zlib_LIBS="$zlib_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.5.2\""; } >&5
($PKG_CONFIG --exists --print-errors "zlib >= 1.2.5.2") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.11\""; } >&5
($PKG_CONFIG --exists --print-errors "zlib >= 1.2.11") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_zlib_LIBS=`$PKG_CONFIG --libs "zlib >= 1.2.5.2" 2>/dev/null`
pkg_cv_zlib_LIBS=`$PKG_CONFIG --libs "zlib >= 1.2.11" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -5521,14 +5523,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
zlib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib >= 1.2.5.2" 2>&1`
zlib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib >= 1.2.11" 2>&1`
else
zlib_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib >= 1.2.5.2" 2>&1`
zlib_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib >= 1.2.11" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$zlib_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (zlib >= 1.2.5.2) were not met:
as_fn_error $? "Package requirements (zlib >= 1.2.11) were not met:
$zlib_PKG_ERRORS
@@ -6343,7 +6345,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.3.1, which was
This file was extended by qbittorrent $as_me v4.3.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6401,7 +6403,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.3.1
qbittorrent config.status v4.3.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -7659,7 +7661,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.3.1, which was
This file was extended by qbittorrent $as_me v4.3.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -7717,7 +7719,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.3.1
qbittorrent config.status v4.3.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@@ -1,6 +1,8 @@
AC_INIT([qbittorrent], [v4.3.1], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
AC_INIT([qbittorrent], [v4.3.2], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
: ${CFLAGS=""}
: ${CXXFLAGS=""}
AC_PROG_CC
AC_PROG_CXX
AC_PROG_SED
@@ -157,7 +159,7 @@ AS_CASE(["x$enable_qt_dbus"],
AC_MSG_ERROR([Unknown option "$enable_qt_dbus". Use either "yes" or "no".])])
AX_BOOST_BASE([1.40],
AX_BOOST_BASE([1.65],
[AC_MSG_NOTICE([Boost CXXFLAGS: "$BOOST_CPPFLAGS"])
AC_MSG_NOTICE([Boost LDFLAGS: "$BOOST_LDFLAGS"])],
[AC_MSG_ERROR([Could not find Boost])])
@@ -178,17 +180,17 @@ AC_MSG_NOTICE([Boost.System LIB: "$BOOST_SYSTEM_LIB"])
LIBS="$BOOST_SYSTEM_LIB $LIBS"
PKG_CHECK_MODULES(libtorrent,
[libtorrent-rasterbar >= 1.2],
[libtorrent-rasterbar >= 1.2.11],
[CXXFLAGS="$libtorrent_CFLAGS $CXXFLAGS"
LIBS="$libtorrent_LIBS $LIBS"])
PKG_CHECK_MODULES(openssl,
[openssl >= 1.0],
[openssl >= 1.1.1],
[CXXFLAGS="$openssl_CFLAGS $CXXFLAGS"
LIBS="$openssl_LIBS $LIBS"])
PKG_CHECK_MODULES(zlib,
[zlib >= 1.2.5.2],
[zlib >= 1.2.11],
[CXXFLAGS="$zlib_CFLAGS $CXXFLAGS"
LIBS="$zlib_LIBS $LIBS"])

2
dist/mac/Info.plist vendored
View File

@@ -55,7 +55,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>4.3.0</string>
<string>4.3.2</string>
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>

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.3.1" date="2020-11-25"/>
<release version="4.3.2" date="2020-12-27"/>
</releases>
</component>

View File

@@ -11,6 +11,8 @@ Type=Application
StartupNotify=false
StartupWMClass=qbittorrent
Keywords=bittorrent;torrent;magnet;download;p2p;
# Translations
Comment[oc]=Telecargar e partejar de fichièrs amb BitTorrent
GenericName[oc]=Client BitTorrent
Name[oc]=qBittorrent
@@ -53,6 +55,9 @@ Name[en_GB]=qBittorrent
Comment[es]=Descargue y comparta archivos por BitTorrent
GenericName[es]=Cliente BitTorrent
Name[es]=qBittorrent
Comment[et]=Lae alla ja jaga faile üle BitTorrenti
GenericName[et]=BitTorrent klient
Name[et]=qBittorrent
Comment[eu]=Jeitsi eta elkarbanatu agiriak BitTorrent bidez
GenericName[eu]=BitTorrent bezeroa
Name[eu]=qBittorrent
@@ -86,7 +91,7 @@ Name[id]=qBittorrent
Comment[is]=Sækja og deila skrám yfir BitTorrent
GenericName[is]=BitTorrent biðlarar
Name[is]=qBittorrent
Comment[it]=Client BitTorrent per il download di file via internet
Comment[it]=Scarica e condividi file tramite BitTorrent
GenericName[it]=Client BitTorrent
Name[it]=qBittorrent
Comment[ja]=BitTorrent でファイルをダウンロードおよび共有します
@@ -137,6 +142,7 @@ Name[sk]=qBittorrent
Comment[sl]=Prenesite in delite datoteke preko BitTorrenta
GenericName[sl]=BitTorrent odjemalec
Name[sl]=qBittorrent
Comment[sr]=Преузимајте и делите фајлове преко BitTorrent протокола
GenericName[sr]=BitTorrent-клијент
Comment[sr@latin]=Preuzimanje i deljenje fajlova preko BitTorrent-a
GenericName[sr@latin]=BitTorrent klijent
@@ -150,8 +156,8 @@ Name[uz@Latn]=qBittorrent
Comment[ltg]=Atsasyuteit i daleit failus ar BitTorrent
GenericName[ltg]=BitTorrent klients
Name[ltg]=qBittorrent
Comment[hi_IN]= अपनी फाइलें BitTorrent के माध्यम से डाउनलोड आैर साॅझा करें
GenericName[hi_IN]=BitTorrent उपभोक्ता
Comment[hi_IN]=BitTorrent द्वारा फाइल डाउनलोड व सहभाजन
GenericName[hi_IN]=BitTorrent साधन
Name[hi_IN]=qBittorrent
Comment[tr]=Dosyaları BitTorrent üzerinden indirin ve paylaşın
GenericName[tr]=BitTorrent istemcisi
@@ -165,6 +171,9 @@ Name[uk]=qBittorrent
Comment[vi]=Tải về và chia sẻ các tập tin thông qua BitTorrent
GenericName[vi]=Máy trạm dạng BitTorrent
Name[vi]=qBittorrent
Comment[az@latin]=Faylları BitTorrent vasitəsilə göndərin və paylaşın
GenericName[az@latin]=BitTorrent client
Name[az@latin]=qBittorrent
Comment[zh_HK]=經由BitTorrent下載並分享檔案
GenericName[zh_HK]=BitTorrent用戶端
Name[zh_HK]=qBittorrent
@@ -195,6 +204,6 @@ Name[te]=క్యు బిట్ టొరెంట్
Comment[en_AU]=Download and share files over BitTorrent
GenericName[en_AU]=BitTorrent client
Name[en_AU]=qBittorrent
Comment[th]=ดาวนโหลดและแชร์ไฟล์ด้วยบิททอเร้น
Comment[th]=ดาวนโหลดและแชร์ไฟล์ด้วยบิททอเร้น
GenericName[th]=โปรแกรมบิททอเร้น
Name[th]=qBittorrent

View File

@@ -3,9 +3,9 @@
;LangString inst_qbt_req ${LANG_ENGLISH} "qBittorrent (required)"
LangString inst_qbt_req ${LANG_ITALIAN} "qBittorrent (necessario)"
;LangString inst_dekstop ${LANG_ENGLISH} "Create Desktop Shortcut"
LangString inst_dekstop ${LANG_ITALIAN} "Crea icone sul desktop"
LangString inst_dekstop ${LANG_ITALIAN} "Crea collegamento sul Desktop"
;LangString inst_startmenu ${LANG_ENGLISH} "Create Start Menu Shortcut"
LangString inst_startmenu ${LANG_ITALIAN} "Crea gruppo programmi"
LangString inst_startmenu ${LANG_ITALIAN} "Aggiungi al menu Start"
;LangString inst_startup ${LANG_ENGLISH} "Start qBittorrent on Windows start up"
LangString inst_startup ${LANG_ITALIAN} "Esegui qBittorrent all'avvio di Windows"
;LangString inst_torrent ${LANG_ENGLISH} "Open .torrent files with qBittorrent"
@@ -15,19 +15,19 @@ LangString inst_magnet ${LANG_ITALIAN} "Apri collegamenti magnet con qBittorrent
;LangString inst_firewall ${LANG_ENGLISH} "Add Windows Firewall rule"
LangString inst_firewall ${LANG_ITALIAN} "Aggiungi regola al firewall di Windows"
;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_ITALIAN} "Disabilita limite percorso Windows (limite MAX_PATH max 260 caratterin, richiede Windows 10 versione 1607 o successive)"
LangString inst_pathlimit ${LANG_ITALIAN} "Disabilita limite lunghezza percorsi Windows (limite MAX_PATH di 260 caratteri, richiede Windows 10 versione 1607 o successive)"
;LangString inst_firewallinfo ${LANG_ENGLISH} "Adding Windows Firewall rule"
LangString inst_firewallinfo ${LANG_ITALIAN} "Aggiunta regola al firewall di Windows"
;LangString inst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before installing."
LangString inst_warning ${LANG_ITALIAN} "qBittorrent è in esecuzione.%n%nChiudi l'applicazione qBittorrent prima della nuova installazione."
LangString inst_warning ${LANG_ITALIAN} "qBittorrent è in esecuzione. Chiudilo prima di procedere con l'installazione."
;LangString inst_uninstall_question ${LANG_ENGLISH} "Current version will be uninstalled. User settings and torrents will remain intact."
LangString inst_uninstall_question ${LANG_ITALIAN} "L'attuale versione di qBittorrent verrà disinstallata.%n%nLe impostazioni utente e i torrent rimanno invariati."
LangString inst_uninstall_question ${LANG_ITALIAN} "La versione attuale verrà disinstallata. Le impostazioni utente e i torrent rimarranno invariati."
;LangString inst_unist ${LANG_ENGLISH} "Uninstalling previous version."
LangString inst_unist ${LANG_ITALIAN} "Disinstallazione versione precedente di qBittorrent."
LangString inst_unist ${LANG_ITALIAN} "Disinstallazione versione precedente."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_ITALIAN} "Esegui qBittorrent"
LangString launch_qbt ${LANG_ITALIAN} "Esegui qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_ITALIAN} "Questo installer di qBittorrent funziona solo con Windows a 64bit."
LangString inst_requires_64bit ${LANG_ITALIAN} "Questo installer funziona solo con versioni di Windows a 64bit."
;LangString inst_requires_win7 ${LANG_ENGLISH} "This qBittorrent version requires at least Windows 7."
LangString inst_requires_win7 ${LANG_ITALIAN} "Questa versione di qBittorrent richiede Windows 7 o versioni successive."
@@ -42,7 +42,7 @@ LangString remove_shortcuts ${LANG_ITALIAN} "Rimuovi collegamenti"
;LangString remove_associations ${LANG_ENGLISH} "Remove file associations"
LangString remove_associations ${LANG_ITALIAN} "Rimuovi associazione file"
;LangString remove_registry ${LANG_ENGLISH} "Remove registry keys"
LangString remove_registry ${LANG_ITALIAN} "Rimuovi chiavi registro"
LangString remove_registry ${LANG_ITALIAN} "Rimuovi chiavi di registro"
;LangString remove_conf ${LANG_ENGLISH} "Remove configuration files"
LangString remove_conf ${LANG_ITALIAN} "Rimuovi file di configurazione"
;LangString remove_firewall ${LANG_ENGLISH} "Remove Windows Firewall rule"
@@ -52,7 +52,7 @@ LangString remove_firewallinfo ${LANG_ITALIAN} "Rimozione regola dal firewall di
;LangString remove_cache ${LANG_ENGLISH} "Remove torrents and cached data"
LangString remove_cache ${LANG_ITALIAN} "Rimuovi torrent e dati nella cache"
;LangString uninst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before uninstalling."
LangString uninst_warning ${LANG_ITALIAN} "qBittorrent è in esecuzione.%n%nChiudi qBittorrent prima della disinstallazione."
LangString uninst_warning ${LANG_ITALIAN} "qBittorrent è in esecuzione. Chiudilo prima di procedere con la disinstallazione."
;LangString uninst_tor_warn ${LANG_ENGLISH} "Not removing .torrent association. It is associated with:"
LangString uninst_tor_warn ${LANG_ITALIAN} "Associazione file .torrent non rimossa. File associati con:"
;LangString uninst_mag_warn ${LANG_ENGLISH} "Not removing magnet association. It is associated with:"

View File

@@ -21,7 +21,7 @@ LangString inst_firewallinfo ${LANG_RUSSIAN} "Добавление в списо
;LangString inst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before installing."
LangString inst_warning ${LANG_RUSSIAN} "qBittorrent запущен. Пожалуйста, закройте qBittorrent и перезапустите программу установки."
;LangString inst_uninstall_question ${LANG_ENGLISH} "Current version will be uninstalled. User settings and torrents will remain intact."
LangString inst_uninstall_question ${LANG_RUSSIAN} "Обнаружена предыдущая установка. Она будет деинсталлирована без удаления пользовательских настроек."
LangString inst_uninstall_question ${LANG_RUSSIAN} "Текущая версия будет деинсталлирована. Пользовательские настройки и торренты останутся нетронутыми."
;LangString inst_unist ${LANG_ENGLISH} "Uninstalling previous version."
LangString inst_unist ${LANG_RUSSIAN} "Деинсталлируется старая версия."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."

View File

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

View File

@@ -5,9 +5,9 @@
# Sets the QT_QMAKE variable to the path of Qt5 qmake if found.
# --------------------------------------
AC_DEFUN([FIND_QT5],
[PKG_CHECK_EXISTS([Qt5Core >= 5.9.0],
[PKG_CHECK_EXISTS([Qt5Core >= 5.9.5],
[PKG_CHECK_VAR(QT_QMAKE,
[Qt5Core >= 5.9.0],
[Qt5Core >= 5.9.5],
[host_bins])
])
@@ -18,7 +18,7 @@ AS_IF([test -f "$QT_QMAKE/qmake"],
[QT_QMAKE=""])
])
AC_MSG_CHECKING([for Qt5 qmake >= 5.9.0])
AC_MSG_CHECKING([for Qt5 qmake >= 5.9.5])
AS_IF([test "x$QT_QMAKE" != "x"],
[AC_MSG_RESULT([$QT_QMAKE])],
[AC_MSG_RESULT([not found])]
@@ -29,8 +29,8 @@ AS_IF([test "x$QT_QMAKE" != "x"],
# Sets the HAVE_QTDBUS variable to true or false.
# --------------------------------------
AC_DEFUN([FIND_QTDBUS],
[AC_MSG_CHECKING([for Qt5DBus >= 5.9.0])
PKG_CHECK_EXISTS([Qt5DBus >= 5.9.0],
[AC_MSG_CHECKING([for Qt5DBus >= 5.9.5])
PKG_CHECK_EXISTS([Qt5DBus >= 5.9.5],
[AC_MSG_RESULT([found])
HAVE_QTDBUS=[true]],
[AC_MSG_RESULT([not found])

View File

@@ -1,12 +1,12 @@
if (UNIX AND (NOT APPLE) AND (NOT CYGWIN))
find_package(LibtorrentRasterbar QUIET ${requiredLibtorrentVersion} COMPONENTS torrent-rasterbar)
find_package(LibtorrentRasterbar QUIET ${minLibtorrentVersion} COMPONENTS torrent-rasterbar)
if (NOT LibtorrentRasterbar_FOUND)
include(FindPkgConfig)
pkg_check_modules(LIBTORRENT_RASTERBAR IMPORTED_TARGET GLOBAL "libtorrent-rasterbar>=${requiredLibtorrentVersion}")
pkg_check_modules(LIBTORRENT_RASTERBAR IMPORTED_TARGET GLOBAL "libtorrent-rasterbar>=${minLibtorrentVersion}")
if (NOT LIBTORRENT_RASTERBAR_FOUND)
message(
FATAL_ERROR
"Package LibtorrentRasterbar >= ${requiredLibtorrentVersion} not found"
"Package LibtorrentRasterbar >= ${minLibtorrentVersion} not found"
" with CMake or pkg-config.\n- Set LibtorrentRasterbar_DIR to a directory containing"
" a LibtorrentRasterbarConfig.cmake file or add the installation prefix of LibtorrentRasterbar"
" to CMAKE_PREFIX_PATH.\n- Alternatively, make sure there is a valid libtorrent-rasterbar.pc"
@@ -18,9 +18,9 @@ if (UNIX AND (NOT APPLE) AND (NOT CYGWIN))
# force a fake package to show up in the feature summary
set_property(GLOBAL APPEND PROPERTY
PACKAGES_FOUND
"LibtorrentRasterbar via pkg-config (required version >= ${requiredLibtorrentVersion})"
"LibtorrentRasterbar via pkg-config (version >= ${minLibtorrentVersion})"
)
set_package_properties("LibtorrentRasterbar via pkg-config (required version >= ${requiredLibtorrentVersion})"
set_package_properties("LibtorrentRasterbar via pkg-config (version >= ${minLibtorrentVersion})"
PROPERTIES
TYPE REQUIRED
)
@@ -28,16 +28,16 @@ if (UNIX AND (NOT APPLE) AND (NOT CYGWIN))
set_package_properties(LibtorrentRasterbar PROPERTIES TYPE REQUIRED)
endif()
else()
find_package(LibtorrentRasterbar ${requiredLibtorrentVersion} REQUIRED COMPONENTS torrent-rasterbar)
find_package(LibtorrentRasterbar ${minLibtorrentVersion} REQUIRED COMPONENTS torrent-rasterbar)
endif()
# force variable type so that it always shows up in ccmake/cmake-gui frontends
set_property(CACHE LibtorrentRasterbar_DIR PROPERTY TYPE PATH)
find_package(Boost ${requiredBoostVersion} REQUIRED)
find_package(OpenSSL ${requiredOpenSSLVersion} REQUIRED)
find_package(ZLIB ${requiredZlibVersion} REQUIRED)
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml LinguistTools)
find_package(Boost ${minBoostVersion} REQUIRED)
find_package(OpenSSL ${minOpenSSLVersion} REQUIRED)
find_package(ZLIB ${minZlibVersion} REQUIRED)
find_package(Qt5 ${minQtVersion} REQUIRED COMPONENTS Core Network Xml LinguistTools)
if (DBUS)
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS DBus)
find_package(Qt5 ${minQtVersion} REQUIRED COMPONENTS DBus)
set_package_properties(Qt5DBus PROPERTIES
DESCRIPTION "Qt5 module for inter-process communication over the D-Bus protocol"
PURPOSE "Required by the DBUS feature"
@@ -60,11 +60,11 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(base)
if (GUI)
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Widgets Svg)
find_package(Qt5 ${minQtVersion} REQUIRED COMPONENTS Widgets Svg)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS MacExtras)
find_package(Qt5 ${minQtVersion} REQUIRED COMPONENTS MacExtras)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS WinExtras)
find_package(Qt5 ${minQtVersion} REQUIRED COMPONENTS WinExtras)
endif()
add_subdirectory(gui)
endif()

View File

@@ -28,8 +28,7 @@
* exception statement from your version.
*/
#ifndef APP_OPTIONS_H
#define APP_OPTIONS_H
#pragma once
#include <stdexcept>
@@ -81,5 +80,3 @@ private:
QBtCommandLineParameters parseCommandLine(const QStringList &args);
void displayUsage(const QString &prgName);
#endif // APP_OPTIONS_H

View File

@@ -33,6 +33,7 @@
#include <QDateTime>
#include <QDir>
#include <QTextStream>
#include <QVector>
#include "base/global.h"
#include "base/logger.h"

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef FILELOGGER_H
#define FILELOGGER_H
#pragma once
#include <QFile>
#include <QObject>
@@ -73,5 +72,3 @@ private:
QFile m_logFile;
QTimer m_flusher;
};
#endif // FILELOGGER_H

View File

@@ -66,8 +66,7 @@
****************************************************************************
*/
#ifndef QTLOCALPEER_H
#define QTLOCALPEER_H
#pragma once
#include "qtlockedfile.h"
@@ -99,5 +98,3 @@ protected:
private:
static const char* ack;
};
#endif // QTLOCALPEER_H

View File

@@ -66,8 +66,7 @@
****************************************************************************
*/
#ifndef QTLOCKEDFILE_H
#define QTLOCKEDFILE_H
#pragma once
#include <QFile>
@@ -112,5 +111,3 @@ namespace QtLP_Private
LockMode m_lock_mode;
};
}
#endif

View File

@@ -18,8 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef STACKTRACE_WIN_H
#define STACKTRACE_WIN_H
#pragma once
#include <windows.h>
#include <dbghelp.h>
@@ -355,5 +354,3 @@ const QString straceWin::getBacktrace()
#pragma warning(pop)
#pragma optimize("g", on)
#endif
#endif // STACKTRACE_WIN_H

View File

@@ -27,8 +27,7 @@
*
*/
#ifndef STACKTRACEDIALOG_H
#define STACKTRACEDIALOG_H
#pragma once
#include <QDialog>
@@ -51,5 +50,3 @@ public:
private:
Ui::StacktraceDialog *m_ui;
};
#endif // STACKTRACEDIALOG_H

View File

@@ -29,11 +29,15 @@
#include "upgrade.h"
#include <QFile>
#include <QMetaEnum>
#include <QVector>
#include "base/bittorrent/torrentcontentlayout.h"
#include "base/logger.h"
#include "base/profile.h"
#include "base/settingsstorage.h"
#include "base/utils/fs.h"
#include "base/utils/string.h"
namespace
{
@@ -78,11 +82,32 @@ namespace
, QLatin1String("Preferences/WebUI/HTTPS/KeyPath")
, Utils::Fs::toNativePath(configPath + QLatin1String("WebUIPrivateKey.pem")));
}
void upgradeTorrentContentLayout()
{
const QString oldKey {QLatin1String {"BitTorrent/Session/CreateTorrentSubfolder"}};
const QString newKey {QLatin1String {"BitTorrent/Session/TorrentContentLayout"}};
SettingsStorage *settingsStorage {SettingsStorage::instance()};
const QVariant oldData {settingsStorage->loadValue(oldKey)};
const QString newData {settingsStorage->loadValue(newKey).toString()};
if (!newData.isEmpty() || !oldData.isValid())
return;
const bool createSubfolder = oldData.toBool();
const BitTorrent::TorrentContentLayout torrentContentLayout =
(createSubfolder ? BitTorrent::TorrentContentLayout::Original : BitTorrent::TorrentContentLayout::NoSubfolder);
settingsStorage->storeValue(newKey, Utils::String::fromEnum(torrentContentLayout));
settingsStorage->removeValue(oldKey);
}
}
bool upgrade(const bool /*ask*/)
{
exportWebUIHttpsFiles();
upgradeTorrentContentLayout();
return true;
}

View File

@@ -8,6 +8,7 @@ add_library(qbt_base STATIC
bittorrent/common.h
bittorrent/customstorage.h
bittorrent/downloadpriority.h
bittorrent/filesearcher.h
bittorrent/filterparserthread.h
bittorrent/infohash.h
bittorrent/ltqhash.h
@@ -23,6 +24,7 @@ add_library(qbt_base STATIC
bittorrent/sessionstatus.h
bittorrent/speedmonitor.h
bittorrent/statistics.h
bittorrent/torrentcontentlayout.h
bittorrent/torrentcreatorthread.h
bittorrent/torrenthandle.h
bittorrent/torrenthandleimpl.h
@@ -90,6 +92,7 @@ add_library(qbt_base STATIC
bittorrent/bandwidthscheduler.cpp
bittorrent/customstorage.cpp
bittorrent/downloadpriority.cpp
bittorrent/filesearcher.cpp
bittorrent/filterparserthread.cpp
bittorrent/infohash.cpp
bittorrent/magneturi.cpp

View File

@@ -7,6 +7,7 @@ HEADERS += \
$$PWD/bittorrent/common.h \
$$PWD/bittorrent/customstorage.h \
$$PWD/bittorrent/downloadpriority.h \
$$PWD/bittorrent/filesearcher.h \
$$PWD/bittorrent/filterparserthread.h \
$$PWD/bittorrent/infohash.h \
$$PWD/bittorrent/ltqhash.h \
@@ -22,6 +23,7 @@ HEADERS += \
$$PWD/bittorrent/sessionstatus.h \
$$PWD/bittorrent/speedmonitor.h \
$$PWD/bittorrent/statistics.h \
$$PWD/bittorrent/torrentcontentlayout.h \
$$PWD/bittorrent/torrentcreatorthread.h \
$$PWD/bittorrent/torrenthandle.h \
$$PWD/bittorrent/torrenthandleimpl.h \
@@ -90,6 +92,7 @@ SOURCES += \
$$PWD/bittorrent/bandwidthscheduler.cpp \
$$PWD/bittorrent/customstorage.cpp \
$$PWD/bittorrent/downloadpriority.cpp \
$$PWD/bittorrent/filesearcher.cpp \
$$PWD/bittorrent/filterparserthread.cpp \
$$PWD/bittorrent/infohash.cpp \
$$PWD/bittorrent/magneturi.cpp \

View File

@@ -28,12 +28,15 @@
#pragma once
#include <boost/optional.hpp>
#include <QSet>
#include <QString>
#include <QVector>
#include "base/tristatebool.h"
#include "torrenthandle.h"
#include "torrentcontentlayout.h"
namespace BitTorrent
{
@@ -52,7 +55,7 @@ namespace BitTorrent
TriStateBool addPaused;
QVector<DownloadPriority> filePriorities; // used if TorrentInfo is set
bool skipChecking = false;
TriStateBool createSubfolder;
boost::optional<BitTorrent::TorrentContentLayout> contentLayout;
TriStateBool useAutoTMM;
int uploadLimit = -1;
int downloadLimit = -1;

View File

@@ -27,8 +27,7 @@
* exception statement from your version.
*/
#ifndef BANDWIDTHSCHEDULER_H
#define BANDWIDTHSCHEDULER_H
#pragma once
#include <QObject>
#include <QTimer>
@@ -52,5 +51,3 @@ private:
QTimer m_timer;
bool m_lastAlternative;
};
#endif // BANDWIDTHSCHEDULER_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef BITTORRENT_CACHESTATUS_H
#define BITTORRENT_CACHESTATUS_H
#pragma once
#include <QtGlobal>
@@ -39,8 +38,6 @@ namespace BitTorrent
quint64 jobQueueLength = 0;
quint64 averageJobTime = 0;
quint64 queuedBytes = 0;
qreal readRatio = 0.0;
qreal readRatio = 0; // TODO: remove when LIBTORRENT_VERSION_NUM >= 20000
};
}
#endif // BITTORRENT_CACHESTATUS_H

View File

@@ -0,0 +1,69 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2020 Vladimir Golovnev <glassez@yandex.ru>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
#include "filesearcher.h"
#include <QDir>
#include "base/bittorrent/common.h"
#include "base/bittorrent/infohash.h"
void FileSearcher::search(const BitTorrent::InfoHash &id, const QStringList &originalFileNames
, const QString &completeSavePath, const QString &incompleteSavePath)
{
const auto findInDir = [](const QString &dirPath, QStringList &fileNames) -> bool
{
const QDir dir {dirPath};
bool found = false;
for (QString &fileName : fileNames)
{
if (dir.exists(fileName))
{
found = true;
}
else if (dir.exists(fileName + QB_EXT))
{
found = true;
fileName += QB_EXT;
}
}
return found;
};
QString savePath = completeSavePath;
QStringList adjustedFileNames = originalFileNames;
const bool found = findInDir(savePath, adjustedFileNames);
if (!found && !incompleteSavePath.isEmpty())
{
savePath = incompleteSavePath;
findInDir(savePath, adjustedFileNames);
}
emit searchFinished(id, savePath, adjustedFileNames);
}

View File

@@ -0,0 +1,52 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2020 Vladimir Golovnev <glassez@yandex.ru>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
#pragma once
#include <QObject>
namespace BitTorrent
{
class InfoHash;
}
class FileSearcher final : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(FileSearcher)
public:
FileSearcher() = default;
public slots:
void search(const BitTorrent::InfoHash &id, const QStringList &originalFileNames
, const QString &completeSavePath, const QString &incompleteSavePath);
signals:
void searchFinished(const BitTorrent::InfoHash &id, const QString &savePath, const QStringList &fileNames);
};

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef FILTERPARSERTHREAD_H
#define FILTERPARSERTHREAD_H
#pragma once
#include <libtorrent/ip_filter.hpp>
@@ -64,5 +63,3 @@ private:
QString m_filePath;
lt::ip_filter m_filter;
};
#endif // BITTORRENT_FILTERPARSERTHREAD_H

View File

@@ -33,10 +33,7 @@
using namespace BitTorrent;
InfoHash::InfoHash()
: m_valid(false)
{
}
const int InfoHashTypeId = qRegisterMetaType<InfoHash>();
InfoHash::InfoHash(const lt::sha1_hash &nativeHash)
: m_valid(true)
@@ -87,6 +84,11 @@ bool BitTorrent::operator!=(const InfoHash &left, const InfoHash &right)
return !(left == right);
}
bool BitTorrent::operator<(const InfoHash &left, const InfoHash &right)
{
return static_cast<lt::sha1_hash>(left) < static_cast<lt::sha1_hash>(right);
}
uint BitTorrent::qHash(const InfoHash &key, const uint seed)
{
return ::qHash((std::hash<lt::sha1_hash> {})(key), seed);

View File

@@ -26,11 +26,11 @@
* exception statement from your version.
*/
#ifndef BITTORRENT_INFOHASH_H
#define BITTORRENT_INFOHASH_H
#pragma once
#include <libtorrent/sha1_hash.hpp>
#include <QMetaType>
#include <QString>
namespace BitTorrent
@@ -38,7 +38,7 @@ namespace BitTorrent
class InfoHash
{
public:
InfoHash();
InfoHash() = default;
InfoHash(const lt::sha1_hash &nativeHash);
InfoHash(const QString &hashString);
InfoHash(const InfoHash &other) = default;
@@ -54,14 +54,15 @@ namespace BitTorrent
operator QString() const;
private:
bool m_valid;
bool m_valid = false;
lt::sha1_hash m_nativeHash;
QString m_hashString;
};
bool operator==(const InfoHash &left, const InfoHash &right);
bool operator!=(const InfoHash &left, const InfoHash &right);
bool operator<(const InfoHash &left, const InfoHash &right);
uint qHash(const InfoHash &key, uint seed);
}
#endif // BITTORRENT_INFOHASH_H
Q_DECLARE_METATYPE(BitTorrent::InfoHash)

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef BITTORRENT_MAGNETURI_H
#define BITTORRENT_MAGNETURI_H
#pragma once
#include <libtorrent/add_torrent_params.hpp>
@@ -65,5 +64,3 @@ namespace BitTorrent
lt::add_torrent_params m_addTorrentParams;
};
}
#endif // BITTORRENT_MAGNETURI_H

View File

@@ -52,3 +52,11 @@ bool NativeTorrentExtension::on_pause()
// and other extensions to be also invoked.
return false;
}
void NativeTorrentExtension::on_state(const lt::torrent_status::state_t state)
{
if (m_state == lt::torrent_status::downloading_metadata)
m_torrentHandle.set_flags(lt::torrent_flags::stop_when_ready);
m_state = state;
}

View File

@@ -38,6 +38,8 @@ public:
private:
bool on_pause() override;
void on_state(lt::torrent_status::state_t state) override;
lt::torrent_handle m_torrentHandle;
lt::torrent_status::state_t m_state = lt::torrent_status::checking_resume_data;
};

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef BITTORRENT_PEERINFO_H
#define BITTORRENT_PEERINFO_H
#pragma once
#include <libtorrent/peer_info.hpp>
@@ -104,5 +103,3 @@ namespace BitTorrent
mutable QString m_country;
};
}
#endif // BITTORRENT_PEERINFO_H

View File

@@ -88,6 +88,7 @@
#include "bandwidthscheduler.h"
#include "common.h"
#include "customstorage.h"
#include "filesearcher.h"
#include "filterparserthread.h"
#include "ltunderlyingtype.h"
#include "magneturi.h"
@@ -346,11 +347,7 @@ Session::Session(QObject *parent)
, m_hashingThreads(BITTORRENT_SESSION_KEY("HashingThreadsCount"), 2)
, m_filePoolSize(BITTORRENT_SESSION_KEY("FilePoolSize"), 40)
, m_checkingMemUsage(BITTORRENT_SESSION_KEY("CheckingMemUsageSize"), 32)
#if (LIBTORRENT_VERSION_NUM >= 10206)
, m_diskCacheSize(BITTORRENT_SESSION_KEY("DiskCacheSize"), -1)
#else
, m_diskCacheSize(BITTORRENT_SESSION_KEY("DiskCacheSize"), 64)
#endif
, m_diskCacheTTL(BITTORRENT_SESSION_KEY("DiskCacheTTL"), 60)
, m_useOSCache(BITTORRENT_SESSION_KEY("UseOSCache"), true)
#ifdef Q_OS_WIN
@@ -380,11 +377,7 @@ Session::Session(QObject *parent)
, m_includeOverheadInLimits(BITTORRENT_SESSION_KEY("IncludeOverheadInLimits"), false)
, m_announceIP(BITTORRENT_SESSION_KEY("AnnounceIP"))
, m_maxConcurrentHTTPAnnounces(BITTORRENT_SESSION_KEY("MaxConcurrentHTTPAnnounces"), 50)
#if (LIBTORRENT_VERSION_NUM >= 10206)
, m_stopTrackerTimeout(BITTORRENT_SESSION_KEY("StopTrackerTimeout"), 5)
#else
, m_stopTrackerTimeout(BITTORRENT_SESSION_KEY("StopTrackerTimeout"), 1)
#endif
, m_maxConnections(BITTORRENT_SESSION_KEY("MaxConnections"), 500, lowerLimited(0, -1))
, m_maxUploads(BITTORRENT_SESSION_KEY("MaxUploads"), 20, lowerLimited(0, -1))
, m_maxConnectionsPerTorrent(BITTORRENT_SESSION_KEY("MaxConnectionsPerTorrent"), 100, lowerLimited(0, -1))
@@ -394,6 +387,7 @@ Session::Session(QObject *parent)
, m_isUTPRateLimited(BITTORRENT_SESSION_KEY("uTPRateLimited"), true)
, m_utpMixedMode(BITTORRENT_SESSION_KEY("uTPMixedMode"), MixedModeAlgorithm::TCP
, clampValue(MixedModeAlgorithm::TCP, MixedModeAlgorithm::Proportional))
, m_IDNSupportEnabled(BITTORRENT_SESSION_KEY("IDNSupportEnabled"), false)
, m_multiConnectionsPerIpEnabled(BITTORRENT_SESSION_KEY("MultiConnectionsPerIp"), false)
, m_validateHTTPSTrackerCertificate(BITTORRENT_SESSION_KEY("ValidateHTTPSTrackerCertificate"), false)
, m_blockPeersOnPrivilegedPorts(BITTORRENT_SESSION_KEY("BlockPeersOnPrivilegedPorts"), false)
@@ -402,7 +396,7 @@ Session::Session(QObject *parent)
, m_globalMaxRatio(BITTORRENT_SESSION_KEY("GlobalMaxRatio"), -1, [](qreal r) { return r < 0 ? -1. : r;})
, m_globalMaxSeedingMinutes(BITTORRENT_SESSION_KEY("GlobalMaxSeedingMinutes"), -1, lowerLimited(-1))
, m_isAddTorrentPaused(BITTORRENT_SESSION_KEY("AddTorrentPaused"), false)
, m_isKeepTorrentTopLevelFolder(BITTORRENT_SESSION_KEY("CreateTorrentSubfolder"), true)
, m_torrentContentLayout(BITTORRENT_SESSION_KEY("TorrentContentLayout"), TorrentContentLayout::Original)
, m_isAppendExtensionEnabled(BITTORRENT_SESSION_KEY("AddExtensionToIncompleteFiles"), false)
, m_refreshInterval(BITTORRENT_SESSION_KEY("RefreshInterval"), 1500)
, m_isPreallocationEnabled(BITTORRENT_SESSION_KEY("Preallocation"), false)
@@ -509,6 +503,12 @@ Session::Session(QObject *parent)
m_resumeDataSavingManager = new ResumeDataSavingManager {m_resumeFolderPath};
m_resumeDataSavingManager->moveToThread(m_ioThread);
connect(m_ioThread, &QThread::finished, m_resumeDataSavingManager, &QObject::deleteLater);
m_fileSearcher = new FileSearcher;
m_fileSearcher->moveToThread(m_ioThread);
connect(m_ioThread, &QThread::finished, m_fileSearcher, &QObject::deleteLater);
connect(m_fileSearcher, &FileSearcher::searchFinished, this, &Session::fileSearchFinished);
m_ioThread->start();
// Regular saving of fastresume data
@@ -593,11 +593,11 @@ void Session::setAppendExtensionEnabled(const bool enabled)
{
if (isAppendExtensionEnabled() != enabled)
{
m_isAppendExtensionEnabled = enabled;
// append or remove .!qB extension for incomplete files
for (TorrentHandleImpl *const torrent : asConst(m_torrents))
torrent->handleAppendExtensionToggled();
m_isAppendExtensionEnabled = enabled;
}
}
@@ -661,9 +661,7 @@ QString Session::tempPath() const
QString Session::torrentTempPath(const TorrentInfo &torrentInfo) const
{
if ((torrentInfo.filesCount() > 1) && !torrentInfo.hasRootFolder())
return tempPath()
+ QString::fromStdString(torrentInfo.nativeInfo()->orig_files().name())
+ '/';
return tempPath() + torrentInfo.name() + '/';
return tempPath();
}
@@ -1089,9 +1087,6 @@ void Session::initializeNativeSession()
// turn them off before `lt::session` ctor to avoid split second effects
pack.set_bool(lt::settings_pack::enable_upnp, false);
pack.set_bool(lt::settings_pack::enable_natpmp, false);
#if (LIBTORRENT_VERSION_NUM < 10204)
pack.set_bool(lt::settings_pack::upnp_ignore_nonrouters, true);
#endif
#if (LIBTORRENT_VERSION_NUM > 20000)
// preserve the same behavior as in earlier libtorrent versions
@@ -1166,80 +1161,44 @@ void Session::applyBandwidthLimits(lt::settings_pack &settingsPack) const
void Session::initMetrics()
{
m_metricIndices.net.hasIncomingConnections = lt::find_metric_idx("net.has_incoming_connections");
Q_ASSERT(m_metricIndices.net.hasIncomingConnections >= 0);
const auto findMetricIndex = [](const char *name) -> int
{
const int index = lt::find_metric_idx(name);
Q_ASSERT(index >= 0);
return index;
};
m_metricIndices.net.sentPayloadBytes = lt::find_metric_idx("net.sent_payload_bytes");
Q_ASSERT(m_metricIndices.net.sentPayloadBytes >= 0);
// TODO: switch to "designated initializers" in C++20
m_metricIndices.net.hasIncomingConnections = findMetricIndex("net.has_incoming_connections");
m_metricIndices.net.sentPayloadBytes = findMetricIndex("net.sent_payload_bytes");
m_metricIndices.net.recvPayloadBytes = findMetricIndex("net.recv_payload_bytes");
m_metricIndices.net.sentBytes = findMetricIndex("net.sent_bytes");
m_metricIndices.net.recvBytes = findMetricIndex("net.recv_bytes");
m_metricIndices.net.sentIPOverheadBytes = findMetricIndex("net.sent_ip_overhead_bytes");
m_metricIndices.net.recvIPOverheadBytes = findMetricIndex("net.recv_ip_overhead_bytes");
m_metricIndices.net.sentTrackerBytes = findMetricIndex("net.sent_tracker_bytes");
m_metricIndices.net.recvTrackerBytes = findMetricIndex("net.recv_tracker_bytes");
m_metricIndices.net.recvRedundantBytes = findMetricIndex("net.recv_redundant_bytes");
m_metricIndices.net.recvFailedBytes = findMetricIndex("net.recv_failed_bytes");
m_metricIndices.net.recvPayloadBytes = lt::find_metric_idx("net.recv_payload_bytes");
Q_ASSERT(m_metricIndices.net.recvPayloadBytes >= 0);
m_metricIndices.peer.numPeersConnected = findMetricIndex("peer.num_peers_connected");
m_metricIndices.peer.numPeersDownDisk = findMetricIndex("peer.num_peers_down_disk");
m_metricIndices.peer.numPeersUpDisk = findMetricIndex("peer.num_peers_up_disk");
m_metricIndices.net.sentBytes = lt::find_metric_idx("net.sent_bytes");
Q_ASSERT(m_metricIndices.net.sentBytes >= 0);
m_metricIndices.dht.dhtBytesIn = findMetricIndex("dht.dht_bytes_in");
m_metricIndices.dht.dhtBytesOut = findMetricIndex("dht.dht_bytes_out");
m_metricIndices.dht.dhtNodes = findMetricIndex("dht.dht_nodes");
m_metricIndices.net.recvBytes = lt::find_metric_idx("net.recv_bytes");
Q_ASSERT(m_metricIndices.net.recvBytes >= 0);
m_metricIndices.net.sentIPOverheadBytes = lt::find_metric_idx("net.sent_ip_overhead_bytes");
Q_ASSERT(m_metricIndices.net.sentIPOverheadBytes >= 0);
m_metricIndices.net.recvIPOverheadBytes = lt::find_metric_idx("net.recv_ip_overhead_bytes");
Q_ASSERT(m_metricIndices.net.recvIPOverheadBytes >= 0);
m_metricIndices.net.sentTrackerBytes = lt::find_metric_idx("net.sent_tracker_bytes");
Q_ASSERT(m_metricIndices.net.sentTrackerBytes >= 0);
m_metricIndices.net.recvTrackerBytes = lt::find_metric_idx("net.recv_tracker_bytes");
Q_ASSERT(m_metricIndices.net.recvTrackerBytes >= 0);
m_metricIndices.net.recvRedundantBytes = lt::find_metric_idx("net.recv_redundant_bytes");
Q_ASSERT(m_metricIndices.net.recvRedundantBytes >= 0);
m_metricIndices.net.recvFailedBytes = lt::find_metric_idx("net.recv_failed_bytes");
Q_ASSERT(m_metricIndices.net.recvFailedBytes >= 0);
m_metricIndices.peer.numPeersConnected = lt::find_metric_idx("peer.num_peers_connected");
Q_ASSERT(m_metricIndices.peer.numPeersConnected >= 0);
m_metricIndices.peer.numPeersDownDisk = lt::find_metric_idx("peer.num_peers_down_disk");
Q_ASSERT(m_metricIndices.peer.numPeersDownDisk >= 0);
m_metricIndices.peer.numPeersUpDisk = lt::find_metric_idx("peer.num_peers_up_disk");
Q_ASSERT(m_metricIndices.peer.numPeersUpDisk >= 0);
m_metricIndices.dht.dhtBytesIn = lt::find_metric_idx("dht.dht_bytes_in");
Q_ASSERT(m_metricIndices.dht.dhtBytesIn >= 0);
m_metricIndices.dht.dhtBytesOut = lt::find_metric_idx("dht.dht_bytes_out");
Q_ASSERT(m_metricIndices.dht.dhtBytesOut >= 0);
m_metricIndices.dht.dhtNodes = lt::find_metric_idx("dht.dht_nodes");
Q_ASSERT(m_metricIndices.dht.dhtNodes >= 0);
m_metricIndices.disk.diskBlocksInUse = lt::find_metric_idx("disk.disk_blocks_in_use");
Q_ASSERT(m_metricIndices.disk.diskBlocksInUse >= 0);
m_metricIndices.disk.numBlocksRead = lt::find_metric_idx("disk.num_blocks_read");
Q_ASSERT(m_metricIndices.disk.numBlocksRead >= 0);
m_metricIndices.disk.numBlocksCacheHits = lt::find_metric_idx("disk.num_blocks_cache_hits");
Q_ASSERT(m_metricIndices.disk.numBlocksCacheHits >= 0);
m_metricIndices.disk.writeJobs = lt::find_metric_idx("disk.num_write_ops");
Q_ASSERT(m_metricIndices.disk.writeJobs >= 0);
m_metricIndices.disk.readJobs = lt::find_metric_idx("disk.num_read_ops");
Q_ASSERT(m_metricIndices.disk.readJobs >= 0);
m_metricIndices.disk.hashJobs = lt::find_metric_idx("disk.num_blocks_hashed");
Q_ASSERT(m_metricIndices.disk.hashJobs >= 0);
m_metricIndices.disk.queuedDiskJobs = lt::find_metric_idx("disk.queued_disk_jobs");
Q_ASSERT(m_metricIndices.disk.queuedDiskJobs >= 0);
m_metricIndices.disk.diskJobTime = lt::find_metric_idx("disk.disk_job_time");
Q_ASSERT(m_metricIndices.disk.diskJobTime >= 0);
m_metricIndices.disk.diskBlocksInUse = findMetricIndex("disk.disk_blocks_in_use");
m_metricIndices.disk.numBlocksRead = findMetricIndex("disk.num_blocks_read");
#if (LIBTORRENT_VERSION_NUM < 20000)
m_metricIndices.disk.numBlocksCacheHits = findMetricIndex("disk.num_blocks_cache_hits");
#endif
m_metricIndices.disk.writeJobs = findMetricIndex("disk.num_write_ops");
m_metricIndices.disk.readJobs = findMetricIndex("disk.num_read_ops");
m_metricIndices.disk.hashJobs = findMetricIndex("disk.num_blocks_hashed");
m_metricIndices.disk.queuedDiskJobs = findMetricIndex("disk.queued_disk_jobs");
m_metricIndices.disk.diskJobTime = findMetricIndex("disk.disk_job_time");
}
void Session::loadLTSettings(lt::settings_pack &settingsPack)
@@ -1341,9 +1300,7 @@ void Session::loadLTSettings(lt::settings_pack &settingsPack)
settingsPack.set_bool(lt::settings_pack::coalesce_writes, isCoalesceReadWriteEnabled());
#endif
#if (LIBTORRENT_VERSION_NUM >= 10202)
settingsPack.set_bool(lt::settings_pack::piece_extent_affinity, usePieceExtentAffinity());
#endif
settingsPack.set_int(lt::settings_pack::suggest_mode, isSuggestModeEnabled()
? lt::settings_pack::suggest_read_cache : lt::settings_pack::no_piece_suggestions);
@@ -1380,18 +1337,14 @@ void Session::loadLTSettings(lt::settings_pack &settingsPack)
settingsPack.set_int(lt::settings_pack::outgoing_port, outgoingPortsMin());
settingsPack.set_int(lt::settings_pack::num_outgoing_ports, outgoingPortsMax() - outgoingPortsMin() + 1);
#if (LIBTORRENT_VERSION_NUM >= 10206)
settingsPack.set_int(lt::settings_pack::upnp_lease_duration, UPnPLeaseDuration());
#endif
// Include overhead in transfer limits
settingsPack.set_bool(lt::settings_pack::rate_limit_ip_overhead, includeOverheadInLimits());
// IP address to announce to trackers
settingsPack.set_str(lt::settings_pack::announce_ip, announceIP().toStdString());
#if (LIBTORRENT_VERSION_NUM >= 10207)
// Max concurrent HTTP announces
settingsPack.set_int(lt::settings_pack::max_concurrent_http_announces, maxConcurrentHTTPAnnounces());
#endif
// Stop tracker timeout
settingsPack.set_int(lt::settings_pack::stop_tracker_timeout, stopTrackerTimeout());
// * Max connections limit
@@ -1435,6 +1388,10 @@ void Session::loadLTSettings(lt::settings_pack &settingsPack)
break;
}
#ifdef HAS_IDN_SUPPORT
settingsPack.set_bool(lt::settings_pack::allow_idna, isIDNSupportEnabled());
#endif
settingsPack.set_bool(lt::settings_pack::allow_multiple_connections_per_ip, multiConnectionsPerIpEnabled());
#ifdef HAS_HTTPS_TRACKER_VALIDATION
@@ -1765,6 +1722,31 @@ void Session::handleDownloadFinished(const Net::DownloadResult &result)
}
}
void Session::fileSearchFinished(const InfoHash &id, const QString &savePath, const QStringList &fileNames)
{
TorrentHandleImpl *torrent = m_torrents.value(id);
if (torrent)
{
torrent->fileSearchFinished(savePath, fileNames);
return;
}
const auto loadingTorrentsIter = m_loadingTorrents.find(id);
if (loadingTorrentsIter != m_loadingTorrents.end())
{
LoadTorrentParams params = loadingTorrentsIter.value();
m_loadingTorrents.erase(loadingTorrentsIter);
lt::add_torrent_params &p = params.ltAddTorrentParams;
p.save_path = Utils::Fs::toNativePath(savePath).toStdString();
for (int i = 0; i < fileNames.size(); ++i)
p.renamed_files[lt::file_index_t {i}] = fileNames[i].toStdString();
loadTorrent(params);
}
}
// Return the torrent handle, given its hash
TorrentHandle *Session::findTorrent(const InfoHash &hash) const
{
@@ -1892,12 +1874,12 @@ bool Session::deleteTorrent(const InfoHash &hash, const DeleteOption deleteOptio
return true;
}
bool Session::cancelLoadMetadata(const InfoHash &hash)
bool Session::cancelDownloadMetadata(const InfoHash &hash)
{
const auto loadedMetadataIter = m_loadedMetadata.find(hash);
if (loadedMetadataIter == m_loadedMetadata.end()) return false;
const auto downloadedMetadataIter = m_downloadedMetadata.find(hash);
if (downloadedMetadataIter == m_downloadedMetadata.end()) return false;
m_loadedMetadata.erase(loadedMetadataIter);
m_downloadedMetadata.erase(downloadedMetadataIter);
--m_extraLimit;
adjustLimits();
m_nativeSession->remove_torrent(m_nativeSession->find_torrent(hash), lt::session::delete_files);
@@ -1951,7 +1933,7 @@ void Session::decreaseTorrentsQueuePos(const QVector<InfoHash> &hashes)
torrentQueue.pop();
}
for (auto i = m_loadedMetadata.cbegin(); i != m_loadedMetadata.cend(); ++i)
for (auto i = m_downloadedMetadata.cbegin(); i != m_downloadedMetadata.cend(); ++i)
torrentQueuePositionBottom(m_nativeSession->find_torrent(*i));
saveTorrentsQueue();
@@ -2004,7 +1986,7 @@ void Session::bottomTorrentsQueuePos(const QVector<InfoHash> &hashes)
torrentQueue.pop();
}
for (auto i = m_loadedMetadata.cbegin(); i != m_loadedMetadata.cend(); ++i)
for (auto i = m_downloadedMetadata.cbegin(); i != m_downloadedMetadata.cend(); ++i)
torrentQueuePositionBottom(m_nativeSession->find_torrent(*i));
saveTorrentsQueue();
@@ -2058,21 +2040,6 @@ bool Session::addTorrent(const MagnetUri &magnetUri, const AddTorrentParams &par
{
if (!magnetUri.isValid()) return false;
const InfoHash hash = magnetUri.hash();
const auto it = m_loadedMetadata.constFind(hash);
if (it != m_loadedMetadata.constEnd())
{
// It looks illogical that we don't just use an existing handle,
// but as previous experience has shown, it actually creates unnecessary
// problems and unwanted behavior due to the fact that it was originally
// added with parameters other than those provided by the user.
m_loadedMetadata.erase(it);
--m_extraLimit;
adjustLimits();
m_nativeSession->remove_torrent(m_nativeSession->find_torrent(hash), lt::session::delete_files);
}
return addTorrent_impl(params, magnetUri);
}
@@ -2091,9 +2058,9 @@ LoadTorrentParams Session::initLoadTorrentParams(const AddTorrentParams &addTorr
loadTorrentParams.tags = addTorrentParams.tags;
loadTorrentParams.firstLastPiecePriority = addTorrentParams.firstLastPiecePriority;
loadTorrentParams.hasSeedStatus = addTorrentParams.skipChecking; // do not react on 'torrent_finished_alert' when skipping
loadTorrentParams.hasRootFolder = ((addTorrentParams.createSubfolder == TriStateBool::Undefined)
? isKeepTorrentTopLevelFolder()
: (addTorrentParams.createSubfolder == TriStateBool::True));
loadTorrentParams.contentLayout = (addTorrentParams.contentLayout
? *addTorrentParams.contentLayout
: torrentContentLayout());
loadTorrentParams.forced = (addTorrentParams.addForced == TriStateBool::True);
loadTorrentParams.paused = ((addTorrentParams.addPaused == TriStateBool::Undefined)
? isAddTorrentPaused()
@@ -2113,7 +2080,7 @@ LoadTorrentParams Session::initLoadTorrentParams(const AddTorrentParams &addTorr
const QString category = addTorrentParams.category;
if (!category.isEmpty() && !m_categories.contains(category) && !addCategory(category))
loadTorrentParams.category = "";
loadTorrentParams.category = "";
else
loadTorrentParams.category = addTorrentParams.category;
@@ -2126,9 +2093,15 @@ bool Session::addTorrent_impl(const AddTorrentParams &addTorrentParams, const Ma
const bool hasMetadata = metadata.isValid();
const InfoHash hash = (hasMetadata ? metadata.hash() : magnetUri.hash());
// It looks illogical that we don't just use an existing handle,
// but as previous experience has shown, it actually creates unnecessary
// problems and unwanted behavior due to the fact that it was originally
// added with parameters other than those provided by the user.
cancelDownloadMetadata(hash);
// We should not add the torrent if it is already
// processed or is pending to add to session
if (m_loadingTorrents.contains(hash) || m_loadedMetadata.contains(hash))
if (m_loadingTorrents.contains(hash))
return false;
TorrentHandleImpl *const torrent = m_torrents.value(hash);
@@ -2146,15 +2119,19 @@ bool Session::addTorrent_impl(const AddTorrentParams &addTorrentParams, const Ma
LoadTorrentParams loadTorrentParams = initLoadTorrentParams(addTorrentParams);
lt::add_torrent_params &p = loadTorrentParams.ltAddTorrentParams;
bool isFindingIncompleteFiles = false;
// If empty then Automatic mode, otherwise Manual mode
QString actualSavePath = loadTorrentParams.savePath.isEmpty() ? categorySavePath(loadTorrentParams.category) : loadTorrentParams.savePath;
const QString actualSavePath = loadTorrentParams.savePath.isEmpty() ? categorySavePath(loadTorrentParams.category) : loadTorrentParams.savePath;
if (hasMetadata)
{
if (!loadTorrentParams.hasRootFolder)
metadata.stripRootFolder();
metadata.setContentLayout(loadTorrentParams.contentLayout);
if (!loadTorrentParams.hasSeedStatus)
findIncompleteFiles(metadata, actualSavePath); // if needed points savePath to incomplete folder too
{
findIncompleteFiles(metadata, actualSavePath);
isFindingIncompleteFiles = true;
}
// if torrent name wasn't explicitly set we handle the case of
// initial renaming of torrent content and rename torrent accordingly
@@ -2184,9 +2161,6 @@ bool Session::addTorrent_impl(const AddTorrentParams &addTorrentParams, const Ma
if (loadTorrentParams.name.isEmpty() && !p.name.empty())
loadTorrentParams.name = QString::fromStdString(p.name);
if (isTempPathEnabled())
actualSavePath = tempPath();
}
p.save_path = Utils::Fs::toNativePath(actualSavePath).toStdString();
@@ -2218,7 +2192,11 @@ bool Session::addTorrent_impl(const AddTorrentParams &addTorrentParams, const Ma
else
p.flags |= lt::torrent_flags::auto_managed;
return loadTorrent(loadTorrentParams);
if (!isFindingIncompleteFiles)
return loadTorrent(loadTorrentParams);
m_loadingTorrents.insert(hash, loadTorrentParams);
return true;
}
// Add a torrent to the BitTorrent session
@@ -2243,42 +2221,27 @@ bool Session::loadTorrent(LoadTorrentParams params)
return true;
}
bool Session::findIncompleteFiles(TorrentInfo &torrentInfo, QString &savePath) const
void Session::findIncompleteFiles(const TorrentInfo &torrentInfo, const QString &savePath) const
{
auto findInDir = [](const QString &dirPath, TorrentInfo &torrentInfo) -> bool
const InfoHash searchId = torrentInfo.hash();
const QStringList originalFileNames = torrentInfo.filePaths();
const QString completeSavePath = savePath;
const QString incompleteSavePath = (isTempPathEnabled() ? torrentTempPath(torrentInfo) : QString {});
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
QMetaObject::invokeMethod(m_fileSearcher, [=]()
{
const QDir dir(dirPath);
bool found = false;
for (int i = 0; i < torrentInfo.filesCount(); ++i)
{
const QString filePath = torrentInfo.filePath(i);
if (dir.exists(filePath))
{
found = true;
}
else if (dir.exists(filePath + QB_EXT))
{
found = true;
torrentInfo.renameFile(i, filePath + QB_EXT);
}
}
return found;
};
bool found = findInDir(savePath, torrentInfo);
if (!found && isTempPathEnabled())
{
savePath = torrentTempPath(torrentInfo);
found = findInDir(savePath, torrentInfo);
}
return found;
m_fileSearcher->search(searchId, originalFileNames, completeSavePath, incompleteSavePath);
});
#else
QMetaObject::invokeMethod(m_fileSearcher, "search"
, Q_ARG(BitTorrent::InfoHash, searchId), Q_ARG(QStringList, originalFileNames)
, Q_ARG(QString, completeSavePath), Q_ARG(QString, incompleteSavePath));
#endif
}
// Add a torrent to the BitTorrent session in hidden mode
// and force it to load its metadata
bool Session::loadMetadata(const MagnetUri &magnetUri)
// Add a torrent to libtorrent session in hidden mode
// and force it to download its metadata
bool Session::downloadMetadata(const MagnetUri &magnetUri)
{
if (!magnetUri.isValid()) return false;
@@ -2289,7 +2252,7 @@ bool Session::loadMetadata(const MagnetUri &magnetUri)
// processed or adding to session
if (m_torrents.contains(hash)) return false;
if (m_loadingTorrents.contains(hash)) return false;
if (m_loadedMetadata.contains(hash)) return false;
if (m_downloadedMetadata.contains(hash)) return false;
qDebug("Adding torrent to preload metadata...");
qDebug(" -> Hash: %s", qUtf8Printable(hash));
@@ -2322,13 +2285,13 @@ bool Session::loadMetadata(const MagnetUri &magnetUri)
p.storage = customStorageConstructor;
#endif
// Adding torrent to BitTorrent session
// Adding torrent to libtorrent session
lt::error_code ec;
lt::torrent_handle h = m_nativeSession->add_torrent(p, ec);
if (ec) return false;
// waiting for metadata...
m_loadedMetadata.insert(h.info_hash());
m_downloadedMetadata.insert(h.info_hash());
++m_extraLimit;
adjustLimits();
@@ -3701,6 +3664,19 @@ void Session::setUtpMixedMode(const MixedModeAlgorithm mode)
configureDeferred();
}
bool Session::isIDNSupportEnabled() const
{
return m_IDNSupportEnabled;
}
void Session::setIDNSupportEnabled(const bool enabled)
{
if (enabled == m_IDNSupportEnabled) return;
m_IDNSupportEnabled = enabled;
configureDeferred();
}
bool Session::multiConnectionsPerIpEnabled() const
{
return m_multiConnectionsPerIpEnabled;
@@ -3775,7 +3751,7 @@ bool Session::isKnownTorrent(const InfoHash &hash) const
{
return (m_torrents.contains(hash)
|| m_loadingTorrents.contains(hash)
|| m_loadedMetadata.contains(hash));
|| m_downloadedMetadata.contains(hash));
}
void Session::updateSeedingLimitTimer()
@@ -3879,8 +3855,6 @@ void Session::handleTorrentUrlSeedsRemoved(TorrentHandleImpl *const torrent, con
void Session::handleTorrentMetadataReceived(TorrentHandleImpl *const torrent)
{
torrent->saveResumeData();
// Save metadata
const QDir resumeDataDir {m_resumeFolderPath};
const QString torrentFileName {QString {"%1.torrent"}.arg(torrent->hash())};
@@ -3897,7 +3871,7 @@ void Session::handleTorrentMetadataReceived(TorrentHandleImpl *const torrent)
.arg(torrentFileName, err.message()), Log::CRITICAL);
}
emit torrentMetadataLoaded(torrent);
emit torrentMetadataReceived(torrent);
}
void Session::handleTorrentPaused(TorrentHandleImpl *const torrent)
@@ -4052,6 +4026,8 @@ void Session::moveTorrentStorage(const MoveStorageJob &job) const
void Session::handleMoveTorrentStorageJobFinished()
{
const MoveStorageJob finishedJob = m_moveStorageQueue.takeFirst();
if (!m_moveStorageQueue.isEmpty())
moveTorrentStorage(m_moveStorageQueue.first());
const auto iter = std::find_if(m_moveStorageQueue.cbegin(), m_moveStorageQueue.cend()
, [&finishedJob](const MoveStorageJob &job)
@@ -4063,22 +4039,17 @@ void Session::handleMoveTorrentStorageJobFinished()
TorrentHandleImpl *torrent = m_torrents.value(finishedJob.torrentHandle.info_hash());
if (torrent)
torrent->handleMoveStorageJobFinished(torrentHasOutstandingJob);
if (!torrentHasOutstandingJob)
{
if (!torrent)
{
// Last job is completed for torrent that being removing, so actually remove it
const lt::torrent_handle nativeHandle {finishedJob.torrentHandle};
const RemovingTorrentData &removingTorrentData = m_removingTorrents[nativeHandle.info_hash()];
if (removingTorrentData.deleteOption == Torrent)
m_nativeSession->remove_torrent(nativeHandle, lt::session::delete_partfile);
}
torrent->handleMoveStorageJobFinished(torrentHasOutstandingJob);
}
else if (!torrentHasOutstandingJob)
{
// Last job is completed for torrent that being removing, so actually remove it
const lt::torrent_handle nativeHandle {finishedJob.torrentHandle};
const RemovingTorrentData &removingTorrentData = m_removingTorrents[nativeHandle.info_hash()];
if (removingTorrentData.deleteOption == Torrent)
m_nativeSession->remove_torrent(nativeHandle, lt::session::delete_partfile);
}
if (!m_moveStorageQueue.isEmpty())
moveTorrentStorage(m_moveStorageQueue.first());
}
void Session::handleTorrentTrackerWarning(TorrentHandleImpl *const torrent, const QString &trackerUrl)
@@ -4223,9 +4194,27 @@ bool Session::loadTorrentResumeData(const QByteArray &data, const TorrentInfo &m
Utils::Fs::toUniformPath(fromLTString(root.dict_find_string_value("qBt-savePath"))));
torrentParams.hasSeedStatus = root.dict_find_int_value("qBt-seedStatus");
torrentParams.firstLastPiecePriority = root.dict_find_int_value("qBt-firstLastPiecePriority");
torrentParams.hasRootFolder = root.dict_find_int_value("qBt-hasRootFolder");
torrentParams.seedingTimeLimit = root.dict_find_int_value("qBt-seedingTimeLimit", TorrentHandle::USE_GLOBAL_SEEDING_TIME);
// TODO: The following code is deprecated. Replace with the commented one after several releases in 4.4.x.
// === BEGIN DEPRECATED CODE === //
const lt::bdecode_node contentLayoutNode = root.dict_find("qBt-contentLayout");
if (contentLayoutNode.type() == lt::bdecode_node::string_t)
{
const QString contentLayoutStr = fromLTString(contentLayoutNode.string_value());
torrentParams.contentLayout = Utils::String::toEnum(contentLayoutStr, TorrentContentLayout::Original);
}
else
{
const bool hasRootFolder = root.dict_find_int_value("qBt-hasRootFolder");
torrentParams.contentLayout = (hasRootFolder ? TorrentContentLayout::Original : TorrentContentLayout::NoSubfolder);
}
// === END DEPRECATED CODE === //
// === BEGIN REPLACEMENT CODE === //
// torrentParams.contentLayout = Utils::String::parse(
// fromLTString(root.dict_find_string_value("qBt-contentLayout")), TorrentContentLayout::Default);
// === END REPLACEMENT CODE === //
const lt::string_view ratioLimitString = root.dict_find_string_value("qBt-ratioLimit");
if (ratioLimitString.empty())
torrentParams.ratioLimit = root.dict_find_int_value("qBt-ratioLimit", TorrentHandle::USE_GLOBAL_RATIO * 1000) / 1000.0;
@@ -4258,21 +4247,21 @@ bool Session::loadTorrentResumeData(const QByteArray &data, const TorrentInfo &m
if (metadata.isValid())
p.ti = metadata.nativeInfo();
torrentParams.paused = (p.flags & lt::torrent_flags::paused) && !(p.flags & lt::torrent_flags::auto_managed);
if (!torrentParams.paused)
if (p.flags & lt::torrent_flags::stop_when_ready)
{
// If torrent has "stop_when_ready" flag set then it is actually "stopped"
// but temporarily "resumed" to perform some service jobs (e.g. checking)
torrentParams.paused = !!(p.flags & lt::torrent_flags::stop_when_ready);
torrentParams.paused = true;
torrentParams.forced = false;
// ...but temporarily "resumed" to perform some service jobs (e.g. checking)
p.flags &= ~lt::torrent_flags::paused;
p.flags |= lt::torrent_flags::auto_managed;
}
else
{
// Fix inconsistent state when "paused" torrent has "stop_when_ready" flag set
p.flags &= ~lt::torrent_flags::stop_when_ready;
torrentParams.paused = (p.flags & lt::torrent_flags::paused) && !(p.flags & lt::torrent_flags::auto_managed);
torrentParams.forced = !(p.flags & lt::torrent_flags::paused) && !(p.flags & lt::torrent_flags::auto_managed);
}
torrentParams.forced = !(p.flags & lt::torrent_flags::paused) && !(p.flags & lt::torrent_flags::auto_managed);
const bool hasMetadata = (p.ti && p.ti->is_valid());
if (!hasMetadata && !root.dict_find("info-hash"))
{
@@ -4456,14 +4445,14 @@ std::vector<lt::alert *> Session::getPendingAlerts(const lt::time_duration time)
return alerts;
}
bool Session::isKeepTorrentTopLevelFolder() const
TorrentContentLayout Session::torrentContentLayout() const
{
return m_isKeepTorrentTopLevelFolder;
return m_torrentContentLayout;
}
void Session::setKeepTorrentTopLevelFolder(const bool value)
void Session::setTorrentContentLayout(const TorrentContentLayout value)
{
m_isKeepTorrentTopLevelFolder = value;
m_torrentContentLayout = value;
}
// Read alerts sent by the BitTorrent session
@@ -4504,11 +4493,6 @@ void Session::handleAlert(const lt::alert *a)
case lt::file_error_alert::alert_type:
handleFileErrorAlert(static_cast<const lt::file_error_alert*>(a));
break;
#if (LIBTORRENT_VERSION_NUM < 10208)
case lt::read_piece_alert::alert_type:
handleReadPieceAlert(static_cast<const lt::read_piece_alert*>(a));
break;
#endif
case lt::add_torrent_alert::alert_type:
handleAddTorrentAlert(static_cast<const lt::add_torrent_alert*>(a));
break;
@@ -4554,11 +4538,9 @@ void Session::handleAlert(const lt::alert *a)
case lt::storage_moved_failed_alert::alert_type:
handleStorageMovedFailedAlert(static_cast<const lt::storage_moved_failed_alert*>(a));
break;
#if (LIBTORRENT_VERSION_NUM >= 10204)
case lt::socks5_alert::alert_type:
handleSocks5Alert(static_cast<const lt::socks5_alert *>(a));
break;
#endif
}
}
catch (const std::exception &exc)
@@ -4590,7 +4572,7 @@ void Session::createTorrentHandle(const lt::torrent_handle &nativeHandle)
const LoadTorrentParams params = m_loadingTorrents.take(nativeHandle.info_hash());
auto *const torrent = new TorrentHandleImpl {this, nativeHandle, params};
auto *const torrent = new TorrentHandleImpl {this, m_nativeSession, nativeHandle, params};
m_torrents.insert(torrent->hash(), torrent);
const bool hasMetadata = torrent->hasMetadata();
@@ -4645,12 +4627,6 @@ void Session::createTorrentHandle(const lt::torrent_handle &nativeHandle)
// Torrent could have error just after adding to libtorrent
if (torrent->hasError())
LogMsg(tr("Torrent errored. Torrent: \"%1\". Error: %2.").arg(torrent->name(), torrent->error()), Log::WARNING);
#if (LIBTORRENT_VERSION_NUM < 10208)
// Check if file(s) exist when using skip hash check
if (nativeHandle.flags() & lt::torrent_flags::seed_mode)
nativeHandle.read_piece(lt::piece_index_t {0});
#endif
}
void Session::handleAddTorrentAlert(const lt::add_torrent_alert *p)
@@ -4704,17 +4680,17 @@ void Session::handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed_ale
if (removingTorrentDataIter == m_removingTorrents.end())
return;
// libtorrent won't delete the directory if it contains files not listed in the torrent,
// so we remove the directory ourselves
Utils::Fs::smartRemoveEmptyFolderTree(removingTorrentDataIter->pathToRemove);
if (p->error)
{
// libtorrent won't delete the directory if it contains files not listed in the torrent,
// so we remove the directory ourselves
Utils::Fs::smartRemoveEmptyFolderTree(removingTorrentDataIter->pathToRemove);
LogMsg(tr("'%1' was removed from the transfer list but the files couldn't be deleted. Error: %2", "'xxx.avi' was removed...")
.arg(removingTorrentDataIter->name, QString::fromLocal8Bit(p->error.message().c_str()))
, Log::WARNING);
}
else
else // torrent without metadata, hence no files on disk
{
LogMsg(tr("'%1' was removed from the transfer list.", "'xxx.avi' was removed...").arg(removingTorrentDataIter->name));
}
@@ -4724,18 +4700,18 @@ void Session::handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed_ale
void Session::handleMetadataReceivedAlert(const lt::metadata_received_alert *p)
{
const InfoHash hash {p->handle.info_hash()};
const auto loadedMetadataIter = m_loadedMetadata.find(hash);
const auto downloadedMetadataIter = m_downloadedMetadata.find(hash);
if (loadedMetadataIter != m_loadedMetadata.end())
if (downloadedMetadataIter != m_downloadedMetadata.end())
{
TorrentInfo metadata {p->handle.torrent_file()};
m_loadedMetadata.erase(loadedMetadataIter);
m_downloadedMetadata.erase(downloadedMetadataIter);
--m_extraLimit;
adjustLimits();
m_nativeSession->remove_torrent(p->handle, lt::session::delete_files);
emit metadataLoaded(metadata);
emit metadataDownloaded(metadata);
}
}
@@ -4761,17 +4737,6 @@ void Session::handleFileErrorAlert(const lt::file_error_alert *p)
m_recentErroredTorrentsTimer->start();
}
#if (LIBTORRENT_VERSION_NUM < 10208)
void Session::handleReadPieceAlert(const lt::read_piece_alert *p) const
{
if (p->error)
{
p->handle.unset_flags(lt::torrent_flags::auto_managed);
p->handle.force_recheck();
}
}
#endif
void Session::handlePortmapWarningAlert(const lt::portmap_error_alert *p)
{
LogMsg(tr("UPnP/NAT-PMP: Port mapping failure, message: %1").arg(QString::fromStdString(p->message())), Log::CRITICAL);
@@ -4922,11 +4887,14 @@ void Session::handleSessionStatsAlert(const lt::session_stats_alert *p)
m_status.peersCount = stats[m_metricIndices.peer.numPeersConnected];
const int64_t numBlocksRead = stats[m_metricIndices.disk.numBlocksRead];
const int64_t numBlocksCacheHits = stats[m_metricIndices.disk.numBlocksCacheHits];
m_cacheStatus.totalUsedBuffers = stats[m_metricIndices.disk.diskBlocksInUse];
m_cacheStatus.readRatio = static_cast<qreal>(numBlocksCacheHits) / std::max<int64_t>(numBlocksCacheHits + numBlocksRead, 1);
m_cacheStatus.jobQueueLength = stats[m_metricIndices.disk.queuedDiskJobs];
#if (LIBTORRENT_VERSION_NUM < 20000)
const int64_t numBlocksCacheHits = stats[m_metricIndices.disk.numBlocksCacheHits];
m_cacheStatus.readRatio = static_cast<qreal>(numBlocksCacheHits) / std::max<int64_t>((numBlocksCacheHits + numBlocksRead), 1);
#endif
const int64_t totalJobs = stats[m_metricIndices.disk.writeJobs] + stats[m_metricIndices.disk.readJobs]
+ stats[m_metricIndices.disk.hashJobs];
m_cacheStatus.averageJobTime = (totalJobs > 0)
@@ -5013,7 +4981,6 @@ void Session::handleStateUpdateAlert(const lt::state_update_alert *p)
enqueueRefresh();
}
#if (LIBTORRENT_VERSION_NUM >= 10204)
void Session::handleSocks5Alert(const lt::socks5_alert *p) const
{
if (p->error)
@@ -5022,4 +4989,3 @@ void Session::handleSocks5Alert(const lt::socks5_alert *p) const
, Log::WARNING);
}
}
#endif

View File

@@ -27,8 +27,7 @@
* exception statement from your version.
*/
#ifndef BITTORRENT_SESSION_H
#define BITTORRENT_SESSION_H
#pragma once
#include <memory>
#include <vector>
@@ -41,6 +40,7 @@
#include <QHash>
#include <QPointer>
#include <QSet>
#include <QtContainerFwd>
#include <QVector>
#include "base/settingvalue.h"
@@ -50,20 +50,24 @@
#include "sessionstatus.h"
#include "torrentinfo.h"
#if ((LIBTORRENT_VERSION_NUM >= 10206) && !defined(Q_OS_WIN))
#if !defined(Q_OS_WIN) || (LIBTORRENT_VERSION_NUM >= 10212)
#define HAS_HTTPS_TRACKER_VALIDATION
#endif
#if ((LIBTORRENT_VERSION_NUM >= 10212) && (LIBTORRENT_VERSION_NUM < 20000)) || (LIBTORRENT_VERSION_NUM >= 20002)
#define HAS_IDN_SUPPORT
#endif
class QFile;
class QNetworkConfiguration;
class QNetworkConfigurationManager;
class QString;
class QStringList;
class QThread;
class QTimer;
class QUrl;
class BandwidthScheduler;
class FileSearcher;
class FilterParserThread;
class ResumeDataSavingManager;
class Statistics;
@@ -110,7 +114,7 @@ namespace BitTorrent
// Using `Q_ENUM_NS()` without a wrapper namespace in our case is not advised
// since `Q_NAMESPACE` cannot be used when the same namespace resides at different files.
// https://www.kdab.com/new-qt-5-8-meta-object-support-namespaces/#comment-143779
namespace SessionSettingsEnums
inline namespace SessionSettingsEnums
{
Q_NAMESPACE
@@ -156,49 +160,50 @@ namespace BitTorrent
Q_ENUM_NS(OSMemoryPriority)
#endif
}
using namespace SessionSettingsEnums;
struct SessionMetricIndices
{
struct
{
int hasIncomingConnections = 0;
int sentPayloadBytes = 0;
int recvPayloadBytes = 0;
int sentBytes = 0;
int recvBytes = 0;
int sentIPOverheadBytes = 0;
int recvIPOverheadBytes = 0;
int sentTrackerBytes = 0;
int recvTrackerBytes = 0;
int recvRedundantBytes = 0;
int recvFailedBytes = 0;
int hasIncomingConnections = -1;
int sentPayloadBytes = -1;
int recvPayloadBytes = -1;
int sentBytes = -1;
int recvBytes = -1;
int sentIPOverheadBytes = -1;
int recvIPOverheadBytes = -1;
int sentTrackerBytes = -1;
int recvTrackerBytes = -1;
int recvRedundantBytes = -1;
int recvFailedBytes = -1;
} net;
struct
{
int numPeersConnected = 0;
int numPeersUpDisk = 0;
int numPeersDownDisk = 0;
int numPeersConnected = -1;
int numPeersUpDisk = -1;
int numPeersDownDisk = -1;
} peer;
struct
{
int dhtBytesIn = 0;
int dhtBytesOut = 0;
int dhtNodes = 0;
int dhtBytesIn = -1;
int dhtBytesOut = -1;
int dhtNodes = -1;
} dht;
struct
{
int diskBlocksInUse = 0;
int numBlocksRead = 0;
int numBlocksCacheHits = 0;
int writeJobs = 0;
int readJobs = 0;
int hashJobs = 0;
int queuedDiskJobs = 0;
int diskJobTime = 0;
int diskBlocksInUse = -1;
int numBlocksRead = -1;
#if (LIBTORRENT_VERSION_NUM < 20000)
int numBlocksCacheHits = -1;
#endif
int writeJobs = -1;
int readJobs = -1;
int hashJobs = -1;
int queuedDiskJobs = -1;
int diskJobTime = -1;
} disk;
};
@@ -270,8 +275,8 @@ namespace BitTorrent
void setPeXEnabled(bool enabled);
bool isAddTorrentPaused() const;
void setAddTorrentPaused(bool value);
bool isKeepTorrentTopLevelFolder() const;
void setKeepTorrentTopLevelFolder(bool value);
TorrentContentLayout torrentContentLayout() const;
void setTorrentContentLayout(TorrentContentLayout value);
bool isTrackerEnabled() const;
void setTrackerEnabled(bool enabled);
bool isAppendExtensionEnabled() const;
@@ -416,6 +421,8 @@ namespace BitTorrent
void setUTPRateLimited(bool limited);
MixedModeAlgorithm utpMixedMode() const;
void setUtpMixedMode(MixedModeAlgorithm mode);
bool isIDNSupportEnabled() const;
void setIDNSupportEnabled(bool enabled);
bool multiConnectionsPerIpEnabled() const;
void setMultiConnectionsPerIpEnabled(bool enabled);
bool validateHTTPSTrackerCertificate() const;
@@ -453,8 +460,8 @@ namespace BitTorrent
bool addTorrent(const MagnetUri &magnetUri, const AddTorrentParams &params = AddTorrentParams());
bool addTorrent(const TorrentInfo &torrentInfo, const AddTorrentParams &params = AddTorrentParams());
bool deleteTorrent(const InfoHash &hash, DeleteOption deleteOption = Torrent);
bool loadMetadata(const MagnetUri &magnetUri);
bool cancelLoadMetadata(const InfoHash &hash);
bool downloadMetadata(const MagnetUri &magnetUri);
bool cancelDownloadMetadata(const InfoHash &hash);
void recursiveTorrentDownload(const InfoHash &hash);
void increaseTorrentsQueuePos(const QVector<InfoHash> &hashes);
@@ -488,6 +495,8 @@ namespace BitTorrent
bool addMoveTorrentStorageJob(TorrentHandleImpl *torrent, const QString &newPath, MoveStorageMode mode);
void findIncompleteFiles(const TorrentInfo &torrentInfo, const QString &savePath) const;
signals:
void allTorrentsFinished();
void categoryAdded(const QString &categoryName);
@@ -497,7 +506,7 @@ namespace BitTorrent
void fullDiskError(TorrentHandle *torrent, const QString &msg);
void IPFilterParsed(bool error, int ruleCount);
void loadTorrentFailed(const QString &error);
void metadataLoaded(const TorrentInfo &info);
void metadataDownloaded(const TorrentInfo &info);
void recursiveTorrentDownloadPossible(TorrentHandle *torrent);
void speedLimitModeChanged(bool alternative);
void statsUpdated();
@@ -510,7 +519,7 @@ namespace BitTorrent
void torrentFinished(TorrentHandle *torrent);
void torrentFinishedChecking(TorrentHandle *torrent);
void torrentLoaded(TorrentHandle *torrent);
void torrentMetadataLoaded(TorrentHandle *torrent);
void torrentMetadataReceived(TorrentHandle *torrent);
void torrentPaused(TorrentHandle *torrent);
void torrentResumed(TorrentHandle *torrent);
void torrentSavePathChanged(TorrentHandle *torrent);
@@ -537,6 +546,7 @@ namespace BitTorrent
void handleIPFilterParsed(int ruleCount);
void handleIPFilterError();
void handleDownloadFinished(const Net::DownloadResult &result);
void fileSearchFinished(const InfoHash &id, const QString &savePath, const QStringList &fileNames);
// Session reconfiguration triggers
void networkOnlineStateChanged(bool online);
@@ -593,7 +603,6 @@ namespace BitTorrent
bool loadTorrent(LoadTorrentParams params);
LoadTorrentParams initLoadTorrentParams(const AddTorrentParams &addTorrentParams);
bool addTorrent_impl(const AddTorrentParams &addTorrentParams, const MagnetUri &magnetUri, TorrentInfo torrentInfo = TorrentInfo());
bool findIncompleteFiles(TorrentInfo &torrentInfo, QString &savePath) const;
void updateSeedingLimitTimer();
void exportTorrentFile(const TorrentHandle *torrent, TorrentExportFolder folder = TorrentExportFolder::Regular);
@@ -604,9 +613,6 @@ namespace BitTorrent
void handleStateUpdateAlert(const lt::state_update_alert *p);
void handleMetadataReceivedAlert(const lt::metadata_received_alert *p);
void handleFileErrorAlert(const lt::file_error_alert *p);
#if (LIBTORRENT_VERSION_NUM < 10208)
void handleReadPieceAlert(const lt::read_piece_alert *p) const;
#endif
void handleTorrentRemovedAlert(const lt::torrent_removed_alert *p);
void handleTorrentDeletedAlert(const lt::torrent_deleted_alert *p);
void handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed_alert *p);
@@ -622,9 +628,7 @@ namespace BitTorrent
void handleAlertsDroppedAlert(const lt::alerts_dropped_alert *p) const;
void handleStorageMovedAlert(const lt::storage_moved_alert *p);
void handleStorageMovedFailedAlert(const lt::storage_moved_failed_alert *p);
#if (LIBTORRENT_VERSION_NUM >= 10204)
void handleSocks5Alert(const lt::socks5_alert *p) const;
#endif
void createTorrentHandle(const lt::torrent_handle &nativeHandle);
@@ -690,6 +694,7 @@ namespace BitTorrent
CachedSettingValue<BTProtocol> m_btProtocol;
CachedSettingValue<bool> m_isUTPRateLimited;
CachedSettingValue<MixedModeAlgorithm> m_utpMixedMode;
CachedSettingValue<bool> m_IDNSupportEnabled;
CachedSettingValue<bool> m_multiConnectionsPerIpEnabled;
CachedSettingValue<bool> m_validateHTTPSTrackerCertificate;
CachedSettingValue<bool> m_blockPeersOnPrivilegedPorts;
@@ -698,7 +703,7 @@ namespace BitTorrent
CachedSettingValue<qreal> m_globalMaxRatio;
CachedSettingValue<int> m_globalMaxSeedingMinutes;
CachedSettingValue<bool> m_isAddTorrentPaused;
CachedSettingValue<bool> m_isKeepTorrentTopLevelFolder;
CachedSettingValue<TorrentContentLayout> m_torrentContentLayout;
CachedSettingValue<bool> m_isAppendExtensionEnabled;
CachedSettingValue<int> m_refreshInterval;
CachedSettingValue<bool> m_isPreallocationEnabled;
@@ -763,8 +768,9 @@ namespace BitTorrent
// fastresume data writing thread
QThread *m_ioThread = nullptr;
ResumeDataSavingManager *m_resumeDataSavingManager = nullptr;
FileSearcher *m_fileSearcher = nullptr;
QSet<InfoHash> m_loadedMetadata;
QSet<InfoHash> m_downloadedMetadata;
QHash<InfoHash, TorrentHandleImpl *> m_torrents;
QHash<InfoHash, LoadTorrentParams> m_loadingTorrents;
@@ -795,5 +801,3 @@ namespace BitTorrent
Q_DECLARE_METATYPE(std::shared_ptr<lt::entry>)
const int sharedPtrLtEntryTypeID = qRegisterMetaType<std::shared_ptr<lt::entry>>();
#endif
#endif // BITTORRENT_SESSION_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef BITTORRENT_SESSIONSTATUS_H
#define BITTORRENT_SESSIONSTATUS_H
#pragma once
#include <QtGlobal>
@@ -74,5 +73,3 @@ namespace BitTorrent
quint64 peersCount = 0;
};
}
#endif // BITTORRENT_SESSIONSTATUS_H

View File

@@ -27,8 +27,7 @@
* exception statement from your version.
*/
#ifndef SPEEDMONITOR_H
#define SPEEDMONITOR_H
#pragma once
#ifndef Q_MOC_RUN
#include <boost/circular_buffer.hpp>
@@ -86,5 +85,3 @@ private:
boost::circular_buffer<SpeedSample> m_speedSamples;
SpeedSample m_sum;
};
#endif // SPEEDMONITOR_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef STATISTICS_H
#define STATISTICS_H
#pragma once
#include <QObject>
#include <QTimer>
@@ -67,5 +66,3 @@ private:
QTimer m_timer;
};
#endif // STATISTICS_H

View File

@@ -0,0 +1,51 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2020 Vladimir Golovnev <glassez@yandex.ru>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
#pragma once
#include <QMetaEnum>
namespace BitTorrent
{
// Using `Q_ENUM_NS()` without a wrapper namespace in our case is not advised
// since `Q_NAMESPACE` cannot be used when the same namespace resides at different files.
// https://www.kdab.com/new-qt-5-8-meta-object-support-namespaces/#comment-143779
inline namespace TorrentContentLayoutNS
{
Q_NAMESPACE
enum class TorrentContentLayout
{
Original,
Subfolder,
NoSubfolder
};
Q_ENUM_NS(TorrentContentLayout)
}
}

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef BITTORRENT_TORRENTCREATORTHREAD_H
#define BITTORRENT_TORRENTCREATORTHREAD_H
#pragma once
#include <libtorrent/version.hpp>
@@ -94,5 +93,3 @@ namespace BitTorrent
TorrentCreatorParams m_params;
};
}
#endif // BITTORRENT_TORRENTCREATORTHREAD_H

View File

@@ -31,6 +31,8 @@
#include <type_traits>
#include <QHash>
namespace BitTorrent
{
uint qHash(const TorrentState key, const uint seed)

View File

@@ -29,15 +29,12 @@
#pragma once
#include <QHash>
#include <QMetaType>
#include <QSet>
#include <QString>
#include <QVector>
#include <QtContainerFwd>
class QBitArray;
class QDateTime;
class QStringList;
class QUrl;
namespace BitTorrent
@@ -180,8 +177,6 @@ namespace BitTorrent
virtual bool removeTag(const QString &tag) = 0;
virtual void removeAllTags() = 0;
virtual bool hasRootFolder() const = 0;
virtual int filesCount() const = 0;
virtual int piecesCount() const = 0;
virtual int piecesHave() const = 0;

View File

@@ -41,6 +41,7 @@
#include <libtorrent/alert_types.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/magnet_uri.hpp>
#include <libtorrent/session.hpp>
#include <libtorrent/storage_defs.hpp>
#include <libtorrent/time.hpp>
#include <libtorrent/version.hpp>
@@ -101,10 +102,11 @@ namespace
// TorrentHandleImpl
TorrentHandleImpl::TorrentHandleImpl(Session *session, const lt::torrent_handle &nativeHandle,
const LoadTorrentParams &params)
TorrentHandleImpl::TorrentHandleImpl(Session *session, lt::session *nativeSession
, const lt::torrent_handle &nativeHandle, const LoadTorrentParams &params)
: QObject(session)
, m_session(session)
, m_nativeSession(nativeSession)
, m_nativeHandle(nativeHandle)
, m_name(params.name)
, m_savePath(Utils::Fs::toNativePath(params.savePath))
@@ -113,8 +115,8 @@ TorrentHandleImpl::TorrentHandleImpl(Session *session, const lt::torrent_handle
, m_ratioLimit(params.ratioLimit)
, m_seedingTimeLimit(params.seedingTimeLimit)
, m_operatingMode(params.forced ? TorrentOperatingMode::Forced : TorrentOperatingMode::AutoManaged)
, m_contentLayout(params.contentLayout)
, m_hasSeedStatus(params.hasSeedStatus)
, m_hasRootFolder(params.hasRootFolder)
, m_hasFirstLastPiecePriority(params.firstLastPiecePriority)
, m_useAutoTMM(params.savePath.isEmpty())
, m_isStopped(params.paused)
@@ -123,20 +125,19 @@ TorrentHandleImpl::TorrentHandleImpl(Session *session, const lt::torrent_handle
if (m_useAutoTMM)
m_savePath = Utils::Fs::toNativePath(m_session->categorySavePath(m_category));
m_hash = InfoHash {m_nativeHandle.info_hash()};
if (m_ltAddTorrentParams.ti)
{
// Initialize it only if torrent is added with metadata.
// Otherwise it should be initialized in "Metadata received" handler.
m_torrentInfo = TorrentInfo {m_nativeHandle.torrent_file()};
}
updateStatus();
m_hash = InfoHash(m_nativeStatus.info_hash);
if (hasMetadata())
{
applyFirstLastPiecePriority(m_hasFirstLastPiecePriority);
if (!params.restored)
{
if (filesCount() == 1)
m_hasRootFolder = false;
}
}
// TODO: Remove the following upgrade code in v.4.4
// == BEGIN UPGRADE CODE ==
const QString spath = actualStorageLocation();
@@ -176,17 +177,15 @@ InfoHash TorrentHandleImpl::hash() const
QString TorrentHandleImpl::name() const
{
QString name = m_name;
if (!name.isEmpty()) return name;
name = QString::fromStdString(m_nativeStatus.name);
if (!name.isEmpty()) return name;
if (!m_name.isEmpty())
return m_name;
if (hasMetadata())
{
name = QString::fromStdString(m_torrentInfo.nativeInfo()->orig_files().name());
if (!name.isEmpty()) return name;
}
return m_torrentInfo.name();
const QString name = QString::fromStdString(m_nativeStatus.name);
if (!name.isEmpty())
return name;
return m_hash;
}
@@ -252,7 +251,7 @@ QString TorrentHandleImpl::savePath(bool actual) const
QString TorrentHandleImpl::rootPath(bool actual) const
{
if ((filesCount() > 1) && !hasRootFolder())
if (!hasMetadata())
return {};
const QString firstFilePath = filePath(0);
@@ -265,10 +264,13 @@ QString TorrentHandleImpl::rootPath(bool actual) const
QString TorrentHandleImpl::contentPath(const bool actual) const
{
if (!hasMetadata())
return {};
if (filesCount() == 1)
return QDir(savePath(actual)).absoluteFilePath(filePath(0));
if (hasRootFolder())
if (m_torrentInfo.hasRootFolder())
return rootPath(actual);
return savePath(actual);
@@ -290,11 +292,6 @@ void TorrentHandleImpl::setAutoTMMEnabled(bool enabled)
move_impl(m_session->categorySavePath(m_category), MoveStorageMode::Overwrite);
}
bool TorrentHandleImpl::hasRootFolder() const
{
return m_hasRootFolder;
}
QString TorrentHandleImpl::actualStorageLocation() const
{
return QString::fromStdString(m_nativeStatus.save_path);
@@ -445,9 +442,7 @@ void TorrentHandleImpl::removeUrlSeeds(const QVector<QUrl> &urlSeeds)
void TorrentHandleImpl::clearPeers()
{
#if (LIBTORRENT_VERSION_NUM >= 10207)
m_nativeHandle.clear_peers();
#endif
}
bool TorrentHandleImpl::connectPeer(const PeerAddress &peerAddress)
@@ -646,7 +641,9 @@ bool TorrentHandleImpl::isPaused() const
bool TorrentHandleImpl::isQueued() const
{
// Torrent is Queued if it isn't in Paused state but paused internally
return ((m_nativeStatus.flags & lt::torrent_flags::paused) && !isPaused());
return (!isPaused()
&& (m_nativeStatus.flags & lt::torrent_flags::auto_managed)
&& (m_nativeStatus.flags & lt::torrent_flags::paused));
}
bool TorrentHandleImpl::isChecking() const
@@ -753,10 +750,19 @@ void TorrentHandleImpl::updateState()
{
m_state = TorrentState::Error;
}
else if (!hasMetadata())
{
if (isPaused())
m_state = TorrentState::PausedDownloading;
else if (m_session->isQueueingSystemEnabled() && isQueued())
m_state = TorrentState::QueuedDownloading;
else
m_state = TorrentState::DownloadingMetadata;
}
else if ((m_nativeStatus.state == lt::torrent_status::checking_files)
&& (!isPaused() || (m_nativeStatus.flags & lt::torrent_flags::auto_managed)
|| !(m_nativeStatus.flags & lt::torrent_flags::paused)))
{
{
// If the torrent is not just in the "checking" state, but is being actually checked
m_state = m_hasSeedStatus ? TorrentState::CheckingUploading : TorrentState::CheckingDownloading;
}
@@ -777,8 +783,6 @@ void TorrentHandleImpl::updateState()
{
if (isPaused())
m_state = TorrentState::PausedDownloading;
else if (m_nativeStatus.state == lt::torrent_status::downloading_metadata)
m_state = TorrentState::DownloadingMetadata;
else if (m_session->isQueueingSystemEnabled() && isQueued())
m_state = TorrentState::QueuedDownloading;
else if (isForced())
@@ -792,7 +796,7 @@ void TorrentHandleImpl::updateState()
bool TorrentHandleImpl::hasMetadata() const
{
return m_nativeStatus.has_metadata;
return m_torrentInfo.isValid();
}
bool TorrentHandleImpl::hasMissingFiles() const
@@ -894,6 +898,9 @@ qlonglong TorrentHandleImpl::eta() const
QVector<qreal> TorrentHandleImpl::filesProgress() const
{
if (!hasMetadata())
return {};
std::vector<int64_t> fp;
m_nativeHandle.file_progress(fp, lt::torrent_handle::piece_granularity);
@@ -1281,18 +1288,66 @@ void TorrentHandleImpl::applyFirstLastPiecePriority(const bool enabled, const QV
m_nativeHandle.prioritize_pieces(piecePriorities);
}
void TorrentHandleImpl::fileSearchFinished(const QString &savePath, const QStringList &fileNames)
{
endReceivedMetadataHandling(savePath, fileNames);
}
void TorrentHandleImpl::endReceivedMetadataHandling(const QString &savePath, const QStringList &fileNames)
{
const auto queuePos = m_nativeHandle.queue_position();
lt::add_torrent_params p = m_ltAddTorrentParams;
p.ti = std::const_pointer_cast<lt::torrent_info>(m_nativeHandle.torrent_file());
m_nativeSession->remove_torrent(m_nativeHandle, lt::session::delete_partfile);
for (int i = 0; i < fileNames.size(); ++i)
p.renamed_files[lt::file_index_t {i}] = fileNames[i].toStdString();
p.save_path = Utils::Fs::toNativePath(savePath).toStdString();
p.flags |= lt::torrent_flags::update_subscribe
| lt::torrent_flags::override_trackers
| lt::torrent_flags::override_web_seeds;
m_nativeHandle = m_nativeSession->add_torrent(p);
m_nativeHandle.queue_position_set(queuePos);
m_torrentInfo = TorrentInfo {m_nativeHandle.torrent_file()};
// If first/last piece priority was specified when adding this torrent,
// we should apply it now that we have metadata:
if (m_hasFirstLastPiecePriority)
applyFirstLastPiecePriority(true);
if (!m_isStopped)
{
setAutoManaged(m_operatingMode == TorrentOperatingMode::AutoManaged);
if (m_operatingMode == TorrentOperatingMode::Forced)
m_nativeHandle.resume();
}
m_maintenanceJob = MaintenanceJob::None;
updateStatus();
m_session->handleTorrentMetadataReceived(this);
}
void TorrentHandleImpl::pause()
{
setAutoManaged(false);
m_nativeHandle.pause();
m_speedMonitor.reset();
if (!m_isStopped)
{
m_isStopped = true;
m_session->handleTorrentPaused(this);
}
if (m_maintenanceJob == MaintenanceJob::None)
{
setAutoManaged(false);
m_nativeHandle.pause();
m_speedMonitor.reset();
}
}
void TorrentHandleImpl::resume(const TorrentOperatingMode mode)
@@ -1306,24 +1361,24 @@ void TorrentHandleImpl::resume(const TorrentOperatingMode mode)
m_nativeHandle.force_recheck();
}
m_operatingMode = mode;
if (m_isStopped)
{
// Torrent may have been temporarily resumed to perform checking files
// so we have to ensure it will not pause after checking is done.
m_nativeHandle.unset_flags(lt::torrent_flags::stop_when_ready);
}
setAutoManaged(mode == TorrentOperatingMode::AutoManaged);
if (mode == TorrentOperatingMode::Forced)
m_nativeHandle.resume();
m_operatingMode = mode;
if (m_isStopped)
{
m_isStopped = false;
m_session->handleTorrentResumed(this);
}
if (m_maintenanceJob == MaintenanceJob::None)
{
setAutoManaged(m_operatingMode == TorrentOperatingMode::AutoManaged);
if (m_operatingMode == TorrentOperatingMode::Forced)
m_nativeHandle.resume();
}
}
void TorrentHandleImpl::moveStorage(const QString &newPath, const MoveStorageMode mode)
@@ -1408,13 +1463,20 @@ void TorrentHandleImpl::handleTrackerErrorAlert(const lt::tracker_error_alert *p
void TorrentHandleImpl::handleTorrentCheckedAlert(const lt::torrent_checked_alert *p)
{
Q_UNUSED(p);
qDebug("\"%s\" have just finished checking", qUtf8Printable(name()));
qDebug("\"%s\" have just finished checking.", qUtf8Printable(name()));
if (!hasMetadata())
{
// The torrent is checked due to metadata received, but we should not process
// this event until the torrent is reloaded using the received metadata.
return;
}
saveResumeData();
if (m_fastresumeDataRejected && !m_hasMissingFiles)
{
saveResumeData();
m_fastresumeDataRejected = false;
}
updateStatus();
@@ -1473,13 +1535,18 @@ void TorrentHandleImpl::handleTorrentResumedAlert(const lt::torrent_resumed_aler
void TorrentHandleImpl::handleSaveResumeDataAlert(const lt::save_resume_data_alert *p)
{
if (p && !m_hasMissingFiles)
if (!m_hasMissingFiles)
{
// Update recent resume data
m_ltAddTorrentParams = p->params;
}
if (!m_isStopped)
if (m_isStopped)
{
m_ltAddTorrentParams.flags |= lt::torrent_flags::paused;
m_ltAddTorrentParams.flags &= ~lt::torrent_flags::auto_managed;
}
else
{
// Torrent can be actually "running" but temporarily "paused" to perform some
// service jobs behind the scenes so we need to restore it as "running"
@@ -1498,12 +1565,23 @@ void TorrentHandleImpl::handleSaveResumeDataAlert(const lt::save_resume_data_ale
m_ltAddTorrentParams.save_path = Profile::instance()->toPortablePath(
QString::fromStdString(m_ltAddTorrentParams.save_path)).toStdString();
if (m_maintenanceJob == MaintenanceJob::HandleMetadata)
{
m_ltAddTorrentParams.have_pieces.clear();
m_ltAddTorrentParams.verified_pieces.clear();
TorrentInfo metadata = TorrentInfo {m_nativeHandle.torrent_file()};
metadata.setContentLayout(m_contentLayout);
m_session->findIncompleteFiles(metadata, m_savePath);
}
auto resumeDataPtr = std::make_shared<lt::entry>(lt::write_resume_data(m_ltAddTorrentParams));
lt::entry &resumeData = *resumeDataPtr;
// TODO: The following code is deprecated. Remove after several releases in 4.3.x.
// === BEGIN DEPRECATED CODE === //
const bool useDummyResumeData = !p;
const bool useDummyResumeData = !hasMetadata();
if (useDummyResumeData)
{
updateStatus();
@@ -1525,7 +1603,7 @@ void TorrentHandleImpl::handleSaveResumeDataAlert(const lt::save_resume_data_ale
resumeData["qBt-tags"] = setToEntryList(m_tags);
resumeData["qBt-name"] = m_name.toStdString();
resumeData["qBt-seedStatus"] = m_hasSeedStatus;
resumeData["qBt-hasRootFolder"] = m_hasRootFolder;
resumeData["qBt-contentLayout"] = Utils::String::fromEnum(m_contentLayout).toStdString();
resumeData["qBt-firstLastPiecePriority"] = m_hasFirstLastPiecePriority;
m_session->handleTorrentResumeDataReady(this, resumeDataPtr);
@@ -1534,11 +1612,7 @@ void TorrentHandleImpl::handleSaveResumeDataAlert(const lt::save_resume_data_ale
void TorrentHandleImpl::handleSaveResumeDataFailedAlert(const lt::save_resume_data_failed_alert *p)
{
Q_UNUSED(p);
// if torrent has no metadata libtorrent doesn't generate "fastresume" data
// so we should save dummy "fastresume" data containing the values used to
// load torrent and qBittorrent own resume data
handleSaveResumeDataAlert(nullptr);
Q_ASSERT_X(false, Q_FUNC_INFO, "This point should be unreachable since libtorrent 1.2.11");
}
void TorrentHandleImpl::handleFastResumeRejectedAlert(const lt::fastresume_rejected_alert *p)
@@ -1560,12 +1634,8 @@ void TorrentHandleImpl::handleFastResumeRejectedAlert(const lt::fastresume_rejec
void TorrentHandleImpl::handleFileRenamedAlert(const lt::file_renamed_alert *p)
{
// We don't really need to call updateStatus() in this place.
// All we need to do is make sure we have a valid instance of the TorrentInfo object.
m_torrentInfo = TorrentInfo {m_nativeHandle.torrent_file()};
// remove empty leftover folders
// for example renaming "a/b/c" to "d/b/c", then folders "a/b" and "a" will
// Remove empty leftover folders
// For example renaming "a/b/c" to "d/b/c", then folders "a/b" and "a" will
// be removed if they are empty
const QString oldFilePath = m_oldPath[p->index].takeFirst();
const QString newFilePath = Utils::Fs::toUniformPath(p->new_name());
@@ -1626,10 +1696,6 @@ void TorrentHandleImpl::handleFileRenameFailedAlert(const lt::file_rename_failed
void TorrentHandleImpl::handleFileCompletedAlert(const lt::file_completed_alert *p)
{
// We don't really need to call updateStatus() in this place.
// All we need to do is make sure we have a valid instance of the TorrentInfo object.
m_torrentInfo = TorrentInfo {m_nativeHandle.torrent_file()};
qDebug("A file completed download in torrent \"%s\"", qUtf8Printable(name()));
if (m_session->isAppendExtensionEnabled())
{
@@ -1647,20 +1713,11 @@ void TorrentHandleImpl::handleFileCompletedAlert(const lt::file_completed_alert
void TorrentHandleImpl::handleMetadataReceivedAlert(const lt::metadata_received_alert *p)
{
Q_UNUSED(p);
qDebug("Metadata received for torrent %s.", qUtf8Printable(name()));
updateStatus();
if (m_session->isAppendExtensionEnabled())
manageIncompleteFiles();
if (!m_hasRootFolder)
m_torrentInfo.stripRootFolder();
if (filesCount() == 1)
m_hasRootFolder = false;
m_session->handleTorrentMetadataReceived(this);
// If first/last piece priority was specified when adding this torrent,
// we should apply it now that we have metadata:
if (m_hasFirstLastPiecePriority)
applyFirstLastPiecePriority(true);
qDebug("Metadata received for torrent %s.", qUtf8Printable(name()));
m_maintenanceJob = MaintenanceJob::HandleMetadata;
saveResumeData();
}
void TorrentHandleImpl::handlePerformanceAlert(const lt::performance_alert *p) const
@@ -1814,13 +1871,6 @@ lt::torrent_handle TorrentHandleImpl::nativeHandle() const
return m_nativeHandle;
}
void TorrentHandleImpl::updateTorrentInfo()
{
if (!hasMetadata()) return;
m_torrentInfo = TorrentInfo(m_nativeStatus.torrent_file.lock());
}
bool TorrentHandleImpl::isMoveInProgress() const
{
return m_storageIsMoving;
@@ -1839,19 +1889,20 @@ void TorrentHandleImpl::updateStatus()
void TorrentHandleImpl::updateStatus(const lt::torrent_status &nativeStatus)
{
m_nativeStatus = nativeStatus;
updateState();
updateTorrentInfo();
// NOTE: Don't change the order of these conditionals!
// Otherwise it will not work properly since torrent can be CheckingDownloading.
if (isChecking())
m_unchecked = false;
else if (isDownloading())
m_unchecked = true;
m_speedMonitor.addSample({nativeStatus.download_payload_rate
, nativeStatus.upload_payload_rate});
, nativeStatus.upload_payload_rate});
if (hasMetadata())
{
// NOTE: Don't change the order of these conditionals!
// Otherwise it will not work properly since torrent can be CheckingDownloading.
if (isChecking())
m_unchecked = false;
else if (isDownloading())
m_unchecked = true;
}
}
void TorrentHandleImpl::setRatioLimit(qreal limit)
@@ -1924,7 +1975,7 @@ void TorrentHandleImpl::prioritizeFiles(const QVector<DownloadPriority> &priorit
if ((oldPriorities[i] == DownloadPriority::Ignored)
&& (priorities[i] > DownloadPriority::Ignored)
&& (progress[i] < 1.0))
{
{
m_hasSeedStatus = false;
break;
}

View File

@@ -62,12 +62,13 @@ namespace BitTorrent
QString category;
QSet<QString> tags;
QString savePath;
TorrentContentLayout contentLayout = TorrentContentLayout::Original;
bool firstLastPiecePriority = false;
bool hasSeedStatus = false;
bool hasRootFolder = true;
bool forced = false;
bool paused = false;
qreal ratioLimit = TorrentHandle::USE_GLOBAL_RATIO;
int seedingTimeLimit = TorrentHandle::USE_GLOBAL_SEEDING_TIME;
@@ -80,14 +81,20 @@ namespace BitTorrent
Overwrite
};
enum class MaintenanceJob
{
None,
HandleMetadata
};
class TorrentHandleImpl final : public QObject, public TorrentHandle
{
Q_DISABLE_COPY(TorrentHandleImpl)
Q_DECLARE_TR_FUNCTIONS(BitTorrent::TorrentHandleImpl)
public:
TorrentHandleImpl(Session *session, const lt::torrent_handle &nativeHandle,
const LoadTorrentParams &params);
TorrentHandleImpl(Session *session, lt::session *nativeSession
, const lt::torrent_handle &nativeHandle, const LoadTorrentParams &params);
~TorrentHandleImpl() override;
bool isValid() const;
@@ -123,8 +130,6 @@ namespace BitTorrent
bool removeTag(const QString &tag) override;
void removeAllTags() override;
bool hasRootFolder() const override;
int filesCount() const override;
int piecesCount() const override;
int piecesHave() const override;
@@ -241,6 +246,7 @@ namespace BitTorrent
void handleAppendExtensionToggled();
void saveResumeData();
void handleMoveStorageJobFinished(bool hasOutstandingJob);
void fileSearchFinished(const QString &savePath, const QStringList &fileNames);
QString actualStorageLocation() const;
@@ -250,7 +256,6 @@ namespace BitTorrent
void updateStatus();
void updateStatus(const lt::torrent_status &nativeStatus);
void updateState();
void updateTorrentInfo();
void handleFastResumeRejectedAlert(const lt::fastresume_rejected_alert *p);
void handleFileCompletedAlert(const lt::file_completed_alert *p);
@@ -279,7 +284,10 @@ namespace BitTorrent
void manageIncompleteFiles();
void applyFirstLastPiecePriority(bool enabled, const QVector<DownloadPriority> &updatedFilePrio = {});
void endReceivedMetadataHandling(const QString &savePath, const QStringList &fileNames);
Session *const m_session;
lt::session *m_nativeSession;
lt::torrent_handle m_nativeHandle;
lt::torrent_status m_nativeStatus;
TorrentState m_state = TorrentState::Unknown;
@@ -294,6 +302,8 @@ namespace BitTorrent
int m_renameCount = 0;
bool m_storageIsMoving = false;
MaintenanceJob m_maintenanceJob = MaintenanceJob::None;
// Until libtorrent provide an "old_name" field in `file_renamed_alert`
// we will rely on this workaround to remove empty leftover folders
QHash<lt::file_index_t, QVector<QString>> m_oldPath;
@@ -308,10 +318,10 @@ namespace BitTorrent
qreal m_ratioLimit;
int m_seedingTimeLimit;
TorrentOperatingMode m_operatingMode;
TorrentContentLayout m_contentLayout;
bool m_hasSeedStatus;
bool m_fastresumeDataRejected = false;
bool m_hasMissingFiles = false;
bool m_hasRootFolder;
bool m_hasFirstLastPiecePriority = false;
bool m_useAutoTMM;
bool m_isStopped;

View File

@@ -40,6 +40,7 @@
#include <QString>
#include <QStringList>
#include <QUrl>
#include <QVector>
#include "base/exceptions.h"
#include "base/global.h"
@@ -51,6 +52,29 @@
using namespace BitTorrent;
namespace
{
QString getRootFolder(const QStringList &filePaths)
{
QString rootFolder;
for (const QString &filePath : filePaths)
{
if (QDir::isAbsolutePath(filePath)) continue;
const auto filePathElements = filePath.splitRef('/');
// if at least one file has no root folder, no common root folder exists
if (filePathElements.count() <= 1) return {};
if (rootFolder.isEmpty())
rootFolder = filePathElements.at(0).toString();
else if (rootFolder != filePathElements.at(0))
return {};
}
return rootFolder;
}
}
TorrentInfo::TorrentInfo(std::shared_ptr<const lt::torrent_info> nativeInfo)
{
m_nativeInfo = std::const_pointer_cast<lt::torrent_info>(nativeInfo);
@@ -169,7 +193,7 @@ InfoHash TorrentInfo::hash() const
QString TorrentInfo::name() const
{
if (!isValid()) return {};
return QString::fromStdString(m_nativeInfo->name());
return QString::fromStdString(m_nativeInfo->orig_files().name());
}
QDateTime TorrentInfo::creationDate() const
@@ -411,23 +435,7 @@ int TorrentInfo::fileIndex(const QString &fileName) const
QString TorrentInfo::rootFolder() const
{
QString rootFolder;
for (int i = 0; i < filesCount(); ++i)
{
const QString filePath = this->filePath(i);
if (QDir::isAbsolutePath(filePath)) continue;
const auto filePathElements = filePath.splitRef('/');
// if at least one file has no root folder, no common root folder exists
if (filePathElements.count() <= 1) return "";
if (rootFolder.isEmpty())
rootFolder = filePathElements.at(0).toString();
else if (rootFolder != filePathElements.at(0))
return "";
}
return rootFolder;
return getRootFolder(filePaths());
}
bool TorrentInfo::hasRootFolder() const
@@ -435,10 +443,26 @@ bool TorrentInfo::hasRootFolder() const
return !rootFolder().isEmpty();
}
void TorrentInfo::setContentLayout(const TorrentContentLayout layout)
{
switch (layout)
{
case TorrentContentLayout::Original:
setContentLayout(defaultContentLayout());
break;
case TorrentContentLayout::Subfolder:
if (rootFolder().isEmpty())
addRootFolder();
break;
case TorrentContentLayout::NoSubfolder:
if (!rootFolder().isEmpty())
stripRootFolder();
break;
}
}
void TorrentInfo::stripRootFolder()
{
if (!hasRootFolder()) return;
lt::file_storage files = m_nativeInfo->files();
// Solution for case of renamed root folder
@@ -455,6 +479,32 @@ void TorrentInfo::stripRootFolder()
m_nativeInfo->remap_files(files);
}
void TorrentInfo::addRootFolder()
{
const QString rootFolder = name();
Q_ASSERT(!rootFolder.isEmpty());
const std::string rootPrefix = Utils::Fs::toNativePath(rootFolder + QLatin1Char {'/'}).toStdString();
lt::file_storage files = m_nativeInfo->files();
files.set_name(rootFolder.toStdString());
for (int i = 0; i < files.num_files(); ++i)
files.rename_file(lt::file_index_t {i}, rootPrefix + files.file_path(lt::file_index_t {i}));
m_nativeInfo->remap_files(files);
}
TorrentContentLayout TorrentInfo::defaultContentLayout() const
{
QStringList origFilePaths;
origFilePaths.reserve(filesCount());
for (int i = 0; i < filesCount(); ++i)
origFilePaths << origFilePath(i);
const QString origRootFolder = getRootFolder(origFilePaths);
return (origRootFolder.isEmpty()
? TorrentContentLayout::NoSubfolder
: TorrentContentLayout::Subfolder);
}
std::shared_ptr<lt::torrent_info> TorrentInfo::nativeInfo() const
{
return m_nativeInfo;

View File

@@ -26,20 +26,19 @@
* exception statement from your version.
*/
#ifndef BITTORRENT_TORRENTINFO_H
#define BITTORRENT_TORRENTINFO_H
#pragma once
#include <libtorrent/torrent_info.hpp>
#include <QCoreApplication>
#include <QVector>
#include <QtContainerFwd>
#include "base/indexrange.h"
#include "torrentcontentlayout.h"
class QByteArray;
class QDateTime;
class QString;
class QStringList;
class QUrl;
namespace BitTorrent
@@ -96,15 +95,17 @@ namespace BitTorrent
QString rootFolder() const;
bool hasRootFolder() const;
void stripRootFolder();
void setContentLayout(TorrentContentLayout layout);
std::shared_ptr<lt::torrent_info> nativeInfo() const;
private:
// returns file index or -1 if fileName is not found
int fileIndex(const QString &fileName) const;
void stripRootFolder();
void addRootFolder();
TorrentContentLayout defaultContentLayout() const;
std::shared_ptr<lt::torrent_info> m_nativeInfo;
};
}
#endif // BITTORRENT_TORRENTINFO_H

View File

@@ -28,8 +28,7 @@
* exception statement from your version.
*/
#ifndef BITTORRENT_TRACKER_H
#define BITTORRENT_TRACKER_H
#pragma once
#include <string>
@@ -106,5 +105,3 @@ namespace BitTorrent
QHash<InfoHash, TorrentStats> m_torrents;
};
}
#endif // BITTORRENT_TRACKER_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef BITTORRENT_TRACKERENTRY_H
#define BITTORRENT_TRACKERENTRY_H
#pragma once
#include <libtorrent/announce_entry.hpp>
@@ -73,5 +72,3 @@ namespace BitTorrent
bool operator==(const TrackerEntry &left, const TrackerEntry &right);
uint qHash(const TrackerEntry &key, uint seed);
}
#endif // BITTORRENT_TRACKERENTRY_H

View File

@@ -26,17 +26,15 @@
* exception statement from your version.
*/
#ifndef FILESYSTEMWATCHER_H
#define FILESYSTEMWATCHER_H
#pragma once
#include <QDir>
#include <QFileSystemWatcher>
#include <QHash>
#include <QtContainerFwd>
#include <QTimer>
#include <QVector>
class QStringList;
/*
* Subclassing QFileSystemWatcher in order to support Network File
* System watching (NFS, CIFS) on Linux and Mac OS.
@@ -70,5 +68,3 @@ private:
QVector<QDir> m_watchedFolders;
QTimer m_watchTimer;
};
#endif // FILESYSTEMWATCHER_H

View File

@@ -28,8 +28,7 @@
*/
#ifndef HTTP_CONNECTION_H
#define HTTP_CONNECTION_H
#pragma once
#include <QElapsedTimer>
#include <QObject>
@@ -66,5 +65,3 @@ namespace Http
QElapsedTimer m_idleTimer;
};
}
#endif // HTTP_CONNECTION_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef HTTP_IREQUESTHANDLER_H
#define HTTP_IREQUESTHANDLER_H
#pragma once
namespace Http
{
@@ -42,5 +41,3 @@ namespace Http
virtual Response processRequest(const Request &request, const Environment &env) = 0;
};
}
#endif // HTTP_IREQUESTHANDLER_H

View File

@@ -28,8 +28,7 @@
* exception statement from your version.
*/
#ifndef HTTP_REQUESTPARSER_H
#define HTTP_REQUESTPARSER_H
#pragma once
#include "types.h"
@@ -70,5 +69,3 @@ namespace Http
Request m_request;
};
}
#endif // HTTP_REQUESTPARSER_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef HTTP_RESPONSEBUILDER_H
#define HTTP_RESPONSEBUILDER_H
#pragma once
#include "types.h"
@@ -50,5 +49,3 @@ namespace Http
Response m_response;
};
}
#endif // HTTP_RESPONSEBUILDER_H

View File

@@ -28,8 +28,7 @@
*/
#ifndef HTTP_RESPONSEGENERATOR_H
#define HTTP_RESPONSEGENERATOR_H
#pragma once
class QByteArray;
class QString;
@@ -42,5 +41,3 @@ namespace Http
QString httpDate();
void compressContent(Response &response);
}
#endif // HTTP_RESPONSEGENERATOR_H

View File

@@ -28,8 +28,7 @@
*/
#ifndef HTTP_SERVER_H
#define HTTP_SERVER_H
#pragma once
#include <QSet>
#include <QSslCertificate>
@@ -67,5 +66,3 @@ namespace Http
QSslKey m_key;
};
}
#endif // HTTP_SERVER_H

View File

@@ -27,8 +27,7 @@
* exception statement from your version.
*/
#ifndef HTTP_TYPES_H
#define HTTP_TYPES_H
#pragma once
#include <QHostAddress>
#include <QString>
@@ -127,5 +126,3 @@ namespace Http
}
};
}
#endif // HTTP_TYPES_H

View File

@@ -27,8 +27,7 @@
* exception statement from your version.
*/
#ifndef ICONPROVIDER_H
#define ICONPROVIDER_H
#pragma once
#include <QObject>
@@ -51,5 +50,3 @@ protected:
static IconProvider *m_instance;
};
#endif // ICONPROVIDER_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef QBT_INDEXRANGE_H
#define QBT_INDEXRANGE_H
#pragma once
#include <QtGlobal>
@@ -169,5 +168,3 @@ private:
IndexType m_first;
IndexDiffType m_size;
};
#endif // QBT_INDEXRANGE_H

View File

@@ -31,6 +31,7 @@
#include <algorithm>
#include <QDateTime>
#include <QVector>
namespace
{

View File

@@ -26,15 +26,14 @@
* exception statement from your version.
*/
#ifndef LOGGER_H
#define LOGGER_H
#pragma once
#include <boost/circular_buffer.hpp>
#include <QObject>
#include <QReadWriteLock>
#include <QString>
#include <QVector>
#include <QtContainerFwd>
const int MAX_LOG_MESSAGES = 20000;
@@ -103,5 +102,3 @@ private:
// Helper function
void LogMsg(const QString &message, const Log::MsgType &type = Log::NORMAL);
#endif // LOGGER_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef DNSUPDATER_H
#define DNSUPDATER_H
#pragma once
#include <QDateTime>
#include <QHostAddress>
@@ -84,5 +83,3 @@ namespace Net
QString m_password;
};
}
#endif // DNSUPDATER_H

View File

@@ -27,8 +27,7 @@
* exception statement from your version.
*/
#ifndef NET_DOWNLOADMANAGER_H
#define NET_DOWNLOADMANAGER_H
#pragma once
#include <QHash>
#include <QNetworkAccessManager>
@@ -159,5 +158,3 @@ namespace Net
connect(handler, &DownloadHandler::finished, context, slot);
}
}
#endif // NET_DOWNLOADMANAGER_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef GEOIPDATABASE_H
#define GEOIPDATABASE_H
#pragma once
#include <QCoreApplication>
#include <QtGlobal>
@@ -100,5 +99,3 @@ private:
quint32 m_size;
uchar *m_data;
};
#endif // GEOIPDATABASE_H

View File

@@ -27,8 +27,7 @@
* exception statement from your version.
*/
#ifndef NET_GEOIPMANAGER_H
#define NET_GEOIPMANAGER_H
#pragma once
#include <QObject>
@@ -73,5 +72,3 @@ namespace Net
static GeoIPManager *m_instance;
};
}
#endif // NET_GEOIPMANAGER_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef NET_PORTFORWARDER_H
#define NET_PORTFORWARDER_H
#pragma once
#include <QObject>
@@ -53,5 +52,3 @@ namespace Net
static PortForwarder *m_instance;
};
}
#endif // NET_PORTFORWARDER_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef NET_PROXYCONFIGURATIONMANAGER_H
#define NET_PROXYCONFIGURATIONMANAGER_H
#pragma once
#include <QObject>
@@ -85,5 +84,3 @@ namespace Net
bool m_isProxyOnlyForTorrents;
};
}
#endif // NET_PROXYCONFIGURATIONMANAGER_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef NET_REVERSERESOLUTION_H
#define NET_REVERSERESOLUTION_H
#pragma once
#include <QCache>
#include <QObject>
@@ -60,5 +59,3 @@ namespace Net
QCache<QHostAddress, QString> m_cache; // <IP, HostName>
};
}
#endif // NET_REVERSERESOLUTION_H

View File

@@ -30,8 +30,7 @@
* This code is based on QxtSmtp from libqxt (http://libqxt.org)
*/
#ifndef SMTP_H
#define SMTP_H
#pragma once
#include <QAbstractSocket>
#include <QByteArray>
@@ -119,5 +118,3 @@ namespace Net
QString m_password;
};
}
#endif // SMTP_H

View File

@@ -41,6 +41,7 @@
#include <QCoreApplication>
#include <QDateTime>
#include <QDir>
#include <QList>
#include <QLocale>
#include <QNetworkCookie>
#include <QSettings>

View File

@@ -27,19 +27,17 @@
* exception statement from your version.
*/
#ifndef PREFERENCES_H
#define PREFERENCES_H
#pragma once
#include <QList>
#include <QtContainerFwd>
#include <QVariant>
#include "base/utils/net.h"
class QDateTime;
class QNetworkCookie;
class QSize;
class QStringList;
class QTime;
class QVariant;
enum SchedulerDays
{
@@ -404,5 +402,3 @@ public slots:
void apply();
};
#endif // PREFERENCES_H

View File

@@ -27,8 +27,7 @@
* exception statement from your version.
*/
#ifndef QBT_PROFILE_H
#define QBT_PROFILE_H
#pragma once
#include <memory>
@@ -82,5 +81,3 @@ private:
};
QString specialFolderLocation(SpecialFolder folder);
#endif // QBT_PROFILE_H

View File

@@ -27,8 +27,7 @@
* exception statement from your version.
*/
#ifndef QBT_PROFILE_P_H
#define QBT_PROFILE_P_H
#pragma once
#include <QDir>
#include <QStandardPaths>
@@ -132,5 +131,3 @@ namespace Private
QDir m_baseDir;
};
}
#endif // QBT_PROFILE_P_H

View File

@@ -396,7 +396,7 @@ void AutoDownloader::processJob(const QSharedPointer<ProcessingJob> &job)
params.savePath = rule.savePath();
params.category = rule.assignedCategory();
params.addPaused = rule.addPaused();
params.createSubfolder = rule.createSubfolder();
params.contentLayout = rule.torrentContentLayout();
if (!rule.savePath().isEmpty())
params.useAutoTMM = TriStateBool::False;
const auto torrentURL = job->articleData.value(Article::KeyTorrentURL).toString();

View File

@@ -40,11 +40,11 @@
#include <QString>
#include <QStringList>
#include "../global.h"
#include "../preferences.h"
#include "../tristatebool.h"
#include "../utils/fs.h"
#include "../utils/string.h"
#include "base/global.h"
#include "base/preferences.h"
#include "base/tristatebool.h"
#include "base/utils/fs.h"
#include "base/utils/string.h"
#include "rss_article.h"
#include "rss_autodownloader.h"
#include "rss_feed.h"
@@ -91,6 +91,21 @@ namespace
default: return 0; // default
}
}
boost::optional<BitTorrent::TorrentContentLayout> jsonValueToContentLayout(const QJsonValue &jsonVal)
{
const QString str = jsonVal.toString();
if (str.isEmpty())
return {};
return Utils::String::toEnum(str, BitTorrent::TorrentContentLayout::Original);
}
QJsonValue contentLayoutToJsonValue(const boost::optional<BitTorrent::TorrentContentLayout> contentLayout)
{
if (!contentLayout)
return {};
return Utils::String::fromEnum(*contentLayout);
}
}
const QString Str_Name(QStringLiteral("name"));
@@ -106,6 +121,7 @@ const QString Str_LastMatch(QStringLiteral("lastMatch"));
const QString Str_IgnoreDays(QStringLiteral("ignoreDays"));
const QString Str_AddPaused(QStringLiteral("addPaused"));
const QString Str_CreateSubfolder(QStringLiteral("createSubfolder"));
const QString Str_ContentLayout(QStringLiteral("torrentContentLayout"));
const QString Str_SmartFilter(QStringLiteral("smartFilter"));
const QString Str_PreviouslyMatched(QStringLiteral("previouslyMatchedEpisodes"));
@@ -127,7 +143,7 @@ namespace RSS
QString savePath;
QString category;
TriStateBool addPaused = TriStateBool::Undefined;
TriStateBool createSubfolder = TriStateBool::Undefined;
boost::optional<BitTorrent::TorrentContentLayout> contentLayout;
bool smartFilter = false;
QStringList previouslyMatchedEpisodes;
@@ -149,7 +165,7 @@ namespace RSS
&& (savePath == other.savePath)
&& (category == other.category)
&& (addPaused == other.addPaused)
&& (createSubfolder == other.createSubfolder)
&& (contentLayout == other.contentLayout)
&& (smartFilter == other.smartFilter);
}
};
@@ -462,7 +478,7 @@ QJsonObject AutoDownloadRule::toJsonObject() const
, {Str_LastMatch, lastMatch().toString(Qt::RFC2822Date)}
, {Str_IgnoreDays, ignoreDays()}
, {Str_AddPaused, triStateBoolToJsonValue(addPaused())}
, {Str_CreateSubfolder, triStateBoolToJsonValue(createSubfolder())}
, {Str_ContentLayout, contentLayoutToJsonValue(torrentContentLayout())}
, {Str_SmartFilter, useSmartFilter()}
, {Str_PreviouslyMatched, QJsonArray::fromStringList(previouslyMatchedEpisodes())}};
}
@@ -479,7 +495,29 @@ AutoDownloadRule AutoDownloadRule::fromJsonObject(const QJsonObject &jsonObj, co
rule.setSavePath(jsonObj.value(Str_SavePath).toString());
rule.setCategory(jsonObj.value(Str_AssignedCategory).toString());
rule.setAddPaused(jsonValueToTriStateBool(jsonObj.value(Str_AddPaused)));
rule.setCreateSubfolder(jsonValueToTriStateBool(jsonObj.value(Str_CreateSubfolder)));
// TODO: The following code is deprecated. Replace with the commented one after several releases in 4.4.x.
// === BEGIN DEPRECATED CODE === //
if (jsonObj.contains(Str_ContentLayout))
{
rule.setTorrentContentLayout(jsonValueToContentLayout(jsonObj.value(Str_ContentLayout)));
}
else
{
const TriStateBool createSubfolder = jsonValueToTriStateBool(jsonObj.value(Str_CreateSubfolder));
boost::optional<BitTorrent::TorrentContentLayout> contentLayout;
if (createSubfolder == TriStateBool::True)
contentLayout = BitTorrent::TorrentContentLayout::Original;
else if (createSubfolder == TriStateBool::False)
contentLayout = BitTorrent::TorrentContentLayout::NoSubfolder;
rule.setTorrentContentLayout(contentLayout);
}
// === END DEPRECATED CODE === //
// === BEGIN REPLACEMENT CODE === //
// rule.setTorrentContentLayout(jsonValueToContentLayout(jsonObj.value(Str_ContentLayout)));
// === END REPLACEMENT CODE === //
rule.setLastMatch(QDateTime::fromString(jsonObj.value(Str_LastMatch).toString(), Qt::RFC2822Date));
rule.setIgnoreDays(jsonObj.value(Str_IgnoreDays).toInt());
rule.setUseSmartFilter(jsonObj.value(Str_SmartFilter).toBool(false));
@@ -611,14 +649,14 @@ void AutoDownloadRule::setAddPaused(const TriStateBool addPaused)
m_dataPtr->addPaused = addPaused;
}
TriStateBool AutoDownloadRule::createSubfolder() const
boost::optional<BitTorrent::TorrentContentLayout> AutoDownloadRule::torrentContentLayout() const
{
return m_dataPtr->createSubfolder;
return m_dataPtr->contentLayout;
}
void AutoDownloadRule::setCreateSubfolder(const TriStateBool createSubfolder)
void AutoDownloadRule::setTorrentContentLayout(const boost::optional<BitTorrent::TorrentContentLayout> contentLayout)
{
m_dataPtr->createSubfolder = createSubfolder;
m_dataPtr->contentLayout = contentLayout;
}
QString AutoDownloadRule::assignedCategory() const

View File

@@ -29,9 +29,13 @@
#pragma once
#include <boost/optional.hpp>
#include <QSharedDataPointer>
#include <QVariant>
#include "base/bittorrent/torrentcontentlayout.h"
class QDateTime;
class QJsonObject;
class QRegularExpression;
@@ -79,8 +83,8 @@ namespace RSS
void setSavePath(const QString &savePath);
TriStateBool addPaused() const;
void setAddPaused(TriStateBool addPaused);
TriStateBool createSubfolder() const;
void setCreateSubfolder(TriStateBool createSubfolder);
boost::optional<BitTorrent::TorrentContentLayout> torrentContentLayout() const;
void setTorrentContentLayout(boost::optional<BitTorrent::TorrentContentLayout> contentLayout);
QString assignedCategory() const;
void setCategory(const QString &category);

View File

@@ -26,13 +26,11 @@
* exception statement from your version.
*/
#ifndef SCANFOLDERSMODEL_H
#define SCANFOLDERSMODEL_H
#pragma once
#include <QAbstractListModel>
#include <QList>
class QStringList;
#include <QtContainerFwd>
class FileSystemWatcher;
@@ -111,5 +109,3 @@ private:
QList<PathData*> m_pathList;
FileSystemWatcher *m_fsWatcher;
};
#endif // SCANFOLDERSMODEL_H

View File

@@ -31,6 +31,7 @@
#include <QProcess>
#include <QTimer>
#include <QVector>
#include "base/global.h"
#include "base/utils/foreignapps.h"

View File

@@ -33,7 +33,7 @@
#include <QList>
#include <QObject>
#include <QString>
#include <QVector>
#include <QtContainerFwd>
class QProcess;
class QTimer;

View File

@@ -27,8 +27,7 @@
* exception statement from your version.
*/
#ifndef SETTINGSSTORAGE_H
#define SETTINGSSTORAGE_H
#pragma once
#include <QObject>
#include <QReadWriteLock>
@@ -61,5 +60,3 @@ private:
QTimer m_timer;
mutable QReadWriteLock m_lock;
};
#endif // SETTINGSSTORAGE_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef SETTINGVALUE_H
#define SETTINGVALUE_H
#pragma once
#include <type_traits>
@@ -35,6 +34,7 @@
#include <QString>
#include "settingsstorage.h"
#include "utils/string.h"
template <typename T>
class CachedSettingValue
@@ -78,13 +78,13 @@ public:
private:
// regular load/save pair
template <typename U, typename std::enable_if<!std::is_enum<U>::value, int>::type = 0>
template <typename U, typename std::enable_if_t<!std::is_enum<U>::value, int> = 0>
U loadValue(const U &defaultValue)
{
return SettingsStorage::instance()->loadValue(m_keyName, defaultValue).template value<T>();
}
template <typename U, typename std::enable_if<!std::is_enum<U>::value, int>::type = 0>
template <typename U, typename std::enable_if_t<!std::is_enum<U>::value, int> = 0>
void storeValue(const U &value)
{
SettingsStorage::instance()->storeValue(m_keyName, value);
@@ -92,27 +92,18 @@ private:
// load/save pair for an enum
// saves literal value of the enum constant, obtained from QMetaEnum
template <typename U, typename std::enable_if<std::is_enum<U>::value, int>::type = 0>
template <typename U, typename std::enable_if_t<std::is_enum<U>::value, int> = 0>
U loadValue(const U &defaultValue)
{
static_assert(std::is_same<int, typename std::underlying_type<U>::type>::value,
"Enumeration underlying type has to be int");
bool ok = false;
const U res = static_cast<U>(QMetaEnum::fromType<U>().keyToValue(
SettingsStorage::instance()->loadValue(m_keyName).toString().toLatin1().constData(), &ok));
return ok ? res : defaultValue;
return Utils::String::toEnum(SettingsStorage::instance()->loadValue(m_keyName).toString(), defaultValue);
}
template <typename U, typename std::enable_if<std::is_enum<U>::value, int>::type = 0>
template <typename U, typename std::enable_if_t<std::is_enum<U>::value, int> = 0>
void storeValue(const U &value)
{
SettingsStorage::instance()->storeValue(m_keyName,
QString::fromLatin1(QMetaEnum::fromType<U>().valueToKey(static_cast<int>(value))));
SettingsStorage::instance()->storeValue(m_keyName, Utils::String::fromEnum(value));
}
const QString m_keyName;
T m_value;
};
#endif // SETTINGVALUE_H

View File

@@ -32,7 +32,7 @@
#include "bittorrent/torrenthandle.h"
const QString TorrentFilter::AnyCategory;
const QStringSet TorrentFilter::AnyHash = (QStringSet() << QString());
const InfoHashSet TorrentFilter::AnyHash {{}};
const QString TorrentFilter::AnyTag;
const TorrentFilter TorrentFilter::DownloadingTorrent(TorrentFilter::Downloading);
@@ -49,12 +49,7 @@ const TorrentFilter TorrentFilter::ErroredTorrent(TorrentFilter::Errored);
using BitTorrent::TorrentHandle;
TorrentFilter::TorrentFilter()
: m_type(All)
{
}
TorrentFilter::TorrentFilter(const Type type, const QStringSet &hashSet, const QString &category, const QString &tag)
TorrentFilter::TorrentFilter(const Type type, const InfoHashSet &hashSet, const QString &category, const QString &tag)
: m_type(type)
, m_category(category)
, m_tag(tag)
@@ -62,7 +57,7 @@ TorrentFilter::TorrentFilter(const Type type, const QStringSet &hashSet, const Q
{
}
TorrentFilter::TorrentFilter(const QString &filter, const QStringSet &hashSet, const QString &category, const QString &tag)
TorrentFilter::TorrentFilter(const QString &filter, const InfoHashSet &hashSet, const QString &category, const QString &tag)
: m_type(All)
, m_category(category)
, m_tag(tag)
@@ -112,7 +107,7 @@ bool TorrentFilter::setTypeByName(const QString &filter)
return setType(type);
}
bool TorrentFilter::setHashSet(const QStringSet &hashSet)
bool TorrentFilter::setHashSet(const InfoHashSet &hashSet)
{
if (m_hashSet != hashSet)
{

View File

@@ -26,19 +26,20 @@
* exception statement from your version.
*/
#ifndef TORRENTFILTER_H
#define TORRENTFILTER_H
#pragma once
#include <QSet>
#include <QString>
typedef QSet<QString> QStringSet;
#include "base/bittorrent/infohash.h"
namespace BitTorrent
{
class TorrentHandle;
}
using InfoHashSet = QSet<BitTorrent::InfoHash>;
class TorrentFilter
{
public:
@@ -60,7 +61,7 @@ public:
// These mean any permutation, including no category / tag.
static const QString AnyCategory;
static const QStringSet AnyHash;
static const InfoHashSet AnyHash;
static const QString AnyTag;
static const TorrentFilter DownloadingTorrent;
@@ -75,15 +76,15 @@ public:
static const TorrentFilter StalledDownloadingTorrent;
static const TorrentFilter ErroredTorrent;
TorrentFilter();
TorrentFilter() = default;
// category & tags: pass empty string for uncategorized / untagged torrents.
// Pass null string (QString()) to disable filtering (i.e. all torrents).
TorrentFilter(Type type, const QStringSet &hashSet = AnyHash, const QString &category = AnyCategory, const QString &tag = AnyTag);
TorrentFilter(const QString &filter, const QStringSet &hashSet = AnyHash, const QString &category = AnyCategory, const QString &tags = AnyTag);
TorrentFilter(Type type, const InfoHashSet &hashSet = AnyHash, const QString &category = AnyCategory, const QString &tag = AnyTag);
TorrentFilter(const QString &filter, const InfoHashSet &hashSet = AnyHash, const QString &category = AnyCategory, const QString &tags = AnyTag);
bool setType(Type type);
bool setTypeByName(const QString &filter);
bool setHashSet(const QStringSet &hashSet);
bool setHashSet(const InfoHashSet &hashSet);
bool setCategory(const QString &category);
bool setTag(const QString &tag);
@@ -95,10 +96,8 @@ private:
bool matchCategory(const BitTorrent::TorrentHandle *torrent) const;
bool matchTag(const BitTorrent::TorrentHandle *torrent) const;
Type m_type;
Type m_type {All};
QString m_category;
QString m_tag;
QStringSet m_hashSet;
InfoHashSet m_hashSet;
};
#endif // TORRENTFILTER_H

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef TRISTATEBOOL_H
#define TRISTATEBOOL_H
#pragma once
class TriStateBool
{
@@ -68,5 +67,3 @@ constexpr bool operator!=(const TriStateBool &left, const TriStateBool &right)
{
return !(left == right);
}
#endif // TRISTATEBOOL_H

View File

@@ -26,10 +26,9 @@
* exception statement from your version.
*/
#ifndef TYPES_H
#define TYPES_H
#pragma once
#include <QMap>
#include <QtContainerFwd>
const qlonglong MAX_ETA = 8640000;
@@ -42,5 +41,3 @@ enum class ShutdownDialogAction
};
typedef QMap<QString, QString> QStringMap;
#endif // TYPES_H

View File

@@ -29,6 +29,7 @@
#include "bytearray.h"
#include <QByteArray>
#include <QVector>
QVector<QByteArray> Utils::ByteArray::splitToViews(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior)
{

View File

@@ -29,7 +29,7 @@
#pragma once
#include <QString>
#include <QVector>
#include <QtContainerFwd>
class QByteArray;

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef UTILS_FS_H
#define UTILS_FS_H
#pragma once
/**
* Utility functions related to file system.
@@ -79,5 +78,3 @@ namespace Utils
#endif
}
}
#endif // UTILS_FS_H

View File

@@ -27,8 +27,7 @@
* exception statement from your version.
*/
#ifndef UTILS_GZIP_H
#define UTILS_GZIP_H
#pragma once
class QByteArray;
@@ -40,5 +39,3 @@ namespace Utils
QByteArray decompress(const QByteArray &data, bool *ok = nullptr);
}
}
#endif // UTILS_GZIP_H

View File

@@ -52,6 +52,7 @@
#include <QRegularExpression>
#include <QSet>
#include <QSysInfo>
#include <QVector>
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
#include <QDBusInterface>

View File

@@ -26,8 +26,7 @@
* exception statement from your version.
*/
#ifndef UTILS_MISC_H
#define UTILS_MISC_H
#pragma once
#include <QtGlobal>
@@ -108,5 +107,3 @@ namespace Utils
#endif // Q_OS_WIN
}
}
#endif // UTILS_MISC_H

View File

@@ -28,10 +28,13 @@
#include "net.h"
#include <QList>
#include <QNetworkInterface>
#include <QPair>
#include <QSslCertificate>
#include <QSslKey>
#include <QString>
#include <QVector>
namespace Utils
{

View File

@@ -26,13 +26,10 @@
* exception statement from your version.
*/
#ifndef BASE_UTILS_NET_H
#define BASE_UTILS_NET_H
#pragma once
#include <QHostAddress>
#include <QList>
#include <QPair>
#include <QVector>
#include <QtContainerFwd>
class QSslCertificate;
class QSslKey;
@@ -59,5 +56,3 @@ namespace Utils
bool isSSLKeyValid(const QByteArray &data);
}
}
#endif // BASE_UTILS_NET_H

View File

@@ -34,6 +34,7 @@
#include <QByteArray>
#include <QString>
#include <QVector>
#include "bytearray.h"
#include "random.h"

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