mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-25 09:48:04 -06:00
Compare commits
692 Commits
release-4.
...
release-4.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b501904cf | ||
|
|
ea986a1f1b | ||
|
|
b924357ea9 | ||
|
|
b823d74ac3 | ||
|
|
d1e2019cd7 | ||
|
|
70573eba2c | ||
|
|
cf46653333 | ||
|
|
8d3fcbd897 | ||
|
|
1900538315 | ||
|
|
a9feae6110 | ||
|
|
8d822f2cb4 | ||
|
|
c12e486f59 | ||
|
|
d0d0bed333 | ||
|
|
8799321312 | ||
|
|
00d2997971 | ||
|
|
69f7f233fd | ||
|
|
793e8643bf | ||
|
|
521ef8e28f | ||
|
|
7433d85418 | ||
|
|
ba1cf12817 | ||
|
|
7dc7b95bfd | ||
|
|
59352e4ca7 | ||
|
|
011d026d76 | ||
|
|
89a8184ad2 | ||
|
|
a23e10dff5 | ||
|
|
535603fac4 | ||
|
|
fb6282da57 | ||
|
|
23766cd01d | ||
|
|
44b2afb218 | ||
|
|
9e82e59fc8 | ||
|
|
e006538514 | ||
|
|
fad5dfa4f4 | ||
|
|
b737ee0240 | ||
|
|
9d9f774dad | ||
|
|
526ee9c9db | ||
|
|
671eff324d | ||
|
|
a93cf04aca | ||
|
|
e93a67e644 | ||
|
|
b29a52dfa8 | ||
|
|
4ed99ba851 | ||
|
|
3e92e716b2 | ||
|
|
c6c8f6563d | ||
|
|
138c911ef4 | ||
|
|
e5fe6401a0 | ||
|
|
bed643e627 | ||
|
|
4ac25a50ed | ||
|
|
d9cf189ef6 | ||
|
|
6e19878973 | ||
|
|
9f9c4d6ed0 | ||
|
|
567848e94f | ||
|
|
221cbcc1ac | ||
|
|
dc2086dab4 | ||
|
|
7be2a03c86 | ||
|
|
e87f8f5b93 | ||
|
|
11a063ea66 | ||
|
|
1d26f4c5f7 | ||
|
|
8a09558ed8 | ||
|
|
60b1e692b9 | ||
|
|
0a1865d0dd | ||
|
|
3d94c70c48 | ||
|
|
7d7f967d5e | ||
|
|
ce554e6c77 | ||
|
|
5d151cca9d | ||
|
|
e47d90b5a6 | ||
|
|
e4730191db | ||
|
|
49aab492e0 | ||
|
|
2d4d246268 | ||
|
|
09e558ae0b | ||
|
|
a3fd6633c4 | ||
|
|
1eb246c98b | ||
|
|
96e0c0df20 | ||
|
|
aa8f420681 | ||
|
|
7974b5a95c | ||
|
|
ed4570cb4d | ||
|
|
01d851440b | ||
|
|
e5943b64c1 | ||
|
|
933e56494c | ||
|
|
140e73be4e | ||
|
|
960b9b855f | ||
|
|
1e1d55b26d | ||
|
|
925bf7715c | ||
|
|
399d3ad85a | ||
|
|
d923c03d52 | ||
|
|
699b91ab8d | ||
|
|
abd6eb2ff3 | ||
|
|
32f29e72c6 | ||
|
|
e76bac4131 | ||
|
|
8b94642ab1 | ||
|
|
d3497148c5 | ||
|
|
27baa55443 | ||
|
|
fd3d4d479a | ||
|
|
4b0a2d050a | ||
|
|
d85c14864b | ||
|
|
ee696e6f36 | ||
|
|
6ccbd8472c | ||
|
|
8ec26e9ea9 | ||
|
|
45e31a153c | ||
|
|
7c23d800e6 | ||
|
|
4dbf6af733 | ||
|
|
bdc03b1c75 | ||
|
|
9bfc74a1bc | ||
|
|
5d03917877 | ||
|
|
d2f975a0f3 | ||
|
|
eedd47860a | ||
|
|
6e59248ea6 | ||
|
|
365554d064 | ||
|
|
70d1cb86fd | ||
|
|
ccb7c0d579 | ||
|
|
fd9941e2d8 | ||
|
|
2f89563fca | ||
|
|
261f601bd5 | ||
|
|
5157e4965a | ||
|
|
3ffd25f9e1 | ||
|
|
665ab34f25 | ||
|
|
37f227ae74 | ||
|
|
f6eb29d800 | ||
|
|
f5315d9ba7 | ||
|
|
124cc9621d | ||
|
|
3faa7226e7 | ||
|
|
6070b41c9b | ||
|
|
50ddfea617 | ||
|
|
e74ad86f14 | ||
|
|
2bd2490539 | ||
|
|
5c0378a684 | ||
|
|
2bd5aca3a4 | ||
|
|
ccb59fbad3 | ||
|
|
6c66d02aff | ||
|
|
9f03598259 | ||
|
|
8191246c19 | ||
|
|
437769ac0b | ||
|
|
f97a1103b1 | ||
|
|
9b0c9be7dd | ||
|
|
97c7f3bc67 | ||
|
|
2503271a45 | ||
|
|
d335f263f3 | ||
|
|
1c34635016 | ||
|
|
b6a35e9477 | ||
|
|
6aa8251b98 | ||
|
|
3b4bf90a13 | ||
|
|
0c71756009 | ||
|
|
2f6abb8aa1 | ||
|
|
42582e21f7 | ||
|
|
af49a4dd5a | ||
|
|
b2081faf87 | ||
|
|
f960934eb9 | ||
|
|
5522725f5d | ||
|
|
9f3d36bab0 | ||
|
|
87e7085c22 | ||
|
|
d8eac56f5e | ||
|
|
c20557f690 | ||
|
|
65bdc4cf43 | ||
|
|
ee79c196df | ||
|
|
41682bfcbb | ||
|
|
34be8c9213 | ||
|
|
aebb9f89d1 | ||
|
|
40f6201509 | ||
|
|
2e8e2b04a1 | ||
|
|
015780fc72 | ||
|
|
c64e433a69 | ||
|
|
e21f46d824 | ||
|
|
ef79546508 | ||
|
|
2993fdb169 | ||
|
|
365b1c6299 | ||
|
|
9565b695ef | ||
|
|
89cedd411e | ||
|
|
a51742b47c | ||
|
|
ea3b897d5d | ||
|
|
e432d67b3b | ||
|
|
bd7dc8b5e7 | ||
|
|
a7ac700fe1 | ||
|
|
ff87958188 | ||
|
|
f308cd392b | ||
|
|
e4bea17fb8 | ||
|
|
2c47cfbe25 | ||
|
|
b0685541d9 | ||
|
|
f097c15c61 | ||
|
|
511fa37c84 | ||
|
|
a82ca6adb2 | ||
|
|
05e3e46f5a | ||
|
|
6d399f0303 | ||
|
|
ecebfc34fa | ||
|
|
59b53f3db4 | ||
|
|
e86916a7f9 | ||
|
|
11ae073c12 | ||
|
|
aec53b2849 | ||
|
|
0f42ab230e | ||
|
|
211c92c387 | ||
|
|
2f1ec09aef | ||
|
|
4561d844e4 | ||
|
|
3caa57358f | ||
|
|
94195d5339 | ||
|
|
c9a552c89c | ||
|
|
6b123921a4 | ||
|
|
383eaf44ac | ||
|
|
223d15802e | ||
|
|
bdf2f6c3e1 | ||
|
|
fdc186c92f | ||
|
|
ab6141edb7 | ||
|
|
d0dcf53575 | ||
|
|
ab906f17de | ||
|
|
28ef33b0a0 | ||
|
|
376dedebb1 | ||
|
|
137c6458f7 | ||
|
|
75e0990eb3 | ||
|
|
62a6c725d6 | ||
|
|
d4554c2e5c | ||
|
|
d6a398cf2c | ||
|
|
68e3bcbcda | ||
|
|
6864e13e6f | ||
|
|
942fad1d6f | ||
|
|
29e6b229ac | ||
|
|
a4ce5d1687 | ||
|
|
cb8d6a0939 | ||
|
|
e38128119c | ||
|
|
c7c7924d37 | ||
|
|
b5a24fd877 | ||
|
|
e1ed5b73d0 | ||
|
|
3e47d26e44 | ||
|
|
e0d17e496a | ||
|
|
6cf99cd0f2 | ||
|
|
31d84100cd | ||
|
|
0eb39aa9e3 | ||
|
|
f457069881 | ||
|
|
47eef78365 | ||
|
|
eaaadf40c9 | ||
|
|
c9e2da5f53 | ||
|
|
53b7956968 | ||
|
|
d13be829c3 | ||
|
|
e18b2ab437 | ||
|
|
6777a615d4 | ||
|
|
41f2375053 | ||
|
|
f385bd2236 | ||
|
|
35032d7eed | ||
|
|
bfd48f187a | ||
|
|
7662da52e6 | ||
|
|
7722916fad | ||
|
|
d82a1d7198 | ||
|
|
45925efe32 | ||
|
|
a64bb1a990 | ||
|
|
650bf15db8 | ||
|
|
2b8e50b296 | ||
|
|
2731eb1c05 | ||
|
|
f97aa05bdb | ||
|
|
4a68df084e | ||
|
|
83530b7adb | ||
|
|
a2ef09466f | ||
|
|
7c9488105e | ||
|
|
3f32b040dc | ||
|
|
21b3c61162 | ||
|
|
5045fa6dcd | ||
|
|
c4a3d70500 | ||
|
|
435bb34435 | ||
|
|
bb9ca7f418 | ||
|
|
2e30ed17bd | ||
|
|
0b3d088782 | ||
|
|
6514eaf565 | ||
|
|
f8e7602d96 | ||
|
|
565aef9637 | ||
|
|
82efb83c43 | ||
|
|
f29ff67585 | ||
|
|
825bf8d61e | ||
|
|
1344b31535 | ||
|
|
9b8bddf7b2 | ||
|
|
8a087a876e | ||
|
|
f8067aa592 | ||
|
|
2b837381f3 | ||
|
|
cd6959b712 | ||
|
|
3e5f8c64d4 | ||
|
|
2d1c34d8e0 | ||
|
|
48d532777a | ||
|
|
f6336a6056 | ||
|
|
cd7bdc8998 | ||
|
|
2b7b3c65cc | ||
|
|
98e02a8fed | ||
|
|
a93391e247 | ||
|
|
102cc684dd | ||
|
|
a230228441 | ||
|
|
135cad576c | ||
|
|
561fbf2cca | ||
|
|
a8127d6102 | ||
|
|
2f28d3c7b6 | ||
|
|
e59c735331 | ||
|
|
221014a2e3 | ||
|
|
e2dbfa9ace | ||
|
|
121ff2b7be | ||
|
|
45465e994e | ||
|
|
af85a8a340 | ||
|
|
5fe0e9395f | ||
|
|
1f1cabd144 | ||
|
|
c3bab70434 | ||
|
|
1d6af22813 | ||
|
|
a50798c78f | ||
|
|
379d41b6fb | ||
|
|
09da6828b8 | ||
|
|
9f386afe9c | ||
|
|
35dedd3d83 | ||
|
|
45c0d5a823 | ||
|
|
7bc5bfa140 | ||
|
|
fda6def384 | ||
|
|
4bf4d45389 | ||
|
|
4e8eb2c996 | ||
|
|
e43a9de2f3 | ||
|
|
1a9e97ee3b | ||
|
|
901fca2d12 | ||
|
|
c23f8542b2 | ||
|
|
0189606445 | ||
|
|
9b31496b22 | ||
|
|
b9676ac3eb | ||
|
|
764aabc459 | ||
|
|
61d2ff359b | ||
|
|
87ad8a1495 | ||
|
|
5d889e4a8f | ||
|
|
b65a714d17 | ||
|
|
ea1c4a8fc8 | ||
|
|
5beb1b2cd0 | ||
|
|
f55e0b6775 | ||
|
|
d124041726 | ||
|
|
7a26a92edd | ||
|
|
43c8ac0aa1 | ||
|
|
46e6ed480a | ||
|
|
9f30aba2b3 | ||
|
|
560ecbc6c3 | ||
|
|
8d9b6cca63 | ||
|
|
3972597163 | ||
|
|
b0d17221f2 | ||
|
|
be2cdca1e9 | ||
|
|
f6ab1d63e8 | ||
|
|
cf5e833898 | ||
|
|
6ed2e2694f | ||
|
|
04827188f2 | ||
|
|
560239c918 | ||
|
|
a78929dadf | ||
|
|
349cc54c69 | ||
|
|
a8ae97ba91 | ||
|
|
aad6b69f00 | ||
|
|
d74df935f4 | ||
|
|
5c8806b307 | ||
|
|
a078633a32 | ||
|
|
f022458383 | ||
|
|
6139d0d65a | ||
|
|
86a283b4ae | ||
|
|
bb39a41e9e | ||
|
|
1568e98d43 | ||
|
|
0c9ecd1d76 | ||
|
|
799e67bbca | ||
|
|
561b597031 | ||
|
|
6d6908e625 | ||
|
|
4da4fb0676 | ||
|
|
7a8c05dc7c | ||
|
|
d7bacdcbff | ||
|
|
73e927ff19 | ||
|
|
e2c785b2d5 | ||
|
|
20e9952d98 | ||
|
|
0bf36ad031 | ||
|
|
f3435c5e35 | ||
|
|
166ec74ff9 | ||
|
|
6b3c6c12ff | ||
|
|
5161758193 | ||
|
|
bea32cfe38 | ||
|
|
8cfd803222 | ||
|
|
9a567721a8 | ||
|
|
3a49c8f2da | ||
|
|
12938799a6 | ||
|
|
89807fb55f | ||
|
|
891a24c6ba | ||
|
|
752b45083c | ||
|
|
f00f552369 | ||
|
|
5c2b81d78f | ||
|
|
a2b0531d5f | ||
|
|
752eb58ec0 | ||
|
|
7373b60522 | ||
|
|
59f0961594 | ||
|
|
b776f98df8 | ||
|
|
7400284cff | ||
|
|
da87eb7b4c | ||
|
|
e1f9083c81 | ||
|
|
614376ed64 | ||
|
|
529dd6e3a8 | ||
|
|
acb1bc0c0e | ||
|
|
8233f60569 | ||
|
|
4ae2160372 | ||
|
|
1df2dd9593 | ||
|
|
d53a1d1412 | ||
|
|
de9b43984a | ||
|
|
4a0b36a50b | ||
|
|
fffe5e7003 | ||
|
|
0bac639a04 | ||
|
|
0d0d0a7c23 | ||
|
|
c8e8a44747 | ||
|
|
173f8b093f | ||
|
|
e46c88580a | ||
|
|
e6033c952e | ||
|
|
3dfd0ff3b3 | ||
|
|
dd65f35e5a | ||
|
|
0d550c9bce | ||
|
|
2aeb8b9390 | ||
|
|
afa2fc0ba9 | ||
|
|
6a45919b25 | ||
|
|
e4f7d607e1 | ||
|
|
0690ef31d1 | ||
|
|
c3f02d833c | ||
|
|
e273ac3a0d | ||
|
|
459d02abc8 | ||
|
|
f5e8b26a55 | ||
|
|
2d27083509 | ||
|
|
ce482c20cb | ||
|
|
c2f149cca3 | ||
|
|
ab0e1ec6e8 | ||
|
|
5e4f548321 | ||
|
|
e53634ecef | ||
|
|
03e7019182 | ||
|
|
82b0bc63a3 | ||
|
|
04275e7d5d | ||
|
|
7a471ea6b2 | ||
|
|
45874fa333 | ||
|
|
74a5c6e745 | ||
|
|
cfafe90fe0 | ||
|
|
12d396ffc5 | ||
|
|
dc39b9e643 | ||
|
|
e6a8c02745 | ||
|
|
88d695f7af | ||
|
|
b673e0c219 | ||
|
|
5c819f7242 | ||
|
|
40bd2039d4 | ||
|
|
53f29613c2 | ||
|
|
3371709472 | ||
|
|
50c009265e | ||
|
|
e169c0ce5e | ||
|
|
f04d4b10e4 | ||
|
|
f3e4338efc | ||
|
|
c8979a6a49 | ||
|
|
5b495e2f51 | ||
|
|
42637a642b | ||
|
|
2375e7c100 | ||
|
|
ae1b852821 | ||
|
|
44e4dd3700 | ||
|
|
24d7d599f1 | ||
|
|
d85a41ad75 | ||
|
|
478ddfe102 | ||
|
|
198f832c3d | ||
|
|
f0b78ffc04 | ||
|
|
a445311705 | ||
|
|
1fe1fa9eac | ||
|
|
6258652c7b | ||
|
|
28d31b9d5b | ||
|
|
75426cc498 | ||
|
|
ae29e8bbab | ||
|
|
2b9c7e04a4 | ||
|
|
d1aba56096 | ||
|
|
3985d58d3c | ||
|
|
1479b61214 | ||
|
|
15a249eb54 | ||
|
|
08b3d6bbb0 | ||
|
|
710c5e2c31 | ||
|
|
17fa615bd3 | ||
|
|
6bfed97710 | ||
|
|
f9e286123f | ||
|
|
613fd1bcf0 | ||
|
|
52ce52d466 | ||
|
|
cede5ac9d2 | ||
|
|
89559eae2b | ||
|
|
d7fb2e6403 | ||
|
|
e3119b457c | ||
|
|
ae27a5b7b7 | ||
|
|
302cb27e98 | ||
|
|
2d3481b9a9 | ||
|
|
9b67e988db | ||
|
|
15f1fdddd9 | ||
|
|
24fa9e32b0 | ||
|
|
0b4fef19f6 | ||
|
|
35731b96dc | ||
|
|
b79a1b5755 | ||
|
|
1561f6f09f | ||
|
|
36d7fce909 | ||
|
|
b8d6058b28 | ||
|
|
8771e1a339 | ||
|
|
7b657c942d | ||
|
|
531ae501ad | ||
|
|
d0cac421bb | ||
|
|
4429a16ca8 | ||
|
|
c669401767 | ||
|
|
4d349f5f81 | ||
|
|
08e0349ca3 | ||
|
|
ee5fe424e8 | ||
|
|
552ff0489d | ||
|
|
04a9ce6e81 | ||
|
|
586bdc0567 | ||
|
|
4bb3d13921 | ||
|
|
7c02630186 | ||
|
|
ff63ad8b97 | ||
|
|
bdf1fb6db8 | ||
|
|
d21fdb7546 | ||
|
|
be5af2796d | ||
|
|
b1020c599f | ||
|
|
b2199202ab | ||
|
|
06105072f9 | ||
|
|
b676ca7d96 | ||
|
|
90f355cfaf | ||
|
|
757ab3dc92 | ||
|
|
e022c371ff | ||
|
|
50a2cc9917 | ||
|
|
5209b0172b | ||
|
|
cfb55d9d77 | ||
|
|
df2bbe129d | ||
|
|
f7cae610a4 | ||
|
|
bb698d682c | ||
|
|
5bd6ff2285 | ||
|
|
e6cf186c23 | ||
|
|
e8b5508463 | ||
|
|
d70b893852 | ||
|
|
a579b4a519 | ||
|
|
fffa2f097e | ||
|
|
cabb2198b0 | ||
|
|
3af2168b02 | ||
|
|
f1337524f6 | ||
|
|
348109a1f9 | ||
|
|
0b0597be0c | ||
|
|
690dbc4725 | ||
|
|
cc9b1ea8a1 | ||
|
|
ffebe82586 | ||
|
|
4453e7fcdd | ||
|
|
60d65d8137 | ||
|
|
c8eefe749f | ||
|
|
162421a59a | ||
|
|
79048812e9 | ||
|
|
70b242f190 | ||
|
|
8db4bde15d | ||
|
|
fbb8f0cbf5 | ||
|
|
aafa12eb6e | ||
|
|
76f285f19c | ||
|
|
e1073de36f | ||
|
|
ae48e49cba | ||
|
|
4180db601d | ||
|
|
423983e023 | ||
|
|
90a1ea4281 | ||
|
|
0ebd864db9 | ||
|
|
02e85913da | ||
|
|
1d5dc283fe | ||
|
|
769f0a78d4 | ||
|
|
4029f86c60 | ||
|
|
f6d1fea9b7 | ||
|
|
fa6524d377 | ||
|
|
c56cb8adb6 | ||
|
|
78638a15be | ||
|
|
d4a51979bb | ||
|
|
77555cd5c2 | ||
|
|
7c48ba2f19 | ||
|
|
4dbe0a0d0e | ||
|
|
ca92a74a39 | ||
|
|
c01d28a471 | ||
|
|
98ff09931d | ||
|
|
20ae89c2a1 | ||
|
|
0baa23f553 | ||
|
|
10fbb6a2a8 | ||
|
|
6152b83405 | ||
|
|
aed25ff87c | ||
|
|
5f94238d23 | ||
|
|
4d1d5d6b20 | ||
|
|
5ba6a5fca1 | ||
|
|
cba8d83b21 | ||
|
|
aaeffe3846 | ||
|
|
6881e8fbe3 | ||
|
|
137e455f03 | ||
|
|
ff3d0346eb | ||
|
|
498da509db | ||
|
|
d484c0e7ce | ||
|
|
5c1c561d7d | ||
|
|
9f0429ca6f | ||
|
|
3485ad39d9 | ||
|
|
d899923876 | ||
|
|
4e04cd27c9 | ||
|
|
7e4b428a3e | ||
|
|
9f65a318da | ||
|
|
2f6ed86c78 | ||
|
|
6590915b15 | ||
|
|
0c3fe54b0b | ||
|
|
a93b675cb8 | ||
|
|
0f2df23800 | ||
|
|
e4e0a24416 | ||
|
|
6aa5abf298 | ||
|
|
bd672c4c4e | ||
|
|
8d768bda31 | ||
|
|
5110994f81 | ||
|
|
83d17b5c0e | ||
|
|
e6c174c33b | ||
|
|
9497300a4a | ||
|
|
acab62e345 | ||
|
|
0e8feed2f2 | ||
|
|
82716d8014 | ||
|
|
af262e9a14 | ||
|
|
d0d5af8c66 | ||
|
|
86f9b1f6db | ||
|
|
c4485d0af7 | ||
|
|
7c5d0a0e00 | ||
|
|
5f014a2056 | ||
|
|
eaaacd71a8 | ||
|
|
75cead9266 | ||
|
|
d79c5824b8 | ||
|
|
4381739b6d | ||
|
|
8f2cdcef0e | ||
|
|
990cc41e80 | ||
|
|
9721acbf63 | ||
|
|
be5cb1683b | ||
|
|
a4e7e546ff | ||
|
|
4259b4571c | ||
|
|
2414a79578 | ||
|
|
84623ac1f6 | ||
|
|
d46343fb9c | ||
|
|
5c788a6130 | ||
|
|
281cf584ec | ||
|
|
13c4581c86 | ||
|
|
9c938b91b7 | ||
|
|
f71f7a0b63 | ||
|
|
b8c03a1905 | ||
|
|
9515b40ca5 | ||
|
|
df3d3db776 | ||
|
|
e15df81351 | ||
|
|
77ec423510 | ||
|
|
c41df9ffbd | ||
|
|
acad35c5bc | ||
|
|
6b3fe68a17 | ||
|
|
6ec07d744e | ||
|
|
989fdb5895 | ||
|
|
e60b91b5e2 | ||
|
|
0be2567d97 | ||
|
|
61770ad69e | ||
|
|
85bd0feee0 | ||
|
|
b249216db6 | ||
|
|
2a2a80b0bf | ||
|
|
7ddd5e9bc3 | ||
|
|
6b4a4517ec | ||
|
|
7c1c91ac43 | ||
|
|
6b56768e9c | ||
|
|
b2b7d02c01 | ||
|
|
8bb097fd10 | ||
|
|
a5f8f1f0f5 | ||
|
|
424e2c76fa | ||
|
|
41ae2bfb84 | ||
|
|
4bdf9eda41 | ||
|
|
ef1c7eec74 | ||
|
|
87527fccc6 | ||
|
|
f23234d0df | ||
|
|
fdbc3a692f | ||
|
|
571aaea3e0 | ||
|
|
d0986297ca | ||
|
|
188e679ea3 | ||
|
|
4209a5699a | ||
|
|
80ca7796ca | ||
|
|
02f19bfbee | ||
|
|
49d5591f48 | ||
|
|
816bc45707 | ||
|
|
73e9dce143 | ||
|
|
9f0edde12b | ||
|
|
cf55b67cee | ||
|
|
9ca415c665 | ||
|
|
af029e6c3f | ||
|
|
6d514c97f8 | ||
|
|
e812ac2c0b | ||
|
|
480832318c | ||
|
|
7a3e397949 | ||
|
|
c95e450b8d | ||
|
|
b63a34110e | ||
|
|
0a2a71e83b | ||
|
|
831bf71ce6 | ||
|
|
172eda5471 | ||
|
|
aa899f0693 | ||
|
|
82602b51bf | ||
|
|
3971a12f0e | ||
|
|
70c4eb44fd | ||
|
|
9ce54162c2 | ||
|
|
92c6fc04a8 | ||
|
|
46ebf9b7e5 | ||
|
|
799ad0feff | ||
|
|
1a56385cf9 | ||
|
|
71827fe4e6 | ||
|
|
8568f7a0fb | ||
|
|
39c61327b5 | ||
|
|
81d2130b06 | ||
|
|
536f5ff091 | ||
|
|
7e258bfe38 | ||
|
|
66f0e6a8f2 | ||
|
|
04306a544f | ||
|
|
e4fe3bfe35 | ||
|
|
b636bf4b2a | ||
|
|
05c7796909 | ||
|
|
e2b3463c05 | ||
|
|
6c016cf443 | ||
|
|
fc48168153 | ||
|
|
096e6f2f80 | ||
|
|
4a00bfcc55 | ||
|
|
6ebc19fccb | ||
|
|
0fa40c9ac3 |
@@ -13,8 +13,8 @@ environment:
|
||||
REPO_DIR: &REPO_DIR c:\qbittorrent
|
||||
CACHE_DIR: &CACHE_DIR c:\qbt_cache
|
||||
|
||||
QBT_VER_URL: https://builds.shiki.hu/appveyor/version
|
||||
QBT_LIB_URL: https://builds.shiki.hu/appveyor/qbt_libraries.7z
|
||||
QBT_VER_URL: https://builds.shiki.hu/appveyor/version_64
|
||||
QBT_LIB_URL: https://builds.shiki.hu/appveyor/qbt_libraries_64.7z
|
||||
|
||||
# project directory
|
||||
clone_folder: *REPO_DIR
|
||||
@@ -38,12 +38,12 @@ install:
|
||||
appveyor DownloadFile "%QBT_LIB_URL%" -FileName "c:\qbt_lib.7z" && 7z x "c:\qbt_lib.7z" -o"%CACHE_DIR%" > nul &&
|
||||
COPY "c:\version_new" "%CACHE_DIR%\version")
|
||||
# Qt stay compressed in cache
|
||||
- 7z x "%CACHE_DIR%\qt5_32.7z" -o"c:\qbt" > nul
|
||||
- 7z x "%CACHE_DIR%\qt5_64.7z" -o"c:\qbt" > nul
|
||||
|
||||
before_build:
|
||||
# setup env
|
||||
- CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat"
|
||||
- SET PATH=%PATH%;c:\qbt\qt5_32\bin;%CACHE_DIR%\jom;
|
||||
- CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
- SET PATH=%PATH%;C:\Qt\5.15.2\msvc2019_64\bin;%CACHE_DIR%\jom
|
||||
# setup project
|
||||
- COPY /Y "%CACHE_DIR%\conf.pri" "%REPO_DIR%"
|
||||
# workarounds
|
||||
|
||||
19
.github/ISSUE_TEMPLATE.md
vendored
19
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,19 +0,0 @@
|
||||
**Please provide the following information**
|
||||
|
||||
### qBittorrent version and Operating System
|
||||
(type here)
|
||||
|
||||
### If on linux, libtorrent-rasterbar and Qt version
|
||||
(type here)
|
||||
|
||||
### What is the problem
|
||||
(type here)
|
||||
|
||||
### What is the expected behavior
|
||||
(type here)
|
||||
|
||||
### Steps to reproduce
|
||||
(type here)
|
||||
|
||||
### Extra info(if any)
|
||||
(type here)
|
||||
89
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
89
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Report a problem with qBittorrent to help us resolve it.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
# Bug report
|
||||
|
||||
<!--
|
||||
###############################################################################
|
||||
WARNING!
|
||||
IGNORING THE INSTRUCTIONS IN THIS TEMPLATE WILL RESULT IN THE ISSUE BEING
|
||||
CLOSED AS INCOMPLETE/INVALID
|
||||
###############################################################################
|
||||
-->
|
||||
|
||||
## Checklist
|
||||
|
||||
<!--
|
||||
################################## IMPORTANT ##################################
|
||||
|
||||
As you read and fulfill each of the following requirements below,
|
||||
put an "x" between the square brackets to mark each task as done, like so: [x]
|
||||
-->
|
||||
|
||||
- [ ] I have read the **issue reporting section** in the [contributing guidelines](https://github.com/qbittorrent/qBittorrent/blob/master/CONTRIBUTING.md), so I know how to submit a good bug report with the required information
|
||||
- [ ] I have verified that the **issue is not fixed and is reproducible** in the **[latest version](https://www.qbittorrent.org/download.php)**
|
||||
- [ ] (optional but recommended) I have verified that the **issue is not fixed and is reproducible** in the **[latest CI build](https://github.com/qbittorrent/qBittorrent/actions/workflows/ci.yaml?query=branch%3Amaster+event%3Apush)**
|
||||
- [ ] I have **checked the [frequent/common issues list](https://github.com/qbittorrent/qBittorrent/projects/2)** and **searched** the issue tracker for similar bug reports (including closed ones) **to avoid posting a duplicate**
|
||||
- [ ] This report is **not a support request or question**, both of which are better suited for either the [discussions section](https://github.com/qbittorrent/qBittorrent/discussions), [forum](https://qbforums.shiki.hu/), or [subreddit](https://www.reddit.com/r/qBittorrent/). The [wiki](https://github.com/qbittorrent/qBittorrent/wiki) did not contain a suitable solution either
|
||||
- [ ] I have **pasted/attached the settings file and relevant log(s)** in the **Attachments** section at the bottom of the report. Mandatory: the settings file and at least the most recent log. See [this wiki page](https://github.com/qbittorrent/qBittorrent/wiki/Frequently-Asked-Questions#Where_does_qBittorrent_save_its_settings) if you're not sure where to find them.
|
||||
|
||||
## Description
|
||||
|
||||
<!--
|
||||
################################## IMPORTANT ##################################
|
||||
|
||||
Delete each "(type here)" indicator and type your text in their place in the subsections below.
|
||||
You MUST fill in ALL subsections marked with "(type here)" with the appropriate information.
|
||||
|
||||
Please make sure the description is worded well enough to be understood.
|
||||
Provide steps to reproduce the issue, any additional relevant information, suggested solution (if applicable) and as much context and examples as possible.
|
||||
For more information consult the Contributing Guidelines at https://github.com/qbittorrent/qBittorrent/blob/master/CONTRIBUTING.md.
|
||||
|
||||
Do not forget about the mandatory attachments!
|
||||
|
||||
Use the Preview tab before posting to make sure your report looks like it is formatted properly.
|
||||
You don't need to delete these comments, they won't show up in the final post.
|
||||
-->
|
||||
|
||||
### qBittorrent info and operating system(s)
|
||||
|
||||
<!--
|
||||
IMPORTANT:
|
||||
if you did not get the qBittorrent installer from the links in the official website
|
||||
or if you did not install it from the PPA, please mention that after the version
|
||||
-->
|
||||
|
||||
- qBittorrent version: (type here)
|
||||
- Operating system(s) where the issue occurs: (type here)
|
||||
|
||||
### If on Linux, `libtorrent-rasterbar` and `Qt` versions
|
||||
|
||||
- Qt: (type here)
|
||||
- libtorrent-rasterbar: (type here)
|
||||
|
||||
### What is the problem
|
||||
|
||||
(type here)
|
||||
|
||||
### Detailed steps to reproduce the problem
|
||||
|
||||
1. (type here)
|
||||
2. (type here)
|
||||
3. (etc.)
|
||||
|
||||
### What is the expected behavior
|
||||
|
||||
(type here)
|
||||
|
||||
### Extra info (if any)
|
||||
|
||||
(type here)
|
||||
|
||||
## Attachments
|
||||
|
||||
<!-- paste file contents here (or attach the files if they are big), do NOT link to external sites -->
|
||||
20
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
20
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
-
|
||||
about: "Consult the wiki first (especially the FAQ), it might already contain the information you are looking for"
|
||||
name: Wiki
|
||||
url: "https://github.com/qbittorrent/qBittorrent/wiki/"
|
||||
|
||||
-
|
||||
about: "Please ask questions related to usage/setup/support/non-issue development discussion in the Discussions section"
|
||||
name: Question
|
||||
url: "https://github.com/qbittorrent/qBittorrent/discussions"
|
||||
|
||||
-
|
||||
about: "Alternatively, ask on the official forum"
|
||||
name: Question
|
||||
url: "http://forum.qbittorrent.org/"
|
||||
-
|
||||
about: "Alternatively, use the subreddit"
|
||||
name: Question
|
||||
url: "https://www.reddit.com/r/qBittorrent/"
|
||||
61
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
61
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: Suggest a new feature or enhancement for qBittorrent.
|
||||
title: ''
|
||||
labels: 'Feature request'
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
# Feature request
|
||||
|
||||
<!--
|
||||
###############################################################################
|
||||
WARNING!
|
||||
IGNORING THE INSTRUCTIONS IN THIS TEMPLATE WILL RESULT IN THE ISSUE BEING
|
||||
CLOSED AS INCOMPLETE/INVALID
|
||||
###############################################################################
|
||||
-->
|
||||
|
||||
## Checklist
|
||||
|
||||
<!--
|
||||
################################## IMPORTANT ##################################
|
||||
|
||||
As you read and fulfill each of the following requirements below,
|
||||
put an "x" between the square brackets to mark each task as done, like so: [x]
|
||||
-->
|
||||
|
||||
- [ ] I have read the **feature request section** in the [contributing guidelines](https://github.com/qbittorrent/qBittorrent/blob/master/CONTRIBUTING.md), so I know how to submit a good feature request with the required information
|
||||
- [ ] I have verified that the **feature** I am requesting is **not available** in the **[latest version](https://www.qbittorrent.org/download.php)**
|
||||
- [ ] (optional but recommended) I have verified that the **feature** I am requesting is **not available** in the **[latest CI build](https://github.com/qbittorrent/qBittorrent/actions/workflows/ci.yaml?query=branch%3Amaster+event%3Apush)**
|
||||
- [ ] I have **checked the [frequent/common issues list](https://github.com/qbittorrent/qBittorrent/projects/2)** and **searched** the issue tracker for similar feature requests (including closed ones) **to avoid posting a duplicate**
|
||||
- [ ] This request is **not a support request or question**, both of which are better suited for either the [discussions section](https://github.com/qbittorrent/qBittorrent/discussions), [forum](https://qbforums.shiki.hu/), or [subreddit](https://www.reddit.com/r/qBittorrent/). The [wiki](https://github.com/qbittorrent/qBittorrent/wiki) did not contain a suitable solution either
|
||||
|
||||
## Description
|
||||
|
||||
<!--
|
||||
################################## IMPORTANT ##################################
|
||||
|
||||
Delete each "(type here)" indicator and type your text in their place in the subsections below.
|
||||
You MUST fill in ALL subsections marked with "(type here)" with the appropriate information.
|
||||
|
||||
Please make sure the description is worded well enough to be understood.
|
||||
Provide a detailed description of the feature and as much context and examples as necessary.
|
||||
If the feature request has to do with visual elements and the GUI, images/screenshots are always helpful.
|
||||
For more information consult the Contributing Guidelines at https://github.com/qbittorrent/qBittorrent/blob/master/CONTRIBUTING.md.
|
||||
|
||||
Use the Preview tab before posting to make sure your report looks like it is formatted properly.
|
||||
You don't need to delete these comments, they won't show up in the final post.
|
||||
-->
|
||||
|
||||
### Suggestion
|
||||
|
||||
(type here)
|
||||
|
||||
### Use case
|
||||
|
||||
(type here)
|
||||
|
||||
### Extra info/examples/attachments
|
||||
|
||||
<!-- optional -->
|
||||
16
.github/PULL_REQUEST_TEMPLATE/pull_request.md
vendored
Normal file
16
.github/PULL_REQUEST_TEMPLATE/pull_request.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# Changes proposed in this pull request
|
||||
|
||||
<!--
|
||||
IMPORTANT: an image is worth a thousand words.
|
||||
It is often a good idea to post screenshots showing the "before" and "after" your PR's changes,
|
||||
especially with changes related to the GUI, along with the textual description.
|
||||
Images makes it immediately clearer for others what your proposed changes are all about.
|
||||
-->
|
||||
|
||||
(type here)
|
||||
|
||||
<!--
|
||||
OPTIONAL: if this PR directly addresses an issue, make sure to include a "Closes #XXXXX" statement at the end.
|
||||
-->
|
||||
|
||||
<!-- You don't need to delete these comments before posting, they won't show up in the post :) -->
|
||||
18
.github/SUPPORT.md
vendored
Normal file
18
.github/SUPPORT.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Support Resources
|
||||
|
||||
The issue tracker is only for bug reports/feature requests related to the project itself.
|
||||
|
||||
Please do not use the issue tracker for questions about general program usage,
|
||||
how BitTorrent (the protocol) works in general, etc.
|
||||
|
||||
For such questions, use one of the following community support resources:
|
||||
|
||||
* The [discussions section][discussions-url]
|
||||
|
||||
* The official forum [official forum][forum-url]
|
||||
|
||||
* The [qBittorrent subreddit][subreddit-url]
|
||||
|
||||
[discussions-url]: https://github.com/qbittorrent/qBittorrent/discussions
|
||||
[forum-url]: http://forum.qbittorrent.org/
|
||||
[subreddit-url]: https://www.reddit.com/r/qBittorrent/
|
||||
240
.github/workflows/ci.yaml
vendored
240
.github/workflows/ci.yaml
vendored
@@ -1,240 +0,0 @@
|
||||
name: GitHub Actions CI
|
||||
|
||||
# Cache is used for all Windows and macOS dependencies (size approx. 1230 * 2 + 1850 = 4310 MiB)
|
||||
# Cache is not used for Ubuntu builds, because it already has all dependencies except
|
||||
# the appropriate libtorrent version, which only takes 3-5 minutes to build from source anyway
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
env:
|
||||
VCPKG_COMMIT: e4ce66eecfd3e5cca5eac06c971921bf8e37cf88
|
||||
VCPKG_DEST_MACOS: /Users/runner/qbt_tools/vcpkg
|
||||
VCPKG_DEST_WIN: C:\qbt_tools\vcpkg
|
||||
LIBTORRENT_VERSION_TAG: v1.2.12
|
||||
|
||||
jobs:
|
||||
|
||||
ci_ubuntu:
|
||||
name: Ubuntu
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-20.04]
|
||||
qbt_gui: ["GUI=ON", "GUI=OFF"]
|
||||
fail-fast: false
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install all build dependencies except libtorrent from Ubuntu repos
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install \
|
||||
build-essential cmake git ninja-build pkg-config \
|
||||
libssl-dev libgeoip-dev zlib1g-dev \
|
||||
libboost-dev libboost-chrono-dev libboost-random-dev libboost-system-dev \
|
||||
libqt5svg5-dev qtbase5-dev qttools5-dev
|
||||
|
||||
- name: install libtorrent from source
|
||||
run: |
|
||||
git clone https://github.com/arvidn/libtorrent && cd libtorrent
|
||||
git checkout ${{ env.LIBTORRENT_VERSION_TAG }}
|
||||
cmake -B cmake-build-dir -G "Ninja" \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-Ddeprecated-functions=OFF \
|
||||
--graphviz=cmake-build-dir/target_graph.dot
|
||||
cmake --build cmake-build-dir
|
||||
sudo cmake --install cmake-build-dir --prefix /usr/local
|
||||
|
||||
- name: build qBittorrent
|
||||
run: |
|
||||
cmake -B build -G "Ninja" \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-D${{ matrix.qbt_gui }} \
|
||||
-DVERBOSE_CONFIGURE=ON \
|
||||
--graphviz=build/target_graph.dot
|
||||
cmake --build build
|
||||
|
||||
- name: upload artifact as zip
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: qBittorrent-CI_${{ matrix.os }}-x64_${{ matrix.qbt_gui }}
|
||||
path: |
|
||||
build/compile_commands.json
|
||||
build/target_graph.dot
|
||||
build/qbittorrent
|
||||
build/qbittorrent-nox
|
||||
libtorrent/cmake-build-dir/compile_commands.json
|
||||
libtorrent/cmake-build-dir/target_graph.dot
|
||||
|
||||
ci_windows:
|
||||
name: Windows + vcpkg
|
||||
|
||||
runs-on: windows-2019
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# - ninja is needed for building qBittorrent (because it's preferrable, not a hard requirement)
|
||||
- name: install additional required packages with chocolatey
|
||||
run: |
|
||||
choco install ninja
|
||||
|
||||
- name: setup vcpkg (cached, if possible)
|
||||
uses: lukka/run-vcpkg@v4
|
||||
with:
|
||||
vcpkgDirectory: ${{ env.VCPKG_DEST_WIN }}
|
||||
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }}
|
||||
setupOnly: true
|
||||
|
||||
# Tell vcpkg to only build Release variants of the dependencies
|
||||
- name: configure vcpkg triplet overlay for release builds only
|
||||
run: |
|
||||
New-Item -Path ${{ github.workspace }} -Name "triplets_overlay" -ItemType Directory
|
||||
Copy-Item ${{ env.RUNVCPKG_VCPKG_ROOT }}/triplets/x64-windows-static.cmake `
|
||||
${{ github.workspace }}/triplets_overlay/x64-windows-static-release.cmake
|
||||
Add-Content ${{ github.workspace }}/triplets_overlay/x64-windows-static-release.cmake `
|
||||
-Value "set(VCPKG_BUILD_TYPE release)"
|
||||
|
||||
# clear buildtrees after each package installation to reduce disk space requirements
|
||||
- name: install dependencies via vcpkg
|
||||
run: |
|
||||
$packages = `
|
||||
"boost-circular-buffer:x64-windows-static-release",
|
||||
"libtorrent:x64-windows-static-release",
|
||||
"qt5-base:x64-windows-static-release",
|
||||
"qt5-svg:x64-windows-static-release",
|
||||
"qt5-tools:x64-windows-static-release",
|
||||
"qt5-winextras:x64-windows-static-release"
|
||||
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe upgrade `
|
||||
--overlay-triplets=${{ github.workspace }}/triplets_overlay `
|
||||
--overlay-ports=${{ github.workspace }}/vcpkg `
|
||||
--no-dry-run
|
||||
foreach($package in $packages)
|
||||
{
|
||||
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe install $package `
|
||||
--overlay-triplets=${{ github.workspace }}/triplets_overlay `
|
||||
--overlay-ports=${{ github.workspace }}/vcpkg `
|
||||
--clean-after-build
|
||||
}
|
||||
|
||||
# NOTE: this is necessary to correctly find and use cl.exe with the Ninja generator for now
|
||||
- name: setup devcmd
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: build qBittorrent
|
||||
shell: cmd
|
||||
run: |
|
||||
cmake -B build -G "Ninja" ^
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo ^
|
||||
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_DEST_WIN }}\scripts\buildsystems\vcpkg.cmake ^
|
||||
-DVCPKG_TARGET_TRIPLET=x64-windows-static-release ^
|
||||
-DVERBOSE_CONFIGURE=ON ^
|
||||
-DMSVC_RUNTIME_DYNAMIC=OFF ^
|
||||
--graphviz=build\target_graph.dot
|
||||
cmake --build build
|
||||
|
||||
- name: upload artifact as zip
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: qBittorrent-CI_Windows-x64
|
||||
path: |
|
||||
build/compile_commands.json
|
||||
build/target_graph.dot
|
||||
build/qbittorrent.exe
|
||||
build/qbittorrent.pdb
|
||||
dist/windows/qt.conf
|
||||
|
||||
ci_macos:
|
||||
name: macOS + vcpkg
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
qbt_gui: ["GUI=ON", "GUI=OFF"]
|
||||
fail-fast: false
|
||||
|
||||
runs-on: macos-10.15
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# - ninja is needed for building qBittorrent (because it's preferrable, not a hard requirement)
|
||||
# - 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 automake ninja
|
||||
|
||||
- name: setup vcpkg (cached, if possible)
|
||||
uses: lukka/run-vcpkg@v4
|
||||
with:
|
||||
vcpkgDirectory: ${{ env.VCPKG_DEST_MACOS }}
|
||||
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }}
|
||||
setupOnly: true
|
||||
|
||||
- name: configure vcpkg triplet overlay for release builds only
|
||||
run: |
|
||||
New-Item -Path ${{ github.workspace }} -Name "triplets_overlay" -ItemType Directory
|
||||
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)","set(VCPKG_OSX_DEPLOYMENT_TARGET 10.15)"
|
||||
|
||||
- name: install dependencies via vcpkg
|
||||
run: |
|
||||
$packages = `
|
||||
"boost-circular-buffer:x64-osx-release",
|
||||
"libtorrent:x64-osx-release",
|
||||
"qt5-base:x64-osx-release",
|
||||
"qt5-svg:x64-osx-release",
|
||||
"qt5-tools:x64-osx-release",
|
||||
"qt5-macextras:x64-osx-release"
|
||||
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg upgrade `
|
||||
--overlay-triplets=${{ github.workspace }}/triplets_overlay `
|
||||
--overlay-ports=${{ github.workspace }}/vcpkg `
|
||||
--no-dry-run
|
||||
foreach($package in $packages)
|
||||
{
|
||||
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg install $package `
|
||||
--overlay-triplets=${{ github.workspace }}/triplets_overlay `
|
||||
--overlay-ports=${{ github.workspace }}/vcpkg `
|
||||
--clean-after-build
|
||||
}
|
||||
|
||||
- name: build qBittorrent
|
||||
shell: bash
|
||||
run: |
|
||||
cmake -B build -G "Ninja" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_DEST_MACOS }}/scripts/buildsystems/vcpkg.cmake \
|
||||
-DVCPKG_TARGET_TRIPLET=x64-osx-release \
|
||||
-D${{ matrix.qbt_gui }} \
|
||||
-DVERBOSE_CONFIGURE=ON \
|
||||
--graphviz=build/target_graph.dot
|
||||
cmake --build build
|
||||
|
||||
- name: upload artifact as zip
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: qBittorrent-CI_macOS_${{ matrix.qbt_gui }}
|
||||
path: |
|
||||
build/compile_commands.json
|
||||
build/target_graph.dot
|
||||
build/qbittorrent.app
|
||||
build/qbittorrent-nox.app
|
||||
20
.github/workflows/ci_file_health.yaml
vendored
Normal file
20
.github/workflows/ci_file_health.yaml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: CI - File health
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install zsh
|
||||
|
||||
- name: Check files
|
||||
run: |
|
||||
./.github/workflows/file_health.sh
|
||||
73
.github/workflows/ci_macos.yaml
vendored
Normal file
73
.github/workflows/ci_macos.yaml
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
name: CI - macOS
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: Build
|
||||
runs-on: macos-10.15
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
libt_version: ["v2.0.4", "v1.2.14"]
|
||||
qbt_gui: ["GUI=ON", "GUI=OFF"]
|
||||
fail-fast: false
|
||||
|
||||
env:
|
||||
openssl_root: /usr/local/opt/openssl@1.1
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup ccache
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
with:
|
||||
key: ${{ runner.os }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew update > /dev/null
|
||||
brew install \
|
||||
cmake ninja \
|
||||
boost openssl@1.1 qt@5 zlib
|
||||
brew link --force \
|
||||
qt@5
|
||||
# workaround for cmake + Qt
|
||||
sudo ln -s /usr/local/opt/qt@5/mkspecs /usr/local/mkspecs
|
||||
sudo ln -s /usr/local/opt/qt@5/plugins /usr/local/plugins
|
||||
|
||||
- name: Install libtorrent
|
||||
run: |
|
||||
git clone --branch ${{ matrix.libt_version }} --depth 1 https://github.com/arvidn/libtorrent.git
|
||||
cd libtorrent
|
||||
git submodule update --init --recursive
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
cmake \
|
||||
-B build \
|
||||
-G "Ninja" \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
-Ddeprecated-functions=OFF \
|
||||
-DOPENSSL_ROOT_DIR="${{ env.openssl_root }}"
|
||||
cmake --build build
|
||||
sudo cmake --install build
|
||||
|
||||
- name: Build qBittorrent
|
||||
run: |
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
cmake \
|
||||
-B build \
|
||||
-G "Ninja" \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-D${{ matrix.qbt_gui }} \
|
||||
-DVERBOSE_CONFIGURE=ON \
|
||||
-DOPENSSL_ROOT_DIR="${{ env.openssl_root }}"
|
||||
cmake --build build
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: qBittorrent-CI_macOS_${{ matrix.qbt_gui }}_libtorrent-${{ matrix.libt_version }}
|
||||
path: |
|
||||
build/qbittorrent.app
|
||||
build/qbittorrent-nox.app
|
||||
84
.github/workflows/ci_ubuntu.yaml
vendored
Normal file
84
.github/workflows/ci_ubuntu.yaml
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
name: CI - Ubuntu
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: Build
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
libt_version: ["v2.0.4", "v1.2.14"]
|
||||
qbt_gui: ["GUI=ON", "GUI=OFF"]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup ccache
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
with:
|
||||
key: ${{ runner.os }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install \
|
||||
build-essential cmake git ninja-build pkg-config \
|
||||
libssl-dev libgeoip-dev zlib1g-dev \
|
||||
libboost-dev libboost-chrono-dev libboost-random-dev libboost-system-dev
|
||||
# sudo apt install libqt5svg5-dev qtbase5-dev qttools5-dev # the Qt version in the standard repositories is too old...
|
||||
|
||||
# this will be installed under /opt/qt515. CMake will still find it automatically without additional hints
|
||||
# to speed up the process, only the required components are installed rather than the full qt515-meta-full metapackage
|
||||
- name: Install Qt
|
||||
run: |
|
||||
sudo add-apt-repository ppa:beineri/opt-qt-5.15.2-focal
|
||||
sudo apt install \
|
||||
qt515base qt515svg qt515tools
|
||||
|
||||
- name: Install libtorrent
|
||||
run: |
|
||||
git clone --branch ${{ matrix.libt_version }} --depth 1 https://github.com/arvidn/libtorrent.git
|
||||
cd libtorrent
|
||||
git submodule update --init --recursive
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
cmake \
|
||||
-B build \
|
||||
-G "Ninja" \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-Ddeprecated-functions=OFF \
|
||||
--graphviz=cmake-build-dir/target_graph.dot
|
||||
cmake --build build
|
||||
sudo cmake --install build
|
||||
|
||||
- name: Build qBittorrent
|
||||
run: |
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
cmake \
|
||||
-B build \
|
||||
-G "Ninja" \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-D${{ matrix.qbt_gui }} \
|
||||
-DVERBOSE_CONFIGURE=ON \
|
||||
--graphviz=build/target_graph.dot
|
||||
cmake --build build
|
||||
|
||||
- name: Install qBittorrent
|
||||
run: sudo cmake --install build
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: qBittorrent-CI_ubuntu-20.04-x64_${{ matrix.qbt_gui }}_libtorrent-${{ matrix.libt_version }}
|
||||
path: |
|
||||
build/compile_commands.json
|
||||
build/install_manifest.txt
|
||||
build/target_graph.dot
|
||||
build/qbittorrent
|
||||
build/qbittorrent-nox
|
||||
libtorrent/cmake-build-dir/compile_commands.json
|
||||
libtorrent/cmake-build-dir/target_graph.dot
|
||||
32
.github/workflows/ci_webui.yaml
vendored
Normal file
32
.github/workflows/ci_webui.yaml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
name: CI - WebUI
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: Check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: src/webui/www
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup nodejs
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
|
||||
- name: Install tools
|
||||
run: npm install
|
||||
|
||||
- name: Lint code
|
||||
run: npm run lint
|
||||
|
||||
- name: Format code
|
||||
run: |
|
||||
npm run format
|
||||
git diff --exit-code
|
||||
85
.github/workflows/ci_windows.yaml
vendored
Normal file
85
.github/workflows/ci_windows.yaml
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
name: CI - Windows
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: Build
|
||||
runs-on: windows-2019
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install build tools
|
||||
run: |
|
||||
choco install ninja
|
||||
|
||||
# use the preinstalled vcpkg from image
|
||||
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#package-management
|
||||
- name: Setup vcpkg
|
||||
uses: lukka/run-vcpkg@v7
|
||||
with:
|
||||
vcpkgDirectory: C:/vcpkg
|
||||
doNotUpdateVcpkg: true # the preinstalled vcpkg is updated regularly
|
||||
setupOnly: true
|
||||
|
||||
# tell vcpkg to only build Release variants of the dependencies
|
||||
- name: Configure vcpkg triplet overlay
|
||||
run: |
|
||||
New-Item `
|
||||
-Path "${{ github.workspace }}" `
|
||||
-Name "triplets_overlay" `
|
||||
-ItemType Directory
|
||||
Copy-Item `
|
||||
"${{ env.RUNVCPKG_VCPKG_ROOT }}/triplets/x64-windows-static.cmake" `
|
||||
"${{ github.workspace }}/triplets_overlay/x64-windows-static-release.cmake"
|
||||
Add-Content `
|
||||
"${{ github.workspace }}/triplets_overlay/x64-windows-static-release.cmake" `
|
||||
-Value "set(VCPKG_BUILD_TYPE release)"
|
||||
|
||||
# clear buildtrees after each package installation to reduce disk space requirements
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
$packages = `
|
||||
"boost-circular-buffer:x64-windows-static-release",
|
||||
"libtorrent:x64-windows-static-release",
|
||||
"qt5-base:x64-windows-static-release",
|
||||
"qt5-svg:x64-windows-static-release",
|
||||
"qt5-tools:x64-windows-static-release",
|
||||
"qt5-winextras:x64-windows-static-release"
|
||||
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe upgrade `
|
||||
--overlay-triplets="${{ github.workspace }}/triplets_overlay" `
|
||||
--no-dry-run
|
||||
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe install `
|
||||
--overlay-triplets="${{ github.workspace }}/triplets_overlay" `
|
||||
--clean-after-build `
|
||||
$packages
|
||||
|
||||
# this is necessary to correctly find and use cl.exe with the Ninja generator for now
|
||||
- name: Setup devcmd
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Build qBittorrent
|
||||
run: |
|
||||
cmake `
|
||||
-B build `
|
||||
-G "Ninja" `
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON `
|
||||
-DCMAKE_TOOLCHAIN_FILE="${{ env.RUNVCPKG_VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" `
|
||||
-DMSVC_RUNTIME_DYNAMIC=OFF `
|
||||
-DVCPKG_TARGET_TRIPLET=x64-windows-static-release `
|
||||
-DVERBOSE_CONFIGURE=ON `
|
||||
--graphviz=build/target_graph.dot
|
||||
cmake --build build
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: qBittorrent-CI_Windows-x64
|
||||
path: |
|
||||
build/compile_commands.json
|
||||
build/qbittorrent.exe
|
||||
build/qbittorrent.pdb
|
||||
build/target_graph.dot
|
||||
dist/windows/qt.conf
|
||||
85
.github/workflows/coverity-scan.yml
vendored
Normal file
85
.github/workflows/coverity-scan.yml
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
name: Coverity Scan
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 1 * *' # Monthly (1st day of month at midnight)
|
||||
workflow_dispatch: # Mainly for testing. Don't forget the Coverity usage limits.
|
||||
|
||||
env:
|
||||
LIBTORRENT_VERSION_TAG: v1.2.14
|
||||
|
||||
jobs:
|
||||
coverity_scan:
|
||||
name: Scan
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install \
|
||||
build-essential cmake git ninja-build pkg-config \
|
||||
libssl-dev zlib1g-dev libboost-dev libboost-system-dev
|
||||
# sudo apt install libqt5svg5-dev qtbase5-dev qttools5-dev # the Qt version in the standard repositories is too old...
|
||||
|
||||
# this will be installed under /opt/qt515. CMake will still find it automatically without additional hints
|
||||
# to speed up the process, only the required components are installed rather than the full qt515-meta-full metapackage
|
||||
- name: Install Qt
|
||||
run: |
|
||||
sudo add-apt-repository ppa:beineri/opt-qt-5.15.2-focal
|
||||
sudo apt install \
|
||||
qt515base qt515svg qt515tools
|
||||
|
||||
- name: Install libtorrent
|
||||
run: |
|
||||
git clone https://github.com/arvidn/libtorrent
|
||||
cd libtorrent
|
||||
git checkout ${{ env.LIBTORRENT_VERSION_TAG }}
|
||||
cmake \
|
||||
-B build \
|
||||
-G "Ninja" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-Ddeprecated-functions=OFF
|
||||
cmake --build build
|
||||
sudo cmake --install build --prefix /usr/local
|
||||
|
||||
- name: Download Coverity Build Tool
|
||||
run: |
|
||||
wget \
|
||||
-q \
|
||||
https://scan.coverity.com/download/linux64 \
|
||||
--post-data "token=$TOKEN&project=qbittorrent%2FqBittorrent" \
|
||||
-O coverity_tool.tgz
|
||||
mkdir coverity_tool
|
||||
tar xzf coverity_tool.tgz --strip 1 -C coverity_tool
|
||||
env:
|
||||
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||
|
||||
- name: Configure qBittorrent
|
||||
run: |
|
||||
cmake \
|
||||
-B build \
|
||||
-G "Ninja" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DGUI=ON \
|
||||
-DVERBOSE_CONFIGURE=ON
|
||||
|
||||
- name: Build qBittorrent
|
||||
run: |
|
||||
export PATH="$(pwd)/coverity_tool/bin:$PATH"
|
||||
cov-build --dir cov-int cmake --build build
|
||||
|
||||
- name: Submit the result to Coverity Scan
|
||||
run: |
|
||||
tar caf qbittorrent.xz cov-int
|
||||
curl \
|
||||
--form token=$TOKEN \
|
||||
--form email=sledgehammer999@qbittorrent.org \
|
||||
--form file=@qbittorrent.tgz \
|
||||
--form version="$(git rev-parse --short HEAD)" \
|
||||
--form description="master" \
|
||||
https://scan.coverity.com/builds?project=qbittorrent%2FqBittorrent
|
||||
env:
|
||||
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||
4
.github/workflows/file_health.sh
vendored
4
.github/workflows/file_health.sh
vendored
@@ -11,9 +11,9 @@ regressions=0
|
||||
# exclusions (these are just grep extended regular expressions to match against paths relative to the root of the repository)
|
||||
exclusions_nonutf8='(.*(7z|gif|ic(ns|o)|png|qm|zip))'
|
||||
exclusions_bom='src/base/unicodestrings.h'
|
||||
exclusions_tw='(*.ts)|src/webui/www/private/scripts/lib/mootools-1.2-more.js'
|
||||
exclusions_tw='(*.ts)|src/webui/www/private/scripts/lib/*'
|
||||
exclusions_trailing_newline='configure'
|
||||
exclusions_no_lf='(*.ts)|(.*svg)|compile_commands.json|src/webui/www/private/scripts/lib/mootools-1.2-(core-yc.js|more.js)'
|
||||
exclusions_no_lf='(*.ts)|(.*svg)|compile_commands.json|src/webui/www/private/scripts/lib/*'
|
||||
|
||||
echo -e "\n*** Detect files not encoded in UTF-8 ***\n"
|
||||
|
||||
|
||||
22
.github/workflows/file_health.yaml
vendored
22
.github/workflows/file_health.yaml
vendored
@@ -1,22 +0,0 @@
|
||||
name: GitHub Actions file health check
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
check_file_health:
|
||||
name: Check file health
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install zsh
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install zsh
|
||||
|
||||
- name: run check file health script
|
||||
run: |
|
||||
./.github/workflows/file_health.sh
|
||||
22
.github/workflows/stale_bot.yaml
vendored
Normal file
22
.github/workflows/stale_bot.yaml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: Stale bot
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Mark and close stale PRs
|
||||
uses: actions/stale@v4
|
||||
with:
|
||||
stale-pr-message: "This PR is stale because it has been 60 days with no activity. This PR will be automatically closed within 7 days if there is no further activity."
|
||||
close-pr-message: "This PR was closed because it has been stalled for some time with no activity."
|
||||
days-before-stale: -1 # avoid marking issues
|
||||
days-before-pr-stale: 60
|
||||
days-before-close: -1 # avoid closing issues
|
||||
days-before-pr-close: 7
|
||||
exempt-all-pr-assignees: true # avoid stale for all PR with assignees
|
||||
exempt-all-pr-milestones: true # avoid stale for all PR with milestones
|
||||
operations-per-run: 200
|
||||
31
.github/workflows/webui_ci.yaml
vendored
31
.github/workflows/webui_ci.yaml
vendored
@@ -1,31 +0,0 @@
|
||||
name: WebUI CI
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
check_webui:
|
||||
name: Check WebUI
|
||||
runs-on: ubuntu-20.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: src/webui/www
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: setup nodejs
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
|
||||
- name: install tools
|
||||
run: npm install
|
||||
|
||||
- name: lint code
|
||||
run: npm run lint
|
||||
|
||||
- name: format code
|
||||
run: |
|
||||
npm run format
|
||||
git diff --exit-code
|
||||
@@ -10,11 +10,12 @@ project(qBittorrent
|
||||
|
||||
# use CONFIG mode first in find_package
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
# version requirements - older vesions may work, but you are on your own
|
||||
# version requirements - older versions may work, but you are on your own
|
||||
set(minBoostVersion 1.65)
|
||||
set(minQtVersion 5.11)
|
||||
set(minQtVersion 5.15.2)
|
||||
set(minOpenSSLVersion 1.1.1)
|
||||
set(minLibtorrentVersion 1.2.12)
|
||||
set(minLibtorrent1Version 1.2.14)
|
||||
set(minLibtorrentVersion 2.0.4)
|
||||
set(minZlibVersion 1.2.11)
|
||||
|
||||
# features (some are platform-specific)
|
||||
|
||||
65
COPYING
65
COPYING
@@ -18,8 +18,8 @@ See also the AUTHORS file
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -32,7 +32,7 @@ software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
@@ -295,3 +295,62 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
||||
150
Changelog
150
Changelog
@@ -1,150 +1,6 @@
|
||||
Tue Aug 03 2021 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.3.7
|
||||
- BUGFIX: Don't forget to start Watched folders timer (glassez)
|
||||
- BUGFIX: Don't close tags menu when toggling items (tgregerson)
|
||||
- BUGFIX: Don't overwrite tracker message (glassez)
|
||||
- BUGFIX: Bump file pool size (#14966) (An0n)
|
||||
- BUGFIX: Properly create "clean path" for watched folder (glassez)
|
||||
- WEBUI: Disconnect comment links (Daniel Aleksandersen)
|
||||
- WINDOWS: NSIS: Update Danish translation (scootergrisen)
|
||||
|
||||
Sat Jun 26 2021 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.3.6
|
||||
- FEATURE: New languages: Mongolian, Persian, Thai
|
||||
- BUGFIX: Provide correct error description in "upload mode" (glassez)
|
||||
- BUGFIX: Allow adding torrents with relative save path (glassez)
|
||||
- BUGFIX: Fix main window turns blank after restoring from tray (#15031) (Chocobo1)
|
||||
- BUGFIX: Remove the lockfile on exit (#14997) (brvphoenix)
|
||||
- BUGFIX: Improve "Watched folders" feature (glassez)
|
||||
- BUGFIX: Keep sub-sorting order (#15074) (Dmitry Khlestkov)
|
||||
- BUGFIX: Properly add torrent with new tags (glassez)
|
||||
- WINDOWS: NSIS: Update Japanese, Turkish, Hungarian, Swedish translation (maboroshin, Burak Yavuz, xkrstudio, nonew-star)
|
||||
|
||||
Sun May 02 2021 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.3.5
|
||||
- BUGFIX: Move cursor to the end when autofilling URL/hash in "Download from URLs" dialog (Chocobo1)
|
||||
- BUGFIX: Sort invalid QDateTime values after valid values (Chocobo1)
|
||||
- BUGFIX: Fix tabChangesFocus attribute in "Edit trackers" dialog (Christoph Rackwitz)
|
||||
- BUGFIX: Update DynDNS register url (zhuangzi926)
|
||||
- BUGFIX: Handle "not enough disk space" error more graciously (glassez)
|
||||
- BUGFIX: Correctly draw progress background with stylesheet (jagannatharjun)
|
||||
- WEBUI: Fix magnet url from the search facility (Chocobo1)
|
||||
- WEBUI: Revise folder monitoring functions (Chocobo1)
|
||||
- WEBUI: Fix magnet url from the browser (brvphoenix)
|
||||
- WEBUI: Allow to specify file indexes in torrents/files API (glassez)
|
||||
- WINDOWS: NSIS: Allow more strings to translated (bovirus, Chocobo1)
|
||||
- WINDOWS: NSIS: Update Italian, German, Estonian, Russian, PortugueseBR translations (bovirus, Henry Water, PriitUring, Долматов Алексей, Felipe)
|
||||
- LINUX: Fix D-Bus Notification `desktop-entry` field (Chocobo1)
|
||||
- MACOS: Don't use executable name as CFBundleName value (Nick Korotysh)
|
||||
- OTHER: Lower Qt requirement to 5.11 (sledgehammer999)
|
||||
- OTHER: Clarify that the license is GPLv2+ (sledgehammer999)
|
||||
|
||||
Wed Mar 24 2021 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.3.4.1
|
||||
- BUGFIX: Correctly draw progress bar (glassez)
|
||||
- WEBUI: Fix javascript code which broke the UI (Chocobo1)
|
||||
|
||||
Tue Mar 23 2021 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.3.4
|
||||
- FEATURE: Add ability to prioritize selected items by shown file order (Chocobo1)
|
||||
- FEATURE: Allow tab to escape the text box in "Edit trackers" dialog (Christoph Rackwitz)
|
||||
- FEATURE: Support sub-sorting in Transferlist (jagannatharjun)
|
||||
- FEATURE: Expose ToS setting from libtorrent (Chocobo1)
|
||||
- FEATURE: Improve tracker entries handling (glassez)
|
||||
- BUGFIX: Drop extension from generated content folder name (glassez)
|
||||
- BUGFIX: Change qBittorrent Updater window title (xavier2k6)
|
||||
- BUGFIX: Validate HTTPS Tracker Certificate by default (an0n666)
|
||||
- BUGFIX: Don't let "program update" dialog steal focus (Chocobo1)
|
||||
- BUGFIX: Disable expand on double click in TorrentContentTreeView (jagannatharjun)
|
||||
- BUGFIX: Add hyperlink to Transifex on translator list (Si Yong Kim)
|
||||
- BUGFIX: Enlarge "speed limit" icon slightly (Chocobo1)
|
||||
- BUGFIX: Don't prevent system sleep due to errored torrents (dyumin)
|
||||
- BUGFIX: Use stable sorting in transfer list (Chocobo1)
|
||||
- BUGFIX: Allow "missing files" torrents to save more resume data (glassez)
|
||||
- BUGFIX: Restart "missing files" torrents after changing location (glassez)
|
||||
- BUGFIX: Show proper string when torrent availability is not available (Chocobo1)
|
||||
- BUGFIX: Apply "Hide zero/infinity values" to "Time Active", "Down/Up Limit" and ETA columns (Chocobo1)
|
||||
- BUGFIX: Fix potential out-of-bounds access (Chocobo1)
|
||||
- BUGFIX: Make SpeedPlotView averager time aware (jagannatharjun)
|
||||
- BUGFIX: Add a 3-Hour graph (jagannatharjun)
|
||||
- BUGFIX: Add an option to disable icons in menus (always disabled on MacOS) (Michał Kopeć)
|
||||
- BUGFIX: Improve detection of filename extension of audio/video files (Chocobo1)
|
||||
- BUGFIX: Various drawing improvements of progress bar (Chocobo1)
|
||||
- BUGFIX: Properly stop torrent creation if aborted (Chocobo1)
|
||||
- BUGFIX: Replace external program parameters in one step (Chocobo1)
|
||||
- BUGFIX: Improve "save resume data" handling (glassez)
|
||||
- BUGFIX: Fix bad IPv6 address format for outgoingInterfaces (treysis)
|
||||
- WEBUI: Properly decode strings (brvphoenix)
|
||||
- WEBUI: Accept "share limits" when adding torrent using WebAPI (glassez)
|
||||
- WEBUI: Add seeding time to the active time column (thalieht)
|
||||
- WEBUI: Fix incorrect seeding time string in General tab (thalieht)
|
||||
- WEBUI: Allow >100 days in WebUI function "friendlyDuration" (thalieht)
|
||||
- WEBUI: Avoid decoding strings repeatedly (brvphoenix)
|
||||
- RSS: Add category button on AutomatedRSSDownloader on GUI (Si Yong Kim)
|
||||
- WINDOWS: NSIS: Update Czech translation (slrslr)
|
||||
- WINDOWS: NSIS: Update Portuguese BR translation (Alex)
|
||||
- WINDOWS: NSIS: Add Estonian translation (PriitUring)
|
||||
- WINDOWS: Allow change-case-only file renaming (glassez)
|
||||
- LINUX: Systemd: wait for mounting of local filesystems (Juraj Oršulić)
|
||||
- OTHER: Raise minimum libtorrent version to 1.2.12 (glassez)
|
||||
- OTHER: Raise minimum Qt version to 5.12 (glassez)
|
||||
|
||||
Tue Jan 19 2021 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.3.3
|
||||
- FEATURE: New languages: Azerbaijani, Estonian
|
||||
- BUGFIX: Unify global speed dialogs for normal/alternative speeds (thalieht)
|
||||
- BUGFIX: Increase maximum global speed limits ~2 GiB/s (thalieht)
|
||||
- BUGFIX: Save fastresume when setting torrent speed limits (thalieht)
|
||||
- BUGFIX: Group several torrent options into one dialog (thalieht)
|
||||
- BUGFIX: Capitalize locale names (Chocobo1)
|
||||
- BUGFIX: Improve content file/folder names handling (glassez)
|
||||
- BUGFIX: Drop notification about move storage finished or failed (glassez)
|
||||
- BUGFIX: Reload "missing files" torrent instead of re-checking (glassez)
|
||||
- BUGFIX: Remember dialog sizes (Chocobo1)
|
||||
- BUGFIX: Improve detection of file extension string (Chocobo1)
|
||||
- WEBUI: Don't call non-existent elements (glassez)
|
||||
- WEBUI: Update "Keep top-level folder" in WebUI options (thalieht)
|
||||
- MACOS: QMake: Raise minimal macOS target version to 10.14 (glassez)
|
||||
- LINUX: Use legacy 'data' directory only as a fallback (lbilli)
|
||||
- OTHER: Bump project requirement to C++17 (Chocobo1)
|
||||
|
||||
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)
|
||||
- FEATURE: Add Latgalian translation (sledgehammer999)
|
||||
- BUGFIX: Prevent resume data to be saved for removed torrent (glassez)
|
||||
- BUGFIX: Clarify connection protocol choice label (FranciscoPombal)
|
||||
- BUGFIX: Fix crash when clicked outside the table of torrent content view (jagannatharjun)
|
||||
- BUGFIX: Don't resume "paused" torrents when put into "checking" state by libtorrent (glassez)
|
||||
- BUGFIX: Fix torrent state calculation (glassez)
|
||||
- BUGFIX: Align integer data to right in torrent content view (jagannatharjun)
|
||||
- WEBUI: Place WebUI RSS description in sandboxed iframe (Sepro)
|
||||
- WEBUI: Avoid settings being reset via WebAPI (Chocobo1)
|
||||
- WEBUI: Fix toggling advanced option in WebUI (thalieht)
|
||||
- WEBUI: Expose contentPath in WebAPI torrents/info (FranciscoPombal)
|
||||
- WEBUI: Fix the issue that IPv6 address can't be banned (brvphoenix)
|
||||
- RSS: Fix confusion in date format description (Thomas De Rocker)
|
||||
- WINDOWS: Update dutch.nsi (Thomas De Rocker)
|
||||
- LINUX: Update .desktop file translations (sledgehammer999)
|
||||
|
||||
Thu Oct 22 2020 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.3.0.1
|
||||
- WINDOWS: NSIS: Update Italian translation (bovirus)
|
||||
Unreleased - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.4.0
|
||||
- FEATURE: Add support for creating v2 torrents(requires libtorrent 2.0.x) (Chocobo1)
|
||||
- FEATURE: Expose libtorrent hashing_threads settings (Anton Bershanskiy)
|
||||
|
||||
Sun Oct 18 2020 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.3.0
|
||||
- FEATURE: Many UI elements colors are themeable now (jagannatharjun)
|
||||
|
||||
14
INSTALL
14
INSTALL
@@ -5,20 +5,22 @@ qBittorrent - A BitTorrent client in C++ / Qt
|
||||
|
||||
- Boost >= 1.65
|
||||
|
||||
- libtorrent-rasterbar >= 1.2.12 (by Arvid Norberg)
|
||||
* https://www.libtorrent.org/
|
||||
- libtorrent-rasterbar 1.2.14 - 1.2.x || 2.0.4 - 2.0.x
|
||||
* By Arvid Norberg, https://www.libtorrent.org/
|
||||
* Be careful: another library (the one used by rTorrent) uses a similar name
|
||||
|
||||
- OpenSSL >= 1.1.1
|
||||
|
||||
- Qt >= 5.12
|
||||
- Qt 5.15.2 - 5.x
|
||||
|
||||
- zlib >= 1.2.11
|
||||
|
||||
- pkg-config (compile-time only on *nix systems)
|
||||
- pkg-config *
|
||||
* Compile-time only on *nix systems
|
||||
|
||||
- Python >= 3.5.0 (optional, runtime only)
|
||||
* Required by the internal search engine
|
||||
- Python >= 3.5.0
|
||||
* Optional, run-time only
|
||||
* Used by the bundled 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.
|
||||
|
||||
@@ -45,8 +45,8 @@ http://forum.qbittorrent.org
|
||||
Please report any bug (or feature request) to:
|
||||
http://bugs.qbittorrent.org
|
||||
|
||||
You can also meet me (sledgehammer_999) on IRC:
|
||||
`#qbittorrent on irc.freenode.net`
|
||||
Official IRC channel:
|
||||
`#qbittorrent on irc.libera.chat`
|
||||
|
||||
------------------------------------------
|
||||
sledgehammer999 <sledgehammer999@qbittorrent.org>
|
||||
|
||||
@@ -17,7 +17,7 @@ macro(qbt_common_config)
|
||||
)
|
||||
|
||||
target_compile_definitions(qbt_common_cfg INTERFACE
|
||||
QT_DEPRECATED_WARNINGS
|
||||
QT_DISABLE_DEPRECATED_BEFORE=0x050f02
|
||||
QT_NO_CAST_TO_ASCII
|
||||
QT_NO_CAST_FROM_BYTEARRAY
|
||||
QT_USE_QSTRINGBUILDER
|
||||
@@ -37,7 +37,7 @@ macro(qbt_common_config)
|
||||
)
|
||||
endif()
|
||||
|
||||
if ((CXX_COMPILER_ID STREQUAL "GNU") OR (CXX_COMPILER_ID STREQUAL "Clang") OR (CXX_COMPILER_ID STREQUAL "AppleClang"))
|
||||
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
|
||||
target_compile_options(qbt_common_cfg INTERFACE
|
||||
-Wall
|
||||
-Wextra
|
||||
@@ -59,7 +59,7 @@ macro(qbt_common_config)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if ((CXX_COMPILER_ID STREQUAL "Clang") OR (CXX_COMPILER_ID STREQUAL "AppleClang"))
|
||||
if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
|
||||
target_compile_options(qbt_common_cfg INTERFACE
|
||||
-Wno-range-loop-analysis
|
||||
)
|
||||
@@ -79,6 +79,8 @@ macro(qbt_common_config)
|
||||
target_compile_options(qbt_common_cfg INTERFACE
|
||||
/guard:cf
|
||||
/utf-8
|
||||
# https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
|
||||
/Zc:__cplusplus
|
||||
)
|
||||
target_link_options(qbt_common_cfg INTERFACE
|
||||
/guard:cf
|
||||
@@ -88,4 +90,7 @@ macro(qbt_common_config)
|
||||
)
|
||||
endif()
|
||||
|
||||
if (LibtorrentRasterbar_VERSION VERSION_GREATER_EQUAL ${minLibtorrentVersion})
|
||||
target_compile_definitions(qbt_common_cfg INTERFACE QBT_USES_LIBTORRENT2)
|
||||
endif()
|
||||
endmacro(qbt_common_config)
|
||||
|
||||
@@ -45,6 +45,9 @@ DEFINES += BOOST_SYSTEM_STATIC_LINK
|
||||
# Enable if linking dynamically against libtorrent
|
||||
#DEFINES += TORRENT_LINKING_SHARED
|
||||
|
||||
# Enable this if compiling with libtorrent 2.x
|
||||
#DEFINES += QBT_USES_LIBTORRENT2
|
||||
|
||||
# Enable stack trace support
|
||||
CONFIG += stacktrace
|
||||
|
||||
|
||||
19
configure.ac
19
configure.ac
@@ -1,4 +1,5 @@
|
||||
AC_INIT([qbittorrent], [v4.3.7], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
|
||||
|
||||
AC_INIT([qbittorrent], [v4.4.0alpha], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
: ${CFLAGS=""}
|
||||
@@ -141,7 +142,7 @@ AS_IF([test "x$QT_QMAKE" = "x"],
|
||||
[AC_MSG_ERROR([Could not find qmake])
|
||||
])
|
||||
AS_IF([test "x$enable_gui" = "xyes"],
|
||||
[PKG_CHECK_MODULES(Qt5Svg, [Qt5Svg >= 5.11])
|
||||
[PKG_CHECK_MODULES(Qt5Svg, [Qt5Svg >= 5.15.2])
|
||||
])
|
||||
AC_MSG_CHECKING([whether QtDBus should be enabled])
|
||||
AS_CASE(["x$enable_qt_dbus"],
|
||||
@@ -175,14 +176,12 @@ m4_define([DETECT_BOOST_VERSION_PROGRAM],
|
||||
AC_COMPILE_IFELSE([DETECT_BOOST_VERSION_PROGRAM(106000)], [],
|
||||
[QBT_ADD_DEFINES="$QBT_ADD_DEFINES BOOST_NO_CXX11_RVALUE_REFERENCES"])
|
||||
|
||||
AX_BOOST_SYSTEM()
|
||||
AC_MSG_NOTICE([Boost.System LIB: "$BOOST_SYSTEM_LIB"])
|
||||
LIBS="$BOOST_SYSTEM_LIB $LIBS"
|
||||
|
||||
PKG_CHECK_MODULES(libtorrent,
|
||||
[libtorrent-rasterbar >= 1.2.12],
|
||||
[CXXFLAGS="$libtorrent_CFLAGS $CXXFLAGS"
|
||||
LIBS="$libtorrent_LIBS $LIBS"])
|
||||
[libtorrent-rasterbar >= 2.0.4],
|
||||
[CXXFLAGS="$libtorrent_CFLAGS $CXXFLAGS" LIBS="$libtorrent_LIBS $LIBS" QBT_ADD_DEFINES="$QBT_ADD_DEFINES QBT_USES_LIBTORRENT2"],
|
||||
[PKG_CHECK_MODULES(libtorrent,
|
||||
[libtorrent-rasterbar >= 1.2.14 libtorrent-rasterbar < 2],
|
||||
[CXXFLAGS="$libtorrent_CFLAGS $CXXFLAGS" LIBS="$libtorrent_LIBS $LIBS"])])
|
||||
|
||||
PKG_CHECK_MODULES(openssl,
|
||||
[openssl >= 1.1.1],
|
||||
@@ -216,7 +215,7 @@ AS_IF([test "x$QBT_CXX17_FOUND" = "xno"],
|
||||
CXXFLAGS="-std=c++17 $TMP_CXXFLAGS"
|
||||
AC_COMPILE_IFELSE([DETECT_CPP17_PROGRAM()],
|
||||
[AC_MSG_RESULT([no])
|
||||
QBT_ADD_CONFIG="$QBT_ADD_CONFIG c++1z"
|
||||
QBT_ADD_CONFIG="$QBT_ADD_CONFIG c++17"
|
||||
AC_MSG_WARN([C++17 mode is now force enabled. The C++ mode should match the mode that other libraries were built with, otherwise you'll likely get linking errors.])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_MSG_ERROR([The compiler supports C++17 but the user or a dependency has explicitly enabled a lower mode.])])],
|
||||
|
||||
2
dist/mac/Info.plist
vendored
2
dist/mac/Info.plist
vendored
@@ -55,7 +55,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.3.7</string>
|
||||
<string>4.4.0</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
|
||||
BIN
dist/mac/qBitTorrentDocument.icns
vendored
BIN
dist/mac/qBitTorrentDocument.icns
vendored
Binary file not shown.
BIN
dist/mac/qbittorrent_mac.icns
vendored
BIN
dist/mac/qbittorrent_mac.icns
vendored
Binary file not shown.
11
dist/unix/CMakeLists.txt
vendored
11
dist/unix/CMakeLists.txt
vendored
@@ -30,12 +30,6 @@ install(FILES ${MAN_FILES}
|
||||
)
|
||||
|
||||
if (GUI)
|
||||
install(DIRECTORY menuicons/
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor
|
||||
COMPONENT data
|
||||
FILES_MATCHING PATTERN "*.png"
|
||||
)
|
||||
|
||||
install(FILES org.qbittorrent.qBittorrent.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/
|
||||
COMPONENT data
|
||||
@@ -46,6 +40,11 @@ if (GUI)
|
||||
COMPONENT data
|
||||
)
|
||||
|
||||
install(DIRECTORY menuicons/
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor
|
||||
COMPONENT data
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${PROJECT_SOURCE_DIR}/src/icons/qbittorrent-tray.svg
|
||||
${PROJECT_SOURCE_DIR}/src/icons/qbittorrent-tray-dark.svg
|
||||
|
||||
16
dist/unix/menuicons/scalable/apps/qbittorrent.svg
vendored
Normal file
16
dist/unix/menuicons/scalable/apps/qbittorrent.svg
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
|
||||
<title>
|
||||
qbittorrent-new-light
|
||||
</title>
|
||||
<defs>
|
||||
<linearGradient x1="34.012%" y1="0%" x2="76.373%" y2="76.805%" id="a">
|
||||
<stop stop-color="#72B4F5" offset="0%"/>
|
||||
<stop stop-color="#356EBF" offset="100%"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<circle stroke="#DAEFFF" stroke-width="32" fill="url(#a)" cx="512" cy="512" r="496"/>
|
||||
<path d="M712.898 332.399q66.657 0 103.38 45.671 37.03 45.364 37.03 128.684t-37.34 129.61q-37.03 45.98-103.07 45.98-33.02 0-60.484-12.035-27.156-12.344-45.672-37.649h-3.703l-10.8 43.512h-36.724V196h51.227v116.65q0 39.191-2.469 70.359h2.47q35.796-50.61 106.155-50.61zm-7.406 42.894q-52.46 0-75.605 30.242-23.145 29.934-23.145 101.219t23.762 102.145q23.761 30.55 76.222 30.55 47.215 0 70.36-34.254 23.144-34.562 23.144-99.058 0-66.04-23.144-98.442-23.145-32.402-71.594-32.402z" fill="#fff"/>
|
||||
<path d="M317.273 639.45q51.227 0 74.68-27.466 23.453-27.464 24.996-92.578v-11.418q0-70.976-24.07-102.144-24.07-31.168-76.223-31.168-45.055 0-69.125 35.18-23.762 34.87-23.762 98.75 0 63.879 23.454 97.515 23.761 33.328 70.05 33.328zm-7.715 42.894q-65.421 0-102.144-45.98-36.723-45.981-36.723-128.376 0-83.011 37.032-129.609 37.03-46.598 103.07-46.598 69.433 0 106.773 52.461h2.778l7.406-46.289h40.426V828h-51.227V683.27q0-30.86 3.395-52.461h-4.012q-35.488 51.535-106.774 51.535z" fill="#c8e8ff"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -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.7" date="2021-08-03"/>
|
||||
<release version="4.4.0" date="2020-10-18"/>
|
||||
</releases>
|
||||
</component>
|
||||
|
||||
54
dist/windows/installer-translations/polish.nsi
vendored
54
dist/windows/installer-translations/polish.nsi
vendored
@@ -1,60 +1,60 @@
|
||||
;Installer strings
|
||||
|
||||
;LangString inst_qbt_req ${LANG_ENGLISH} "qBittorrent (required)"
|
||||
LangString inst_qbt_req ${LANG_POLISH} "qBittorrent (required)"
|
||||
LangString inst_qbt_req ${LANG_POLISH} "qBittorrent (wymagany)"
|
||||
;LangString inst_dekstop ${LANG_ENGLISH} "Create Desktop Shortcut"
|
||||
LangString inst_dekstop ${LANG_POLISH} "Create Desktop Shortcut"
|
||||
LangString inst_dekstop ${LANG_POLISH} "Utwórz skrót na pulpicie"
|
||||
;LangString inst_startmenu ${LANG_ENGLISH} "Create Start Menu Shortcut"
|
||||
LangString inst_startmenu ${LANG_POLISH} "Create Start Menu Shortcut"
|
||||
LangString inst_startmenu ${LANG_POLISH} "Utwórz skrót w menu Start"
|
||||
;LangString inst_startup ${LANG_ENGLISH} "Start qBittorrent on Windows start up"
|
||||
LangString inst_startup ${LANG_POLISH} "Start qBittorrent on Windows start up"
|
||||
LangString inst_startup ${LANG_POLISH} "Uruchamiaj qBittorrent wraz z systemem Windows"
|
||||
;LangString inst_torrent ${LANG_ENGLISH} "Open .torrent files with qBittorrent"
|
||||
LangString inst_torrent ${LANG_POLISH} "Open .torrent files with qBittorrent"
|
||||
LangString inst_torrent ${LANG_POLISH} "Otwieraj pliki .torrent za pomocą qBittorrent"
|
||||
;LangString inst_magnet ${LANG_ENGLISH} "Open magnet links with qBittorrent"
|
||||
LangString inst_magnet ${LANG_POLISH} "Open magnet links with qBittorrent"
|
||||
LangString inst_magnet ${LANG_POLISH} "Otwieraj odnośniki magnet za pomocą qBittorrent"
|
||||
;LangString inst_firewall ${LANG_ENGLISH} "Add Windows Firewall rule"
|
||||
LangString inst_firewall ${LANG_POLISH} "Add Windows Firewall rule"
|
||||
LangString inst_firewall ${LANG_POLISH} "Dodaj regułę Zapory systemu 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_POLISH} "Disable Windows path length limit (260 character MAX_PATH limitation, requires Windows 10 1607 or later)"
|
||||
LangString inst_pathlimit ${LANG_POLISH} "Wyłącz ograniczenie długości ścieżki systemu Windows (ograniczenie MAX_PATH do 260 znaków, wymaga systemu Windows 10 1607 lub nowszego)"
|
||||
;LangString inst_firewallinfo ${LANG_ENGLISH} "Adding Windows Firewall rule"
|
||||
LangString inst_firewallinfo ${LANG_POLISH} "Adding Windows Firewall rule"
|
||||
LangString inst_firewallinfo ${LANG_POLISH} "Dodawanie reguły Zapory systemu Windows"
|
||||
;LangString inst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before installing."
|
||||
LangString inst_warning ${LANG_POLISH} "qBittorrent is running. Please close the application before installing."
|
||||
LangString inst_warning ${LANG_POLISH} "qBittorrent jest uruchomiony. Proszę zamknąć aplikację przed instalacją."
|
||||
;LangString inst_uninstall_question ${LANG_ENGLISH} "Current version will be uninstalled. User settings and torrents will remain intact."
|
||||
LangString inst_uninstall_question ${LANG_POLISH} "Current version will be uninstalled. User settings and torrents will remain intact."
|
||||
LangString inst_uninstall_question ${LANG_POLISH} "Obecna wersja zostanie odinstalowana. Ustawienia użytkownika i torrenty pozostaną nienaruszone."
|
||||
;LangString inst_unist ${LANG_ENGLISH} "Uninstalling previous version."
|
||||
LangString inst_unist ${LANG_POLISH} "Uninstalling previous version."
|
||||
LangString inst_unist ${LANG_POLISH} "Odinstalowywanie poprzedniej wersji."
|
||||
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
|
||||
LangString launch_qbt ${LANG_POLISH} "Launch qBittorrent."
|
||||
LangString launch_qbt ${LANG_POLISH} "Uruchom qBittorrent."
|
||||
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
|
||||
LangString inst_requires_64bit ${LANG_POLISH} "This installer works only in 64-bit Windows versions."
|
||||
LangString inst_requires_64bit ${LANG_POLISH} "Ten instalator działa tylko w 64-bitowych wersjach systemu Windows."
|
||||
;LangString inst_requires_win7 ${LANG_ENGLISH} "This qBittorrent version requires at least Windows 7."
|
||||
LangString inst_requires_win7 ${LANG_POLISH} "This qBittorrent version requires at least Windows 7."
|
||||
LangString inst_requires_win7 ${LANG_POLISH} "Ta wersja qBittorrent wymaga co najmniej systemu Windows 7."
|
||||
;LangString inst_uninstall_link_description ${LANG_ENGLISH} "Uninstall qBittorrent"
|
||||
LangString inst_uninstall_link_description ${LANG_POLISH} "Uninstall qBittorrent"
|
||||
LangString inst_uninstall_link_description ${LANG_POLISH} "Odinstaluj qBittorrent"
|
||||
|
||||
;------------------------------------
|
||||
;Uninstaller strings
|
||||
|
||||
;LangString remove_files ${LANG_ENGLISH} "Remove files"
|
||||
LangString remove_files ${LANG_POLISH} "Remove files"
|
||||
LangString remove_files ${LANG_POLISH} "Usuń pliki"
|
||||
;LangString remove_shortcuts ${LANG_ENGLISH} "Remove shortcuts"
|
||||
LangString remove_shortcuts ${LANG_POLISH} "Remove shortcuts"
|
||||
LangString remove_shortcuts ${LANG_POLISH} "Usuń skróty"
|
||||
;LangString remove_associations ${LANG_ENGLISH} "Remove file associations"
|
||||
LangString remove_associations ${LANG_POLISH} "Remove file associations"
|
||||
LangString remove_associations ${LANG_POLISH} "Usuń skojarzenia plików"
|
||||
;LangString remove_registry ${LANG_ENGLISH} "Remove registry keys"
|
||||
LangString remove_registry ${LANG_POLISH} "Remove registry keys"
|
||||
LangString remove_registry ${LANG_POLISH} "Usuń klucze rejestru"
|
||||
;LangString remove_conf ${LANG_ENGLISH} "Remove configuration files"
|
||||
LangString remove_conf ${LANG_POLISH} "Remove configuration files"
|
||||
LangString remove_conf ${LANG_POLISH} "Usuń pliki konfiguracyjne"
|
||||
;LangString remove_firewall ${LANG_ENGLISH} "Remove Windows Firewall rule"
|
||||
LangString remove_firewall ${LANG_POLISH} "Remove Windows Firewall rule"
|
||||
LangString remove_firewall ${LANG_POLISH} "Usuń regułę Zapory systemu Windows"
|
||||
;LangString remove_firewallinfo ${LANG_ENGLISH} "Removing Windows Firewall rule"
|
||||
LangString remove_firewallinfo ${LANG_POLISH} "Removing Windows Firewall rule"
|
||||
LangString remove_firewallinfo ${LANG_POLISH} "Usuwanie reguły Zapory systemu Windows"
|
||||
;LangString remove_cache ${LANG_ENGLISH} "Remove torrents and cached data"
|
||||
LangString remove_cache ${LANG_POLISH} "Remove torrents and cached data"
|
||||
LangString remove_cache ${LANG_POLISH} "Usuń torrenty i dane z pamięci podręcznej"
|
||||
;LangString uninst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before uninstalling."
|
||||
LangString uninst_warning ${LANG_POLISH} "qBittorrent is running. Please close the application before uninstalling."
|
||||
LangString uninst_warning ${LANG_POLISH} "qBittorrent jest uruchomiony. Zamknij aplikację przed odinstalowaniem."
|
||||
;LangString uninst_tor_warn ${LANG_ENGLISH} "Not removing .torrent association. It is associated with:"
|
||||
LangString uninst_tor_warn ${LANG_POLISH} "Not removing .torrent association. It is associated with:"
|
||||
LangString uninst_tor_warn ${LANG_POLISH} "Bez usuwania skojarzenia .torrent. Skojarzono z:"
|
||||
;LangString uninst_mag_warn ${LANG_ENGLISH} "Not removing magnet association. It is associated with:"
|
||||
LangString uninst_mag_warn ${LANG_POLISH} "Not removing magnet association. It is associated with:"
|
||||
LangString uninst_mag_warn ${LANG_POLISH} "Bez usuwania skojarzenia magnet. Skojarzono z:"
|
||||
|
||||
2
dist/windows/options.nsi
vendored
2
dist/windows/options.nsi
vendored
@@ -28,7 +28,7 @@ XPStyle on
|
||||
!define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
|
||||
|
||||
; Program specific
|
||||
!define PROG_VERSION "4.3.7"
|
||||
!define PROG_VERSION "4.4.0"
|
||||
|
||||
!define MUI_FINISHPAGE_RUN
|
||||
!define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_boost_system.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_BOOST_SYSTEM
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Test for System library from the Boost C++ libraries. The macro requires
|
||||
# a preceding call to AX_BOOST_BASE. Further documentation is available at
|
||||
# <http://randspringer.de/boost/index.html>.
|
||||
#
|
||||
# This macro calls:
|
||||
#
|
||||
# AC_SUBST(BOOST_SYSTEM_LIB)
|
||||
#
|
||||
# And sets:
|
||||
#
|
||||
# HAVE_BOOST_SYSTEM
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
|
||||
# Copyright (c) 2008 Michael Tindal
|
||||
# Copyright (c) 2008 Daniel Casimiro <dan.casimiro@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 20
|
||||
|
||||
AC_DEFUN([AX_BOOST_SYSTEM],
|
||||
[
|
||||
AC_ARG_WITH([boost-system],
|
||||
AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@],
|
||||
[use the System library from boost - it is possible to specify a certain library for the linker
|
||||
e.g. --with-boost-system=boost_system-gcc-mt ]),
|
||||
[
|
||||
if test "$withval" = "no"; then
|
||||
want_boost="no"
|
||||
elif test "$withval" = "yes"; then
|
||||
want_boost="yes"
|
||||
ax_boost_user_system_lib=""
|
||||
else
|
||||
want_boost="yes"
|
||||
ax_boost_user_system_lib="$withval"
|
||||
fi
|
||||
],
|
||||
[want_boost="yes"]
|
||||
)
|
||||
|
||||
if test "x$want_boost" = "xyes"; then
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])
|
||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
export CPPFLAGS
|
||||
|
||||
LDFLAGS_SAVED="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
||||
export LDFLAGS
|
||||
|
||||
AC_CACHE_CHECK(whether the Boost::System library is available,
|
||||
ax_cv_boost_system,
|
||||
[AC_LANG_PUSH([C++])
|
||||
CXXFLAGS_SAVE=$CXXFLAGS
|
||||
CXXFLAGS=
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/system/error_code.hpp>]],
|
||||
[[boost::system::error_category *a = 0;]])],
|
||||
ax_cv_boost_system=yes, ax_cv_boost_system=no)
|
||||
CXXFLAGS=$CXXFLAGS_SAVE
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
if test "x$ax_cv_boost_system" = "xyes"; then
|
||||
AC_SUBST(BOOST_CPPFLAGS)
|
||||
|
||||
AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available])
|
||||
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
|
||||
|
||||
LDFLAGS_SAVE=$LDFLAGS
|
||||
if test "x$ax_boost_user_system_lib" = "x"; then
|
||||
for libextension in `ls -r $BOOSTLIBDIR/libboost_system* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
|
||||
[link_system="no"])
|
||||
done
|
||||
if test "x$link_system" != "xyes"; then
|
||||
for libextension in `ls -r $BOOSTLIBDIR/boost_system* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
|
||||
[link_system="no"])
|
||||
done
|
||||
fi
|
||||
|
||||
else
|
||||
for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
|
||||
[link_system="no"])
|
||||
done
|
||||
|
||||
fi
|
||||
if test "x$ax_lib" = "x"; then
|
||||
AC_MSG_ERROR(Could not find a version of the Boost::System library!)
|
||||
fi
|
||||
if test "x$link_system" = "xno"; then
|
||||
AC_MSG_ERROR(Could not link against $ax_lib !)
|
||||
fi
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
fi
|
||||
])
|
||||
215
m4/pkg.m4
215
m4/pkg.m4
@@ -1,29 +1,60 @@
|
||||
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
||||
# serial 1 (pkg-config-0.24)
|
||||
#
|
||||
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
||||
#
|
||||
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
||||
# serial 12 (pkg-config-0.29.2)
|
||||
|
||||
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
||||
# ----------------------------------
|
||||
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
||||
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
|
||||
dnl
|
||||
dnl This program is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2 of the License, or
|
||||
dnl (at your option) any later version.
|
||||
dnl
|
||||
dnl This program is distributed in the hope that it will be useful, but
|
||||
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; if not, write to the Free Software
|
||||
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
dnl 02111-1307, USA.
|
||||
dnl
|
||||
dnl As a special exception to the GNU General Public License, if you
|
||||
dnl distribute this file as part of a program that contains a
|
||||
dnl configuration script generated by Autoconf, you may include it under
|
||||
dnl the same distribution terms that you use for the rest of that
|
||||
dnl program.
|
||||
|
||||
dnl PKG_PREREQ(MIN-VERSION)
|
||||
dnl -----------------------
|
||||
dnl Since: 0.29
|
||||
dnl
|
||||
dnl Verify that the version of the pkg-config macros are at least
|
||||
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
|
||||
dnl installed version of pkg-config, this checks the developer's version
|
||||
dnl of pkg.m4 when generating configure.
|
||||
dnl
|
||||
dnl To ensure that this macro is defined, also add:
|
||||
dnl m4_ifndef([PKG_PREREQ],
|
||||
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
|
||||
dnl
|
||||
dnl See the "Since" comment for each macro you use to see what version
|
||||
dnl of the macros you require.
|
||||
m4_defun([PKG_PREREQ],
|
||||
[m4_define([PKG_MACROS_VERSION], [0.29.2])
|
||||
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
||||
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
||||
])dnl PKG_PREREQ
|
||||
|
||||
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
||||
dnl ----------------------------------
|
||||
dnl Since: 0.16
|
||||
dnl
|
||||
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
|
||||
dnl first found in the path. Checks that the version of pkg-config found
|
||||
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
|
||||
dnl used since that's the first version where most current features of
|
||||
dnl pkg-config existed.
|
||||
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
||||
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
||||
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
||||
@@ -45,18 +76,19 @@ if test -n "$PKG_CONFIG"; then
|
||||
PKG_CONFIG=""
|
||||
fi
|
||||
fi[]dnl
|
||||
])# PKG_PROG_PKG_CONFIG
|
||||
])dnl PKG_PROG_PKG_CONFIG
|
||||
|
||||
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
#
|
||||
# Check to see whether a particular set of modules exists. Similar
|
||||
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
|
||||
#
|
||||
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
# only at the first occurence in configure.ac, so if the first place
|
||||
# it's called might be skipped (such as if it is within an "if", you
|
||||
# have to call PKG_CHECK_EXISTS manually
|
||||
# --------------------------------------------------------------
|
||||
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl -------------------------------------------------------------------
|
||||
dnl Since: 0.18
|
||||
dnl
|
||||
dnl Check to see whether a particular set of modules exists. Similar to
|
||||
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
|
||||
dnl
|
||||
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
dnl only at the first occurence in configure.ac, so if the first place
|
||||
dnl it's called might be skipped (such as if it is within an "if", you
|
||||
dnl have to call PKG_CHECK_EXISTS manually
|
||||
AC_DEFUN([PKG_CHECK_EXISTS],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
@@ -66,8 +98,10 @@ m4_ifvaln([$3], [else
|
||||
$3])dnl
|
||||
fi])
|
||||
|
||||
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
||||
# ---------------------------------------------
|
||||
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
||||
dnl ---------------------------------------------
|
||||
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
|
||||
dnl pkg_failed based on the result.
|
||||
m4_define([_PKG_CONFIG],
|
||||
[if test -n "$$1"; then
|
||||
pkg_cv_[]$1="$$1"
|
||||
@@ -79,10 +113,11 @@ m4_define([_PKG_CONFIG],
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi[]dnl
|
||||
])# _PKG_CONFIG
|
||||
])dnl _PKG_CONFIG
|
||||
|
||||
# _PKG_SHORT_ERRORS_SUPPORTED
|
||||
# -----------------------------
|
||||
dnl _PKG_SHORT_ERRORS_SUPPORTED
|
||||
dnl ---------------------------
|
||||
dnl Internal check to see if pkg-config supports short errors.
|
||||
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
@@ -90,26 +125,24 @@ if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
else
|
||||
_pkg_short_errors_supported=no
|
||||
fi[]dnl
|
||||
])# _PKG_SHORT_ERRORS_SUPPORTED
|
||||
])dnl _PKG_SHORT_ERRORS_SUPPORTED
|
||||
|
||||
|
||||
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
||||
# [ACTION-IF-NOT-FOUND])
|
||||
#
|
||||
#
|
||||
# Note that if there is a possibility the first call to
|
||||
# PKG_CHECK_MODULES might not happen, you should be sure to include an
|
||||
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
||||
#
|
||||
#
|
||||
# --------------------------------------------------------------
|
||||
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
||||
dnl [ACTION-IF-NOT-FOUND])
|
||||
dnl --------------------------------------------------------------
|
||||
dnl Since: 0.4.0
|
||||
dnl
|
||||
dnl Note that if there is a possibility the first call to
|
||||
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
|
||||
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
||||
AC_DEFUN([PKG_CHECK_MODULES],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
||||
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
||||
|
||||
pkg_failed=no
|
||||
AC_MSG_CHECKING([for $1])
|
||||
AC_MSG_CHECKING([for $2])
|
||||
|
||||
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
||||
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
||||
@@ -119,7 +152,7 @@ and $1[]_LIBS to avoid the need to call pkg-config.
|
||||
See the pkg-config man page for more details.])
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_RESULT([no])
|
||||
_PKG_SHORT_ERRORS_SUPPORTED
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
|
||||
@@ -140,7 +173,7 @@ installed software in a non-standard prefix.
|
||||
_PKG_TEXT])[]dnl
|
||||
])
|
||||
elif test $pkg_failed = untried; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_RESULT([no])
|
||||
m4_default([$4], [AC_MSG_FAILURE(
|
||||
[The pkg-config script could not be found or is too old. Make sure it
|
||||
is in your PATH or set the PKG_CONFIG environment variable to the full
|
||||
@@ -156,16 +189,40 @@ else
|
||||
AC_MSG_RESULT([yes])
|
||||
$3
|
||||
fi[]dnl
|
||||
])# PKG_CHECK_MODULES
|
||||
])dnl PKG_CHECK_MODULES
|
||||
|
||||
|
||||
# PKG_INSTALLDIR(DIRECTORY)
|
||||
# -------------------------
|
||||
# Substitutes the variable pkgconfigdir as the location where a module
|
||||
# should install pkg-config .pc files. By default the directory is
|
||||
# $libdir/pkgconfig, but the default can be changed by passing
|
||||
# DIRECTORY. The user can override through the --with-pkgconfigdir
|
||||
# parameter.
|
||||
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
||||
dnl [ACTION-IF-NOT-FOUND])
|
||||
dnl ---------------------------------------------------------------------
|
||||
dnl Since: 0.29
|
||||
dnl
|
||||
dnl Checks for existence of MODULES and gathers its build flags with
|
||||
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
|
||||
dnl and VARIABLE-PREFIX_LIBS from --libs.
|
||||
dnl
|
||||
dnl Note that if there is a possibility the first call to
|
||||
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
|
||||
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
|
||||
dnl configure.ac.
|
||||
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
_save_PKG_CONFIG=$PKG_CONFIG
|
||||
PKG_CONFIG="$PKG_CONFIG --static"
|
||||
PKG_CHECK_MODULES($@)
|
||||
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
|
||||
])dnl PKG_CHECK_MODULES_STATIC
|
||||
|
||||
|
||||
dnl PKG_INSTALLDIR([DIRECTORY])
|
||||
dnl -------------------------
|
||||
dnl Since: 0.27
|
||||
dnl
|
||||
dnl Substitutes the variable pkgconfigdir as the location where a module
|
||||
dnl should install pkg-config .pc files. By default the directory is
|
||||
dnl $libdir/pkgconfig, but the default can be changed by passing
|
||||
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
|
||||
dnl parameter.
|
||||
AC_DEFUN([PKG_INSTALLDIR],
|
||||
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
|
||||
m4_pushdef([pkg_description],
|
||||
@@ -176,16 +233,18 @@ AC_ARG_WITH([pkgconfigdir],
|
||||
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
|
||||
m4_popdef([pkg_default])
|
||||
m4_popdef([pkg_description])
|
||||
]) dnl PKG_INSTALLDIR
|
||||
])dnl PKG_INSTALLDIR
|
||||
|
||||
|
||||
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
|
||||
# -------------------------
|
||||
# Substitutes the variable noarch_pkgconfigdir as the location where a
|
||||
# module should install arch-independent pkg-config .pc files. By
|
||||
# default the directory is $datadir/pkgconfig, but the default can be
|
||||
# changed by passing DIRECTORY. The user can override through the
|
||||
# --with-noarch-pkgconfigdir parameter.
|
||||
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
|
||||
dnl --------------------------------
|
||||
dnl Since: 0.27
|
||||
dnl
|
||||
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
|
||||
dnl module should install arch-independent pkg-config .pc files. By
|
||||
dnl default the directory is $datadir/pkgconfig, but the default can be
|
||||
dnl changed by passing DIRECTORY. The user can override through the
|
||||
dnl --with-noarch-pkgconfigdir parameter.
|
||||
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
|
||||
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
|
||||
m4_pushdef([pkg_description],
|
||||
@@ -196,13 +255,15 @@ AC_ARG_WITH([noarch-pkgconfigdir],
|
||||
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
|
||||
m4_popdef([pkg_default])
|
||||
m4_popdef([pkg_description])
|
||||
]) dnl PKG_NOARCH_INSTALLDIR
|
||||
])dnl PKG_NOARCH_INSTALLDIR
|
||||
|
||||
|
||||
# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
|
||||
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
# -------------------------------------------
|
||||
# Retrieves the value of the pkg-config variable for the given module.
|
||||
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
|
||||
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl -------------------------------------------
|
||||
dnl Since: 0.28
|
||||
dnl
|
||||
dnl Retrieves the value of the pkg-config variable for the given module.
|
||||
AC_DEFUN([PKG_CHECK_VAR],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
|
||||
@@ -211,4 +272,4 @@ _PKG_CONFIG([$1], [variable="][$3]["], [$2])
|
||||
AS_VAR_COPY([$1], [pkg_cv_][$1])
|
||||
|
||||
AS_VAR_IF([$1], [""], [$5], [$4])dnl
|
||||
])# PKG_CHECK_VAR
|
||||
])dnl PKG_CHECK_VAR
|
||||
|
||||
@@ -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.11],
|
||||
[PKG_CHECK_EXISTS([Qt5Core >= 5.15.2],
|
||||
[PKG_CHECK_VAR(QT_QMAKE,
|
||||
[Qt5Core >= 5.11],
|
||||
[Qt5Core >= 5.15.2],
|
||||
[host_bins])
|
||||
])
|
||||
|
||||
@@ -18,7 +18,7 @@ AS_IF([test -f "$QT_QMAKE/qmake"],
|
||||
[QT_QMAKE=""])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for Qt5 qmake >= 5.11])
|
||||
AC_MSG_CHECKING([for Qt5 qmake >= 5.15.2])
|
||||
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.11])
|
||||
PKG_CHECK_EXISTS([Qt5DBus >= 5.11],
|
||||
[AC_MSG_CHECKING([for Qt5DBus >= 5.15.2])
|
||||
PKG_CHECK_EXISTS([Qt5DBus >= 5.15.2],
|
||||
[AC_MSG_RESULT([found])
|
||||
HAVE_QTDBUS=[true]],
|
||||
[AC_MSG_RESULT([not found])
|
||||
|
||||
@@ -1,41 +1,49 @@
|
||||
if (UNIX AND (NOT APPLE) AND (NOT CYGWIN))
|
||||
find_package(LibtorrentRasterbar QUIET ${minLibtorrentVersion} COMPONENTS torrent-rasterbar)
|
||||
if (NOT LibtorrentRasterbar_FOUND)
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(LIBTORRENT_RASTERBAR IMPORTED_TARGET GLOBAL "libtorrent-rasterbar>=${minLibtorrentVersion}")
|
||||
if (NOT LIBTORRENT_RASTERBAR_FOUND)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"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"
|
||||
" file in your system's pkg-config search paths (use the system environment variable PKG_CONFIG_PATH"
|
||||
" to specify additional search paths if needed)."
|
||||
macro(find_libtorrent version)
|
||||
if (UNIX AND (NOT APPLE) AND (NOT CYGWIN))
|
||||
find_package(LibtorrentRasterbar QUIET ${version} COMPONENTS torrent-rasterbar)
|
||||
if (NOT LibtorrentRasterbar_FOUND)
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(LibtorrentRasterbar IMPORTED_TARGET GLOBAL "libtorrent-rasterbar>=${version}")
|
||||
if (NOT LibtorrentRasterbar_FOUND)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Package LibtorrentRasterbar >= ${version} 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"
|
||||
" file in your system's pkg-config search paths (use the system environment variable PKG_CONFIG_PATH"
|
||||
" to specify additional search paths if needed)."
|
||||
)
|
||||
endif()
|
||||
add_library(LibtorrentRasterbar::torrent-rasterbar ALIAS PkgConfig::LibtorrentRasterbar)
|
||||
# force a fake package to show up in the feature summary
|
||||
set_property(GLOBAL APPEND PROPERTY
|
||||
PACKAGES_FOUND
|
||||
"LibtorrentRasterbar via pkg-config (version >= ${version})"
|
||||
)
|
||||
set_package_properties("LibtorrentRasterbar via pkg-config (version >= ${version})"
|
||||
PROPERTIES
|
||||
TYPE REQUIRED
|
||||
)
|
||||
else()
|
||||
set_package_properties(LibtorrentRasterbar PROPERTIES TYPE REQUIRED)
|
||||
endif()
|
||||
add_library(LibtorrentRasterbar::torrent-rasterbar ALIAS PkgConfig::LIBTORRENT_RASTERBAR)
|
||||
# force a fake package to show up in the feature summary
|
||||
set_property(GLOBAL APPEND PROPERTY
|
||||
PACKAGES_FOUND
|
||||
"LibtorrentRasterbar via pkg-config (version >= ${minLibtorrentVersion})"
|
||||
)
|
||||
set_package_properties("LibtorrentRasterbar via pkg-config (version >= ${minLibtorrentVersion})"
|
||||
PROPERTIES
|
||||
TYPE REQUIRED
|
||||
)
|
||||
else()
|
||||
set_package_properties(LibtorrentRasterbar PROPERTIES TYPE REQUIRED)
|
||||
find_package(LibtorrentRasterbar ${version} REQUIRED COMPONENTS torrent-rasterbar)
|
||||
endif()
|
||||
else()
|
||||
find_package(LibtorrentRasterbar ${minLibtorrentVersion} REQUIRED COMPONENTS torrent-rasterbar)
|
||||
endmacro()
|
||||
|
||||
find_libtorrent(${minLibtorrent1Version})
|
||||
if (LibtorrentRasterbar_FOUND AND (LibtorrentRasterbar_VERSION VERSION_GREATER_EQUAL 2.0))
|
||||
find_libtorrent(${minLibtorrentVersion})
|
||||
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 ${minBoostVersion} REQUIRED)
|
||||
find_package(OpenSSL ${minOpenSSLVersion} REQUIRED)
|
||||
find_package(ZLIB ${minZlibVersion} REQUIRED)
|
||||
find_package(Qt5 ${minQtVersion} REQUIRED COMPONENTS Core Network Xml LinguistTools)
|
||||
find_package(Qt5 ${minQtVersion} REQUIRED COMPONENTS Core Network Sql Xml LinguistTools)
|
||||
if (DBUS)
|
||||
find_package(Qt5 ${minQtVersion} REQUIRED COMPONENTS DBus)
|
||||
set_package_properties(Qt5DBus PROPERTIES
|
||||
@@ -61,9 +69,7 @@ add_subdirectory(base)
|
||||
|
||||
if (GUI)
|
||||
find_package(Qt5 ${minQtVersion} REQUIRED COMPONENTS Widgets Svg)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
find_package(Qt5 ${minQtVersion} REQUIRED COMPONENTS MacExtras)
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
find_package(Qt5 ${minQtVersion} REQUIRED COMPONENTS WinExtras)
|
||||
endif()
|
||||
add_subdirectory(gui)
|
||||
|
||||
@@ -4,22 +4,14 @@
|
||||
# Based on https://gist.github.com/giraldeau/546ba5512a74dfe9d8ea0862d66db412
|
||||
file(GLOB QBT_TS_FILES "${qBittorrent_SOURCE_DIR}/src/lang/*.ts")
|
||||
set_source_files_properties(${QBT_TS_FILES} PROPERTIES OUTPUT_LOCATION "${qBittorrent_BINARY_DIR}/src/lang")
|
||||
if (Qt5_VERSION VERSION_LESS 5.12)
|
||||
qt5_add_translation(QBT_QM_FILES ${QBT_TS_FILES})
|
||||
else()
|
||||
qt5_add_translation(QBT_QM_FILES ${QBT_TS_FILES} OPTIONS -silent)
|
||||
endif()
|
||||
qt5_add_translation(QBT_QM_FILES ${QBT_TS_FILES} OPTIONS -silent)
|
||||
configure_file("${qBittorrent_SOURCE_DIR}/src/lang/lang.qrc" "${qBittorrent_BINARY_DIR}/src/lang/lang.qrc" COPYONLY)
|
||||
|
||||
if (WEBUI)
|
||||
file(GLOB QBT_WEBUI_TS_FILES "${qBittorrent_SOURCE_DIR}/src/webui/www/translations/*.ts")
|
||||
set_source_files_properties(${QBT_WEBUI_TS_FILES}
|
||||
PROPERTIES OUTPUT_LOCATION "${qBittorrent_BINARY_DIR}/src/webui/www/translations")
|
||||
if (Qt5_VERSION VERSION_LESS 5.12)
|
||||
qt5_add_translation(QBT_WEBUI_QM_FILES ${QBT_WEBUI_TS_FILES})
|
||||
else()
|
||||
qt5_add_translation(QBT_WEBUI_QM_FILES ${QBT_WEBUI_TS_FILES} OPTIONS -silent)
|
||||
endif()
|
||||
qt5_add_translation(QBT_WEBUI_QM_FILES ${QBT_WEBUI_TS_FILES} OPTIONS -silent)
|
||||
configure_file("${qBittorrent_SOURCE_DIR}/src/webui/www/translations/webui_translations.qrc"
|
||||
"${qBittorrent_BINARY_DIR}/src/webui/www/translations/webui_translations.qrc" COPYONLY)
|
||||
endif()
|
||||
@@ -147,11 +139,7 @@ endif()
|
||||
if (GUI)
|
||||
target_link_libraries(qbt_app PRIVATE qbt_gui)
|
||||
if ((CMAKE_SYSTEM_NAME STREQUAL "Windows") OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
|
||||
if (Qt5_VERSION VERSION_LESS 5.14)
|
||||
set_property(TARGET qbt_app APPEND PROPERTY QT_PLUGINS Qt5::QSvgIconPlugin Qt5::QSvgPlugin)
|
||||
else()
|
||||
qt_import_plugins(qbt_app INCLUDE Qt5::QSvgIconPlugin Qt5::QSvgPlugin)
|
||||
endif()
|
||||
qt_import_plugins(qbt_app INCLUDE Qt5::QSvgIconPlugin Qt5::QSvgPlugin)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@
|
||||
#include "base/search/searchpluginmanager.h"
|
||||
#include "base/settingsstorage.h"
|
||||
#include "base/torrentfileswatcher.h"
|
||||
#include "base/utils/compare.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "base/version.h"
|
||||
#include "applicationinstancemanager.h"
|
||||
#include "filelogger.h"
|
||||
@@ -302,7 +302,7 @@ void Application::setFileLoggerAgeType(const int value)
|
||||
|
||||
void Application::processMessage(const QString &message)
|
||||
{
|
||||
const QStringList params = message.split(PARAMS_SEPARATOR, QString::SkipEmptyParts);
|
||||
const QStringList params = message.split(PARAMS_SEPARATOR, Qt::SkipEmptyParts);
|
||||
// If Application is not running (i.e., other
|
||||
// components are not ready) store params
|
||||
if (m_running)
|
||||
@@ -350,13 +350,15 @@ void Application::runExternalProgram(const BitTorrent::Torrent *torrent) const
|
||||
#endif
|
||||
break;
|
||||
case u'G':
|
||||
{
|
||||
QStringList tags = torrent->tags().values();
|
||||
std::sort(tags.begin(), tags.end(), Utils::String::naturalLessThan<Qt::CaseInsensitive>);
|
||||
program.replace(i, 2, tags.join(','));
|
||||
}
|
||||
program.replace(i, 2, torrent->tags().join(QLatin1String(",")));
|
||||
break;
|
||||
case u'I':
|
||||
program.replace(i, 2, (torrent->infoHash().v1().isValid() ? torrent->infoHash().v1().toString() : QLatin1String("-")));
|
||||
break;
|
||||
case u'J':
|
||||
program.replace(i, 2, (torrent->infoHash().v2().isValid() ? torrent->infoHash().v2().toString() : QLatin1String("-")));
|
||||
break;
|
||||
case u'K':
|
||||
program.replace(i, 2, torrent->id().toString());
|
||||
break;
|
||||
case u'L':
|
||||
@@ -433,16 +435,12 @@ void Application::runExternalProgram(const BitTorrent::Torrent *torrent) const
|
||||
// enable command injection via torrent name and other arguments
|
||||
// (especially when some automated download mechanism has been setup).
|
||||
// See: https://github.com/qbittorrent/qBittorrent/issues/10925
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
||||
QStringList args = QProcess::splitCommand(program);
|
||||
if (args.isEmpty())
|
||||
return;
|
||||
|
||||
const QString command = args.takeFirst();
|
||||
QProcess::startDetached(command, args);
|
||||
#else
|
||||
QProcess::startDetached(program);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -563,7 +561,7 @@ void Application::processParams(const QStringList ¶ms)
|
||||
|
||||
if (param.startsWith(QLatin1String("@addPaused=")))
|
||||
{
|
||||
torrentParams.addPaused = (param.midRef(11).toInt() != 0);
|
||||
torrentParams.addPaused = (QStringView(param).mid(11).toInt() != 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -593,7 +591,7 @@ void Application::processParams(const QStringList ¶ms)
|
||||
|
||||
if (param.startsWith(QLatin1String("@skipDialog=")))
|
||||
{
|
||||
skipTorrentDialog = (param.midRef(12).toInt() != 0);
|
||||
skipTorrentDialog = (QStringView(param).mid(12).toInt() != 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace RSS
|
||||
class Application final : public BaseApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(Application)
|
||||
Q_DISABLE_COPY_MOVE(Application)
|
||||
|
||||
public:
|
||||
Application(int &argc, char **argv);
|
||||
|
||||
@@ -35,7 +35,7 @@ class QtLocalPeer;
|
||||
class ApplicationInstanceManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(ApplicationInstanceManager)
|
||||
Q_DISABLE_COPY_MOVE(ApplicationInstanceManager)
|
||||
|
||||
public:
|
||||
explicit ApplicationInstanceManager(const QString &appId, QObject *parent = nullptr);
|
||||
|
||||
@@ -126,7 +126,9 @@ void FileLogger::addLogMessage(const Log::Msg &msg)
|
||||
if (!m_logFile.isOpen()) return;
|
||||
|
||||
QTextStream stream(&m_logFile);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
stream.setCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
switch (msg.type)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Log
|
||||
class FileLogger : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(FileLogger)
|
||||
Q_DISABLE_COPY_MOVE(FileLogger)
|
||||
|
||||
public:
|
||||
enum FileLogAgeType
|
||||
|
||||
@@ -134,7 +134,7 @@ int main(int argc, char *argv[])
|
||||
// We must save it here because QApplication constructor may change it
|
||||
bool isOneArg = (argc == 2);
|
||||
|
||||
#if !defined(DISABLE_GUI) && (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
#if !defined(DISABLE_GUI)
|
||||
// Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created
|
||||
if (qgetenv("QT_ENABLE_HIGHDPI_SCALING").isEmpty() && qgetenv("QT_AUTO_SCREEN_SCALE_FACTOR").isEmpty())
|
||||
Application::setAttribute(Qt::AA_EnableHighDpiScaling, true);
|
||||
@@ -235,7 +235,7 @@ int main(int argc, char *argv[])
|
||||
// 3. https://bugreports.qt.io/browse/QTBUG-46015
|
||||
|
||||
qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1));
|
||||
#if !defined(DISABLE_GUI)
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && !defined(DISABLE_GUI)
|
||||
// this is the default in Qt6
|
||||
app->setAttribute(Qt::AA_DisableWindowContextHelpButton);
|
||||
#endif
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
#include <QDir>
|
||||
#include <QLocalServer>
|
||||
#include <QLocalSocket>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "base/utils/misc.h"
|
||||
|
||||
@@ -108,7 +109,7 @@ QtLocalPeer::QtLocalPeer(QObject *parent, const QString &appId)
|
||||
#endif
|
||||
prefix = id.section(QLatin1Char('/'), -1);
|
||||
}
|
||||
prefix.remove(QRegExp("[^a-zA-Z]"));
|
||||
prefix.remove(QRegularExpression("[^a-zA-Z]"));
|
||||
prefix.truncate(6);
|
||||
|
||||
QByteArray idc = id.toUtf8();
|
||||
|
||||
@@ -89,7 +89,7 @@ Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate)
|
||||
|
||||
Qt::HANDLE mutex;
|
||||
if (doCreate) {
|
||||
QT_WA( { mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); },
|
||||
QT_WA( { mutex = CreateMutexW(NULL, FALSE, reinterpret_cast<const TCHAR *>(mname.utf16())); },
|
||||
{ mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); } );
|
||||
if (!mutex) {
|
||||
qErrnoWarning("QtLockedFile::lock(): CreateMutex failed");
|
||||
@@ -97,7 +97,7 @@ Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate)
|
||||
}
|
||||
}
|
||||
else {
|
||||
QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); },
|
||||
QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, reinterpret_cast<const TCHAR *>(mname.utf16())); },
|
||||
{ mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } );
|
||||
if (!mutex) {
|
||||
if (GetLastError() != ERROR_FILE_NOT_FOUND)
|
||||
|
||||
@@ -73,7 +73,7 @@ void straceWin::loadHelpStackFrame(IMAGEHLP_STACK_FRAME& ihsf, const STACKFRAME6
|
||||
BOOL CALLBACK straceWin::EnumSymbolsCB(PSYMBOL_INFO symInfo, ULONG size, PVOID user)
|
||||
{
|
||||
Q_UNUSED(size)
|
||||
QStringList* params = (QStringList*)user;
|
||||
auto params = static_cast<QStringList *>(user);
|
||||
if (symInfo->Flags & SYMFLAG_PARAMETER)
|
||||
params->append(symInfo->Name);
|
||||
return TRUE;
|
||||
@@ -91,7 +91,7 @@ BOOL CALLBACK straceWin::EnumModulesCB(LPCSTR ModuleName, DWORD64 BaseOfDll, PVO
|
||||
{
|
||||
Q_UNUSED(ModuleName)
|
||||
IMAGEHLP_MODULE64 mod;
|
||||
EnumModulesContext* context = (EnumModulesContext*)UserContext;
|
||||
auto context = static_cast<EnumModulesContext *>(UserContext);
|
||||
mod.SizeOfStruct = sizeof(IMAGEHLP_MODULE64);
|
||||
if(SymGetModuleInfo64(context->hProcess, BaseOfDll, &mod))
|
||||
{
|
||||
@@ -264,7 +264,7 @@ const QString straceWin::getBacktrace()
|
||||
ULONG64 buffer[(sizeof(SYMBOL_INFO) +
|
||||
MAX_SYM_NAME * sizeof(TCHAR) +
|
||||
sizeof(ULONG64) - 1) / sizeof(ULONG64)];
|
||||
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer;
|
||||
auto pSymbol = reinterpret_cast<PSYMBOL_INFO>(buffer);
|
||||
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
|
||||
pSymbol->MaxNameLen = MAX_SYM_NAME;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Ui
|
||||
class StacktraceDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(StacktraceDialog)
|
||||
Q_DISABLE_COPY_MOVE(StacktraceDialog)
|
||||
|
||||
public:
|
||||
explicit StacktraceDialog(QWidget *parent = nullptr);
|
||||
|
||||
@@ -102,12 +102,28 @@ namespace
|
||||
settingsStorage->storeValue(newKey, Utils::String::fromEnum(torrentContentLayout));
|
||||
settingsStorage->removeValue(oldKey);
|
||||
}
|
||||
|
||||
void upgradeListenPortSettings()
|
||||
{
|
||||
const auto oldKey = QString::fromLatin1("BitTorrent/Session/UseRandomPort");
|
||||
const auto newKey = QString::fromLatin1("Preferences/Connection/PortRangeMin");
|
||||
auto *settingsStorage = SettingsStorage::instance();
|
||||
|
||||
if (settingsStorage->hasKey(oldKey))
|
||||
{
|
||||
if (settingsStorage->loadValue<bool>(oldKey))
|
||||
settingsStorage->storeValue(newKey, 0);
|
||||
|
||||
settingsStorage->removeValue(oldKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool upgrade(const bool /*ask*/)
|
||||
{
|
||||
exportWebUIHttpsFiles();
|
||||
upgradeTorrentContentLayout();
|
||||
upgradeListenPortSettings();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,16 @@ add_library(qbt_base STATIC
|
||||
bittorrent/abstractfilestorage.h
|
||||
bittorrent/addtorrentparams.h
|
||||
bittorrent/bandwidthscheduler.h
|
||||
bittorrent/bencoderesumedatastorage.h
|
||||
bittorrent/cachestatus.h
|
||||
bittorrent/common.h
|
||||
bittorrent/customstorage.h
|
||||
bittorrent/dbresumedatastorage.h
|
||||
bittorrent/downloadpriority.h
|
||||
bittorrent/filesearcher.h
|
||||
bittorrent/filterparserthread.h
|
||||
bittorrent/infohash.h
|
||||
bittorrent/loadtorrentparams.h
|
||||
bittorrent/ltqhash.h
|
||||
bittorrent/ltunderlyingtype.h
|
||||
bittorrent/magneturi.h
|
||||
@@ -20,7 +23,7 @@ add_library(qbt_base STATIC
|
||||
bittorrent/peeraddress.h
|
||||
bittorrent/peerinfo.h
|
||||
bittorrent/portforwarderimpl.h
|
||||
bittorrent/resumedatasavingmanager.h
|
||||
bittorrent/resumedatastorage.h
|
||||
bittorrent/session.h
|
||||
bittorrent/sessionstatus.h
|
||||
bittorrent/speedmonitor.h
|
||||
@@ -55,6 +58,7 @@ add_library(qbt_base STATIC
|
||||
net/proxyconfigurationmanager.h
|
||||
net/reverseresolution.h
|
||||
net/smtp.h
|
||||
orderedset.h
|
||||
preferences.h
|
||||
profile.h
|
||||
profile_p.h
|
||||
@@ -70,12 +74,14 @@ add_library(qbt_base STATIC
|
||||
search/searchhandler.h
|
||||
search/searchpluginmanager.h
|
||||
settingsstorage.h
|
||||
tagset.h
|
||||
torrentfileguard.h
|
||||
torrentfileswatcher.h
|
||||
torrentfilter.h
|
||||
types.h
|
||||
unicodestrings.h
|
||||
utils/bytearray.h
|
||||
utils/compare.h
|
||||
utils/foreignapps.h
|
||||
utils/fs.h
|
||||
utils/gzip.h
|
||||
@@ -92,7 +98,9 @@ add_library(qbt_base STATIC
|
||||
asyncfilestorage.cpp
|
||||
bittorrent/abstractfilestorage.cpp
|
||||
bittorrent/bandwidthscheduler.cpp
|
||||
bittorrent/bencoderesumedatastorage.cpp
|
||||
bittorrent/customstorage.cpp
|
||||
bittorrent/dbresumedatastorage.cpp
|
||||
bittorrent/downloadpriority.cpp
|
||||
bittorrent/filesearcher.cpp
|
||||
bittorrent/filterparserthread.cpp
|
||||
@@ -103,7 +111,6 @@ add_library(qbt_base STATIC
|
||||
bittorrent/peeraddress.cpp
|
||||
bittorrent/peerinfo.cpp
|
||||
bittorrent/portforwarderimpl.cpp
|
||||
bittorrent/resumedatasavingmanager.cpp
|
||||
bittorrent/session.cpp
|
||||
bittorrent/speedmonitor.cpp
|
||||
bittorrent/statistics.cpp
|
||||
@@ -146,10 +153,12 @@ add_library(qbt_base STATIC
|
||||
search/searchhandler.cpp
|
||||
search/searchpluginmanager.cpp
|
||||
settingsstorage.cpp
|
||||
tagset.cpp
|
||||
torrentfileguard.cpp
|
||||
torrentfileswatcher.cpp
|
||||
torrentfilter.cpp
|
||||
utils/bytearray.cpp
|
||||
utils/compare.cpp
|
||||
utils/foreignapps.cpp
|
||||
utils/fs.cpp
|
||||
utils/gzip.cpp
|
||||
@@ -167,7 +176,7 @@ target_link_libraries(qbt_base
|
||||
ZLIB::ZLIB
|
||||
PUBLIC
|
||||
LibtorrentRasterbar::torrent-rasterbar
|
||||
Qt5::Core Qt5::Network Qt5::Xml
|
||||
Qt5::Core Qt5::Network Qt5::Sql Qt5::Xml
|
||||
qbt_common_cfg
|
||||
)
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Algorithm
|
||||
{
|
||||
};
|
||||
|
||||
// To be used with associative array types, such as QMap, QHash and it's variants
|
||||
// To be used with associative array types, such as QMap, QHash and its variants
|
||||
template <typename T, typename BinaryPredicate
|
||||
, typename std::enable_if_t<HasMappedType<T>::value, int> = 0>
|
||||
void removeIf(T &dict, BinaryPredicate &&p)
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
class AsyncFileStorage : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(AsyncFileStorage)
|
||||
Q_DISABLE_COPY_MOVE(AsyncFileStorage)
|
||||
|
||||
public:
|
||||
explicit AsyncFileStorage(const QString &storageFolderPath, QObject *parent = nullptr);
|
||||
|
||||
@@ -4,13 +4,16 @@ HEADERS += \
|
||||
$$PWD/bittorrent/abstractfilestorage.h \
|
||||
$$PWD/bittorrent/addtorrentparams.h \
|
||||
$$PWD/bittorrent/bandwidthscheduler.h \
|
||||
$$PWD/bittorrent/bencoderesumedatastorage.h \
|
||||
$$PWD/bittorrent/cachestatus.h \
|
||||
$$PWD/bittorrent/common.h \
|
||||
$$PWD/bittorrent/customstorage.h \
|
||||
$$PWD/bittorrent/downloadpriority.h \
|
||||
$$PWD/bittorrent/dbresumedatastorage.h \
|
||||
$$PWD/bittorrent/filesearcher.h \
|
||||
$$PWD/bittorrent/filterparserthread.h \
|
||||
$$PWD/bittorrent/infohash.h \
|
||||
$$PWD/bittorrent/loadtorrentparams.h \
|
||||
$$PWD/bittorrent/ltqhash.h \
|
||||
$$PWD/bittorrent/ltunderlyingtype.h \
|
||||
$$PWD/bittorrent/magneturi.h \
|
||||
@@ -19,7 +22,7 @@ HEADERS += \
|
||||
$$PWD/bittorrent/peeraddress.h \
|
||||
$$PWD/bittorrent/peerinfo.h \
|
||||
$$PWD/bittorrent/portforwarderimpl.h \
|
||||
$$PWD/bittorrent/resumedatasavingmanager.h \
|
||||
$$PWD/bittorrent/resumedatastorage.h \
|
||||
$$PWD/bittorrent/session.h \
|
||||
$$PWD/bittorrent/sessionstatus.h \
|
||||
$$PWD/bittorrent/speedmonitor.h \
|
||||
@@ -54,6 +57,7 @@ HEADERS += \
|
||||
$$PWD/net/proxyconfigurationmanager.h \
|
||||
$$PWD/net/reverseresolution.h \
|
||||
$$PWD/net/smtp.h \
|
||||
$$PWD/orderedset.h \
|
||||
$$PWD/preferences.h \
|
||||
$$PWD/profile.h \
|
||||
$$PWD/profile_p.h \
|
||||
@@ -70,12 +74,14 @@ HEADERS += \
|
||||
$$PWD/search/searchpluginmanager.h \
|
||||
$$PWD/settingsstorage.h \
|
||||
$$PWD/settingvalue.h \
|
||||
$$PWD/tagset.h \
|
||||
$$PWD/torrentfileguard.h \
|
||||
$$PWD/torrentfileswatcher.h \
|
||||
$$PWD/torrentfilter.h \
|
||||
$$PWD/types.h \
|
||||
$$PWD/unicodestrings.h \
|
||||
$$PWD/utils/bytearray.h \
|
||||
$$PWD/utils/compare.h \
|
||||
$$PWD/utils/foreignapps.h \
|
||||
$$PWD/utils/fs.h \
|
||||
$$PWD/utils/gzip.h \
|
||||
@@ -92,7 +98,9 @@ SOURCES += \
|
||||
$$PWD/asyncfilestorage.cpp \
|
||||
$$PWD/bittorrent/abstractfilestorage.cpp \
|
||||
$$PWD/bittorrent/bandwidthscheduler.cpp \
|
||||
$$PWD/bittorrent/bencoderesumedatastorage.cpp \
|
||||
$$PWD/bittorrent/customstorage.cpp \
|
||||
$$PWD/bittorrent/dbresumedatastorage.cpp \
|
||||
$$PWD/bittorrent/downloadpriority.cpp \
|
||||
$$PWD/bittorrent/filesearcher.cpp \
|
||||
$$PWD/bittorrent/filterparserthread.cpp \
|
||||
@@ -103,7 +111,6 @@ SOURCES += \
|
||||
$$PWD/bittorrent/peeraddress.cpp \
|
||||
$$PWD/bittorrent/peerinfo.cpp \
|
||||
$$PWD/bittorrent/portforwarderimpl.cpp \
|
||||
$$PWD/bittorrent/resumedatasavingmanager.cpp \
|
||||
$$PWD/bittorrent/session.cpp \
|
||||
$$PWD/bittorrent/speedmonitor.cpp \
|
||||
$$PWD/bittorrent/statistics.cpp \
|
||||
@@ -146,10 +153,12 @@ SOURCES += \
|
||||
$$PWD/search/searchhandler.cpp \
|
||||
$$PWD/search/searchpluginmanager.cpp \
|
||||
$$PWD/settingsstorage.cpp \
|
||||
$$PWD/tagset.cpp \
|
||||
$$PWD/torrentfileguard.cpp \
|
||||
$$PWD/torrentfileswatcher.cpp \
|
||||
$$PWD/torrentfilter.cpp \
|
||||
$$PWD/utils/bytearray.cpp \
|
||||
$$PWD/utils/compare.cpp \
|
||||
$$PWD/utils/foreignapps.cpp \
|
||||
$$PWD/utils/fs.cpp \
|
||||
$$PWD/utils/gzip.cpp \
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
#include <optional>
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QSet>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/tagset.h"
|
||||
#include "torrent.h"
|
||||
#include "torrentcontentlayout.h"
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace BitTorrent
|
||||
{
|
||||
QString name;
|
||||
QString category;
|
||||
QSet<QString> tags;
|
||||
TagSet tags;
|
||||
QString savePath;
|
||||
bool disableTempPath = false; // e.g. for imported torrents
|
||||
bool sequential = false;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
class BandwidthScheduler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(BandwidthScheduler)
|
||||
Q_DISABLE_COPY_MOVE(BandwidthScheduler)
|
||||
|
||||
public:
|
||||
explicit BandwidthScheduler(QObject *parent = nullptr);
|
||||
|
||||
415
src/base/bittorrent/bencoderesumedatastorage.cpp
Normal file
415
src/base/bittorrent/bencoderesumedatastorage.cpp
Normal file
@@ -0,0 +1,415 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2015, 2018 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 "bencoderesumedatastorage.h"
|
||||
|
||||
#include <libtorrent/bdecode.hpp>
|
||||
#include <libtorrent/bencode.hpp>
|
||||
#include <libtorrent/entry.hpp>
|
||||
#include <libtorrent/read_resume_data.hpp>
|
||||
#include <libtorrent/torrent_info.hpp>
|
||||
#include <libtorrent/write_resume_data.hpp>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QRegularExpression>
|
||||
#include <QSaveFile>
|
||||
#include <QThread>
|
||||
|
||||
#include "base/algorithm.h"
|
||||
#include "base/exceptions.h"
|
||||
#include "base/global.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/profile.h"
|
||||
#include "base/tagset.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/io.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "infohash.h"
|
||||
#include "loadtorrentparams.h"
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class BencodeResumeDataStorage::Worker final : public QObject
|
||||
{
|
||||
Q_DISABLE_COPY_MOVE(Worker)
|
||||
|
||||
public:
|
||||
explicit Worker(const QDir &resumeDataDir);
|
||||
|
||||
void store(const TorrentID &id, const LoadTorrentParams &resumeData) const;
|
||||
void remove(const TorrentID &id) const;
|
||||
void storeQueue(const QVector<TorrentID> &queue) const;
|
||||
|
||||
private:
|
||||
const QDir m_resumeDataDir;
|
||||
};
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename LTStr>
|
||||
QString fromLTString(const LTStr &str)
|
||||
{
|
||||
return QString::fromUtf8(str.data(), static_cast<int>(str.size()));
|
||||
}
|
||||
|
||||
using ListType = lt::entry::list_type;
|
||||
|
||||
ListType setToEntryList(const TagSet &input)
|
||||
{
|
||||
ListType entryList;
|
||||
entryList.reserve(input.size());
|
||||
for (const QString &setValue : input)
|
||||
entryList.emplace_back(setValue.toStdString());
|
||||
return entryList;
|
||||
}
|
||||
|
||||
void writeEntryToFile(const QString &filepath, const lt::entry &data)
|
||||
{
|
||||
QSaveFile file {filepath};
|
||||
if (!file.open(QIODevice::WriteOnly))
|
||||
throw RuntimeError(file.errorString());
|
||||
|
||||
lt::bencode(Utils::IO::FileDeviceOutputIterator {file}, data);
|
||||
if (file.error() != QFileDevice::NoError || !file.commit())
|
||||
throw RuntimeError(file.errorString());
|
||||
}
|
||||
}
|
||||
|
||||
BitTorrent::BencodeResumeDataStorage::BencodeResumeDataStorage(const QString &path, QObject *parent)
|
||||
: ResumeDataStorage {parent}
|
||||
, m_resumeDataDir {path}
|
||||
, m_ioThread {new QThread {this}}
|
||||
, m_asyncWorker {new Worker {m_resumeDataDir}}
|
||||
{
|
||||
if (!m_resumeDataDir.exists() && !m_resumeDataDir.mkpath(m_resumeDataDir.absolutePath()))
|
||||
{
|
||||
throw RuntimeError {tr("Cannot create torrent resume folder: \"%1\"")
|
||||
.arg(Utils::Fs::toNativePath(m_resumeDataDir.absolutePath()))};
|
||||
}
|
||||
|
||||
const QRegularExpression filenamePattern {QLatin1String("^([A-Fa-f0-9]{40})\\.fastresume$")};
|
||||
const QStringList filenames = m_resumeDataDir.entryList(QStringList(QLatin1String("*.fastresume")), QDir::Files, QDir::Unsorted);
|
||||
|
||||
m_registeredTorrents.reserve(filenames.size());
|
||||
for (const QString &filename : filenames)
|
||||
{
|
||||
const QRegularExpressionMatch rxMatch = filenamePattern.match(filename);
|
||||
if (rxMatch.hasMatch())
|
||||
m_registeredTorrents.append(TorrentID::fromString(rxMatch.captured(1)));
|
||||
}
|
||||
|
||||
loadQueue(m_resumeDataDir.absoluteFilePath(QLatin1String("queue")));
|
||||
|
||||
qDebug("Registered torrents count: %d", m_registeredTorrents.size());
|
||||
|
||||
m_asyncWorker->moveToThread(m_ioThread);
|
||||
connect(m_ioThread, &QThread::finished, m_asyncWorker, &QObject::deleteLater);
|
||||
m_ioThread->start();
|
||||
}
|
||||
|
||||
BitTorrent::BencodeResumeDataStorage::~BencodeResumeDataStorage()
|
||||
{
|
||||
m_ioThread->quit();
|
||||
m_ioThread->wait();
|
||||
}
|
||||
|
||||
QVector<BitTorrent::TorrentID> BitTorrent::BencodeResumeDataStorage::registeredTorrents() const
|
||||
{
|
||||
return m_registeredTorrents;
|
||||
}
|
||||
|
||||
std::optional<BitTorrent::LoadTorrentParams> BitTorrent::BencodeResumeDataStorage::load(const TorrentID &id) const
|
||||
{
|
||||
const QString idString = id.toString();
|
||||
const QString fastresumePath = m_resumeDataDir.absoluteFilePath(QString::fromLatin1("%1.fastresume").arg(idString));
|
||||
const QString torrentFilePath = m_resumeDataDir.absoluteFilePath(QString::fromLatin1("%1.torrent").arg(idString));
|
||||
|
||||
QFile resumeDataFile {fastresumePath};
|
||||
if (!resumeDataFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
LogMsg(tr("Cannot read file %1: %2").arg(fastresumePath, resumeDataFile.errorString()), Log::WARNING);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
QFile metadataFile {torrentFilePath};
|
||||
if (metadataFile.exists() && !metadataFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
LogMsg(tr("Cannot read file %1: %2").arg(torrentFilePath, metadataFile.errorString()), Log::WARNING);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const QByteArray data = resumeDataFile.readAll();
|
||||
const QByteArray metadata = (metadataFile.isOpen() ? metadataFile.readAll() : "");
|
||||
|
||||
return loadTorrentResumeData(data, metadata);
|
||||
}
|
||||
|
||||
std::optional<BitTorrent::LoadTorrentParams> BitTorrent::BencodeResumeDataStorage::loadTorrentResumeData(
|
||||
const QByteArray &data, const QByteArray &metadata) const
|
||||
{
|
||||
const QByteArray allData = ((metadata.isEmpty() || data.isEmpty())
|
||||
? data : (data.chopped(1) + metadata.mid(1)));
|
||||
|
||||
lt::error_code ec;
|
||||
const lt::bdecode_node root = lt::bdecode(allData, ec);
|
||||
if (ec || (root.type() != lt::bdecode_node::dict_t))
|
||||
return std::nullopt;
|
||||
|
||||
LoadTorrentParams torrentParams;
|
||||
torrentParams.restored = true;
|
||||
torrentParams.category = fromLTString(root.dict_find_string_value("qBt-category"));
|
||||
torrentParams.name = fromLTString(root.dict_find_string_value("qBt-name"));
|
||||
torrentParams.savePath = Profile::instance()->fromPortablePath(
|
||||
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.seedingTimeLimit = root.dict_find_int_value("qBt-seedingTimeLimit", Torrent::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", Torrent::USE_GLOBAL_RATIO * 1000) / 1000.0;
|
||||
else
|
||||
torrentParams.ratioLimit = fromLTString(ratioLimitString).toDouble();
|
||||
|
||||
const lt::bdecode_node tagsNode = root.dict_find("qBt-tags");
|
||||
if (tagsNode.type() == lt::bdecode_node::list_t)
|
||||
{
|
||||
for (int i = 0; i < tagsNode.list_size(); ++i)
|
||||
{
|
||||
const QString tag = fromLTString(tagsNode.list_string_value_at(i));
|
||||
torrentParams.tags.insert(tag);
|
||||
}
|
||||
}
|
||||
|
||||
lt::add_torrent_params &p = torrentParams.ltAddTorrentParams;
|
||||
|
||||
p = lt::read_resume_data(root, ec);
|
||||
p.save_path = Profile::instance()->fromPortablePath(fromLTString(p.save_path)).toStdString();
|
||||
|
||||
if (p.flags & lt::torrent_flags::stop_when_ready)
|
||||
{
|
||||
// If torrent has "stop_when_ready" flag set then it is actually "stopped"
|
||||
torrentParams.stopped = true;
|
||||
torrentParams.operatingMode = TorrentOperatingMode::AutoManaged;
|
||||
// ...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
|
||||
{
|
||||
torrentParams.stopped = (p.flags & lt::torrent_flags::paused) && !(p.flags & lt::torrent_flags::auto_managed);
|
||||
torrentParams.operatingMode = (p.flags & lt::torrent_flags::paused) || (p.flags & lt::torrent_flags::auto_managed)
|
||||
? TorrentOperatingMode::AutoManaged : TorrentOperatingMode::Forced;
|
||||
}
|
||||
|
||||
const bool hasMetadata = (p.ti && p.ti->is_valid());
|
||||
if (!hasMetadata && !root.dict_find("info-hash"))
|
||||
return std::nullopt;
|
||||
|
||||
return torrentParams;
|
||||
}
|
||||
|
||||
void BitTorrent::BencodeResumeDataStorage::store(const TorrentID &id, const LoadTorrentParams &resumeData) const
|
||||
{
|
||||
QMetaObject::invokeMethod(m_asyncWorker, [this, id, resumeData]()
|
||||
{
|
||||
m_asyncWorker->store(id, resumeData);
|
||||
});
|
||||
}
|
||||
|
||||
void BitTorrent::BencodeResumeDataStorage::remove(const TorrentID &id) const
|
||||
{
|
||||
QMetaObject::invokeMethod(m_asyncWorker, [this, id]()
|
||||
{
|
||||
m_asyncWorker->remove(id);
|
||||
});
|
||||
}
|
||||
|
||||
void BitTorrent::BencodeResumeDataStorage::storeQueue(const QVector<TorrentID> &queue) const
|
||||
{
|
||||
QMetaObject::invokeMethod(m_asyncWorker, [this, queue]()
|
||||
{
|
||||
m_asyncWorker->storeQueue(queue);
|
||||
});
|
||||
}
|
||||
|
||||
void BitTorrent::BencodeResumeDataStorage::loadQueue(const QString &queueFilename)
|
||||
{
|
||||
QFile queueFile {queueFilename};
|
||||
if (!queueFile.exists())
|
||||
return;
|
||||
|
||||
if (queueFile.open(QFile::ReadOnly))
|
||||
{
|
||||
const QRegularExpression hashPattern {QLatin1String("^([A-Fa-f0-9]{40})$")};
|
||||
QByteArray line;
|
||||
int start = 0;
|
||||
while (!(line = queueFile.readLine().trimmed()).isEmpty())
|
||||
{
|
||||
const QRegularExpressionMatch rxMatch = hashPattern.match(line);
|
||||
if (rxMatch.hasMatch())
|
||||
{
|
||||
const auto torrentID = TorrentID::fromString(rxMatch.captured(1));
|
||||
const int pos = m_registeredTorrents.indexOf(torrentID, start);
|
||||
if (pos != -1)
|
||||
{
|
||||
std::swap(m_registeredTorrents[start], m_registeredTorrents[pos]);
|
||||
++start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMsg(tr("Couldn't load torrents queue from '%1'. Error: %2")
|
||||
.arg(queueFile.fileName(), queueFile.errorString()), Log::WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
BitTorrent::BencodeResumeDataStorage::Worker::Worker(const QDir &resumeDataDir)
|
||||
: m_resumeDataDir {resumeDataDir}
|
||||
{
|
||||
}
|
||||
|
||||
void BitTorrent::BencodeResumeDataStorage::Worker::store(const TorrentID &id, const LoadTorrentParams &resumeData) const
|
||||
{
|
||||
// We need to adjust native libtorrent resume data
|
||||
lt::add_torrent_params p = resumeData.ltAddTorrentParams;
|
||||
p.save_path = Profile::instance()->toPortablePath(QString::fromStdString(p.save_path)).toStdString();
|
||||
if (resumeData.stopped)
|
||||
{
|
||||
p.flags |= lt::torrent_flags::paused;
|
||||
p.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"
|
||||
if (resumeData.operatingMode == BitTorrent::TorrentOperatingMode::AutoManaged)
|
||||
{
|
||||
p.flags |= lt::torrent_flags::auto_managed;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.flags &= ~lt::torrent_flags::paused;
|
||||
p.flags &= ~lt::torrent_flags::auto_managed;
|
||||
}
|
||||
}
|
||||
|
||||
lt::entry data = lt::write_resume_data(p);
|
||||
|
||||
// metadata is stored in separate .torrent file
|
||||
if (p.ti)
|
||||
{
|
||||
lt::entry::dictionary_type &dataDict = data.dict();
|
||||
lt::entry metadata {lt::entry::dictionary_t};
|
||||
lt::entry::dictionary_type &metadataDict = metadata.dict();
|
||||
metadataDict.insert(dataDict.extract("info"));
|
||||
metadataDict.insert(dataDict.extract("creation date"));
|
||||
metadataDict.insert(dataDict.extract("created by"));
|
||||
metadataDict.insert(dataDict.extract("comment"));
|
||||
|
||||
const QString torrentFilepath = m_resumeDataDir.absoluteFilePath(QString::fromLatin1("%1.torrent").arg(id.toString()));
|
||||
try
|
||||
{
|
||||
writeEntryToFile(torrentFilepath, metadata);
|
||||
}
|
||||
catch (const RuntimeError &err)
|
||||
{
|
||||
LogMsg(tr("Couldn't save torrent metadata to '%1'. Error: %2.")
|
||||
.arg(torrentFilepath, err.message()), Log::CRITICAL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
data["qBt-savePath"] = Profile::instance()->toPortablePath(resumeData.savePath).toStdString();
|
||||
data["qBt-ratioLimit"] = static_cast<int>(resumeData.ratioLimit * 1000);
|
||||
data["qBt-seedingTimeLimit"] = resumeData.seedingTimeLimit;
|
||||
data["qBt-category"] = resumeData.category.toStdString();
|
||||
data["qBt-tags"] = setToEntryList(resumeData.tags);
|
||||
data["qBt-name"] = resumeData.name.toStdString();
|
||||
data["qBt-seedStatus"] = resumeData.hasSeedStatus;
|
||||
data["qBt-contentLayout"] = Utils::String::fromEnum(resumeData.contentLayout).toStdString();
|
||||
data["qBt-firstLastPiecePriority"] = resumeData.firstLastPiecePriority;
|
||||
|
||||
const QString resumeFilepath = m_resumeDataDir.absoluteFilePath(QString::fromLatin1("%1.fastresume").arg(id.toString()));
|
||||
try
|
||||
{
|
||||
writeEntryToFile(resumeFilepath, data);
|
||||
}
|
||||
catch (const RuntimeError &err)
|
||||
{
|
||||
LogMsg(tr("Couldn't save torrent resume data to '%1'. Error: %2.")
|
||||
.arg(resumeFilepath, err.message()), Log::CRITICAL);
|
||||
}
|
||||
}
|
||||
|
||||
void BitTorrent::BencodeResumeDataStorage::Worker::remove(const TorrentID &id) const
|
||||
{
|
||||
const QString resumeFilename = QString::fromLatin1("%1.fastresume").arg(id.toString());
|
||||
Utils::Fs::forceRemove(m_resumeDataDir.absoluteFilePath(resumeFilename));
|
||||
|
||||
const QString torrentFilename = QString::fromLatin1("%1.torrent").arg(id.toString());
|
||||
Utils::Fs::forceRemove(m_resumeDataDir.absoluteFilePath(torrentFilename));
|
||||
}
|
||||
|
||||
void BitTorrent::BencodeResumeDataStorage::Worker::storeQueue(const QVector<TorrentID> &queue) const
|
||||
{
|
||||
QByteArray data;
|
||||
data.reserve(((BitTorrent::TorrentID::length() * 2) + 1) * queue.size());
|
||||
for (const BitTorrent::TorrentID &torrentID : queue)
|
||||
data += (torrentID.toString().toLatin1() + '\n');
|
||||
|
||||
const QString filepath = m_resumeDataDir.absoluteFilePath(QLatin1String("queue"));
|
||||
QSaveFile file {filepath};
|
||||
if (!file.open(QIODevice::WriteOnly) || (file.write(data) != data.size()) || !file.commit())
|
||||
{
|
||||
LogMsg(tr("Couldn't save data to '%1'. Error: %2")
|
||||
.arg(filepath, file.errorString()), Log::CRITICAL);
|
||||
}
|
||||
}
|
||||
67
src/base/bittorrent/bencoderesumedatastorage.h
Normal file
67
src/base/bittorrent/bencoderesumedatastorage.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2015, 2018 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 <QDir>
|
||||
#include <QVector>
|
||||
|
||||
#include "resumedatastorage.h"
|
||||
|
||||
class QByteArray;
|
||||
class QThread;
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class BencodeResumeDataStorage final : public ResumeDataStorage
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(BencodeResumeDataStorage)
|
||||
|
||||
public:
|
||||
explicit BencodeResumeDataStorage(const QString &path, QObject *parent = nullptr);
|
||||
~BencodeResumeDataStorage() override;
|
||||
|
||||
QVector<TorrentID> registeredTorrents() const override;
|
||||
std::optional<LoadTorrentParams> load(const TorrentID &id) const override;
|
||||
void store(const TorrentID &id, const LoadTorrentParams &resumeData) const override;
|
||||
void remove(const TorrentID &id) const override;
|
||||
void storeQueue(const QVector<TorrentID> &queue) const override;
|
||||
|
||||
private:
|
||||
void loadQueue(const QString &queueFilename);
|
||||
std::optional<LoadTorrentParams> loadTorrentResumeData(const QByteArray &data, const QByteArray &metadata) const;
|
||||
|
||||
const QDir m_resumeDataDir;
|
||||
QVector<TorrentID> m_registeredTorrents;
|
||||
QThread *m_ioThread = nullptr;
|
||||
|
||||
class Worker;
|
||||
Worker *m_asyncWorker = nullptr;
|
||||
};
|
||||
}
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "base/utils/fs.h"
|
||||
#include "common.h"
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
#include <libtorrent/session.hpp>
|
||||
|
||||
std::unique_ptr<lt::disk_interface> customDiskIOConstructor(
|
||||
|
||||
@@ -30,11 +30,10 @@
|
||||
|
||||
#include <libtorrent/aux_/vector.hpp>
|
||||
#include <libtorrent/fwd.hpp>
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
#include <QString>
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
#include <libtorrent/disk_interface.hpp>
|
||||
#include <libtorrent/file_storage.hpp>
|
||||
#include <libtorrent/io_context.hpp>
|
||||
@@ -46,7 +45,7 @@
|
||||
#include <libtorrent/storage.hpp>
|
||||
#endif
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
std::unique_ptr<lt::disk_interface> customDiskIOConstructor(
|
||||
lt::io_context &ioContext, lt::settings_interface const &settings, lt::counters &counters);
|
||||
|
||||
|
||||
591
src/base/bittorrent/dbresumedatastorage.cpp
Normal file
591
src/base/bittorrent/dbresumedatastorage.cpp
Normal file
@@ -0,0 +1,591 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2021 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 "dbresumedatastorage.h"
|
||||
|
||||
#include <libtorrent/bdecode.hpp>
|
||||
#include <libtorrent/bencode.hpp>
|
||||
#include <libtorrent/entry.hpp>
|
||||
#include <libtorrent/read_resume_data.hpp>
|
||||
#include <libtorrent/torrent_info.hpp>
|
||||
#include <libtorrent/write_resume_data.hpp>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QFile>
|
||||
#include <QSet>
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlError>
|
||||
#include <QSqlQuery>
|
||||
#include <QThread>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/exceptions.h"
|
||||
#include "base/global.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/profile.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "infohash.h"
|
||||
#include "loadtorrentparams.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
const char DB_CONNECTION_NAME[] = "ResumeDataStorage";
|
||||
|
||||
const int DB_VERSION = 1;
|
||||
|
||||
const char DB_TABLE_META[] = "meta";
|
||||
const char DB_TABLE_TORRENTS[] = "torrents";
|
||||
|
||||
struct Column
|
||||
{
|
||||
QString name;
|
||||
QString placeholder;
|
||||
};
|
||||
|
||||
Column makeColumn(const char *columnName)
|
||||
{
|
||||
return {QLatin1String(columnName), (QLatin1Char(':') + QLatin1String(columnName))};
|
||||
}
|
||||
|
||||
const Column DB_COLUMN_ID = makeColumn("id");
|
||||
const Column DB_COLUMN_TORRENT_ID = makeColumn("torrent_id");
|
||||
const Column DB_COLUMN_QUEUE_POSITION = makeColumn("queue_position");
|
||||
const Column DB_COLUMN_NAME = makeColumn("name");
|
||||
const Column DB_COLUMN_CATEGORY = makeColumn("category");
|
||||
const Column DB_COLUMN_TAGS = makeColumn("tags");
|
||||
const Column DB_COLUMN_TARGET_SAVE_PATH = makeColumn("target_save_path");
|
||||
const Column DB_COLUMN_CONTENT_LAYOUT = makeColumn("content_layout");
|
||||
const Column DB_COLUMN_RATIO_LIMIT = makeColumn("ratio_limit");
|
||||
const Column DB_COLUMN_SEEDING_TIME_LIMIT = makeColumn("seeding_time_limit");
|
||||
const Column DB_COLUMN_HAS_OUTER_PIECES_PRIORITY = makeColumn("has_outer_pieces_priority");
|
||||
const Column DB_COLUMN_HAS_SEED_STATUS = makeColumn("has_seed_status");
|
||||
const Column DB_COLUMN_OPERATING_MODE = makeColumn("operating_mode");
|
||||
const Column DB_COLUMN_STOPPED = makeColumn("stopped");
|
||||
const Column DB_COLUMN_RESUMEDATA = makeColumn("libtorrent_resume_data");
|
||||
const Column DB_COLUMN_METADATA = makeColumn("metadata");
|
||||
const Column DB_COLUMN_VALUE = makeColumn("value");
|
||||
|
||||
template <typename LTStr>
|
||||
QString fromLTString(const LTStr &str)
|
||||
{
|
||||
return QString::fromUtf8(str.data(), static_cast<int>(str.size()));
|
||||
}
|
||||
|
||||
QString quoted(const QString &name)
|
||||
{
|
||||
const QLatin1Char quote {'`'};
|
||||
|
||||
return (quote + name + quote);
|
||||
}
|
||||
|
||||
QString makeCreateTableStatement(const QString &tableName, const QStringList &items)
|
||||
{
|
||||
return QString::fromLatin1("CREATE TABLE %1 (%2)").arg(quoted(tableName), items.join(QLatin1Char(',')));
|
||||
}
|
||||
|
||||
QString makeInsertStatement(const QString &tableName, const QVector<Column> &columns)
|
||||
{
|
||||
QStringList names;
|
||||
names.reserve(columns.size());
|
||||
QStringList values;
|
||||
values.reserve(columns.size());
|
||||
for (const Column &column : columns)
|
||||
{
|
||||
names.append(quoted(column.name));
|
||||
values.append(column.placeholder);
|
||||
}
|
||||
|
||||
const QString jointNames = names.join(QLatin1Char(','));
|
||||
const QString jointValues = values.join(QLatin1Char(','));
|
||||
|
||||
return QString::fromLatin1("INSERT INTO %1 (%2) VALUES (%3)")
|
||||
.arg(quoted(tableName), jointNames, jointValues);
|
||||
}
|
||||
|
||||
QString makeOnConflictUpdateStatement(const Column &constraint, const QVector<Column> &columns)
|
||||
{
|
||||
QStringList names;
|
||||
names.reserve(columns.size());
|
||||
QStringList values;
|
||||
values.reserve(columns.size());
|
||||
for (const Column &column : columns)
|
||||
{
|
||||
names.append(quoted(column.name));
|
||||
values.append(column.placeholder);
|
||||
}
|
||||
|
||||
const QString jointNames = names.join(QLatin1Char(','));
|
||||
const QString jointValues = values.join(QLatin1Char(','));
|
||||
|
||||
return QString::fromLatin1(" ON CONFLICT (%1) DO UPDATE SET (%2) = (%3)")
|
||||
.arg(quoted(constraint.name), jointNames, jointValues);
|
||||
}
|
||||
|
||||
QString makeColumnDefinition(const Column &column, const char *definition)
|
||||
{
|
||||
return QString::fromLatin1("%1 %2").arg(quoted(column.name), QLatin1String(definition));
|
||||
}
|
||||
}
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class DBResumeDataStorage::Worker final : public QObject
|
||||
{
|
||||
Q_DISABLE_COPY_MOVE(Worker)
|
||||
|
||||
public:
|
||||
Worker(const QString &dbPath, const QString &dbConnectionName);
|
||||
|
||||
void openDatabase() const;
|
||||
void closeDatabase() const;
|
||||
|
||||
void store(const TorrentID &id, const LoadTorrentParams &resumeData) const;
|
||||
void remove(const TorrentID &id) const;
|
||||
void storeQueue(const QVector<TorrentID> &queue) const;
|
||||
|
||||
private:
|
||||
const QString m_path;
|
||||
const QString m_connectionName;
|
||||
};
|
||||
}
|
||||
|
||||
BitTorrent::DBResumeDataStorage::DBResumeDataStorage(const QString &dbPath, QObject *parent)
|
||||
: ResumeDataStorage {parent}
|
||||
, m_ioThread {new QThread(this)}
|
||||
{
|
||||
const bool needCreateDB = !QFile::exists(dbPath);
|
||||
|
||||
auto db = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), DB_CONNECTION_NAME);
|
||||
db.setDatabaseName(dbPath);
|
||||
if (!db.open())
|
||||
throw RuntimeError(db.lastError().text());
|
||||
|
||||
if (needCreateDB)
|
||||
createDB();
|
||||
|
||||
m_asyncWorker = new Worker(dbPath, QLatin1String("ResumeDataStorageWorker"));
|
||||
m_asyncWorker->moveToThread(m_ioThread);
|
||||
connect(m_ioThread, &QThread::finished, m_asyncWorker, &QObject::deleteLater);
|
||||
m_ioThread->start();
|
||||
|
||||
RuntimeError *errPtr = nullptr;
|
||||
QMetaObject::invokeMethod(m_asyncWorker, [this, &errPtr]()
|
||||
{
|
||||
try
|
||||
{
|
||||
m_asyncWorker->openDatabase();
|
||||
}
|
||||
catch (const RuntimeError &err)
|
||||
{
|
||||
errPtr = new RuntimeError(err);
|
||||
}
|
||||
}, Qt::BlockingQueuedConnection);
|
||||
|
||||
if (errPtr)
|
||||
throw *errPtr;
|
||||
}
|
||||
|
||||
BitTorrent::DBResumeDataStorage::~DBResumeDataStorage()
|
||||
{
|
||||
QMetaObject::invokeMethod(m_asyncWorker, &Worker::closeDatabase);
|
||||
QSqlDatabase::removeDatabase(DB_CONNECTION_NAME);
|
||||
|
||||
m_ioThread->quit();
|
||||
m_ioThread->wait();
|
||||
}
|
||||
|
||||
QVector<BitTorrent::TorrentID> BitTorrent::DBResumeDataStorage::registeredTorrents() const
|
||||
{
|
||||
const auto selectTorrentIDStatement = QString::fromLatin1("SELECT %1 FROM %2 ORDER BY %3;")
|
||||
.arg(quoted(DB_COLUMN_TORRENT_ID.name), quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name));
|
||||
|
||||
auto db = QSqlDatabase::database(DB_CONNECTION_NAME);
|
||||
QSqlQuery query {db};
|
||||
|
||||
if (!query.exec(selectTorrentIDStatement))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
QVector<TorrentID> registeredTorrents;
|
||||
registeredTorrents.reserve(query.size());
|
||||
while (query.next())
|
||||
registeredTorrents.append(BitTorrent::TorrentID::fromString(query.value(0).toString()));
|
||||
|
||||
return registeredTorrents;
|
||||
}
|
||||
|
||||
std::optional<BitTorrent::LoadTorrentParams> BitTorrent::DBResumeDataStorage::load(const TorrentID &id) const
|
||||
{
|
||||
const QString selectTorrentStatement =
|
||||
QString(QLatin1String("SELECT * FROM %1 WHERE %2 = %3;"))
|
||||
.arg(quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_TORRENT_ID.name), DB_COLUMN_TORRENT_ID.placeholder);
|
||||
|
||||
auto db = QSqlDatabase::database(DB_CONNECTION_NAME);
|
||||
QSqlQuery query {db};
|
||||
try
|
||||
{
|
||||
if (!query.prepare(selectTorrentStatement))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
query.bindValue(DB_COLUMN_TORRENT_ID.placeholder, id.toString());
|
||||
if (!query.exec())
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
if (!query.next())
|
||||
throw RuntimeError(tr("Not found."));
|
||||
}
|
||||
catch (const RuntimeError &err)
|
||||
{
|
||||
LogMsg(tr("Couldn't load resume data of torrent '%1'. Error: %2")
|
||||
.arg(id.toString(), err.message()), Log::CRITICAL);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
LoadTorrentParams resumeData;
|
||||
resumeData.restored = true;
|
||||
resumeData.name = query.value(DB_COLUMN_NAME.name).toString();
|
||||
resumeData.category = query.value(DB_COLUMN_CATEGORY.name).toString();
|
||||
const QString tagsData = query.value(DB_COLUMN_TAGS.name).toString();
|
||||
if (!tagsData.isEmpty())
|
||||
{
|
||||
const QStringList tagList = tagsData.split(QLatin1Char(','));
|
||||
resumeData.tags.insert(tagList.cbegin(), tagList.cend());
|
||||
}
|
||||
resumeData.savePath = Profile::instance()->fromPortablePath(
|
||||
Utils::Fs::toUniformPath(query.value(DB_COLUMN_TARGET_SAVE_PATH.name).toString()));
|
||||
resumeData.hasSeedStatus = query.value(DB_COLUMN_HAS_SEED_STATUS.name).toBool();
|
||||
resumeData.firstLastPiecePriority = query.value(DB_COLUMN_HAS_OUTER_PIECES_PRIORITY.name).toBool();
|
||||
resumeData.ratioLimit = query.value(DB_COLUMN_RATIO_LIMIT.name).toInt() / 1000.0;
|
||||
resumeData.seedingTimeLimit = query.value(DB_COLUMN_SEEDING_TIME_LIMIT.name).toInt();
|
||||
resumeData.contentLayout = Utils::String::toEnum<TorrentContentLayout>(
|
||||
query.value(DB_COLUMN_CONTENT_LAYOUT.name).toString(), TorrentContentLayout::Original);
|
||||
resumeData.operatingMode = Utils::String::toEnum<TorrentOperatingMode>(
|
||||
query.value(DB_COLUMN_OPERATING_MODE.name).toString(), TorrentOperatingMode::AutoManaged);
|
||||
resumeData.stopped = query.value(DB_COLUMN_STOPPED.name).toBool();
|
||||
|
||||
const QByteArray bencodedResumeData = query.value(DB_COLUMN_RESUMEDATA.name).toByteArray();
|
||||
const QByteArray bencodedMetadata = query.value(DB_COLUMN_METADATA.name).toByteArray();
|
||||
const QByteArray allData = ((bencodedMetadata.isEmpty() || bencodedResumeData.isEmpty())
|
||||
? bencodedResumeData
|
||||
: (bencodedResumeData.chopped(1) + bencodedMetadata.mid(1)));
|
||||
|
||||
lt::error_code ec;
|
||||
const lt::bdecode_node root = lt::bdecode(allData, ec);
|
||||
|
||||
lt::add_torrent_params &p = resumeData.ltAddTorrentParams;
|
||||
|
||||
p = lt::read_resume_data(root, ec);
|
||||
p.save_path = Profile::instance()->fromPortablePath(fromLTString(p.save_path)).toStdString();
|
||||
|
||||
return resumeData;
|
||||
}
|
||||
|
||||
void BitTorrent::DBResumeDataStorage::store(const TorrentID &id, const LoadTorrentParams &resumeData) const
|
||||
{
|
||||
QMetaObject::invokeMethod(m_asyncWorker, [this, id, resumeData]()
|
||||
{
|
||||
m_asyncWorker->store(id, resumeData);
|
||||
});
|
||||
}
|
||||
|
||||
void BitTorrent::DBResumeDataStorage::remove(const BitTorrent::TorrentID &id) const
|
||||
{
|
||||
QMetaObject::invokeMethod(m_asyncWorker, [this, id]()
|
||||
{
|
||||
m_asyncWorker->remove(id);
|
||||
});
|
||||
}
|
||||
|
||||
void BitTorrent::DBResumeDataStorage::storeQueue(const QVector<TorrentID> &queue) const
|
||||
{
|
||||
QMetaObject::invokeMethod(m_asyncWorker, [this, queue]()
|
||||
{
|
||||
m_asyncWorker->storeQueue(queue);
|
||||
});
|
||||
}
|
||||
|
||||
void BitTorrent::DBResumeDataStorage::createDB() const
|
||||
{
|
||||
auto db = QSqlDatabase::database(DB_CONNECTION_NAME);
|
||||
|
||||
if (!db.transaction())
|
||||
throw RuntimeError(db.lastError().text());
|
||||
|
||||
QSqlQuery query {db};
|
||||
|
||||
try
|
||||
{
|
||||
const QStringList tableMetaItems = {
|
||||
makeColumnDefinition(DB_COLUMN_ID, "INTEGER PRIMARY KEY"),
|
||||
makeColumnDefinition(DB_COLUMN_NAME, "TEXT NOT NULL UNIQUE"),
|
||||
makeColumnDefinition(DB_COLUMN_VALUE, "BLOB")
|
||||
};
|
||||
const QString createTableMetaQuery = makeCreateTableStatement(DB_TABLE_META, tableMetaItems);
|
||||
if (!query.exec(createTableMetaQuery))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
const QString insertMetaVersionQuery = makeInsertStatement(DB_TABLE_META, {DB_COLUMN_NAME, DB_COLUMN_VALUE});
|
||||
if (!query.prepare(insertMetaVersionQuery))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
query.bindValue(DB_COLUMN_NAME.placeholder, QString::fromLatin1("version"));
|
||||
query.bindValue(DB_COLUMN_VALUE.placeholder, DB_VERSION);
|
||||
|
||||
if (!query.exec())
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
const QStringList tableTorrentsItems = {
|
||||
makeColumnDefinition(DB_COLUMN_ID, "INTEGER PRIMARY KEY"),
|
||||
makeColumnDefinition(DB_COLUMN_TORRENT_ID, "BLOB NOT NULL UNIQUE"),
|
||||
makeColumnDefinition(DB_COLUMN_QUEUE_POSITION, "INTEGER NOT NULL DEFAULT -1"),
|
||||
makeColumnDefinition(DB_COLUMN_NAME, "TEXT"),
|
||||
makeColumnDefinition(DB_COLUMN_CATEGORY, "TEXT"),
|
||||
makeColumnDefinition(DB_COLUMN_TAGS, "TEXT"),
|
||||
makeColumnDefinition(DB_COLUMN_TARGET_SAVE_PATH, "TEXT"),
|
||||
makeColumnDefinition(DB_COLUMN_CONTENT_LAYOUT, "TEXT NOT NULL"),
|
||||
makeColumnDefinition(DB_COLUMN_RATIO_LIMIT, "INTEGER NOT NULL"),
|
||||
makeColumnDefinition(DB_COLUMN_SEEDING_TIME_LIMIT, "INTEGER NOT NULL"),
|
||||
makeColumnDefinition(DB_COLUMN_HAS_OUTER_PIECES_PRIORITY, "INTEGER NOT NULL"),
|
||||
makeColumnDefinition(DB_COLUMN_HAS_SEED_STATUS, "INTEGER NOT NULL"),
|
||||
makeColumnDefinition(DB_COLUMN_OPERATING_MODE, "TEXT NOT NULL"),
|
||||
makeColumnDefinition(DB_COLUMN_STOPPED, "INTEGER NOT NULL"),
|
||||
makeColumnDefinition(DB_COLUMN_RESUMEDATA, "BLOB NOT NULL"),
|
||||
makeColumnDefinition(DB_COLUMN_METADATA, "BLOB")
|
||||
};
|
||||
const QString createTableTorrentsQuery = makeCreateTableStatement(DB_TABLE_TORRENTS, tableTorrentsItems);
|
||||
if (!query.exec(createTableTorrentsQuery))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
if (!db.commit())
|
||||
throw RuntimeError(db.lastError().text());
|
||||
}
|
||||
catch (const RuntimeError &)
|
||||
{
|
||||
db.rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
BitTorrent::DBResumeDataStorage::Worker::Worker(const QString &dbPath, const QString &dbConnectionName)
|
||||
: m_path {dbPath}
|
||||
, m_connectionName {dbConnectionName}
|
||||
{
|
||||
}
|
||||
|
||||
void BitTorrent::DBResumeDataStorage::Worker::openDatabase() const
|
||||
{
|
||||
auto db = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), m_connectionName);
|
||||
db.setDatabaseName(m_path);
|
||||
if (!db.open())
|
||||
throw RuntimeError(db.lastError().text());
|
||||
}
|
||||
|
||||
void BitTorrent::DBResumeDataStorage::Worker::closeDatabase() const
|
||||
{
|
||||
QSqlDatabase::removeDatabase(m_connectionName);
|
||||
}
|
||||
|
||||
void BitTorrent::DBResumeDataStorage::Worker::store(const TorrentID &id, const LoadTorrentParams &resumeData) const
|
||||
{
|
||||
// We need to adjust native libtorrent resume data
|
||||
lt::add_torrent_params p = resumeData.ltAddTorrentParams;
|
||||
p.save_path = Profile::instance()->toPortablePath(QString::fromStdString(p.save_path)).toStdString();
|
||||
if (resumeData.stopped)
|
||||
{
|
||||
p.flags |= lt::torrent_flags::paused;
|
||||
p.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"
|
||||
if (resumeData.operatingMode == BitTorrent::TorrentOperatingMode::AutoManaged)
|
||||
{
|
||||
p.flags |= lt::torrent_flags::auto_managed;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.flags &= ~lt::torrent_flags::paused;
|
||||
p.flags &= ~lt::torrent_flags::auto_managed;
|
||||
}
|
||||
}
|
||||
|
||||
QVector<Column> columns {
|
||||
DB_COLUMN_TORRENT_ID,
|
||||
DB_COLUMN_NAME,
|
||||
DB_COLUMN_CATEGORY,
|
||||
DB_COLUMN_TAGS,
|
||||
DB_COLUMN_TARGET_SAVE_PATH,
|
||||
DB_COLUMN_CONTENT_LAYOUT,
|
||||
DB_COLUMN_RATIO_LIMIT,
|
||||
DB_COLUMN_SEEDING_TIME_LIMIT,
|
||||
DB_COLUMN_HAS_OUTER_PIECES_PRIORITY,
|
||||
DB_COLUMN_HAS_SEED_STATUS,
|
||||
DB_COLUMN_OPERATING_MODE,
|
||||
DB_COLUMN_STOPPED,
|
||||
DB_COLUMN_RESUMEDATA
|
||||
};
|
||||
|
||||
lt::entry data = lt::write_resume_data(p);
|
||||
|
||||
// metadata is stored in separate column
|
||||
QByteArray bencodedMetadata;
|
||||
if (p.ti)
|
||||
{
|
||||
lt::entry::dictionary_type &dataDict = data.dict();
|
||||
lt::entry metadata {lt::entry::dictionary_t};
|
||||
lt::entry::dictionary_type &metadataDict = metadata.dict();
|
||||
metadataDict.insert(dataDict.extract("info"));
|
||||
metadataDict.insert(dataDict.extract("creation date"));
|
||||
metadataDict.insert(dataDict.extract("created by"));
|
||||
metadataDict.insert(dataDict.extract("comment"));
|
||||
|
||||
try
|
||||
{
|
||||
bencodedMetadata.reserve(512 * 1024);
|
||||
lt::bencode(std::back_inserter(bencodedMetadata), metadata);
|
||||
}
|
||||
catch (const std::exception &err)
|
||||
{
|
||||
LogMsg(tr("Couldn't save torrent metadata. Error: %1.")
|
||||
.arg(QString::fromLocal8Bit(err.what())), Log::CRITICAL);
|
||||
return;
|
||||
}
|
||||
|
||||
columns.append(DB_COLUMN_METADATA);
|
||||
}
|
||||
|
||||
QByteArray bencodedResumeData;
|
||||
bencodedResumeData.reserve(256 * 1024);
|
||||
lt::bencode(std::back_inserter(bencodedResumeData), data);
|
||||
|
||||
const QString insertTorrentStatement = makeInsertStatement(DB_TABLE_TORRENTS, columns)
|
||||
+ makeOnConflictUpdateStatement(DB_COLUMN_TORRENT_ID, columns);
|
||||
auto db = QSqlDatabase::database(m_connectionName);
|
||||
QSqlQuery query {db};
|
||||
|
||||
try
|
||||
{
|
||||
if (!query.prepare(insertTorrentStatement))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
query.bindValue(DB_COLUMN_TORRENT_ID.placeholder, id.toString());
|
||||
query.bindValue(DB_COLUMN_NAME.placeholder, resumeData.name);
|
||||
query.bindValue(DB_COLUMN_CATEGORY.placeholder, resumeData.category);
|
||||
query.bindValue(DB_COLUMN_TAGS.placeholder, (resumeData.tags.isEmpty()
|
||||
? QVariant(QVariant::String) : resumeData.tags.join(QLatin1String(","))));
|
||||
query.bindValue(DB_COLUMN_TARGET_SAVE_PATH.placeholder, Profile::instance()->toPortablePath(resumeData.savePath));
|
||||
query.bindValue(DB_COLUMN_CONTENT_LAYOUT.placeholder, Utils::String::fromEnum(resumeData.contentLayout));
|
||||
query.bindValue(DB_COLUMN_RATIO_LIMIT.placeholder, static_cast<int>(resumeData.ratioLimit * 1000));
|
||||
query.bindValue(DB_COLUMN_SEEDING_TIME_LIMIT.placeholder, resumeData.seedingTimeLimit);
|
||||
query.bindValue(DB_COLUMN_HAS_OUTER_PIECES_PRIORITY.placeholder, resumeData.firstLastPiecePriority);
|
||||
query.bindValue(DB_COLUMN_HAS_SEED_STATUS.placeholder, resumeData.hasSeedStatus);
|
||||
query.bindValue(DB_COLUMN_OPERATING_MODE.placeholder, Utils::String::fromEnum(resumeData.operatingMode));
|
||||
query.bindValue(DB_COLUMN_STOPPED.placeholder, resumeData.stopped);
|
||||
query.bindValue(DB_COLUMN_RESUMEDATA.placeholder, bencodedResumeData);
|
||||
if (!bencodedMetadata.isEmpty())
|
||||
query.bindValue(DB_COLUMN_METADATA.placeholder, bencodedMetadata);
|
||||
|
||||
if (!query.exec())
|
||||
throw RuntimeError(query.lastError().text());
|
||||
}
|
||||
catch (const RuntimeError &err)
|
||||
{
|
||||
LogMsg(tr("Couldn't store resume data for torrent '%1'. Error: %2")
|
||||
.arg(id.toString(), err.message()), Log::CRITICAL);
|
||||
}
|
||||
}
|
||||
|
||||
void BitTorrent::DBResumeDataStorage::Worker::remove(const TorrentID &id) const
|
||||
{
|
||||
const auto deleteTorrentStatement = QString::fromLatin1("DELETE FROM %1 WHERE %2 = %3;")
|
||||
.arg(quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_TORRENT_ID.name), DB_COLUMN_TORRENT_ID.placeholder);
|
||||
|
||||
auto db = QSqlDatabase::database(m_connectionName);
|
||||
QSqlQuery query {db};
|
||||
|
||||
try
|
||||
{
|
||||
if (!query.prepare(deleteTorrentStatement))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
query.bindValue(DB_COLUMN_TORRENT_ID.placeholder, id.toString());
|
||||
if (!query.exec())
|
||||
throw RuntimeError(query.lastError().text());
|
||||
}
|
||||
catch (const RuntimeError &err)
|
||||
{
|
||||
LogMsg(tr("Couldn't delete resume data of torrent '%1'. Error: %2")
|
||||
.arg(id.toString(), err.message()), Log::CRITICAL);
|
||||
}
|
||||
}
|
||||
|
||||
void BitTorrent::DBResumeDataStorage::Worker::storeQueue(const QVector<TorrentID> &queue) const
|
||||
{
|
||||
const auto updateQueuePosStatement = QString::fromLatin1("UPDATE %1 SET %2 = %3 WHERE %4 = %5;")
|
||||
.arg(quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name), DB_COLUMN_QUEUE_POSITION.placeholder
|
||||
, quoted(DB_COLUMN_TORRENT_ID.name), DB_COLUMN_TORRENT_ID.placeholder);
|
||||
|
||||
auto db = QSqlDatabase::database(m_connectionName);
|
||||
|
||||
try
|
||||
{
|
||||
if (!db.transaction())
|
||||
throw RuntimeError(db.lastError().text());
|
||||
|
||||
QSqlQuery query {db};
|
||||
|
||||
try
|
||||
{
|
||||
if (!query.prepare(updateQueuePosStatement))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
int pos = 0;
|
||||
for (const TorrentID &torrentID : queue)
|
||||
{
|
||||
query.bindValue(DB_COLUMN_TORRENT_ID.placeholder, torrentID.toString());
|
||||
query.bindValue(DB_COLUMN_QUEUE_POSITION.placeholder, pos++);
|
||||
if (!query.exec())
|
||||
throw RuntimeError(query.lastError().text());
|
||||
}
|
||||
|
||||
if (!db.commit())
|
||||
throw RuntimeError(db.lastError().text());
|
||||
}
|
||||
catch (const RuntimeError &)
|
||||
{
|
||||
db.rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
catch (const RuntimeError &err)
|
||||
{
|
||||
LogMsg(tr("Couldn't store torrents queue positions. Error: %1")
|
||||
.arg(err.message()), Log::CRITICAL);
|
||||
}
|
||||
}
|
||||
60
src/base/bittorrent/dbresumedatastorage.h
Normal file
60
src/base/bittorrent/dbresumedatastorage.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2021 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 "resumedatastorage.h"
|
||||
|
||||
class QThread;
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class DBResumeDataStorage final : public ResumeDataStorage
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(DBResumeDataStorage)
|
||||
|
||||
public:
|
||||
explicit DBResumeDataStorage(const QString &dbPath, QObject *parent = nullptr);
|
||||
~DBResumeDataStorage() override;
|
||||
|
||||
QVector<TorrentID> registeredTorrents() const override;
|
||||
std::optional<LoadTorrentParams> load(const TorrentID &id) const override;
|
||||
void store(const TorrentID &id, const LoadTorrentParams &resumeData) const override;
|
||||
void remove(const TorrentID &id) const override;
|
||||
void storeQueue(const QVector<TorrentID> &queue) const override;
|
||||
|
||||
private:
|
||||
void createDB() const;
|
||||
|
||||
QThread *m_ioThread = nullptr;
|
||||
|
||||
class Worker;
|
||||
Worker *m_asyncWorker = nullptr;
|
||||
};
|
||||
}
|
||||
@@ -38,7 +38,7 @@ namespace BitTorrent
|
||||
class FileSearcher final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(FileSearcher)
|
||||
Q_DISABLE_COPY_MOVE(FileSearcher)
|
||||
|
||||
public:
|
||||
FileSearcher() = default;
|
||||
|
||||
@@ -41,9 +41,27 @@ bool BitTorrent::InfoHash::isValid() const
|
||||
return m_valid;
|
||||
}
|
||||
|
||||
SHA1Hash BitTorrent::InfoHash::v1() const
|
||||
{
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
return (m_nativeHash.has_v1() ? SHA1Hash(m_nativeHash.v1) : SHA1Hash());
|
||||
#else
|
||||
return {m_nativeHash};
|
||||
#endif
|
||||
}
|
||||
|
||||
SHA256Hash BitTorrent::InfoHash::v2() const
|
||||
{
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
return (m_nativeHash.has_v2() ? SHA256Hash(m_nativeHash.v2) : SHA256Hash());
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
|
||||
BitTorrent::TorrentID BitTorrent::InfoHash::toTorrentID() const
|
||||
{
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
return m_nativeHash.get_best();
|
||||
#else
|
||||
return {m_nativeHash};
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <libtorrent/version.hpp>
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
#include <libtorrent/info_hash.hpp>
|
||||
#endif
|
||||
|
||||
@@ -58,7 +57,7 @@ namespace BitTorrent
|
||||
class InfoHash
|
||||
{
|
||||
public:
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
using WrappedType = lt::info_hash_t;
|
||||
#else
|
||||
using WrappedType = lt::sha1_hash;
|
||||
@@ -69,6 +68,8 @@ namespace BitTorrent
|
||||
InfoHash(const WrappedType &nativeHash);
|
||||
|
||||
bool isValid() const;
|
||||
SHA1Hash v1() const;
|
||||
SHA256Hash v2() const;
|
||||
TorrentID toTorrentID() const;
|
||||
|
||||
operator WrappedType() const;
|
||||
|
||||
60
src/base/bittorrent/loadtorrentparams.h
Normal file
60
src/base/bittorrent/loadtorrentparams.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2021 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 <libtorrent/add_torrent_params.hpp>
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "base/tagset.h"
|
||||
#include "torrent.h"
|
||||
#include "torrentcontentlayout.h"
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
struct LoadTorrentParams
|
||||
{
|
||||
lt::add_torrent_params ltAddTorrentParams {};
|
||||
|
||||
QString name;
|
||||
QString category;
|
||||
TagSet tags;
|
||||
QString savePath;
|
||||
TorrentContentLayout contentLayout = TorrentContentLayout::Original;
|
||||
TorrentOperatingMode operatingMode = TorrentOperatingMode::AutoManaged;
|
||||
bool firstLastPiecePriority = false;
|
||||
bool hasSeedStatus = false;
|
||||
bool stopped = false;
|
||||
|
||||
qreal ratioLimit = Torrent::USE_GLOBAL_RATIO;
|
||||
int seedingTimeLimit = Torrent::USE_GLOBAL_SEEDING_TIME;
|
||||
|
||||
bool restored = false; // is existing torrent job?
|
||||
};
|
||||
}
|
||||
@@ -28,31 +28,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct HasUnderlyingType
|
||||
: std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct HasUnderlyingType<T, std::void_t<typename T::underlying_type>>
|
||||
: std::true_type
|
||||
typename T::underlying_type toLTUnderlyingType(const T &t)
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct LTUnderlying
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct LTUnderlying<T, typename std::enable_if_t<HasUnderlyingType<T>::value>>
|
||||
{
|
||||
using type = typename T::underlying_type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using LTUnderlyingType = typename LTUnderlying<T>::type;
|
||||
return static_cast<typename T::underlying_type>(t);
|
||||
}
|
||||
|
||||
@@ -39,21 +39,34 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
bool isSHA1Hash(const QString &string)
|
||||
// BEP9 Extension for Peers to Send Metadata Files
|
||||
|
||||
bool isV1Hash(const QString &string)
|
||||
{
|
||||
// There are 2 representations for BitTorrent info hash:
|
||||
// There are 2 representations for BitTorrent v1 info hash:
|
||||
// 1. 40 chars hex-encoded string
|
||||
// == 20 (SHA-1 length in bytes) * 2 (each byte maps to 2 hex characters)
|
||||
// 2. 32 chars Base32 encoded string
|
||||
// == 20 (SHA-1 length in bytes) * 1.6 (the efficiency of Base32 encoding)
|
||||
const int SHA1_HEX_SIZE = SHA1Hash::length() * 2;
|
||||
const int SHA1_BASE32_SIZE = SHA1Hash::length() * 1.6;
|
||||
const int V1_HEX_SIZE = SHA1Hash::length() * 2;
|
||||
const int V1_BASE32_SIZE = SHA1Hash::length() * 1.6;
|
||||
|
||||
return ((((string.size() == SHA1_HEX_SIZE))
|
||||
return ((((string.size() == V1_HEX_SIZE))
|
||||
&& !string.contains(QRegularExpression(QLatin1String("[^0-9A-Fa-f]"))))
|
||||
|| ((string.size() == SHA1_BASE32_SIZE)
|
||||
|| ((string.size() == V1_BASE32_SIZE)
|
||||
&& !string.contains(QRegularExpression(QLatin1String("[^2-7A-Za-z]")))));
|
||||
}
|
||||
|
||||
bool isV2Hash(const QString &string)
|
||||
{
|
||||
// There are 1 representation for BitTorrent v2 info hash:
|
||||
// 1. 64 chars hex-encoded string
|
||||
// == 32 (SHA-2 256 length in bytes) * 2 (each byte maps to 2 hex characters)
|
||||
const int V2_HEX_SIZE = SHA256Hash::length() * 2;
|
||||
|
||||
return (string.size() == V2_HEX_SIZE)
|
||||
&& !string.contains(QRegularExpression(QLatin1String("[^0-9A-Fa-f]")));
|
||||
}
|
||||
}
|
||||
|
||||
using namespace BitTorrent;
|
||||
@@ -66,8 +79,10 @@ MagnetUri::MagnetUri(const QString &source)
|
||||
{
|
||||
if (source.isEmpty()) return;
|
||||
|
||||
if (isSHA1Hash(source))
|
||||
m_url = QLatin1String("magnet:?xt=urn:btih:") + source;
|
||||
if (isV2Hash(source))
|
||||
m_url = QString::fromLatin1("magnet:?xt=urn:btmh:1220") + source; // 0x12 0x20 is the "multihash format" tag for the SHA-256 hashing scheme.
|
||||
else if (isV1Hash(source))
|
||||
m_url = QString::fromLatin1("magnet:?xt=urn:btih:") + source;
|
||||
|
||||
lt::error_code ec;
|
||||
lt::parse_magnet_uri(m_url.toStdString(), m_addTorrentParams, ec);
|
||||
@@ -75,7 +90,7 @@ MagnetUri::MagnetUri(const QString &source)
|
||||
|
||||
m_valid = true;
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
m_infoHash = m_addTorrentParams.info_hashes;
|
||||
#else
|
||||
m_infoHash = m_addTorrentParams.info_hash;
|
||||
|
||||
@@ -29,11 +29,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <libtorrent/extensions.hpp>
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
class NativeSessionExtension final : public lt::plugin
|
||||
{
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
using ClientData = lt::client_data_t;
|
||||
#else
|
||||
using ClientData = void *;
|
||||
|
||||
@@ -32,18 +32,18 @@
|
||||
|
||||
using namespace BitTorrent;
|
||||
|
||||
PeerAddress PeerAddress::parse(const QString &address)
|
||||
PeerAddress PeerAddress::parse(const QStringView address)
|
||||
{
|
||||
QVector<QStringRef> ipPort;
|
||||
QList<QStringView> ipPort;
|
||||
|
||||
if (address.startsWith('[') && address.contains("]:"))
|
||||
if (address.startsWith(u'[') && address.contains(QLatin1String("]:")))
|
||||
{ // IPv6
|
||||
ipPort = address.splitRef("]:");
|
||||
ipPort = address.split(QString::fromLatin1("]:"));
|
||||
ipPort[0] = ipPort[0].mid(1); // chop '['
|
||||
}
|
||||
else if (address.contains(':'))
|
||||
else if (address.contains(u':'))
|
||||
{ // IPv4
|
||||
ipPort = address.splitRef(':');
|
||||
ipPort = address.split(u':');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace BitTorrent
|
||||
QHostAddress ip;
|
||||
ushort port = 0;
|
||||
|
||||
static PeerAddress parse(const QString &address);
|
||||
static PeerAddress parse(QStringView address);
|
||||
QString toString() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -257,123 +257,86 @@ qreal PeerInfo::relevance() const
|
||||
|
||||
void PeerInfo::determineFlags()
|
||||
{
|
||||
const auto updateFlags = [this](const QChar specifier, const QString &explanation)
|
||||
{
|
||||
m_flags += (specifier + QLatin1Char(' '));
|
||||
m_flagsDescription += QString::fromLatin1("%1 = %2\n").arg(specifier, explanation);
|
||||
};
|
||||
|
||||
if (isInteresting())
|
||||
{
|
||||
// d = Your client wants to download, but peer doesn't want to send (interested and choked)
|
||||
if (isRemoteChocked())
|
||||
{
|
||||
m_flags += "d ";
|
||||
m_flagsDescription += ("d = "
|
||||
+ tr("Interested(local) and Choked(peer)") + '\n');
|
||||
// d = Your client wants to download, but peer doesn't want to send (interested and choked)
|
||||
updateFlags(QLatin1Char('d'), tr("Interested (local) and choked (peer)"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// D = Currently downloading (interested and not choked)
|
||||
m_flags += "D ";
|
||||
m_flagsDescription += ("D = "
|
||||
+ tr("interested(local) and unchoked(peer)") + '\n');
|
||||
updateFlags(QLatin1Char('D'), tr("Interested (local) and unchoked (peer)"));
|
||||
}
|
||||
}
|
||||
|
||||
if (isRemoteInterested())
|
||||
{
|
||||
// u = Peer wants your client to upload, but your client doesn't want to (interested and choked)
|
||||
if (isChocked())
|
||||
{
|
||||
m_flags += "u ";
|
||||
m_flagsDescription += ("u = "
|
||||
+ tr("interested(peer) and choked(local)") + '\n');
|
||||
// u = Peer wants your client to upload, but your client doesn't want to (interested and choked)
|
||||
updateFlags(QLatin1Char('u'), tr("Interested (peer) and choked (local)"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// U = Currently uploading (interested and not choked)
|
||||
m_flags += "U ";
|
||||
m_flagsDescription += ("U = "
|
||||
+ tr("interested(peer) and unchoked(local)") + '\n');
|
||||
updateFlags(QLatin1Char('U'), tr("Interested (peer) and unchoked (local)"));
|
||||
}
|
||||
}
|
||||
|
||||
// O = Optimistic unchoke
|
||||
if (optimisticUnchoke())
|
||||
{
|
||||
m_flags += "O ";
|
||||
m_flagsDescription += ("O = " + tr("optimistic unchoke") + '\n');
|
||||
}
|
||||
|
||||
// S = Peer is snubbed
|
||||
if (isSnubbed())
|
||||
{
|
||||
m_flags += "S ";
|
||||
m_flagsDescription += ("S = " + tr("peer snubbed") + '\n');
|
||||
}
|
||||
|
||||
// I = Peer is an incoming connection
|
||||
if (!isLocalConnection())
|
||||
{
|
||||
m_flags += "I ";
|
||||
m_flagsDescription += ("I = " + tr("incoming connection") + '\n');
|
||||
}
|
||||
|
||||
// K = Peer is unchoking your client, but your client is not interested
|
||||
if (!isRemoteChocked() && !isInteresting())
|
||||
{
|
||||
m_flags += "K ";
|
||||
m_flagsDescription += ("K = "
|
||||
+ tr("not interested(local) and unchoked(peer)") + '\n');
|
||||
}
|
||||
updateFlags(QLatin1Char('K'), tr("Not interested (local) and unchoked (peer)"));
|
||||
|
||||
// ? = Your client unchoked the peer but the peer is not interested
|
||||
if (!isChocked() && !isRemoteInterested())
|
||||
{
|
||||
m_flags += "? ";
|
||||
m_flagsDescription += ("? = "
|
||||
+ tr("not interested(peer) and unchoked(local)") + '\n');
|
||||
}
|
||||
updateFlags(QLatin1Char('?'), tr("Not interested (peer) and unchoked (local)"));
|
||||
|
||||
// X = Peer was included in peerlists obtained through Peer Exchange (PEX)
|
||||
if (fromPeX())
|
||||
{
|
||||
m_flags += "X ";
|
||||
m_flagsDescription += ("X = " + tr("peer from PEX") + '\n');
|
||||
}
|
||||
// O = Optimistic unchoke
|
||||
if (optimisticUnchoke())
|
||||
updateFlags(QLatin1Char('O'), tr("Optimistic unchoke"));
|
||||
|
||||
// S = Peer is snubbed
|
||||
if (isSnubbed())
|
||||
updateFlags(QLatin1Char('S'), tr("Peer snubbed"));
|
||||
|
||||
// I = Peer is an incoming connection
|
||||
if (!isLocalConnection())
|
||||
updateFlags(QLatin1Char('I'), tr("Incoming connection"));
|
||||
|
||||
// H = Peer was obtained through DHT
|
||||
if (fromDHT())
|
||||
{
|
||||
m_flags += "H ";
|
||||
m_flagsDescription += ("H = " + tr("peer from DHT") + '\n');
|
||||
}
|
||||
updateFlags(QLatin1Char('H'), tr("Peer from DHT"));
|
||||
|
||||
// E = Peer is using Protocol Encryption (all traffic)
|
||||
if (isRC4Encrypted())
|
||||
{
|
||||
m_flags += "E ";
|
||||
m_flagsDescription += ("E = " + tr("encrypted traffic") + '\n');
|
||||
}
|
||||
|
||||
// e = Peer is using Protocol Encryption (handshake)
|
||||
if (isPlaintextEncrypted())
|
||||
{
|
||||
m_flags += "e ";
|
||||
m_flagsDescription += ("e = " + tr("encrypted handshake") + '\n');
|
||||
}
|
||||
|
||||
// P = Peer is using uTorrent uTP
|
||||
if (useUTPSocket())
|
||||
{
|
||||
m_flags += "P ";
|
||||
m_flagsDescription += ("P = " + QString::fromUtf8(C_UTP) + '\n');
|
||||
}
|
||||
// X = Peer was included in peerlists obtained through Peer Exchange (PEX)
|
||||
if (fromPeX())
|
||||
updateFlags(QLatin1Char('X'), tr("Peer from PEX"));
|
||||
|
||||
// L = Peer is local
|
||||
if (fromLSD())
|
||||
{
|
||||
m_flags += "L ";
|
||||
m_flagsDescription += ("L = " + tr("peer from LSD") + '\n');
|
||||
}
|
||||
updateFlags(QLatin1Char('L'), tr("Peer from LSD"));
|
||||
|
||||
m_flags = m_flags.trimmed();
|
||||
m_flagsDescription = m_flagsDescription.trimmed();
|
||||
// E = Peer is using Protocol Encryption (all traffic)
|
||||
if (isRC4Encrypted())
|
||||
updateFlags(QLatin1Char('E'), tr("Encrypted traffic"));
|
||||
|
||||
// e = Peer is using Protocol Encryption (handshake)
|
||||
if (isPlaintextEncrypted())
|
||||
updateFlags(QLatin1Char('e'), tr("Encrypted handshake"));
|
||||
|
||||
// P = Peer is using uTorrent uTP
|
||||
if (useUTPSocket())
|
||||
updateFlags(QLatin1Char('P'), QString::fromUtf8(C_UTP));
|
||||
|
||||
m_flags.chop(1);
|
||||
m_flagsDescription.chop(1);
|
||||
}
|
||||
|
||||
QString PeerInfo::flags() const
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
class PortForwarderImpl final : public Net::PortForwarder
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(PortForwarderImpl)
|
||||
Q_DISABLE_COPY_MOVE(PortForwarderImpl)
|
||||
|
||||
public:
|
||||
explicit PortForwarderImpl(lt::session *provider, QObject *parent = nullptr);
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2015, 2018 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 "resumedatasavingmanager.h"
|
||||
|
||||
#include <libtorrent/bencode.hpp>
|
||||
#include <libtorrent/entry.hpp>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QSaveFile>
|
||||
|
||||
#include "base/logger.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/io.h"
|
||||
|
||||
ResumeDataSavingManager::ResumeDataSavingManager(const QString &resumeFolderPath)
|
||||
: m_resumeDataDir(resumeFolderPath)
|
||||
{
|
||||
}
|
||||
|
||||
void ResumeDataSavingManager::save(const QString &filename, const QByteArray &data) const
|
||||
{
|
||||
const QString filepath = m_resumeDataDir.absoluteFilePath(filename);
|
||||
|
||||
QSaveFile file {filepath};
|
||||
if (!file.open(QIODevice::WriteOnly) || (file.write(data) != data.size()) || !file.commit())
|
||||
{
|
||||
LogMsg(tr("Couldn't save data to '%1'. Error: %2")
|
||||
.arg(filepath, file.errorString()), Log::CRITICAL);
|
||||
}
|
||||
}
|
||||
|
||||
void ResumeDataSavingManager::save(const QString &filename, const std::shared_ptr<lt::entry> &data) const
|
||||
{
|
||||
const QString filepath = m_resumeDataDir.absoluteFilePath(filename);
|
||||
|
||||
QSaveFile file {filepath};
|
||||
if (!file.open(QIODevice::WriteOnly))
|
||||
{
|
||||
LogMsg(tr("Couldn't save data to '%1'. Error: %2")
|
||||
.arg(filepath, file.errorString()), Log::CRITICAL);
|
||||
return;
|
||||
}
|
||||
|
||||
lt::bencode(Utils::IO::FileDeviceOutputIterator {file}, *data);
|
||||
if ((file.error() != QFileDevice::NoError) || !file.commit())
|
||||
{
|
||||
LogMsg(tr("Couldn't save data to '%1'. Error: %2")
|
||||
.arg(filepath, file.errorString()), Log::CRITICAL);
|
||||
}
|
||||
}
|
||||
|
||||
void ResumeDataSavingManager::remove(const QString &filename) const
|
||||
{
|
||||
const QString filepath = m_resumeDataDir.absoluteFilePath(filename);
|
||||
|
||||
Utils::Fs::forceRemove(filepath);
|
||||
}
|
||||
55
src/base/bittorrent/resumedatastorage.h
Normal file
55
src/base/bittorrent/resumedatastorage.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2015, 2018 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 <optional>
|
||||
|
||||
#include <QtContainerFwd>
|
||||
#include <QObject>
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TorrentID;
|
||||
struct LoadTorrentParams;
|
||||
|
||||
class ResumeDataStorage : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(ResumeDataStorage)
|
||||
|
||||
public:
|
||||
using QObject::QObject;
|
||||
|
||||
virtual QVector<TorrentID> registeredTorrents() const = 0;
|
||||
virtual std::optional<LoadTorrentParams> load(const TorrentID &id) const = 0;
|
||||
virtual void store(const TorrentID &id, const LoadTorrentParams &resumeData) const = 0;
|
||||
virtual void remove(const TorrentID &id) const = 0;
|
||||
virtual void storeQueue(const QVector<TorrentID> &queue) const = 0;
|
||||
};
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,6 @@
|
||||
#include <libtorrent/add_torrent_params.hpp>
|
||||
#include <libtorrent/fwd.hpp>
|
||||
#include <libtorrent/torrent_handle.hpp>
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
#include <QHash>
|
||||
#include <QPointer>
|
||||
@@ -50,10 +49,12 @@
|
||||
#include "cachestatus.h"
|
||||
#include "sessionstatus.h"
|
||||
#include "torrentinfo.h"
|
||||
#include "trackerentry.h"
|
||||
|
||||
class QFile;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
class QNetworkConfiguration;
|
||||
class QNetworkConfigurationManager;
|
||||
#endif
|
||||
class QString;
|
||||
class QThread;
|
||||
class QTimer;
|
||||
@@ -62,7 +63,6 @@ class QUrl;
|
||||
class BandwidthScheduler;
|
||||
class FileSearcher;
|
||||
class FilterParserThread;
|
||||
class ResumeDataSavingManager;
|
||||
class Statistics;
|
||||
|
||||
// These values should remain unchanged when adding new items
|
||||
@@ -81,12 +81,6 @@ enum DeleteOption
|
||||
DeleteTorrentAndFiles
|
||||
};
|
||||
|
||||
enum TorrentExportFolder
|
||||
{
|
||||
Regular,
|
||||
Finished
|
||||
};
|
||||
|
||||
namespace Net
|
||||
{
|
||||
struct DownloadResult;
|
||||
@@ -96,11 +90,11 @@ namespace BitTorrent
|
||||
{
|
||||
class InfoHash;
|
||||
class MagnetUri;
|
||||
class ResumeDataStorage;
|
||||
class Torrent;
|
||||
class TorrentImpl;
|
||||
class Tracker;
|
||||
struct LoadTorrentParams;
|
||||
struct TrackerEntry;
|
||||
|
||||
enum class MoveStorageMode;
|
||||
|
||||
@@ -141,6 +135,13 @@ namespace BitTorrent
|
||||
};
|
||||
Q_ENUM_NS(SeedChokingAlgorithm)
|
||||
|
||||
enum class ResumeDataStorageType
|
||||
{
|
||||
Legacy,
|
||||
SQLite
|
||||
};
|
||||
Q_ENUM_NS(ResumeDataStorageType)
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
enum class OSMemoryPriority : int
|
||||
{
|
||||
@@ -189,7 +190,7 @@ namespace BitTorrent
|
||||
{
|
||||
int diskBlocksInUse = -1;
|
||||
int numBlocksRead = -1;
|
||||
#if (LIBTORRENT_VERSION_NUM < 20000)
|
||||
#ifndef QBT_USES_LIBTORRENT2
|
||||
int numBlocksCacheHits = -1;
|
||||
#endif
|
||||
int writeJobs = -1;
|
||||
@@ -203,7 +204,7 @@ namespace BitTorrent
|
||||
class Session : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(Session)
|
||||
Q_DISABLE_COPY_MOVE(Session)
|
||||
|
||||
public:
|
||||
static void initInstance();
|
||||
@@ -304,8 +305,6 @@ namespace BitTorrent
|
||||
void setSaveResumeDataInterval(int value);
|
||||
int port() const;
|
||||
void setPort(int port);
|
||||
bool useRandomPort() const;
|
||||
void setUseRandomPort(bool value);
|
||||
QString networkInterface() const;
|
||||
void setNetworkInterface(const QString &iface);
|
||||
QString networkInterfaceName() const;
|
||||
@@ -364,6 +363,8 @@ namespace BitTorrent
|
||||
void setSendBufferLowWatermark(int value);
|
||||
int sendBufferWatermarkFactor() const;
|
||||
void setSendBufferWatermarkFactor(int value);
|
||||
int connectionSpeed() const;
|
||||
void setConnectionSpeed(int value);
|
||||
int socketBacklogSize() const;
|
||||
void setSocketBacklogSize(int value);
|
||||
bool isAnonymousModeEnabled() const;
|
||||
@@ -394,6 +395,9 @@ namespace BitTorrent
|
||||
void setAnnounceIP(const QString &ip);
|
||||
int maxConcurrentHTTPAnnounces() const;
|
||||
void setMaxConcurrentHTTPAnnounces(int value);
|
||||
bool isReannounceWhenAddressChangedEnabled() const;
|
||||
void setReannounceWhenAddressChangedEnabled(bool enabled);
|
||||
void reannounceToAllTrackers() const;
|
||||
int stopTrackerTimeout() const;
|
||||
void setStopTrackerTimeout(int value);
|
||||
int maxConnections() const;
|
||||
@@ -422,12 +426,16 @@ namespace BitTorrent
|
||||
void setMultiConnectionsPerIpEnabled(bool enabled);
|
||||
bool validateHTTPSTrackerCertificate() const;
|
||||
void setValidateHTTPSTrackerCertificate(bool enabled);
|
||||
bool isSSRFMitigationEnabled() const;
|
||||
void setSSRFMitigationEnabled(bool enabled);
|
||||
bool blockPeersOnPrivilegedPorts() const;
|
||||
void setBlockPeersOnPrivilegedPorts(bool enabled);
|
||||
bool isTrackerFilteringEnabled() const;
|
||||
void setTrackerFilteringEnabled(bool enabled);
|
||||
QStringList bannedIPs() const;
|
||||
void setBannedIPs(const QStringList &newList);
|
||||
ResumeDataStorageType resumeDataStorageType() const;
|
||||
void setResumeDataStorageType(ResumeDataStorageType type);
|
||||
#if defined(Q_OS_WIN)
|
||||
OSMemoryPriority getOSMemoryPriority() const;
|
||||
void setOSMemoryPriority(OSMemoryPriority priority);
|
||||
@@ -542,9 +550,11 @@ namespace BitTorrent
|
||||
void handleDownloadFinished(const Net::DownloadResult &result);
|
||||
void fileSearchFinished(const TorrentID &id, const QString &savePath, const QStringList &fileNames);
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
// Session reconfiguration triggers
|
||||
void networkOnlineStateChanged(bool online);
|
||||
void networkConfigurationChange(const QNetworkConfiguration &);
|
||||
#endif
|
||||
|
||||
private:
|
||||
struct MoveStorageJob
|
||||
@@ -567,8 +577,6 @@ namespace BitTorrent
|
||||
bool hasPerTorrentRatioLimit() const;
|
||||
bool hasPerTorrentSeedingTimeLimit() const;
|
||||
|
||||
void initResumeFolder();
|
||||
|
||||
// Session configuration
|
||||
Q_INVOKABLE void configure();
|
||||
void configureComponents();
|
||||
@@ -593,13 +601,12 @@ namespace BitTorrent
|
||||
void applyOSMemoryPriority() const;
|
||||
#endif
|
||||
|
||||
bool loadTorrentResumeData(const QByteArray &data, const TorrentInfo &metadata, LoadTorrentParams &torrentParams);
|
||||
bool loadTorrent(LoadTorrentParams params);
|
||||
LoadTorrentParams initLoadTorrentParams(const AddTorrentParams &addTorrentParams);
|
||||
bool addTorrent_impl(const std::variant<MagnetUri, TorrentInfo> &source, const AddTorrentParams &addTorrentParams);
|
||||
|
||||
void updateSeedingLimitTimer();
|
||||
void exportTorrentFile(const Torrent *torrent, TorrentExportFolder folder = TorrentExportFolder::Regular);
|
||||
void exportTorrentFile(const TorrentInfo &torrentInfo, const QString &folderPath, const QString &baseName);
|
||||
|
||||
void handleAlert(const lt::alert *a);
|
||||
void dispatchTorrentAlert(const lt::alert *a);
|
||||
@@ -663,6 +670,7 @@ namespace BitTorrent
|
||||
CachedSettingValue<int> m_sendBufferWatermark;
|
||||
CachedSettingValue<int> m_sendBufferLowWatermark;
|
||||
CachedSettingValue<int> m_sendBufferWatermarkFactor;
|
||||
CachedSettingValue<int> m_connectionSpeed;
|
||||
CachedSettingValue<int> m_socketBacklogSize;
|
||||
CachedSettingValue<bool> m_isAnonymousModeEnabled;
|
||||
CachedSettingValue<bool> m_isQueueingEnabled;
|
||||
@@ -681,6 +689,7 @@ namespace BitTorrent
|
||||
CachedSettingValue<bool> m_includeOverheadInLimits;
|
||||
CachedSettingValue<QString> m_announceIP;
|
||||
CachedSettingValue<int> m_maxConcurrentHTTPAnnounces;
|
||||
CachedSettingValue<bool> m_isReannounceWhenAddressChangedEnabled;
|
||||
CachedSettingValue<int> m_stopTrackerTimeout;
|
||||
CachedSettingValue<int> m_maxConnections;
|
||||
CachedSettingValue<int> m_maxUploads;
|
||||
@@ -692,6 +701,7 @@ namespace BitTorrent
|
||||
CachedSettingValue<bool> m_IDNSupportEnabled;
|
||||
CachedSettingValue<bool> m_multiConnectionsPerIpEnabled;
|
||||
CachedSettingValue<bool> m_validateHTTPSTrackerCertificate;
|
||||
CachedSettingValue<bool> m_SSRFMitigationEnabled;
|
||||
CachedSettingValue<bool> m_blockPeersOnPrivilegedPorts;
|
||||
CachedSettingValue<bool> m_isAddTrackersEnabled;
|
||||
CachedSettingValue<QString> m_additionalTrackers;
|
||||
@@ -712,7 +722,6 @@ namespace BitTorrent
|
||||
CachedSettingValue<bool> m_isBandwidthSchedulerEnabled;
|
||||
CachedSettingValue<int> m_saveResumeDataInterval;
|
||||
CachedSettingValue<int> m_port;
|
||||
CachedSettingValue<bool> m_useRandomPort;
|
||||
CachedSettingValue<QString> m_networkInterface;
|
||||
CachedSettingValue<QString> m_networkInterfaceName;
|
||||
CachedSettingValue<QString> m_networkInterfaceAddress;
|
||||
@@ -736,6 +745,7 @@ namespace BitTorrent
|
||||
CachedSettingValue<int> m_peerTurnoverCutoff;
|
||||
CachedSettingValue<int> m_peerTurnoverInterval;
|
||||
CachedSettingValue<QStringList> m_bannedIPs;
|
||||
CachedSettingValue<ResumeDataStorageType> m_resumeDataStorageType;
|
||||
#if defined(Q_OS_WIN)
|
||||
CachedSettingValue<OSMemoryPriority> m_OSMemoryPriority;
|
||||
#endif
|
||||
@@ -748,8 +758,6 @@ namespace BitTorrent
|
||||
int m_numResumeData = 0;
|
||||
int m_extraLimit = 0;
|
||||
QVector<TrackerEntry> m_additionalTrackerList;
|
||||
QString m_resumeFolderPath;
|
||||
QFile *m_resumeFolderLock = nullptr;
|
||||
|
||||
bool m_refreshEnqueued = false;
|
||||
QTimer *m_seedingLimitTimer = nullptr;
|
||||
@@ -760,9 +768,9 @@ namespace BitTorrent
|
||||
QPointer<BandwidthScheduler> m_bwScheduler;
|
||||
// Tracker
|
||||
QPointer<Tracker> m_tracker;
|
||||
// fastresume data writing thread
|
||||
|
||||
QThread *m_ioThread = nullptr;
|
||||
ResumeDataSavingManager *m_resumeDataSavingManager = nullptr;
|
||||
ResumeDataStorage *m_resumeDataStorage = nullptr;
|
||||
FileSearcher *m_fileSearcher = nullptr;
|
||||
|
||||
QSet<TorrentID> m_downloadedMetadata;
|
||||
@@ -784,11 +792,14 @@ namespace BitTorrent
|
||||
|
||||
SessionStatus m_status;
|
||||
CacheStatus m_cacheStatus;
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
QNetworkConfigurationManager *m_networkManager = nullptr;
|
||||
#endif
|
||||
|
||||
QList<MoveStorageJob> m_moveStorageQueue;
|
||||
|
||||
QString m_lastExternalIP;
|
||||
|
||||
static Session *m_instance;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace BitTorrent
|
||||
class Statistics : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(Statistics)
|
||||
Q_DISABLE_COPY_MOVE(Statistics)
|
||||
|
||||
public:
|
||||
explicit Statistics(BitTorrent::Session *session);
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <QString>
|
||||
#include <QtContainerFwd>
|
||||
|
||||
#include "base/tagset.h"
|
||||
#include "abstractfilestorage.h"
|
||||
|
||||
class QBitArray;
|
||||
@@ -71,6 +72,7 @@ namespace BitTorrent
|
||||
|
||||
ForcedDownloading,
|
||||
Downloading,
|
||||
ForcedDownloadingMetadata,
|
||||
DownloadingMetadata,
|
||||
StalledDownloading,
|
||||
|
||||
@@ -178,7 +180,7 @@ namespace BitTorrent
|
||||
virtual bool belongsToCategory(const QString &category) const = 0;
|
||||
virtual bool setCategory(const QString &category) = 0;
|
||||
|
||||
virtual QSet<QString> tags() const = 0;
|
||||
virtual TagSet tags() const = 0;
|
||||
virtual bool hasTag(const QString &tag) const = 0;
|
||||
virtual bool addTag(const QString &tag) = 0;
|
||||
virtual bool removeTag(const QString &tag) = 0;
|
||||
|
||||
@@ -42,9 +42,9 @@
|
||||
|
||||
#include "base/exceptions.h"
|
||||
#include "base/global.h"
|
||||
#include "base/utils/compare.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/io.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "base/version.h"
|
||||
#include "ltunderlyingtype.h"
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace
|
||||
return !Utils::Fs::fileName(QString::fromStdString(f)).startsWith('.');
|
||||
}
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
lt::create_flags_t toNativeTorrentFormatFlag(const BitTorrent::TorrentFormat torrentFormat)
|
||||
{
|
||||
switch (torrentFormat)
|
||||
@@ -98,6 +98,12 @@ void TorrentCreatorThread::sendProgressSignal(int currentPieceIdx, int totalPiec
|
||||
emit updateProgress(static_cast<int>((currentPieceIdx * 100.) / totalPieces));
|
||||
}
|
||||
|
||||
void TorrentCreatorThread::checkInterruptionRequested() const
|
||||
{
|
||||
if (isInterruptionRequested())
|
||||
throw RuntimeError(tr("Operation aborted"));
|
||||
}
|
||||
|
||||
void TorrentCreatorThread::run()
|
||||
{
|
||||
emit updateProgress(0);
|
||||
@@ -105,6 +111,7 @@ void TorrentCreatorThread::run()
|
||||
try
|
||||
{
|
||||
const QString parentPath = Utils::Fs::branchPath(m_params.inputPath) + '/';
|
||||
const Utils::Compare::NaturalLessThan<Qt::CaseInsensitive> naturalLessThan {};
|
||||
|
||||
// Adding files to the torrent
|
||||
lt::file_storage fs;
|
||||
@@ -117,13 +124,13 @@ void TorrentCreatorThread::run()
|
||||
// need to sort the file names by natural sort order
|
||||
QStringList dirs = {m_params.inputPath};
|
||||
|
||||
QDirIterator dirIter(m_params.inputPath, (QDir::AllDirs | QDir::NoDotAndDotDot), QDirIterator::Subdirectories);
|
||||
QDirIterator dirIter {m_params.inputPath, (QDir::AllDirs | QDir::NoDotAndDotDot), QDirIterator::Subdirectories};
|
||||
while (dirIter.hasNext())
|
||||
{
|
||||
dirIter.next();
|
||||
dirs += dirIter.filePath();
|
||||
}
|
||||
std::sort(dirs.begin(), dirs.end(), Utils::String::naturalLessThan<Qt::CaseInsensitive>);
|
||||
std::sort(dirs.begin(), dirs.end(), naturalLessThan);
|
||||
|
||||
QStringList fileNames;
|
||||
QHash<QString, qint64> fileSizeMap;
|
||||
@@ -142,7 +149,7 @@ void TorrentCreatorThread::run()
|
||||
fileSizeMap[relFilePath] = fileIter.fileInfo().size();
|
||||
}
|
||||
|
||||
std::sort(tmpNames.begin(), tmpNames.end(), Utils::String::naturalLessThan<Qt::CaseInsensitive>);
|
||||
std::sort(tmpNames.begin(), tmpNames.end(), naturalLessThan);
|
||||
fileNames += tmpNames;
|
||||
}
|
||||
|
||||
@@ -150,9 +157,9 @@ void TorrentCreatorThread::run()
|
||||
fs.add_file(fileName.toStdString(), fileSizeMap[fileName]);
|
||||
}
|
||||
|
||||
if (isInterruptionRequested()) return;
|
||||
checkInterruptionRequested();
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
lt::create_torrent newTorrent {fs, m_params.pieceSize, toNativeTorrentFormatFlag(m_params.torrentFormat)};
|
||||
#else
|
||||
lt::create_torrent newTorrent(fs, m_params.pieceSize, m_params.paddedFileSizeLimit
|
||||
@@ -180,10 +187,8 @@ void TorrentCreatorThread::run()
|
||||
lt::set_piece_hashes(newTorrent, Utils::Fs::toNativePath(parentPath).toStdString()
|
||||
, [this, &newTorrent](const lt::piece_index_t n)
|
||||
{
|
||||
if (isInterruptionRequested())
|
||||
throw RuntimeError {tr("Create new torrent aborted.")};
|
||||
|
||||
sendProgressSignal(static_cast<LTUnderlyingType<lt::piece_index_t>>(n), newTorrent.num_pieces());
|
||||
checkInterruptionRequested();
|
||||
sendProgressSignal(toLTUnderlyingType(n), newTorrent.num_pieces());
|
||||
});
|
||||
|
||||
// Set qBittorrent as creator and add user comment to
|
||||
@@ -193,7 +198,7 @@ void TorrentCreatorThread::run()
|
||||
// Is private ?
|
||||
newTorrent.set_priv(m_params.isPrivate);
|
||||
|
||||
if (isInterruptionRequested()) return;
|
||||
checkInterruptionRequested();
|
||||
|
||||
lt::entry entry = newTorrent.generate();
|
||||
|
||||
@@ -201,36 +206,34 @@ void TorrentCreatorThread::run()
|
||||
if (!m_params.source.isEmpty())
|
||||
entry["info"]["source"] = m_params.source.toStdString();
|
||||
|
||||
if (isInterruptionRequested()) return;
|
||||
checkInterruptionRequested();
|
||||
|
||||
// create the torrent
|
||||
QFile outfile {m_params.savePath};
|
||||
if (!outfile.open(QIODevice::WriteOnly))
|
||||
{
|
||||
throw RuntimeError {tr("Create new torrent file failed. Reason: %1")
|
||||
.arg(outfile.errorString())};
|
||||
}
|
||||
throw RuntimeError(outfile.errorString());
|
||||
|
||||
if (isInterruptionRequested()) return;
|
||||
checkInterruptionRequested();
|
||||
|
||||
lt::bencode(Utils::IO::FileDeviceOutputIterator {outfile}, entry);
|
||||
if (outfile.error() != QFileDevice::NoError)
|
||||
{
|
||||
throw RuntimeError {tr("Create new torrent file failed. Reason: %1")
|
||||
.arg(outfile.errorString())};
|
||||
}
|
||||
throw RuntimeError(outfile.errorString());
|
||||
outfile.close();
|
||||
|
||||
emit updateProgress(100);
|
||||
emit creationSuccess(m_params.savePath, parentPath);
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
catch (const RuntimeError &err)
|
||||
{
|
||||
emit creationFailure(e.what());
|
||||
emit creationFailure(tr("Create new torrent file failed. Reason: %1.").arg(err.message()));
|
||||
}
|
||||
catch (const std::exception &err)
|
||||
{
|
||||
emit creationFailure(tr("Create new torrent file failed. Reason: %1.").arg(QString::fromLocal8Bit(err.what())));
|
||||
}
|
||||
}
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
int TorrentCreatorThread::calculateTotalPieces(const QString &inputPath, const int pieceSize, const TorrentFormat torrentFormat)
|
||||
#else
|
||||
int TorrentCreatorThread::calculateTotalPieces(const QString &inputPath, const int pieceSize, const bool isAlignmentOptimized, const int paddedFileSizeLimit)
|
||||
@@ -242,7 +245,7 @@ int TorrentCreatorThread::calculateTotalPieces(const QString &inputPath, const i
|
||||
lt::file_storage fs;
|
||||
lt::add_files(fs, Utils::Fs::toNativePath(inputPath).toStdString(), fileFilter);
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
return lt::create_torrent {fs, pieceSize, toNativeTorrentFormatFlag(torrentFormat)}.num_pieces();
|
||||
#else
|
||||
return lt::create_torrent(fs, pieceSize, paddedFileSizeLimit
|
||||
|
||||
@@ -28,14 +28,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
#include <QStringList>
|
||||
#include <QThread>
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
enum class TorrentFormat
|
||||
{
|
||||
V1,
|
||||
@@ -47,7 +45,7 @@ namespace BitTorrent
|
||||
struct TorrentCreatorParams
|
||||
{
|
||||
bool isPrivate;
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
TorrentFormat torrentFormat;
|
||||
#else
|
||||
bool isAlignmentOptimized;
|
||||
@@ -65,30 +63,30 @@ namespace BitTorrent
|
||||
class TorrentCreatorThread final : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(TorrentCreatorThread)
|
||||
|
||||
public:
|
||||
TorrentCreatorThread(QObject *parent = nullptr);
|
||||
~TorrentCreatorThread();
|
||||
explicit TorrentCreatorThread(QObject *parent = nullptr);
|
||||
~TorrentCreatorThread() override;
|
||||
|
||||
void create(const TorrentCreatorParams ¶ms);
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
static int calculateTotalPieces(const QString &inputPath, const int pieceSize, const TorrentFormat torrentFormat);
|
||||
#else
|
||||
static int calculateTotalPieces(const QString &inputPath
|
||||
, const int pieceSize, const bool isAlignmentOptimized, int paddedFileSizeLimit);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void run() override;
|
||||
|
||||
signals:
|
||||
void creationFailure(const QString &msg);
|
||||
void creationSuccess(const QString &path, const QString &branchPath);
|
||||
void updateProgress(int progress);
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
void sendProgressSignal(int currentPieceIdx, int totalPieces);
|
||||
void checkInterruptionRequested() const;
|
||||
|
||||
TorrentCreatorParams m_params;
|
||||
};
|
||||
|
||||
@@ -43,9 +43,8 @@
|
||||
#include <libtorrent/session.hpp>
|
||||
#include <libtorrent/storage_defs.hpp>
|
||||
#include <libtorrent/time.hpp>
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
#include <libtorrent/info_hash.hpp>
|
||||
#endif
|
||||
|
||||
@@ -63,6 +62,7 @@
|
||||
#include "base/utils/string.h"
|
||||
#include "common.h"
|
||||
#include "downloadpriority.h"
|
||||
#include "loadtorrentparams.h"
|
||||
#include "ltqhash.h"
|
||||
#include "ltunderlyingtype.h"
|
||||
#include "peeraddress.h"
|
||||
@@ -83,7 +83,7 @@ namespace
|
||||
, std::back_inserter(out), [](const DownloadPriority priority)
|
||||
{
|
||||
return static_cast<lt::download_priority_t>(
|
||||
static_cast<LTUnderlyingType<lt::download_priority_t>>(priority));
|
||||
static_cast<lt::download_priority_t::underlying_type>(priority));
|
||||
});
|
||||
return out;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ namespace
|
||||
return entry;
|
||||
}
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
TrackerEntry fromNativeAnnouncerEntry(const lt::announce_entry &nativeEntry
|
||||
, const lt::info_hash_t &hashes, const QMap<lt::tcp::endpoint, int> &trackerPeerCounts)
|
||||
#else
|
||||
@@ -110,8 +110,8 @@ namespace
|
||||
int numNotWorking = 0;
|
||||
QString firstTrackerMessage;
|
||||
QString firstErrorMessage;
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
const size_t numEndpoints = nativeEntry.endpoints.size() * ((hashes.has_v1() && hashes.has_v2()) ? 2 : 1);
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
const auto numEndpoints = static_cast<qsizetype>(nativeEntry.endpoints.size() * ((hashes.has_v1() && hashes.has_v2()) ? 2 : 1));
|
||||
trackerEntry.endpoints.reserve(static_cast<decltype(trackerEntry.endpoints)::size_type>(numEndpoints));
|
||||
for (const lt::announce_endpoint &endpoint : nativeEntry.endpoints)
|
||||
{
|
||||
@@ -166,8 +166,8 @@ namespace
|
||||
}
|
||||
}
|
||||
#else
|
||||
const int numEndpoints = nativeEntry.endpoints.size();
|
||||
trackerEntry.endpoints.reserve(numEndpoints);
|
||||
const auto numEndpoints = static_cast<qsizetype>(nativeEntry.endpoints.size());
|
||||
trackerEntry.endpoints.reserve(static_cast<decltype(trackerEntry.endpoints)::size_type>(numEndpoints));
|
||||
for (const lt::announce_endpoint &endpoint : nativeEntry.endpoints)
|
||||
{
|
||||
TrackerEntry::EndpointStats trackerEndpoint;
|
||||
@@ -264,7 +264,7 @@ TorrentImpl::TorrentImpl(Session *session, lt::session *nativeSession
|
||||
, m_session(session)
|
||||
, m_nativeSession(nativeSession)
|
||||
, m_nativeHandle(nativeHandle)
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
, m_infoHash(m_nativeHandle.info_hashes())
|
||||
#else
|
||||
, m_infoHash(m_nativeHandle.info_hash())
|
||||
@@ -275,12 +275,12 @@ TorrentImpl::TorrentImpl(Session *session, lt::session *nativeSession
|
||||
, m_tags(params.tags)
|
||||
, m_ratioLimit(params.ratioLimit)
|
||||
, m_seedingTimeLimit(params.seedingTimeLimit)
|
||||
, m_operatingMode(params.forced ? TorrentOperatingMode::Forced : TorrentOperatingMode::AutoManaged)
|
||||
, m_operatingMode(params.operatingMode)
|
||||
, m_contentLayout(params.contentLayout)
|
||||
, m_hasSeedStatus(params.hasSeedStatus)
|
||||
, m_hasFirstLastPiecePriority(params.firstLastPiecePriority)
|
||||
, m_useAutoTMM(params.savePath.isEmpty())
|
||||
, m_isStopped(params.paused)
|
||||
, m_isStopped(params.stopped)
|
||||
, m_ltAddTorrentParams(params.ltAddTorrentParams)
|
||||
{
|
||||
if (m_useAutoTMM)
|
||||
@@ -477,7 +477,7 @@ QVector<TrackerEntry> TorrentImpl::trackers() const
|
||||
for (const lt::announce_entry &tracker : nativeTrackers)
|
||||
{
|
||||
const QString trackerURL = QString::fromStdString(tracker.url);
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
entries << fromNativeAnnouncerEntry(tracker, m_nativeHandle.info_hashes(), m_trackerPeerCounts[trackerURL]);
|
||||
#else
|
||||
entries << fromNativeAnnouncerEntry(tracker, m_trackerPeerCounts[trackerURL]);
|
||||
@@ -702,7 +702,7 @@ bool TorrentImpl::belongsToCategory(const QString &category) const
|
||||
return false;
|
||||
}
|
||||
|
||||
QSet<QString> TorrentImpl::tags() const
|
||||
TagSet TorrentImpl::tags() const
|
||||
{
|
||||
return m_tags;
|
||||
}
|
||||
@@ -716,18 +716,18 @@ bool TorrentImpl::addTag(const QString &tag)
|
||||
{
|
||||
if (!Session::isValidTag(tag))
|
||||
return false;
|
||||
if (hasTag(tag))
|
||||
return false;
|
||||
|
||||
if (!hasTag(tag))
|
||||
if (!m_session->hasTag(tag))
|
||||
{
|
||||
if (!m_session->hasTag(tag))
|
||||
if (!m_session->addTag(tag))
|
||||
return false;
|
||||
m_tags.insert(tag);
|
||||
m_session->handleTorrentNeedSaveResumeData(this);
|
||||
m_session->handleTorrentTagAdded(this, tag);
|
||||
return true;
|
||||
if (!m_session->addTag(tag))
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
m_tags.insert(tag);
|
||||
m_session->handleTorrentNeedSaveResumeData(this);
|
||||
m_session->handleTorrentTagAdded(this, tag);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TorrentImpl::removeTag(const QString &tag)
|
||||
@@ -796,9 +796,10 @@ QVector<DownloadPriority> TorrentImpl::filePriorities() const
|
||||
const std::vector<lt::download_priority_t> fp = m_nativeHandle.get_file_priorities();
|
||||
|
||||
QVector<DownloadPriority> ret;
|
||||
std::transform(fp.cbegin(), fp.cend(), std::back_inserter(ret), [](lt::download_priority_t priority)
|
||||
ret.reserve(static_cast<decltype(ret)::size_type>(fp.size()));
|
||||
std::transform(fp.cbegin(), fp.cend(), std::back_inserter(ret), [](const lt::download_priority_t priority)
|
||||
{
|
||||
return static_cast<DownloadPriority>(static_cast<LTUnderlyingType<lt::download_priority_t>>(priority));
|
||||
return static_cast<DownloadPriority>(toLTUnderlyingType(priority));
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
@@ -831,6 +832,7 @@ bool TorrentImpl::isDownloading() const
|
||||
{
|
||||
return m_state == TorrentState::Downloading
|
||||
|| m_state == TorrentState::DownloadingMetadata
|
||||
|| m_state == TorrentState::ForcedDownloadingMetadata
|
||||
|| m_state == TorrentState::StalledDownloading
|
||||
|| m_state == TorrentState::CheckingDownloading
|
||||
|| m_state == TorrentState::PausedDownloading
|
||||
@@ -863,6 +865,7 @@ bool TorrentImpl::isActive() const
|
||||
return (uploadPayloadRate() > 0);
|
||||
|
||||
return m_state == TorrentState::DownloadingMetadata
|
||||
|| m_state == TorrentState::ForcedDownloadingMetadata
|
||||
|| m_state == TorrentState::Downloading
|
||||
|| m_state == TorrentState::ForcedDownloading
|
||||
|| m_state == TorrentState::Uploading
|
||||
@@ -932,7 +935,7 @@ void TorrentImpl::updateState()
|
||||
else if (m_session->isQueueingSystemEnabled() && isQueued())
|
||||
m_state = TorrentState::QueuedDownloading;
|
||||
else
|
||||
m_state = TorrentState::DownloadingMetadata;
|
||||
m_state = isForced() ? TorrentState::ForcedDownloadingMetadata : TorrentState::DownloadingMetadata;
|
||||
}
|
||||
else if ((m_nativeStatus.state == lt::torrent_status::checking_files)
|
||||
&& (!isPaused() || (m_nativeStatus.flags & lt::torrent_flags::auto_managed)
|
||||
@@ -1249,7 +1252,7 @@ QBitArray TorrentImpl::downloadingPieces() const
|
||||
m_nativeHandle.get_download_queue(queue);
|
||||
|
||||
for (const lt::partial_piece_info &info : queue)
|
||||
result.setBit(static_cast<LTUnderlyingType<lt::piece_index_t>>(info.piece_index));
|
||||
result.setBit(toLTUnderlyingType(info.piece_index));
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1259,7 +1262,7 @@ QVector<int> TorrentImpl::pieceAvailability() const
|
||||
std::vector<int> avail;
|
||||
m_nativeHandle.piece_availability(avail);
|
||||
|
||||
return Vector::fromStdVector(avail);
|
||||
return {avail.cbegin(), avail.cend()};
|
||||
}
|
||||
|
||||
qreal TorrentImpl::distributedCopies() const
|
||||
@@ -1508,6 +1511,10 @@ void TorrentImpl::endReceivedMetadataHandling(const QString &savePath, const QSt
|
||||
p.renamed_files[lt::file_index_t {i}] = fileNames[i].toStdString();
|
||||
p.save_path = Utils::Fs::toNativePath(savePath).toStdString();
|
||||
|
||||
// Use qBittorrent default priority rather than libtorrent's (4)
|
||||
p.file_priorities = std::vector(fileNames.size(), static_cast<lt::download_priority_t>(
|
||||
static_cast<lt::download_priority_t::underlying_type>(DownloadPriority::Normal)));
|
||||
|
||||
reload();
|
||||
|
||||
// If first/last piece priority was specified when adding this torrent,
|
||||
@@ -1517,6 +1524,7 @@ void TorrentImpl::endReceivedMetadataHandling(const QString &savePath, const QSt
|
||||
|
||||
m_maintenanceJob = MaintenanceJob::None;
|
||||
updateStatus();
|
||||
prepareResumeData(p);
|
||||
|
||||
m_session->handleTorrentMetadataReceived(this);
|
||||
}
|
||||
@@ -1620,8 +1628,10 @@ void TorrentImpl::moveStorage(const QString &newPath, const MoveStorageMode mode
|
||||
|
||||
void TorrentImpl::renameFile(const int index, const QString &path)
|
||||
{
|
||||
#ifndef QBT_USES_LIBTORRENT2
|
||||
const QString oldPath = filePath(index);
|
||||
m_oldPath[lt::file_index_t {index}].push_back(oldPath);
|
||||
#endif
|
||||
++m_renameCount;
|
||||
m_nativeHandle.rename_file(lt::file_index_t {index}, Utils::Fs::toNativePath(path).toStdString());
|
||||
}
|
||||
@@ -1769,31 +1779,10 @@ void TorrentImpl::handleTorrentResumedAlert(const lt::torrent_resumed_alert *p)
|
||||
|
||||
void TorrentImpl::handleSaveResumeDataAlert(const lt::save_resume_data_alert *p)
|
||||
{
|
||||
if (m_hasMissingFiles)
|
||||
{
|
||||
const auto havePieces = m_ltAddTorrentParams.have_pieces;
|
||||
const auto unfinishedPieces = m_ltAddTorrentParams.unfinished_pieces;
|
||||
const auto verifiedPieces = m_ltAddTorrentParams.verified_pieces;
|
||||
|
||||
// Update recent resume data but preserve existing progress
|
||||
m_ltAddTorrentParams = p->params;
|
||||
m_ltAddTorrentParams.have_pieces = havePieces;
|
||||
m_ltAddTorrentParams.unfinished_pieces = unfinishedPieces;
|
||||
m_ltAddTorrentParams.verified_pieces = verifiedPieces;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update recent resume data
|
||||
m_ltAddTorrentParams = p->params;
|
||||
}
|
||||
|
||||
m_ltAddTorrentParams.added_time = addedTime().toSecsSinceEpoch();
|
||||
|
||||
// We shouldn't save upload_mode flag to allow torrent operate normally on next run
|
||||
m_ltAddTorrentParams.flags &= ~lt::torrent_flags::upload_mode;
|
||||
|
||||
if (m_maintenanceJob == MaintenanceJob::HandleMetadata)
|
||||
{
|
||||
m_ltAddTorrentParams = p->params;
|
||||
|
||||
m_ltAddTorrentParams.have_pieces.clear();
|
||||
m_ltAddTorrentParams.verified_pieces.clear();
|
||||
|
||||
@@ -1802,6 +1791,36 @@ void TorrentImpl::handleSaveResumeDataAlert(const lt::save_resume_data_alert *p)
|
||||
|
||||
m_session->findIncompleteFiles(metadata, m_savePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
prepareResumeData(p->params);
|
||||
}
|
||||
}
|
||||
|
||||
void TorrentImpl::prepareResumeData(const lt::add_torrent_params ¶ms)
|
||||
{
|
||||
if (m_hasMissingFiles)
|
||||
{
|
||||
const auto havePieces = m_ltAddTorrentParams.have_pieces;
|
||||
const auto unfinishedPieces = m_ltAddTorrentParams.unfinished_pieces;
|
||||
const auto verifiedPieces = m_ltAddTorrentParams.verified_pieces;
|
||||
|
||||
// Update recent resume data but preserve existing progress
|
||||
m_ltAddTorrentParams = params;
|
||||
m_ltAddTorrentParams.have_pieces = havePieces;
|
||||
m_ltAddTorrentParams.unfinished_pieces = unfinishedPieces;
|
||||
m_ltAddTorrentParams.verified_pieces = verifiedPieces;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update recent resume data
|
||||
m_ltAddTorrentParams = params;
|
||||
}
|
||||
|
||||
m_ltAddTorrentParams.added_time = addedTime().toSecsSinceEpoch();
|
||||
|
||||
// We shouldn't save upload_mode flag to allow torrent operate normally on next run
|
||||
m_ltAddTorrentParams.flags &= ~lt::torrent_flags::upload_mode;
|
||||
|
||||
LoadTorrentParams resumeData;
|
||||
resumeData.name = m_name;
|
||||
@@ -1813,8 +1832,8 @@ void TorrentImpl::handleSaveResumeDataAlert(const lt::save_resume_data_alert *p)
|
||||
resumeData.seedingTimeLimit = m_seedingTimeLimit;
|
||||
resumeData.firstLastPiecePriority = m_hasFirstLastPiecePriority;
|
||||
resumeData.hasSeedStatus = m_hasSeedStatus;
|
||||
resumeData.paused = m_isStopped;
|
||||
resumeData.forced = (m_operatingMode == TorrentOperatingMode::Forced);
|
||||
resumeData.stopped = m_isStopped;
|
||||
resumeData.operatingMode = m_operatingMode;
|
||||
resumeData.ltAddTorrentParams = m_ltAddTorrentParams;
|
||||
|
||||
m_session->handleTorrentResumeDataReady(this, resumeData);
|
||||
@@ -1848,15 +1867,18 @@ void TorrentImpl::handleFileRenamedAlert(const lt::file_renamed_alert *p)
|
||||
// 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
|
||||
#ifndef QBT_USES_LIBTORRENT2
|
||||
const QString oldFilePath = m_oldPath[p->index].takeFirst();
|
||||
const QString newFilePath = Utils::Fs::toUniformPath(p->new_name());
|
||||
|
||||
if (m_oldPath[p->index].isEmpty())
|
||||
m_oldPath.remove(p->index);
|
||||
#else
|
||||
const QString oldFilePath = Utils::Fs::toUniformPath(p->old_name());
|
||||
#endif
|
||||
const QString newFilePath = Utils::Fs::toUniformPath(p->new_name());
|
||||
|
||||
QVector<QStringRef> oldPathParts = oldFilePath.splitRef('/', QString::SkipEmptyParts);
|
||||
QList<QStringView> oldPathParts = QStringView(oldFilePath).split('/', Qt::SkipEmptyParts);
|
||||
oldPathParts.removeLast(); // drop file name part
|
||||
QVector<QStringRef> newPathParts = newFilePath.splitRef('/', QString::SkipEmptyParts);
|
||||
QList<QStringView> newPathParts = QStringView(newFilePath).split('/', Qt::SkipEmptyParts);
|
||||
newPathParts.removeLast(); // drop file name part
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
@@ -1875,7 +1897,7 @@ void TorrentImpl::handleFileRenamedAlert(const lt::file_renamed_alert *p)
|
||||
|
||||
for (int i = (oldPathParts.size() - 1); i >= pathIdx; --i)
|
||||
{
|
||||
QDir().rmdir(savePath() + Utils::String::join(oldPathParts, QLatin1String("/")));
|
||||
QDir().rmdir(savePath() + Utils::String::join(oldPathParts, QString::fromLatin1("/")));
|
||||
oldPathParts.removeLast();
|
||||
}
|
||||
|
||||
@@ -1889,12 +1911,14 @@ void TorrentImpl::handleFileRenamedAlert(const lt::file_renamed_alert *p)
|
||||
void TorrentImpl::handleFileRenameFailedAlert(const lt::file_rename_failed_alert *p)
|
||||
{
|
||||
LogMsg(tr("File rename failed. Torrent: \"%1\", file: \"%2\", reason: \"%3\"")
|
||||
.arg(name(), filePath(static_cast<LTUnderlyingType<lt::file_index_t>>(p->index))
|
||||
.arg(name(), filePath(toLTUnderlyingType(p->index))
|
||||
, QString::fromLocal8Bit(p->error.message().c_str())), Log::WARNING);
|
||||
|
||||
#ifndef QBT_USES_LIBTORRENT2
|
||||
m_oldPath[p->index].removeFirst();
|
||||
if (m_oldPath[p->index].isEmpty())
|
||||
m_oldPath.remove(p->index);
|
||||
#endif
|
||||
|
||||
--m_renameCount;
|
||||
while (!isMoveInProgress() && (m_renameCount == 0) && !m_moveFinishedTriggers.isEmpty())
|
||||
@@ -1908,13 +1932,13 @@ void TorrentImpl::handleFileCompletedAlert(const lt::file_completed_alert *p)
|
||||
qDebug("A file completed download in torrent \"%s\"", qUtf8Printable(name()));
|
||||
if (m_session->isAppendExtensionEnabled())
|
||||
{
|
||||
QString name = filePath(static_cast<LTUnderlyingType<lt::file_index_t>>(p->index));
|
||||
QString name = filePath(toLTUnderlyingType(p->index));
|
||||
if (name.endsWith(QB_EXT))
|
||||
{
|
||||
const QString oldName = name;
|
||||
name.chop(QB_EXT.size());
|
||||
qDebug("Renaming %s to %s", qUtf8Printable(oldName), qUtf8Printable(name));
|
||||
renameFile(static_cast<LTUnderlyingType<lt::file_index_t>>(p->index), name);
|
||||
renameFile(toLTUnderlyingType(p->index), name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1924,6 +1948,14 @@ void TorrentImpl::handleFileErrorAlert(const lt::file_error_alert *p)
|
||||
m_lastFileError = {p->error, p->op};
|
||||
}
|
||||
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
void TorrentImpl::handleFilePrioAlert(const lt::file_prio_alert *)
|
||||
{
|
||||
if (m_nativeHandle.need_save_resume_data())
|
||||
m_session->handleTorrentNeedSaveResumeData(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
void TorrentImpl::handleMetadataReceivedAlert(const lt::metadata_received_alert *p)
|
||||
{
|
||||
Q_UNUSED(p);
|
||||
@@ -1961,6 +1993,11 @@ void TorrentImpl::handleAlert(const lt::alert *a)
|
||||
{
|
||||
switch (a->type())
|
||||
{
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
case lt::file_prio_alert::alert_type:
|
||||
handleFilePrioAlert(static_cast<const lt::file_prio_alert*>(a));
|
||||
break;
|
||||
#endif
|
||||
case lt::file_renamed_alert::alert_type:
|
||||
handleFileRenamedAlert(static_cast<const lt::file_renamed_alert*>(a));
|
||||
break;
|
||||
|
||||
@@ -42,10 +42,10 @@
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QQueue>
|
||||
#include <QSet>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/tagset.h"
|
||||
#include "infohash.h"
|
||||
#include "speedmonitor.h"
|
||||
#include "torrent.h"
|
||||
@@ -54,27 +54,7 @@
|
||||
namespace BitTorrent
|
||||
{
|
||||
class Session;
|
||||
struct AddTorrentParams;
|
||||
|
||||
struct LoadTorrentParams
|
||||
{
|
||||
lt::add_torrent_params ltAddTorrentParams {};
|
||||
|
||||
QString name;
|
||||
QString category;
|
||||
QSet<QString> tags;
|
||||
QString savePath;
|
||||
TorrentContentLayout contentLayout = TorrentContentLayout::Original;
|
||||
bool firstLastPiecePriority = false;
|
||||
bool hasSeedStatus = false;
|
||||
bool forced = false;
|
||||
bool paused = false;
|
||||
|
||||
qreal ratioLimit = Torrent::USE_GLOBAL_RATIO;
|
||||
int seedingTimeLimit = Torrent::USE_GLOBAL_SEEDING_TIME;
|
||||
|
||||
bool restored = false; // is existing torrent job?
|
||||
};
|
||||
struct LoadTorrentParams;
|
||||
|
||||
enum class MoveStorageMode
|
||||
{
|
||||
@@ -96,7 +76,7 @@ namespace BitTorrent
|
||||
|
||||
class TorrentImpl final : public QObject, public Torrent
|
||||
{
|
||||
Q_DISABLE_COPY(TorrentImpl)
|
||||
Q_DISABLE_COPY_MOVE(TorrentImpl)
|
||||
Q_DECLARE_TR_FUNCTIONS(BitTorrent::TorrentImpl)
|
||||
|
||||
public:
|
||||
@@ -131,7 +111,7 @@ namespace BitTorrent
|
||||
bool belongsToCategory(const QString &category) const override;
|
||||
bool setCategory(const QString &category) override;
|
||||
|
||||
QSet<QString> tags() const override;
|
||||
TagSet tags() const override;
|
||||
bool hasTag(const QString &tag) const override;
|
||||
bool addTag(const QString &tag) override;
|
||||
bool removeTag(const QString &tag) override;
|
||||
@@ -263,7 +243,7 @@ namespace BitTorrent
|
||||
QString actualStorageLocation() const;
|
||||
|
||||
private:
|
||||
typedef std::function<void ()> EventTrigger;
|
||||
using EventTrigger = std::function<void ()>;
|
||||
|
||||
void updateStatus();
|
||||
void updateStatus(const lt::torrent_status &nativeStatus);
|
||||
@@ -272,6 +252,9 @@ namespace BitTorrent
|
||||
void handleFastResumeRejectedAlert(const lt::fastresume_rejected_alert *p);
|
||||
void handleFileCompletedAlert(const lt::file_completed_alert *p);
|
||||
void handleFileErrorAlert(const lt::file_error_alert *p);
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
void handleFilePrioAlert(const lt::file_prio_alert *p);
|
||||
#endif
|
||||
void handleFileRenamedAlert(const lt::file_renamed_alert *p);
|
||||
void handleFileRenameFailedAlert(const lt::file_rename_failed_alert *p);
|
||||
void handleMetadataReceivedAlert(const lt::metadata_received_alert *p);
|
||||
@@ -297,6 +280,7 @@ namespace BitTorrent
|
||||
void manageIncompleteFiles();
|
||||
void applyFirstLastPiecePriority(bool enabled, const QVector<DownloadPriority> &updatedFilePrio = {});
|
||||
|
||||
void prepareResumeData(const lt::add_torrent_params ¶ms);
|
||||
void endReceivedMetadataHandling(const QString &savePath, const QStringList &fileNames);
|
||||
void reload();
|
||||
|
||||
@@ -318,18 +302,20 @@ namespace BitTorrent
|
||||
|
||||
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
|
||||
#ifndef QBT_USES_LIBTORRENT2
|
||||
// Until libtorrent provided an "old_name" field in `file_renamed_alert`
|
||||
// we relied on this workaround to remove empty leftover folders
|
||||
QHash<lt::file_index_t, QVector<QString>> m_oldPath;
|
||||
#endif
|
||||
|
||||
FileErrorInfo m_lastFileError;
|
||||
QHash<QString, QMap<lt::tcp::endpoint, int>> m_trackerPeerCounts;
|
||||
FileErrorInfo m_lastFileError;
|
||||
|
||||
// Persistent data
|
||||
QString m_name;
|
||||
QString m_savePath;
|
||||
QString m_category;
|
||||
QSet<QString> m_tags;
|
||||
TagSet m_tags;
|
||||
qreal m_ratioLimit;
|
||||
int m_seedingTimeLimit;
|
||||
TorrentOperatingMode m_operatingMode;
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <libtorrent/bencode.hpp>
|
||||
#include <libtorrent/create_torrent.hpp>
|
||||
#include <libtorrent/error_code.hpp>
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDateTime>
|
||||
@@ -61,7 +60,7 @@ namespace
|
||||
{
|
||||
if (QDir::isAbsolutePath(filePath)) continue;
|
||||
|
||||
const auto filePathElements = filePath.splitRef('/');
|
||||
const auto filePathElements = QStringView(filePath).split(u'/');
|
||||
// if at least one file has no root folder, no common root folder exists
|
||||
if (filePathElements.count() <= 1) return {};
|
||||
|
||||
@@ -167,18 +166,25 @@ TorrentInfo TorrentInfo::loadFromFile(const QString &path, QString *error) noexc
|
||||
void TorrentInfo::saveToFile(const QString &path) const
|
||||
{
|
||||
if (!isValid())
|
||||
throw RuntimeError {tr("Invalid metadata.")};
|
||||
throw RuntimeError {tr("Invalid metadata")};
|
||||
|
||||
const lt::create_torrent torrentCreator = lt::create_torrent(*(nativeInfo()));
|
||||
const lt::entry torrentEntry = torrentCreator.generate();
|
||||
try
|
||||
{
|
||||
const auto torrentCreator = lt::create_torrent(*nativeInfo());
|
||||
const lt::entry torrentEntry = torrentCreator.generate();
|
||||
|
||||
QFile torrentFile {path};
|
||||
if (!torrentFile.open(QIODevice::WriteOnly))
|
||||
throw RuntimeError {torrentFile.errorString()};
|
||||
QFile torrentFile {path};
|
||||
if (!torrentFile.open(QIODevice::WriteOnly))
|
||||
throw RuntimeError(torrentFile.errorString());
|
||||
|
||||
lt::bencode(Utils::IO::FileDeviceOutputIterator {torrentFile}, torrentEntry);
|
||||
if (torrentFile.error() != QFileDevice::NoError)
|
||||
throw RuntimeError {torrentFile.errorString()};
|
||||
lt::bencode(Utils::IO::FileDeviceOutputIterator {torrentFile}, torrentEntry);
|
||||
if (torrentFile.error() != QFileDevice::NoError)
|
||||
throw RuntimeError(torrentFile.errorString());
|
||||
}
|
||||
catch (const lt::system_error &err)
|
||||
{
|
||||
throw RuntimeError(QString::fromLocal8Bit(err.what()));
|
||||
}
|
||||
}
|
||||
|
||||
bool TorrentInfo::isValid() const
|
||||
@@ -190,7 +196,7 @@ InfoHash TorrentInfo::infoHash() const
|
||||
{
|
||||
if (!isValid()) return {};
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
return m_nativeInfo->info_hashes();
|
||||
#else
|
||||
return m_nativeInfo->info_hash();
|
||||
@@ -335,7 +341,7 @@ QVector<QUrl> TorrentInfo::urlSeeds() const
|
||||
QByteArray TorrentInfo::metadata() const
|
||||
{
|
||||
if (!isValid()) return {};
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20000)
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
const lt::span<const char> infoSection {m_nativeInfo->info_section()};
|
||||
return {infoSection.data(), static_cast<int>(infoSection.size())};
|
||||
#else
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace BitTorrent
|
||||
class Tracker final : public QObject, public Http::IRequestHandler, private Http::ResponseBuilder
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(Tracker)
|
||||
Q_DISABLE_COPY_MOVE(Tracker)
|
||||
|
||||
struct TrackerAnnounceRequest;
|
||||
|
||||
|
||||
@@ -53,10 +53,10 @@ namespace BitTorrent
|
||||
int numSeeds = -1;
|
||||
int numLeeches = -1;
|
||||
int numDownloaded = -1;
|
||||
QString message;
|
||||
QString message {};
|
||||
};
|
||||
|
||||
QString url;
|
||||
QString url {};
|
||||
int tier = 0;
|
||||
|
||||
QVector<EndpointStats> endpoints {};
|
||||
@@ -67,7 +67,7 @@ namespace BitTorrent
|
||||
int numSeeds = -1;
|
||||
int numLeeches = -1;
|
||||
int numDownloaded = -1;
|
||||
QString message;
|
||||
QString message {};
|
||||
};
|
||||
|
||||
bool operator==(const TrackerEntry &left, const TrackerEntry &right);
|
||||
|
||||
@@ -35,44 +35,16 @@
|
||||
#define QBT_APP_64BIT
|
||||
#endif
|
||||
|
||||
const char C_TORRENT_FILE_EXTENSION[] = ".torrent";
|
||||
const int MAX_TORRENT_SIZE = 100 * 1024 * 1024; // 100 MiB
|
||||
inline const char C_TORRENT_FILE_EXTENSION[] = ".torrent";
|
||||
inline const int MAX_TORRENT_SIZE = 100 * 1024 * 1024; // 100 MiB
|
||||
|
||||
template <typename T>
|
||||
constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
|
||||
constexpr typename std::add_const_t<T> &asConst(T &t) noexcept { return t; }
|
||||
|
||||
// Forward rvalue as const
|
||||
template <typename T>
|
||||
constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
|
||||
constexpr typename std::add_const_t<T> asConst(T &&t) noexcept { return std::move(t); }
|
||||
|
||||
// Prevent const rvalue arguments
|
||||
template <typename T>
|
||||
void asConst(const T &&) = delete;
|
||||
|
||||
namespace List
|
||||
{
|
||||
// Replacement for the deprecated`QSet<T> QSet::fromList(const QList<T> &list)`
|
||||
template <typename T>
|
||||
QSet<T> toSet(const QList<T> &list)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
return {list.cbegin(), list.cend()};
|
||||
#else
|
||||
return QSet<T>::fromList(list);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
namespace Vector
|
||||
{
|
||||
// Replacement for the deprecated `QVector<T> QVector::fromStdVector(const std::vector<T> &vector)`
|
||||
template <typename T>
|
||||
QVector<T> fromStdVector(const std::vector<T> &vector)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
return {vector.cbegin(), vector.cend()};
|
||||
#else
|
||||
return QVector<T>::fromStdVector(vector);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,9 +137,9 @@ bool Connection::acceptsGzipEncoding(QString codings)
|
||||
{
|
||||
// [rfc7231] 5.3.4. Accept-Encoding
|
||||
|
||||
const auto isCodingAvailable = [](const QVector<QStringRef> &list, const QString &encoding) -> bool
|
||||
const auto isCodingAvailable = [](const QList<QStringView> &list, const QStringView encoding) -> bool
|
||||
{
|
||||
for (const QStringRef &str : list)
|
||||
for (const QStringView &str : list)
|
||||
{
|
||||
if (!str.startsWith(encoding))
|
||||
continue;
|
||||
@@ -149,7 +149,7 @@ bool Connection::acceptsGzipEncoding(QString codings)
|
||||
return true;
|
||||
|
||||
// [rfc7231] 5.3.1. Quality Values
|
||||
const QStringRef substr = str.mid(encoding.size() + 3); // ex. skip over "gzip;q="
|
||||
const QStringView substr = str.mid(encoding.size() + 3); // ex. skip over "gzip;q="
|
||||
|
||||
bool ok = false;
|
||||
const double qvalue = substr.toDouble(&ok);
|
||||
@@ -161,15 +161,15 @@ bool Connection::acceptsGzipEncoding(QString codings)
|
||||
return false;
|
||||
};
|
||||
|
||||
const QVector<QStringRef> list = codings.remove(' ').remove('\t').splitRef(',', QString::SkipEmptyParts);
|
||||
const QList<QStringView> list = QStringView(codings.remove(' ').remove('\t')).split(u',', Qt::SkipEmptyParts);
|
||||
if (list.isEmpty())
|
||||
return false;
|
||||
|
||||
const bool canGzip = isCodingAvailable(list, QLatin1String("gzip"));
|
||||
const bool canGzip = isCodingAvailable(list, QString::fromLatin1("gzip"));
|
||||
if (canGzip)
|
||||
return true;
|
||||
|
||||
const bool canAny = isCodingAvailable(list, QLatin1String("*"));
|
||||
const bool canAny = isCodingAvailable(list, QString::fromLatin1("*"));
|
||||
if (canAny)
|
||||
return true;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Http
|
||||
class Connection : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(Connection)
|
||||
Q_DISABLE_COPY_MOVE(Connection)
|
||||
|
||||
public:
|
||||
Connection(QTcpSocket *socket, IRequestHandler *requestHandler, QObject *parent = nullptr);
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace
|
||||
return in;
|
||||
}
|
||||
|
||||
bool parseHeaderLine(const QString &line, HeaderMap &out)
|
||||
bool parseHeaderLine(const QStringView line, HeaderMap &out)
|
||||
{
|
||||
// [rfc7230] 3.2. Header Fields
|
||||
const int i = line.indexOf(':');
|
||||
@@ -67,8 +67,8 @@ namespace
|
||||
return false;
|
||||
}
|
||||
|
||||
const QString name = line.leftRef(i).trimmed().toString().toLower();
|
||||
const QString value = line.midRef(i + 1).trimmed().toString();
|
||||
const QString name = line.left(i).trimmed().toString().toLower();
|
||||
const QString value = line.mid(i + 1).trimmed().toString();
|
||||
out[name] = value;
|
||||
|
||||
return true;
|
||||
@@ -145,10 +145,10 @@ RequestParser::ParseResult RequestParser::doParse(const QByteArray &data)
|
||||
return {ParseStatus::BadRequest, Request(), 0}; // TODO: SHOULD respond "501 Not Implemented"
|
||||
}
|
||||
|
||||
bool RequestParser::parseStartLines(const QString &data)
|
||||
bool RequestParser::parseStartLines(const QStringView data)
|
||||
{
|
||||
// we don't handle malformed request which uses `LF` for newline
|
||||
const QVector<QStringRef> lines = data.splitRef(CRLF, QString::SkipEmptyParts);
|
||||
const QList<QStringView> lines = data.split(QString::fromLatin1(CRLF), Qt::SkipEmptyParts);
|
||||
|
||||
// [rfc7230] 3.2.2. Field Order
|
||||
QStringList requestLines;
|
||||
@@ -267,7 +267,7 @@ bool RequestParser::parsePostMessage(const QByteArray &data)
|
||||
return false;
|
||||
}
|
||||
|
||||
const QByteArray delimiter = Utils::String::unquote(contentType.midRef(idx + boundaryFieldName.size())).toLatin1();
|
||||
const QByteArray delimiter = Utils::String::unquote(QStringView(contentType).mid(idx + boundaryFieldName.size())).toLatin1();
|
||||
if (delimiter.isEmpty())
|
||||
{
|
||||
qWarning() << Q_FUNC_INFO << "boundary delimiter field empty!";
|
||||
@@ -276,7 +276,7 @@ bool RequestParser::parsePostMessage(const QByteArray &data)
|
||||
|
||||
// split data by "dash-boundary"
|
||||
const QByteArray dashDelimiter = QByteArray("--") + delimiter + CRLF;
|
||||
QVector<QByteArray> multipart = splitToViews(data, dashDelimiter, QString::SkipEmptyParts);
|
||||
QVector<QByteArray> multipart = splitToViews(data, dashDelimiter, Qt::SkipEmptyParts);
|
||||
if (multipart.isEmpty())
|
||||
{
|
||||
qWarning() << Q_FUNC_INFO << "multipart empty";
|
||||
@@ -299,7 +299,7 @@ bool RequestParser::parsePostMessage(const QByteArray &data)
|
||||
|
||||
bool RequestParser::parseFormData(const QByteArray &data)
|
||||
{
|
||||
const QVector<QByteArray> list = splitToViews(data, EOH, QString::KeepEmptyParts);
|
||||
const QVector<QByteArray> list = splitToViews(data, EOH, Qt::KeepEmptyParts);
|
||||
|
||||
if (list.size() != 2)
|
||||
{
|
||||
@@ -311,13 +311,13 @@ bool RequestParser::parseFormData(const QByteArray &data)
|
||||
const QByteArray payload = viewWithoutEndingWith(list[1], CRLF);
|
||||
|
||||
HeaderMap headersMap;
|
||||
const QVector<QStringRef> headerLines = headers.splitRef(CRLF, QString::SkipEmptyParts);
|
||||
const QList<QStringView> headerLines = QStringView(headers).split(QString::fromLatin1(CRLF), Qt::SkipEmptyParts);
|
||||
for (const auto &line : headerLines)
|
||||
{
|
||||
if (line.trimmed().startsWith(HEADER_CONTENT_DISPOSITION, Qt::CaseInsensitive))
|
||||
if (line.trimmed().startsWith(QString::fromLatin1(HEADER_CONTENT_DISPOSITION), Qt::CaseInsensitive))
|
||||
{
|
||||
// extract out filename & name
|
||||
const QVector<QStringRef> directives = line.split(';', QString::SkipEmptyParts);
|
||||
const QList<QStringView> directives = line.split(u';', Qt::SkipEmptyParts);
|
||||
|
||||
for (const auto &directive : directives)
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Http
|
||||
RequestParser();
|
||||
|
||||
ParseResult doParse(const QByteArray &data);
|
||||
bool parseStartLines(const QString &data);
|
||||
bool parseStartLines(QStringView data);
|
||||
bool parseRequestLine(const QString &line);
|
||||
|
||||
bool parsePostMessage(const QByteArray &data);
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Http
|
||||
class Server final : public QTcpServer
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(Server)
|
||||
Q_DISABLE_COPY_MOVE(Server)
|
||||
|
||||
public:
|
||||
explicit Server(IRequestHandler *requestHandler, QObject *parent = nullptr);
|
||||
|
||||
@@ -35,43 +35,44 @@
|
||||
|
||||
namespace Http
|
||||
{
|
||||
const char METHOD_GET[] = "GET";
|
||||
const char METHOD_POST[] = "POST";
|
||||
inline const char METHOD_GET[] = "GET";
|
||||
inline const char METHOD_POST[] = "POST";
|
||||
|
||||
const char HEADER_CACHE_CONTROL[] = "cache-control";
|
||||
const char HEADER_CONNECTION[] = "connection";
|
||||
const char HEADER_CONTENT_DISPOSITION[] = "content-disposition";
|
||||
const char HEADER_CONTENT_ENCODING[] = "content-encoding";
|
||||
const char HEADER_CONTENT_LENGTH[] = "content-length";
|
||||
const char HEADER_CONTENT_SECURITY_POLICY[] = "content-security-policy";
|
||||
const char HEADER_CONTENT_TYPE[] = "content-type";
|
||||
const char HEADER_DATE[] = "date";
|
||||
const char HEADER_HOST[] = "host";
|
||||
const char HEADER_ORIGIN[] = "origin";
|
||||
const char HEADER_REFERER[] = "referer";
|
||||
const char HEADER_REFERRER_POLICY[] = "referrer-policy";
|
||||
const char HEADER_SET_COOKIE[] = "set-cookie";
|
||||
const char HEADER_X_CONTENT_TYPE_OPTIONS[] = "x-content-type-options";
|
||||
const char HEADER_X_FORWARDED_HOST[] = "x-forwarded-host";
|
||||
const char HEADER_X_FRAME_OPTIONS[] = "x-frame-options";
|
||||
const char HEADER_X_XSS_PROTECTION[] = "x-xss-protection";
|
||||
inline const char HEADER_CACHE_CONTROL[] = "cache-control";
|
||||
inline const char HEADER_CONNECTION[] = "connection";
|
||||
inline const char HEADER_CONTENT_DISPOSITION[] = "content-disposition";
|
||||
inline const char HEADER_CONTENT_ENCODING[] = "content-encoding";
|
||||
inline const char HEADER_CONTENT_LENGTH[] = "content-length";
|
||||
inline const char HEADER_CONTENT_SECURITY_POLICY[] = "content-security-policy";
|
||||
inline const char HEADER_CONTENT_TYPE[] = "content-type";
|
||||
inline const char HEADER_DATE[] = "date";
|
||||
inline const char HEADER_HOST[] = "host";
|
||||
inline const char HEADER_ORIGIN[] = "origin";
|
||||
inline const char HEADER_REFERER[] = "referer";
|
||||
inline const char HEADER_REFERRER_POLICY[] = "referrer-policy";
|
||||
inline const char HEADER_SET_COOKIE[] = "set-cookie";
|
||||
inline const char HEADER_X_CONTENT_TYPE_OPTIONS[] = "x-content-type-options";
|
||||
inline const char HEADER_X_FORWARDED_FOR[] = "x-forwarded-for";
|
||||
inline const char HEADER_X_FORWARDED_HOST[] = "x-forwarded-host";
|
||||
inline const char HEADER_X_FRAME_OPTIONS[] = "x-frame-options";
|
||||
inline const char HEADER_X_XSS_PROTECTION[] = "x-xss-protection";
|
||||
|
||||
const char HEADER_REQUEST_METHOD_GET[] = "GET";
|
||||
const char HEADER_REQUEST_METHOD_HEAD[] = "HEAD";
|
||||
const char HEADER_REQUEST_METHOD_POST[] = "POST";
|
||||
inline const char HEADER_REQUEST_METHOD_GET[] = "GET";
|
||||
inline const char HEADER_REQUEST_METHOD_HEAD[] = "HEAD";
|
||||
inline const char HEADER_REQUEST_METHOD_POST[] = "POST";
|
||||
|
||||
const char CONTENT_TYPE_HTML[] = "text/html";
|
||||
const char CONTENT_TYPE_CSS[] = "text/css";
|
||||
const char CONTENT_TYPE_TXT[] = "text/plain; charset=UTF-8";
|
||||
const char CONTENT_TYPE_JS[] = "application/javascript";
|
||||
const char CONTENT_TYPE_JSON[] = "application/json";
|
||||
const char CONTENT_TYPE_GIF[] = "image/gif";
|
||||
const char CONTENT_TYPE_PNG[] = "image/png";
|
||||
const char CONTENT_TYPE_FORM_ENCODED[] = "application/x-www-form-urlencoded";
|
||||
const char CONTENT_TYPE_FORM_DATA[] = "multipart/form-data";
|
||||
inline const char CONTENT_TYPE_HTML[] = "text/html";
|
||||
inline const char CONTENT_TYPE_CSS[] = "text/css";
|
||||
inline const char CONTENT_TYPE_TXT[] = "text/plain; charset=UTF-8";
|
||||
inline const char CONTENT_TYPE_JS[] = "application/javascript";
|
||||
inline const char CONTENT_TYPE_JSON[] = "application/json";
|
||||
inline const char CONTENT_TYPE_GIF[] = "image/gif";
|
||||
inline const char CONTENT_TYPE_PNG[] = "image/png";
|
||||
inline const char CONTENT_TYPE_FORM_ENCODED[] = "application/x-www-form-urlencoded";
|
||||
inline const char CONTENT_TYPE_FORM_DATA[] = "multipart/form-data";
|
||||
|
||||
// portability: "\r\n" doesn't guarantee mapping to the correct symbol
|
||||
const char CRLF[] = {0x0D, 0x0A, '\0'};
|
||||
inline const char CRLF[] = {0x0D, 0x0A, '\0'};
|
||||
|
||||
struct Environment
|
||||
{
|
||||
@@ -120,7 +121,7 @@ namespace Http
|
||||
HeaderMap headers;
|
||||
QByteArray content;
|
||||
|
||||
Response(uint code = 200, const QString &text = "OK")
|
||||
Response(uint code = 200, const QString &text = QLatin1String("OK"))
|
||||
: status {code, text}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class QString;
|
||||
|
||||
class IconProvider : public QObject
|
||||
{
|
||||
Q_DISABLE_COPY(IconProvider)
|
||||
Q_DISABLE_COPY_MOVE(IconProvider)
|
||||
|
||||
public:
|
||||
static void initInstance();
|
||||
|
||||
@@ -72,7 +72,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Log::MsgTypes)
|
||||
class Logger : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(Logger)
|
||||
Q_DISABLE_COPY_MOVE(Logger)
|
||||
|
||||
public:
|
||||
static void initInstance();
|
||||
|
||||
@@ -39,7 +39,7 @@ class QUrl;
|
||||
class DownloadHandlerImpl final : public Net::DownloadHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(DownloadHandlerImpl)
|
||||
Q_DISABLE_COPY_MOVE(DownloadHandlerImpl)
|
||||
|
||||
public:
|
||||
DownloadHandlerImpl(Net::DownloadManager *manager, const Net::DownloadRequest &downloadRequest);
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Net
|
||||
class DownloadHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(DownloadHandler)
|
||||
Q_DISABLE_COPY_MOVE(DownloadHandler)
|
||||
|
||||
public:
|
||||
using QObject::QObject;
|
||||
@@ -112,7 +112,7 @@ namespace Net
|
||||
class DownloadManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(DownloadManager)
|
||||
Q_DISABLE_COPY_MOVE(DownloadManager)
|
||||
|
||||
public:
|
||||
static void initInstance();
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Net
|
||||
class GeoIPManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(GeoIPManager)
|
||||
Q_DISABLE_COPY_MOVE(GeoIPManager)
|
||||
|
||||
public:
|
||||
static void initInstance();
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Net
|
||||
{
|
||||
class PortForwarder : public QObject
|
||||
{
|
||||
Q_DISABLE_COPY(PortForwarder)
|
||||
Q_DISABLE_COPY_MOVE(PortForwarder)
|
||||
|
||||
public:
|
||||
explicit PortForwarder(QObject *parent = nullptr);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user