Compare commits
890 Commits
release-4.
...
release-3.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83ae15550d | ||
|
|
3783541c30 | ||
|
|
cc388fe772 | ||
|
|
78f2afa239 | ||
|
|
245e8e09bb | ||
|
|
986cff9e66 | ||
|
|
73f477072f | ||
|
|
7e9ece2701 | ||
|
|
ba8641f1ac | ||
|
|
76c6041031 | ||
|
|
2ae8472a78 | ||
|
|
dc9df6d681 | ||
|
|
aed9e8f1b7 | ||
|
|
a94d14acaf | ||
|
|
317689bd5d | ||
|
|
1ad66ba791 | ||
|
|
b4fb193d4a | ||
|
|
ab47559bf2 | ||
|
|
ac87728150 | ||
|
|
1559205114 | ||
|
|
54e8b6944e | ||
|
|
164e8156db | ||
|
|
c83bb22e80 | ||
|
|
166c2a72ac | ||
|
|
6b659804c7 | ||
|
|
0831320f17 | ||
|
|
8d2fb06f65 | ||
|
|
bf6f103142 | ||
|
|
c4b12b854e | ||
|
|
de514e29c2 | ||
|
|
03d020f0f2 | ||
|
|
15e7726233 | ||
|
|
9258a9ae78 | ||
|
|
7c2437e5f2 | ||
|
|
dc315c080b | ||
|
|
971c340b53 | ||
|
|
76b9b02177 | ||
|
|
375c2dfd0b | ||
|
|
6a3e7a12d8 | ||
|
|
d92ef3fa4d | ||
|
|
89d4cb257f | ||
|
|
47ebb0df58 | ||
|
|
71169abaa6 | ||
|
|
83dd0ae86e | ||
|
|
c9500d933b | ||
|
|
b8787460a4 | ||
|
|
d031264d62 | ||
|
|
63b408c743 | ||
|
|
1ac4458d13 | ||
|
|
6b91510d71 | ||
|
|
f1a7e8921a | ||
|
|
78c34b948e | ||
|
|
690db070c7 | ||
|
|
0979936266 | ||
|
|
ba23b41616 | ||
|
|
412584e9c3 | ||
|
|
13aa3c3088 | ||
|
|
067c406c94 | ||
|
|
8536e79f2a | ||
|
|
70b98d903e | ||
|
|
1997a29769 | ||
|
|
f6e4f48386 | ||
|
|
10002984e6 | ||
|
|
2fa2d36c3b | ||
|
|
ceed9b468e | ||
|
|
f19854c054 | ||
|
|
989cbda29c | ||
|
|
881f79b76d | ||
|
|
51986f3ac8 | ||
|
|
943a837570 | ||
|
|
a6cf386073 | ||
|
|
b6e1b6e501 | ||
|
|
cee308a517 | ||
|
|
390d22bc66 | ||
|
|
e4a5b8d352 | ||
|
|
2ba3104337 | ||
|
|
d1dfdd1306 | ||
|
|
8a02a69924 | ||
|
|
8ffc72b626 | ||
|
|
e85479dfd7 | ||
|
|
104bed7cc8 | ||
|
|
75f3dd6d1d | ||
|
|
751f64c98b | ||
|
|
6353c2ca3c | ||
|
|
f51e467ce3 | ||
|
|
358d182c82 | ||
|
|
7d2802cf2c | ||
|
|
a739d86e3d | ||
|
|
6ff614ebea | ||
|
|
d9f4141221 | ||
|
|
415a805818 | ||
|
|
b8fff68230 | ||
|
|
44f81a2d2b | ||
|
|
b98ef9905e | ||
|
|
e4f472e0f8 | ||
|
|
91a38193f5 | ||
|
|
66b92f3bb4 | ||
|
|
a911dc57f3 | ||
|
|
c43c473105 | ||
|
|
d079b71f63 | ||
|
|
8b0b398a5f | ||
|
|
9400aac003 | ||
|
|
7856863b3e | ||
|
|
b1f598a1d3 | ||
|
|
9c7ed80292 | ||
|
|
1835ec6086 | ||
|
|
3d4cead200 | ||
|
|
112a24f9b6 | ||
|
|
cdcafecb44 | ||
|
|
4e173d34d3 | ||
|
|
df5d31b52b | ||
|
|
be745551e6 | ||
|
|
a3e4bcd1dd | ||
|
|
36cc6909f8 | ||
|
|
3987e677d5 | ||
|
|
13f27c6d3b | ||
|
|
68f88f7907 | ||
|
|
6c2c08c6dd | ||
|
|
b8eee9e1b8 | ||
|
|
ef08b4269d | ||
|
|
b5a67aefdb | ||
|
|
a302c995f8 | ||
|
|
f2877cbec4 | ||
|
|
4a95291fcc | ||
|
|
6717e3d30c | ||
|
|
778209ae49 | ||
|
|
258efe261d | ||
|
|
59abbab9b9 | ||
|
|
7cc32cbe97 | ||
|
|
5783f7bafe | ||
|
|
0e64e6887a | ||
|
|
c25cb29e61 | ||
|
|
bca9b60db8 | ||
|
|
1ec122c4ab | ||
|
|
562dd41ab2 | ||
|
|
b4bca7cfb7 | ||
|
|
b985bb43fa | ||
|
|
bf8a438a6f | ||
|
|
7cd9b6f750 | ||
|
|
d487c69dcc | ||
|
|
444c2bdf19 | ||
|
|
f86064e322 | ||
|
|
6675544c23 | ||
|
|
10205ca67e | ||
|
|
2dfed3c41e | ||
|
|
db29a61fbf | ||
|
|
3497c5307c | ||
|
|
565f263ecb | ||
|
|
c94a61f434 | ||
|
|
d390d941eb | ||
|
|
f1de249c9e | ||
|
|
f85768412c | ||
|
|
5a28e8c5e9 | ||
|
|
5b72595547 | ||
|
|
a363ed6d7c | ||
|
|
077469d5a0 | ||
|
|
66df7c47b2 | ||
|
|
20b30dd4b5 | ||
|
|
bacef1ca24 | ||
|
|
8d11af94f2 | ||
|
|
02c96fa5e2 | ||
|
|
65b491fed0 | ||
|
|
f0eab3f085 | ||
|
|
21212fdfe5 | ||
|
|
f39465c25a | ||
|
|
a3eaee7e7e | ||
|
|
1e28bbb47e | ||
|
|
c5b98339ae | ||
|
|
edb1b727c6 | ||
|
|
78aeb5eee7 | ||
|
|
9dd93c3d17 | ||
|
|
2d64405eb8 | ||
|
|
dff560d8c2 | ||
|
|
b3c973612f | ||
|
|
3480d3d10c | ||
|
|
f45d21d3a2 | ||
|
|
8dcb792ac0 | ||
|
|
cb5174bfa2 | ||
|
|
9138156968 | ||
|
|
8a0b1fe0be | ||
|
|
3bbe304856 | ||
|
|
0356172a1d | ||
|
|
80f3b19356 | ||
|
|
39a569b438 | ||
|
|
edaa7e85a7 | ||
|
|
f9f7a8cbf2 | ||
|
|
7aef9828c9 | ||
|
|
18ad972936 | ||
|
|
8b5c275934 | ||
|
|
59765954b8 | ||
|
|
f5fff855bb | ||
|
|
26c713851e | ||
|
|
f9b64c4e73 | ||
|
|
edf6c30cd8 | ||
|
|
83860afa60 | ||
|
|
4b7362aa6b | ||
|
|
dd0537d8d2 | ||
|
|
3c50cc1d2c | ||
|
|
78fdb68457 | ||
|
|
bb1bd34ec0 | ||
|
|
1841834c89 | ||
|
|
30b70a99f1 | ||
|
|
f0f2e93e4d | ||
|
|
5852c5e318 | ||
|
|
b38827bb8e | ||
|
|
240046f720 | ||
|
|
78b1194da1 | ||
|
|
c1a66dad51 | ||
|
|
4a10d246c2 | ||
|
|
125ab378a4 | ||
|
|
4cd8a36b40 | ||
|
|
364df2e18c | ||
|
|
f8f2476aa5 | ||
|
|
d685c9739b | ||
|
|
6fdfcf38f1 | ||
|
|
7c85866881 | ||
|
|
37673cd86f | ||
|
|
a4a38d633c | ||
|
|
93bdc81e3c | ||
|
|
827d5a22fb | ||
|
|
34e56eade8 | ||
|
|
4a23e7da37 | ||
|
|
f577a26fe2 | ||
|
|
3f176d8265 | ||
|
|
cbc001e059 | ||
|
|
a66ed05ecd | ||
|
|
ec347d8dbe | ||
|
|
f0acafb853 | ||
|
|
1a12e891ec | ||
|
|
88ba8e2ceb | ||
|
|
2e403277f3 | ||
|
|
89349f60b0 | ||
|
|
0604d3729a | ||
|
|
cf16e3b8a1 | ||
|
|
dcb3496651 | ||
|
|
9d10da3ed2 | ||
|
|
0524deb496 | ||
|
|
787ae43d54 | ||
|
|
67bb2cc150 | ||
|
|
51995c80d1 | ||
|
|
5f43741b09 | ||
|
|
3328d8efd2 | ||
|
|
a54a9e5487 | ||
|
|
0181ca70f4 | ||
|
|
ff665af3f7 | ||
|
|
9275cdc5bf | ||
|
|
b7c3bdd443 | ||
|
|
5fd08f8664 | ||
|
|
84a4d323c7 | ||
|
|
8efb13bfaf | ||
|
|
0187b55610 | ||
|
|
2f606b2728 | ||
|
|
025f75beca | ||
|
|
4711cafd20 | ||
|
|
8d12ca9477 | ||
|
|
67b90bfb51 | ||
|
|
ab05c0c326 | ||
|
|
c5ea453438 | ||
|
|
4f041c16e1 | ||
|
|
28cfee7bd3 | ||
|
|
6272287fbb | ||
|
|
e7a1542902 | ||
|
|
5e371d8195 | ||
|
|
6bb189ea13 | ||
|
|
8496f31e39 | ||
|
|
08f634f748 | ||
|
|
2b5dc5c4a6 | ||
|
|
0a2f0aefb3 | ||
|
|
66e137b8ee | ||
|
|
f9be39545b | ||
|
|
789b8046a2 | ||
|
|
129bf497c8 | ||
|
|
a6d7693d62 | ||
|
|
4e9fbc4da5 | ||
|
|
23f6ff4673 | ||
|
|
3c0dfa6444 | ||
|
|
694311b2bd | ||
|
|
b77626897f | ||
|
|
b8081feac1 | ||
|
|
8b805f4518 | ||
|
|
8bb4f021f1 | ||
|
|
97c79050dc | ||
|
|
ac62a708de | ||
|
|
8d9789f51b | ||
|
|
559d0228fd | ||
|
|
1296e7b891 | ||
|
|
0333e23710 | ||
|
|
7320a80caa | ||
|
|
0579bfc069 | ||
|
|
d20d04299e | ||
|
|
50b2009e9c | ||
|
|
721d29edda | ||
|
|
bc9cae199b | ||
|
|
c38b250667 | ||
|
|
101b2f3ad2 | ||
|
|
9c4f798d93 | ||
|
|
249ff21738 | ||
|
|
f1149097b6 | ||
|
|
111b0df307 | ||
|
|
8041af72cd | ||
|
|
4be6d0b30f | ||
|
|
8c757969f2 | ||
|
|
ae6a82f814 | ||
|
|
eed3f0559a | ||
|
|
c7884e7621 | ||
|
|
2946ab7e7a | ||
|
|
ddb8e4d21a | ||
|
|
00d4f6141f | ||
|
|
7971a25c2a | ||
|
|
ab2411930a | ||
|
|
93f972bfca | ||
|
|
db638844d0 | ||
|
|
ba99eddc91 | ||
|
|
92428cee5d | ||
|
|
2c7d836925 | ||
|
|
7703dcf626 | ||
|
|
157520c4fc | ||
|
|
5bc728fa33 | ||
|
|
35fdc43b3f | ||
|
|
ae6ea29f2f | ||
|
|
4eac2cab31 | ||
|
|
87f4f57f8e | ||
|
|
a6e250fa43 | ||
|
|
b118079379 | ||
|
|
cb2d39f2a7 | ||
|
|
4cf549ff25 | ||
|
|
b5c6342dca | ||
|
|
46ec556921 | ||
|
|
33ae1a7bee | ||
|
|
87a3a67668 | ||
|
|
055b1e0163 | ||
|
|
2bd5ea2c68 | ||
|
|
1479a74198 | ||
|
|
9a0d25284c | ||
|
|
284e836992 | ||
|
|
43f5b31843 | ||
|
|
cada6cfc88 | ||
|
|
99f157927f | ||
|
|
664664394c | ||
|
|
a790901691 | ||
|
|
fdc70eaa62 | ||
|
|
b05a23e1ab | ||
|
|
9f6a0882e2 | ||
|
|
b351b21e55 | ||
|
|
ef22f06e92 | ||
|
|
8ea7426bc1 | ||
|
|
79e7e1727f | ||
|
|
98c33dd77c | ||
|
|
9c6504f6dd | ||
|
|
76c350bdcb | ||
|
|
106dcfd00e | ||
|
|
668c8cb0e2 | ||
|
|
3159bdf4dd | ||
|
|
97d2c0d187 | ||
|
|
0041ee3636 | ||
|
|
1ed523bec3 | ||
|
|
b131a6e9df | ||
|
|
56d9d370e9 | ||
|
|
a6efc4d92d | ||
|
|
a77db6e822 | ||
|
|
95a558941e | ||
|
|
867d69d0f2 | ||
|
|
a6d381da38 | ||
|
|
f0eb708b07 | ||
|
|
1d70698bd0 | ||
|
|
79871c8e21 | ||
|
|
25d5524213 | ||
|
|
8d21b73434 | ||
|
|
2ef01a314c | ||
|
|
a8b4aca5e6 | ||
|
|
67e7315eae | ||
|
|
a25a15d1c6 | ||
|
|
086588eeed | ||
|
|
44fa308681 | ||
|
|
6188287094 | ||
|
|
17d10afd65 | ||
|
|
89bd0e4397 | ||
|
|
1c1917f885 | ||
|
|
642377bd65 | ||
|
|
bb4668c071 | ||
|
|
689316db09 | ||
|
|
ad0c008a3e | ||
|
|
09e3698b37 | ||
|
|
6450ebfc6c | ||
|
|
e9f38ebcfd | ||
|
|
4dba31f534 | ||
|
|
04c1aad0dd | ||
|
|
6763f3ac33 | ||
|
|
afca704db0 | ||
|
|
eaec8fcddd | ||
|
|
f86fd52d6f | ||
|
|
f3f175570c | ||
|
|
729c80f910 | ||
|
|
fcaca558a0 | ||
|
|
983df9113e | ||
|
|
acf9874252 | ||
|
|
d7cf6bb11b | ||
|
|
558ea53cc2 | ||
|
|
87a6478430 | ||
|
|
cea673b267 | ||
|
|
4a5ab93c62 | ||
|
|
4c86fc8973 | ||
|
|
1c485ffb07 | ||
|
|
f283734f13 | ||
|
|
dca4ff0649 | ||
|
|
1975f2269e | ||
|
|
6fac9b42da | ||
|
|
dabae4c914 | ||
|
|
b1e9b4493d | ||
|
|
2fa207e728 | ||
|
|
7adcd909e7 | ||
|
|
50805fc2b5 | ||
|
|
3a1b7b6159 | ||
|
|
498b7c2436 | ||
|
|
4f17364305 | ||
|
|
9ebc115719 | ||
|
|
a6fa8c3a8e | ||
|
|
8187366c89 | ||
|
|
366ad01120 | ||
|
|
4da05e5914 | ||
|
|
3fb19b6a28 | ||
|
|
88f59070a4 | ||
|
|
476ffbe68a | ||
|
|
8a1846cb26 | ||
|
|
1cafde2afe | ||
|
|
bdf7312f5d | ||
|
|
a848d3d2d8 | ||
|
|
4a328843e4 | ||
|
|
edeb2342be | ||
|
|
0639a06809 | ||
|
|
7590d0fdad | ||
|
|
fe54da80cd | ||
|
|
e4ac654795 | ||
|
|
1848180faa | ||
|
|
4e9b71078f | ||
|
|
fe1b388347 | ||
|
|
23b4e62834 | ||
|
|
7fb96431b9 | ||
|
|
5213f35ec0 | ||
|
|
8e2297510d | ||
|
|
18505e2517 | ||
|
|
10908a6ece | ||
|
|
c1ee91cd2a | ||
|
|
036b4e1a85 | ||
|
|
3a4dc08304 | ||
|
|
e805e6806a | ||
|
|
f2163f6c3d | ||
|
|
6288cb4fd3 | ||
|
|
409e877f8a | ||
|
|
f2d5ba2907 | ||
|
|
b33d0f0a59 | ||
|
|
63245de69b | ||
|
|
b9fd9f1d8d | ||
|
|
c6fe1d3620 | ||
|
|
73f08dd6e1 | ||
|
|
22dc71f365 | ||
|
|
455cc29dad | ||
|
|
9d39a2cddc | ||
|
|
efeb46571b | ||
|
|
a7b564bb2e | ||
|
|
10df509bce | ||
|
|
7b394d6e99 | ||
|
|
f1968de2c9 | ||
|
|
b5db0eeec1 | ||
|
|
3ed803f59b | ||
|
|
ff10702bfd | ||
|
|
73d3664f92 | ||
|
|
aa6025aa87 | ||
|
|
a344886ef6 | ||
|
|
c181019f40 | ||
|
|
5962efde23 | ||
|
|
d43466d466 | ||
|
|
29fb8e8085 | ||
|
|
b076ff68ac | ||
|
|
5f2da3a529 | ||
|
|
576fbe5dc1 | ||
|
|
8fc7f3fdc0 | ||
|
|
becd67ac84 | ||
|
|
7761a2604a | ||
|
|
c6546db138 | ||
|
|
f0dd4d5673 | ||
|
|
7f245b63d7 | ||
|
|
af17f4df9e | ||
|
|
3ec2f94b27 | ||
|
|
d7f1beb7f1 | ||
|
|
8c7a4ab86c | ||
|
|
ce2d42a264 | ||
|
|
dc011a5599 | ||
|
|
3c6b79805c | ||
|
|
7e7055f2ff | ||
|
|
18c9a65340 | ||
|
|
f5ce39a36a | ||
|
|
58e4f9d38e | ||
|
|
5bd7dce396 | ||
|
|
d9d49b6d0b | ||
|
|
cc48ca1fdc | ||
|
|
2dc6002064 | ||
|
|
1478b21e8d | ||
|
|
726c2fd56d | ||
|
|
df86d66702 | ||
|
|
223415fb69 | ||
|
|
a4c9b667a7 | ||
|
|
5f8e05ba50 | ||
|
|
ed2689de15 | ||
|
|
9e124527e1 | ||
|
|
59971aa577 | ||
|
|
164ca0289a | ||
|
|
c0aa50d74b | ||
|
|
66d7dc751c | ||
|
|
c1738f97f1 | ||
|
|
105874613a | ||
|
|
d6829b253b | ||
|
|
c1291539bf | ||
|
|
3060c979f4 | ||
|
|
d71a18b945 | ||
|
|
4078fc5e2d | ||
|
|
b7cb53a251 | ||
|
|
275a775769 | ||
|
|
1c49ff1df6 | ||
|
|
fc77fdbcb5 | ||
|
|
e0e757b610 | ||
|
|
33fe9b6d87 | ||
|
|
fca78d1a3f | ||
|
|
92794a786f | ||
|
|
08d9ad7f80 | ||
|
|
6023093329 | ||
|
|
c070193c30 | ||
|
|
633fb7a7de | ||
|
|
14a37e8d45 | ||
|
|
d03a71899e | ||
|
|
283338f5f3 | ||
|
|
b600253313 | ||
|
|
c97b5ab617 | ||
|
|
9016b698c9 | ||
|
|
eb7a7b9c04 | ||
|
|
9e0a3ee692 | ||
|
|
c899ed5b50 | ||
|
|
a6c50aff95 | ||
|
|
ab4a608342 | ||
|
|
e7cfd7a31d | ||
|
|
c4ea13b284 | ||
|
|
5d09639109 | ||
|
|
885f5b4bee | ||
|
|
3cd06c457a | ||
|
|
373e22660d | ||
|
|
92f58a40e7 | ||
|
|
dbf5a264bd | ||
|
|
145dcf9efe | ||
|
|
f05e25c750 | ||
|
|
fc02377171 | ||
|
|
3816052b0a | ||
|
|
fae583e0da | ||
|
|
1114c198ca | ||
|
|
c5f9567c0b | ||
|
|
e9a5768e4f | ||
|
|
858e5f8db8 | ||
|
|
0afa83dbfa | ||
|
|
fc95ce310e | ||
|
|
e2c9e7b877 | ||
|
|
b1e62ca006 | ||
|
|
a063ebd396 | ||
|
|
728dd744bb | ||
|
|
a0c1ee76a2 | ||
|
|
c7b15b9cc5 | ||
|
|
0770fe8b09 | ||
|
|
cf98220c40 | ||
|
|
2eb393ae9a | ||
|
|
d65d11d64c | ||
|
|
f4fdb80cc9 | ||
|
|
50a0ce1da2 | ||
|
|
2e9370481d | ||
|
|
c60c58b092 | ||
|
|
ba5dded076 | ||
|
|
eb36949e87 | ||
|
|
b7358a3039 | ||
|
|
d0f082e238 | ||
|
|
b301444f5e | ||
|
|
900a80adc1 | ||
|
|
d4887ee736 | ||
|
|
e23566cde1 | ||
|
|
b5f30a6efb | ||
|
|
deb1d54999 | ||
|
|
7779efbc30 | ||
|
|
acd65e3185 | ||
|
|
f2dd050ade | ||
|
|
9c28a48f2e | ||
|
|
3e8af95d30 | ||
|
|
cba9d222de | ||
|
|
b137eb01ed | ||
|
|
fd156580a0 | ||
|
|
21c17f2a81 | ||
|
|
5f19cd2c0e | ||
|
|
9279fedd49 | ||
|
|
2361d6f12d | ||
|
|
78bfbc5669 | ||
|
|
6101f11673 | ||
|
|
15361a6c16 | ||
|
|
835a999464 | ||
|
|
b9b0739efd | ||
|
|
a34c072b7a | ||
|
|
72e88ba7ec | ||
|
|
afb143cad1 | ||
|
|
1ca5d10abb | ||
|
|
67675b6cdc | ||
|
|
ef47983d8d | ||
|
|
cf47517ee3 | ||
|
|
33199bbd74 | ||
|
|
4fb735c6d1 | ||
|
|
99ca42bf48 | ||
|
|
f6b4b5f6f0 | ||
|
|
6f73c32fcc | ||
|
|
c1611988b4 | ||
|
|
fbe1d2d78a | ||
|
|
34fec15ceb | ||
|
|
1977e4f24d | ||
|
|
5774d27c7b | ||
|
|
3a6a857371 | ||
|
|
e2f88feaf9 | ||
|
|
16fec04b6a | ||
|
|
fbac4afa2d | ||
|
|
d6e9736af1 | ||
|
|
76b3c72c86 | ||
|
|
ef954fea55 | ||
|
|
11d085712e | ||
|
|
e4bc7852e5 | ||
|
|
3d107e0588 | ||
|
|
8e5c31ae82 | ||
|
|
3c03ccc14a | ||
|
|
0795320086 | ||
|
|
bd6877a0bd | ||
|
|
b47292c39f | ||
|
|
3d2b1b876b | ||
|
|
843472e663 | ||
|
|
e952e3167e | ||
|
|
67f05edf71 | ||
|
|
3ab76cb985 | ||
|
|
509d97b0ad | ||
|
|
67ae08df3c | ||
|
|
38de6b1e41 | ||
|
|
72b179805d | ||
|
|
beeda5e0b2 | ||
|
|
356db2f2f7 | ||
|
|
19acbf587f | ||
|
|
5eee3f7357 | ||
|
|
8f990d5d7e | ||
|
|
f0ec94c31c | ||
|
|
e37dfa96f9 | ||
|
|
4b48db3273 | ||
|
|
545002a809 | ||
|
|
e2e9470e10 | ||
|
|
0bf1abba6a | ||
|
|
24165856e9 | ||
|
|
657f0640b9 | ||
|
|
faffefc4ff | ||
|
|
0619aacf1f | ||
|
|
9edbbb6473 | ||
|
|
87ee720c0c | ||
|
|
b7ca036bc3 | ||
|
|
c4442c98b9 | ||
|
|
fee8036a7a | ||
|
|
94bd4308c7 | ||
|
|
5e5785435a | ||
|
|
d7f02a7ee7 | ||
|
|
e6480f9dff | ||
|
|
e9f6cfc2e8 | ||
|
|
4f68d263d4 | ||
|
|
6a672472a2 | ||
|
|
3590ac2997 | ||
|
|
98fe5e11dd | ||
|
|
9df5c0292b | ||
|
|
1f2d25a1ff | ||
|
|
f1dd7a091c | ||
|
|
5457bde8d0 | ||
|
|
2e325d9506 | ||
|
|
0264a7bf58 | ||
|
|
32fe930b88 | ||
|
|
72883ffb73 | ||
|
|
f2c24dd8c3 | ||
|
|
8904139c6d | ||
|
|
571f46886f | ||
|
|
0cd691e167 | ||
|
|
4f65e2d468 | ||
|
|
35981f6ef5 | ||
|
|
dc493880f3 | ||
|
|
872e78ca21 | ||
|
|
7b601796d7 | ||
|
|
09ef552aea | ||
|
|
b4c9cae0d1 | ||
|
|
6d2a0ae83b | ||
|
|
238a925000 | ||
|
|
cce01cfb8e | ||
|
|
b2db1972f3 | ||
|
|
8b851fe2b9 | ||
|
|
e3c9488fb0 | ||
|
|
c27fb110f8 | ||
|
|
ec61f24099 | ||
|
|
130ee5a71e | ||
|
|
cb3e7e6bd6 | ||
|
|
7fd65d5428 | ||
|
|
442f521bf5 | ||
|
|
016052aea1 | ||
|
|
411982e2b0 | ||
|
|
4b93ccd4e4 | ||
|
|
6603a8947a | ||
|
|
031e354577 | ||
|
|
ec7fb331e0 | ||
|
|
a232b77104 | ||
|
|
8c11245469 | ||
|
|
60857d3b8e | ||
|
|
2fe6b76968 | ||
|
|
6c7350fce0 | ||
|
|
c770f4d0bc | ||
|
|
876e96911f | ||
|
|
5620fd120e | ||
|
|
ea7f6046b4 | ||
|
|
fddac5d679 | ||
|
|
2c4bc68af1 | ||
|
|
7676f49612 | ||
|
|
e879279019 | ||
|
|
84b7680718 | ||
|
|
be180140a3 | ||
|
|
c051c279d4 | ||
|
|
964dcc4d8a | ||
|
|
64cf93b889 | ||
|
|
365737afe1 | ||
|
|
2cf14f0120 | ||
|
|
46bb25ba9f | ||
|
|
ee5a72c570 | ||
|
|
18b56f4d0a | ||
|
|
f626276218 | ||
|
|
e28554f85c | ||
|
|
a0a3447b2e | ||
|
|
4049ca7308 | ||
|
|
c28151ba92 | ||
|
|
81e1a050a2 | ||
|
|
34d5824c4a | ||
|
|
bb875df400 | ||
|
|
61f47d366a | ||
|
|
8347eb157d | ||
|
|
dd22c9b138 | ||
|
|
7f6ad55042 | ||
|
|
55b06ab9ba | ||
|
|
21f0a5eb76 | ||
|
|
16ed11623f | ||
|
|
c184cf8d7d | ||
|
|
6a90214eb2 | ||
|
|
226ec0610a | ||
|
|
694bd7cb95 | ||
|
|
9e807e7151 | ||
|
|
78fe7fcf9d | ||
|
|
c2465f931e | ||
|
|
8d50325961 | ||
|
|
570a651a59 | ||
|
|
0eaa2aeef2 | ||
|
|
2c7e309493 | ||
|
|
ded3cf5798 | ||
|
|
4edac3e974 | ||
|
|
53885fb5e4 | ||
|
|
3942c095f6 | ||
|
|
94be3b930d | ||
|
|
09bc14cc57 | ||
|
|
51b93b4284 | ||
|
|
9c50ea14cb | ||
|
|
42a74ea78e | ||
|
|
1ac68a9192 | ||
|
|
29b5d460ea | ||
|
|
a441bca4de | ||
|
|
e2da3f2ebd | ||
|
|
f235d412f8 | ||
|
|
60b103b062 | ||
|
|
0fdb23098b | ||
|
|
51c296ac69 | ||
|
|
a120842ba2 | ||
|
|
8911de9349 | ||
|
|
013a1b8403 | ||
|
|
1492a24391 | ||
|
|
bf1559320b | ||
|
|
d5648a67ae | ||
|
|
a6ec82682d | ||
|
|
bd359ad498 | ||
|
|
458f48b290 | ||
|
|
a0ae21148a | ||
|
|
5dc9b5c2dd | ||
|
|
48175bbb85 | ||
|
|
3b03bb286e | ||
|
|
23fdf3a0bc | ||
|
|
4cf7618c52 | ||
|
|
6fd9413dae | ||
|
|
120d073a04 | ||
|
|
8fa2adb6fc | ||
|
|
70105d5834 | ||
|
|
05961faf42 | ||
|
|
386706f05b | ||
|
|
1813e96a42 | ||
|
|
eaf6e47391 | ||
|
|
8ba82064cd | ||
|
|
5d5a0de694 | ||
|
|
145180c2a1 | ||
|
|
50881b9972 | ||
|
|
a115932bc1 | ||
|
|
c7fd0fbe45 | ||
|
|
d513d002cc | ||
|
|
a570bd5e2c | ||
|
|
bdacfd540c | ||
|
|
c89b9edf27 | ||
|
|
0fdf788624 | ||
|
|
f0ae30070b | ||
|
|
8fb8f4b467 | ||
|
|
c3a2e50191 | ||
|
|
b045b5ebf7 | ||
|
|
6436152c75 | ||
|
|
9c3ae53330 | ||
|
|
acd5fcfb00 | ||
|
|
9a6f8ab402 | ||
|
|
0f854014af | ||
|
|
a11175afba | ||
|
|
c5776c3bf1 | ||
|
|
19d566253f | ||
|
|
0d59d6a03e | ||
|
|
c7b2ee367f | ||
|
|
510ec029ea | ||
|
|
1f2daed9d6 | ||
|
|
08b854ce74 | ||
|
|
6b34803c59 | ||
|
|
fca224b9d0 | ||
|
|
4f5009351f | ||
|
|
c1f77d45ab | ||
|
|
60f0447603 | ||
|
|
6ae208a661 | ||
|
|
781c8034a5 | ||
|
|
4cf8359257 | ||
|
|
3ed4de3043 | ||
|
|
a374b99ba2 | ||
|
|
601734a59b | ||
|
|
69cc97c3dd | ||
|
|
226f74a866 | ||
|
|
cf35392cd2 | ||
|
|
27319e9e64 | ||
|
|
69b8544e26 | ||
|
|
41e5dc8911 | ||
|
|
ba1ffa4e54 | ||
|
|
4edc073373 | ||
|
|
1f00d2e5d7 | ||
|
|
d87e42ba00 | ||
|
|
975b1d5257 | ||
|
|
5f84363afb | ||
|
|
545c526e2f | ||
|
|
06fcc57619 | ||
|
|
06c6a444c9 | ||
|
|
8474d0d199 | ||
|
|
0f4610c127 | ||
|
|
d753988729 | ||
|
|
a6b948077a | ||
|
|
3276cc4987 | ||
|
|
71557fe784 | ||
|
|
29fc5bc80d | ||
|
|
db07551e4c | ||
|
|
8f6eb795e3 | ||
|
|
0a37799e6e | ||
|
|
76d6d9a4f9 | ||
|
|
0c8abd0abb | ||
|
|
ddc8420810 | ||
|
|
a4ff039abc | ||
|
|
c8be062e19 | ||
|
|
29443a2c10 | ||
|
|
e402556e91 | ||
|
|
4ed4ebcdb7 | ||
|
|
a280467270 | ||
|
|
9b1090332b | ||
|
|
18a520c9f9 | ||
|
|
af871ef8af | ||
|
|
3af7eb8e03 | ||
|
|
3439300cda | ||
|
|
a8027565c9 | ||
|
|
3d4e1a8127 | ||
|
|
7b6a1a1955 | ||
|
|
3f8dc60680 | ||
|
|
9be449dd7f | ||
|
|
c46f2ba097 | ||
|
|
c2c441ed08 | ||
|
|
c1e52fa1cd | ||
|
|
fbed5dc606 | ||
|
|
97978068c6 | ||
|
|
006e34880a | ||
|
|
1fd5c5d8b5 | ||
|
|
68ac9fda2d | ||
|
|
c5d807ef65 | ||
|
|
e17f10ae6b | ||
|
|
78c5d1c12f | ||
|
|
26fb54299b |
@@ -5,10 +5,6 @@ skip_tags: true
|
||||
|
||||
image: Visual Studio 2017
|
||||
|
||||
branches:
|
||||
except: # blacklist
|
||||
- coverity_scan
|
||||
|
||||
environment:
|
||||
REPO_DIR: &REPO_DIR c:\qbittorrent
|
||||
CACHE_DIR: &CACHE_DIR c:\qbt_cache
|
||||
@@ -24,8 +20,6 @@ clone_folder: *REPO_DIR
|
||||
cache:
|
||||
- *CACHE_DIR
|
||||
|
||||
clone_depth: 50
|
||||
|
||||
install:
|
||||
# check if library needs update
|
||||
- appveyor DownloadFile "%QBT_VER_URL%" -FileName "c:\version_new" && SET /P newVersion=<"c:\version_new"
|
||||
@@ -45,7 +39,8 @@ before_build:
|
||||
- CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
|
||||
- SET PATH=%PATH%;c:\qbt\qt5_32\bin;%CACHE_DIR%\jom;
|
||||
# setup project
|
||||
- COPY /Y "%CACHE_DIR%\conf.pri" "%REPO_DIR%"
|
||||
- COPY /Y "%CACHE_DIR%\winconf.pri" "%REPO_DIR%"
|
||||
- COPY /Y "%CACHE_DIR%\winconf-msvc.pri" "%REPO_DIR%"
|
||||
# workarounds
|
||||
- MKLINK /J "c:\qbt\base" "%CACHE_DIR%\base"
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[**.yml]
|
||||
indent_size = 2
|
||||
18
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,20 +1,14 @@
|
||||
**Please provide the following information**
|
||||
|
||||
### qBittorrent version and Operating System
|
||||
(type here)
|
||||
### qBittorrent version and Operating System:
|
||||
|
||||
### If on linux, libtorrent and Qt version
|
||||
(type here)
|
||||
### If on linux, libtorrent and Qt version:
|
||||
|
||||
### What is the problem
|
||||
(type here)
|
||||
### What is the problem:
|
||||
|
||||
### What is the expected behavior
|
||||
(type here)
|
||||
### What is the expected behavior:
|
||||
|
||||
### Steps to reproduce
|
||||
(type here)
|
||||
### Steps to reproduce:
|
||||
|
||||
### Extra info(if any)
|
||||
(type here)
|
||||
### Extra info(if any):
|
||||
|
||||
|
||||
4
.gitignore
vendored
@@ -22,7 +22,6 @@ qrc_*.cpp
|
||||
ui_*.h
|
||||
*.moc
|
||||
src/lang/qbittorrent_*.qm
|
||||
src/webui/www/translations/webui_*.qm
|
||||
.DS_Store
|
||||
.qmake.stash
|
||||
src/qbittorrent.app
|
||||
@@ -32,6 +31,3 @@ src/qbittorrent.app
|
||||
aclocal.m4
|
||||
autom4te.cache/*
|
||||
config.status
|
||||
src/icons/qbt-theme/build-icons/node_modules/
|
||||
src/icons/skin/build-icons/node_modules/
|
||||
src/icons/skin/build-icons/icons/*.png
|
||||
|
||||
139
.travis.yml
@@ -3,26 +3,26 @@ language: cpp
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
dist: xenial
|
||||
osx_image: xcode7.3
|
||||
|
||||
env:
|
||||
matrix:
|
||||
# Uncomment when Travis upgraded "Ubuntu 12.04 LTS" to a newer version whose repo will have a more up-to-date libtorrent package
|
||||
#- lt_branch=dist gui=true
|
||||
#- lt_branch=dist gui=false
|
||||
- lt_branch=RC_1_0 gui=true build_system=cmake
|
||||
- lt_branch=RC_1_0 gui=false build_system=cmake
|
||||
- lt_branch=RC_1_0 gui=true build_system=qmake
|
||||
- lt_branch=RC_1_0 gui=false build_system=qmake
|
||||
- lt_branch=RC_1_0 qt=5 gui=true
|
||||
- lt_branch=RC_1_0 qt=5 gui=false
|
||||
- lt_branch=RC_1_0 qt=4 gui=true
|
||||
- lt_branch=RC_1_0 qt=4 gui=false
|
||||
global:
|
||||
- secure: "OI9CUjj4lTb0HwwIZU5PbECU3hLlAL6KC8KsbwohG8/O3j5fLcnmDsK4Ad9us5cC39sS11Jcd1kDP2qRcCuST/glVNhLkcjKkiQerOfd5nQ/qL4JYfz/1mfP5mdpz9jHKzpLUIG+TXkbSTjP6VVmsb5KPT+3pKEdRFZB+Pu9+J8="
|
||||
- coverity_branch: coverity_scan
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- env: lt_branch=RC_1_0 gui=true build_system=cmake
|
||||
- env: lt_branch=RC_1_0 gui=false build_system=cmake
|
||||
- os: osx
|
||||
env: lt_branch=RC_1_0 qt=4 gui=true
|
||||
- os: osx
|
||||
env: lt_branch=RC_1_0 qt=4 gui=false
|
||||
|
||||
branches:
|
||||
except:
|
||||
@@ -39,6 +39,11 @@ cache:
|
||||
directories:
|
||||
- $HOME/hombebrew_cache
|
||||
|
||||
# opt-in Ubuntu Trusty
|
||||
dist: trusty
|
||||
# container-based builds
|
||||
sudo: false
|
||||
|
||||
addons:
|
||||
coverity_scan:
|
||||
project:
|
||||
@@ -50,44 +55,53 @@ addons:
|
||||
notification_email: sledgehammer999@qbittorrent.org
|
||||
apt:
|
||||
sources:
|
||||
# sources list: https://github.com/travis-ci/apt-source-safelist/blob/master/ubuntu.json
|
||||
# sources list: https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
|
||||
#- ubuntu-toolchain-r-test
|
||||
#- boost-latest
|
||||
- sourceline: 'ppa:qbittorrent-team/qbittorrent-stable'
|
||||
- sourceline: 'ppa:beineri/opt-qt551-trusty'
|
||||
packages:
|
||||
# packages list: https://github.com/travis-ci/apt-package-safelist/blob/master/ubuntu-trusty
|
||||
- [autoconf, automake, colormake]
|
||||
- [ninja-build]
|
||||
# packages list: https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
|
||||
- autoconf
|
||||
- automake
|
||||
- colormake
|
||||
- libssl-dev
|
||||
- [libboost-dev, libboost-system-dev]
|
||||
- libboost-dev
|
||||
- libboost-system-dev
|
||||
- libtorrent-rasterbar-dev
|
||||
- [qtbase5-dev, qttools5-dev-tools, libqt5svg5-dev]
|
||||
# Qt 5.5.1
|
||||
- qt55base
|
||||
- qt55tools
|
||||
# Qt 4.8
|
||||
- qt4-default
|
||||
- libqt4-dev
|
||||
|
||||
before_install:
|
||||
# only allow specific build for coverity scan, others will stop
|
||||
- if [ "$TRAVIS_BRANCH" = "$coverity_branch" ] && ! [ "$TRAVIS_OS_NAME" = "linux" -a "$lt_branch" = "RC_1_0" -a "$gui" = true -a "$build_system" = "qmake" ]; then exit ; fi
|
||||
- if [ "$TRAVIS_BRANCH" = "$coverity_branch" ] && ! [ "$TRAVIS_OS_NAME" = "linux" -a "$lt_branch" = "RC_1_0" -a "$gui" = true ]; then exit ; fi
|
||||
|
||||
- shopt -s expand_aliases
|
||||
- alias make="colormake -j2" # Using nprocs/2 sometimes may fail (gcc is killed by system)
|
||||
- alias make="colormake -j3" # Using nprocs/2 sometimes may fail (gcc is killed by system)
|
||||
#- libt_path="$HOME/libt_install"
|
||||
#- ltconf="$ltconf --prefix="$libt_path" --disable-geoip"
|
||||
- qbt_path="$HOME/qbt_install"
|
||||
- |
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
qbtconf="$qbtconf --prefix="$qbt_path" PKG_CONFIG_PATH=/opt/qt55/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
else
|
||||
qbtconf="$qbtconf --prefix="$qbt_path" PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedefs -Wno-inconsistent-missing-override"
|
||||
fi
|
||||
- qbtconf="$qbtconf --prefix="$qbt_path" PKG_CONFIG_PATH="$libt_path/lib/pkgconfig":/opt/qt55/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
|
||||
# options for specific branches
|
||||
- if [ "$qt" = 4 ]; then qbtconf="$qbtconf --with-qt4" ; fi
|
||||
- if [ "$gui" = false ]; then qbtconf="$qbtconf --disable-gui" ; fi
|
||||
- |
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
# setup virtual display for after_success target
|
||||
if [ "$gui" = true ]; then export "DISPLAY=:99.0" && /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16 ; fi ;
|
||||
|
||||
# Qt 5
|
||||
PATH=/opt/qt55/bin:${PATH}
|
||||
fi
|
||||
|
||||
# print settings
|
||||
- echo $lt_branch
|
||||
- echo $gui
|
||||
- echo $build_system
|
||||
- echo $ltconf
|
||||
- echo $qbtconf
|
||||
|
||||
@@ -96,67 +110,74 @@ install:
|
||||
#if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
# build libtorrent from source
|
||||
#if [ "$lt_branch" != "dist" ]; then
|
||||
#cd "$HOME" && pwd && git clone --depth 1 https://github.com/arvidn/libtorrent.git --branch $lt_branch
|
||||
#cd libtorrent && ./autotool.sh && ./configure $ltconf && make install
|
||||
#fi
|
||||
#cd "$HOME" && pwd && git clone --depth 1 https://github.com/arvidn/libtorrent.git --branch $lt_branch ;
|
||||
#cd libtorrent && ./autotool.sh && ./configure $ltconf && make install ;
|
||||
#fi ;
|
||||
#fi
|
||||
- |
|
||||
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
# dependencies
|
||||
brew update > /dev/null
|
||||
brew outdated "pkg-config" || brew upgrade "pkg-config"
|
||||
brew install colormake ccache zlib qt openssl libtorrent-rasterbar
|
||||
brew install colormake ccache zlib
|
||||
PATH="/usr/local/opt/ccache/libexec:$PATH"
|
||||
brew link --force zlib qt
|
||||
brew link --force zlib
|
||||
brew outdated "pkg-config" || brew upgrade "pkg-config"
|
||||
|
||||
if [ "$build_system" = "cmake" ]; then
|
||||
brew outdated cmake || brew upgrade cmake
|
||||
brew install ninja
|
||||
wget https://builds.shiki.hu/homebrew/version ;
|
||||
if ! cmp --quiet "version" "$HOME/hombebrew_cache/version" ; then
|
||||
echo "Cached files are different from server. Downloading new ones." ;
|
||||
# First delete old files
|
||||
rm -r "$HOME/hombebrew_cache" ;
|
||||
mkdir "$HOME/hombebrew_cache";
|
||||
cp "version" $HOME/hombebrew_cache ;
|
||||
cd "$HOME/hombebrew_cache" ;
|
||||
wget https://builds.shiki.hu/homebrew/libtorrent-rasterbar.rb ;
|
||||
wget https://builds.shiki.hu/homebrew/libtorrent-rasterbar-1.0.11+git20172003.8736a59adc.el_capitan.bottle.tar.gz
|
||||
wget https://builds.shiki.hu/homebrew/qt.rb
|
||||
wget https://builds.shiki.hu/homebrew/qt-5.9.1.el_capitan.bottle.tar.gz
|
||||
fi
|
||||
|
||||
sudo ln -s /usr/local/opt/qt/mkspecs /usr/local/mkspecs
|
||||
sudo ln -s /usr/local/opt/qt/plugins /usr/local/plugins
|
||||
# Copy custom libtorrent bottle to homebrew's cache so it can find and install it
|
||||
# Also install our custom libtorrent formula by passing the local path to it
|
||||
# These 2 files are restored from Travis' cache.
|
||||
cp "$HOME/hombebrew_cache/libtorrent-rasterbar-1.0.11+git20172003.8736a59adc.el_capitan.bottle.tar.gz" "$(brew --cache)"
|
||||
brew install "$HOME/hombebrew_cache/libtorrent-rasterbar.rb" ;
|
||||
|
||||
MY_CMAKE_OPENSSL_HINT="-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/"
|
||||
# Qt
|
||||
if [ "$qt" = 4 ]; then brew install qt && ln -s /usr/local/Cellar/qt/4.8.7_2/plugins /usr/local ; fi ;
|
||||
if [ "$qt" = 5 ]; then
|
||||
# Copy custom qt5 bottle to homebrew's cache so it can find and install it
|
||||
# Also install our custom qt5 formula by passing the local path to it
|
||||
# These 2 files are restored from Travis' cache.
|
||||
cp "$HOME/hombebrew_cache/qt-5.9.1.el_capitan.bottle.tar.gz" "$(brew --cache)"
|
||||
brew install "$HOME/hombebrew_cache/qt.rb"
|
||||
brew link --force qt
|
||||
fi
|
||||
fi
|
||||
- |
|
||||
if [ "$TRAVIS_BRANCH" != "$coverity_branch" ]; then
|
||||
export use_ccache=true
|
||||
ccache -M 512M
|
||||
ccache -V && ccache --show-stats && ccache --zero-stats
|
||||
fi
|
||||
|
||||
script:
|
||||
- if [ "$TRAVIS_BRANCH" = "$coverity_branch" ]; then exit ; fi # skip usual build when running coverity scan
|
||||
- cd "$TRAVIS_BUILD_DIR" && ./bootstrap.sh && ./configure $qbtconf
|
||||
- |
|
||||
cd "$TRAVIS_BUILD_DIR"
|
||||
if [ "$build_system" = "cmake" ]; then
|
||||
mkdir build
|
||||
cd build
|
||||
if [ "$gui" = "false" ]; then
|
||||
DISABLE_GUI_OPTION="-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=ON"
|
||||
fi
|
||||
cmake $DISABLE_GUI_OPTION -DCMAKE_INSTALL_PREFIX="$qbt_path" "$MY_CMAKE_OPENSSL_HINT" \
|
||||
-G "Ninja" -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE ..
|
||||
BUILD_TOOL="ninja"
|
||||
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
sed -i "" -e "s/^\(CC.*&&\).*$/\1 $CC/" src/Makefile ; # workaround for Qt & ccache: https://bugreports.qt.io/browse/QTBUG-31034
|
||||
sed -i "" -e "s/^\(CXX.*&&\).*$/\1 $CXX/" src/Makefile ;
|
||||
sed -i "" -e 's/^\(CXXFLAGS.*\)$/\1 -Wno-unused-local-typedefs -Wno-inconsistent-missing-override/' src/Makefile ;
|
||||
fi
|
||||
if [ "$build_system" = "qmake" ]; then
|
||||
./bootstrap.sh && ./configure $qbtconf CXXFLAGS="$CXXFLAGS"
|
||||
BUILD_TOOL="make"
|
||||
fi
|
||||
- $BUILD_TOOL && $BUILD_TOOL install
|
||||
- make && make install
|
||||
|
||||
after_success:
|
||||
- if [ "$gui" = true ]; then qbt_exe="qbittorrent" ; else qbt_exe="qbittorrent-nox" ; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd "$qbt_path/bin" ; fi
|
||||
- |
|
||||
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
if [ "$build_system" = "qmake" ]; then
|
||||
macdeployqt "$TRAVIS_BUILD_DIR/src/$qbt_exe.app"
|
||||
cd "$TRAVIS_BUILD_DIR/src/$qbt_exe.app/Contents/MacOS"
|
||||
else
|
||||
cd "$qbt_path/$qbt_exe.app/Contents/MacOS"
|
||||
fi
|
||||
macdeployqt "$TRAVIS_BUILD_DIR/src/$qbt_exe.app" ;
|
||||
cd "$TRAVIS_BUILD_DIR/src/$qbt_exe.app/Contents/MacOS" ;
|
||||
fi
|
||||
- ./$qbt_exe --version
|
||||
|
||||
|
||||
14
.tx/config
@@ -1,7 +1,7 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[qbittorrent.qbittorrent_master]
|
||||
[qbittorrent.qbittorrent_v3_3_x]
|
||||
file_filter = src/lang/qbittorrent_<lang>.ts
|
||||
lang_map = pt: pt_PT
|
||||
source_file = src/lang/qbittorrent_en.ts
|
||||
@@ -10,18 +10,10 @@ type = QT
|
||||
minimum_perc = 23
|
||||
mode = developer
|
||||
|
||||
|
||||
[qbittorrent.qbittorrentdesktop_master]
|
||||
source_file = dist/unix/org.qbittorrent.qBittorrent.desktop
|
||||
source_file = src/icons/qBittorrent.desktop
|
||||
source_lang = en
|
||||
type = DESKTOP
|
||||
minimum_perc = 23
|
||||
mode = developer
|
||||
|
||||
[qbittorrent.qbittorrent_webui]
|
||||
file_filter = src/webui/www/translations/webui_<lang>.ts
|
||||
lang_map = pt: pt_PT
|
||||
source_file = src/webui/www/translations/webui_en.ts
|
||||
source_lang = en
|
||||
type = QT
|
||||
minimum_perc = 23
|
||||
mode = developer
|
||||
|
||||
16
AUTHORS
@@ -34,14 +34,6 @@ Code from other projects:
|
||||
license: GPLv2/3
|
||||
|
||||
Images Authors:
|
||||
* files: src/icons/skin/qbittorrent-tray.svg (and related pngs)
|
||||
copyright: Provided by HVS <hvs linuxmail org> (raster first proposal) and Atif Afzal(@atfzl github) <atif5801@gmail.com> (vectorized and modified)
|
||||
license: GPLv2+
|
||||
|
||||
* files: src/qbittorrent_file.ico src/icons/fileicon.svg
|
||||
copyright: 'uknown.svg' (LGPLv3+) from Oxygen Icon Theme was used as base which was slightly modified and 'qbittorrent-tray.svg' (GPLv2+) was overlayed above it.
|
||||
license: GPLv3+
|
||||
|
||||
* files: src/icons/*.png
|
||||
copyright: Gnome Icon Theme
|
||||
license: GPLv2
|
||||
@@ -52,10 +44,10 @@ Images Authors:
|
||||
license: LGPL
|
||||
url: http://www.oxygen-icons.org
|
||||
|
||||
* files: src/icons/flags/*.svg
|
||||
copyright: lipis/flag-icon-css
|
||||
license: MIT
|
||||
url: https://github.com/lipis/flag-icon-css/
|
||||
* files: src/icons/flags/*.png
|
||||
copyright: Mark James <mjames@gmail.com>
|
||||
license: Public Domain
|
||||
url: http://www.famfamfam.com
|
||||
|
||||
* files: src/icons/skin/*.png
|
||||
files: src/menuicons/YYxYY/*.png
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
|
||||
|
||||
message(AUTHOR_WARNING "If the build fails, please try the autotools/qmake method.")
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_policy(VERSION 3.5)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
|
||||
include(FunctionReadVersion)
|
||||
@@ -23,32 +22,43 @@ add_definitions(-DQBT_VERSION_MINOR=${VER_MINOR})
|
||||
add_definitions(-DQBT_VERSION_BUGFIX=${VER_BUGFIX})
|
||||
add_definitions(-DQBT_VERSION_BUILD=${VER_BUILD})
|
||||
|
||||
# os2 {
|
||||
# DEFINES += DQBT_VERSION=\'\"v$${PROJECT_VERSION}\"\'
|
||||
# DEFINES += DQBT_VERSION_2=\'\"$${PROJECT_VERSION}\"\'
|
||||
# } else {
|
||||
add_definitions(-DQBT_VERSION="v${PROJECT_VERSION}")
|
||||
add_definitions(-DQBT_VERSION_2="${PROJECT_VERSION}")
|
||||
# }
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(FeatureSummary)
|
||||
|
||||
# version requirements
|
||||
set(requiredBoostVersion 1.35)
|
||||
set(requiredQtVersion 5.5.1)
|
||||
if (UNIX AND NOT APPLE)
|
||||
include(GNUInstallDirs)
|
||||
endif (UNIX AND NOT APPLE)
|
||||
|
||||
if(WIN32)
|
||||
include(winconf)
|
||||
endif(WIN32)
|
||||
|
||||
# we need options here, because they are used not only in "src" subdir, but in the "dist" dir too
|
||||
include(CMakeDependentOption)
|
||||
|
||||
# we need options here, at the top level, because they are used not only in "src" subdir, but in the "dist" dir too
|
||||
include(CompileFeature)
|
||||
option(QT5 "Compile using Qt5" ON)
|
||||
option(SYSTEM_QTSINGLEAPPLICATION
|
||||
"Use the system qtsingleapplication library or shipped one otherwise")
|
||||
cmake_dependent_option(SYSTEM_QJSON
|
||||
"Use the shipped qjson library or the system one (Qt4 only)" OFF "NOT QT5" OFF)
|
||||
|
||||
option(GUI "Allows to disable GUI for headless running. Disables QtDBus and the GeoIP Database" ON)
|
||||
|
||||
option(WEBUI "Allows to disable the WebUI." ON)
|
||||
|
||||
if (WIN32)
|
||||
option(STACKTRACE_WIN "")
|
||||
else (WIN32)
|
||||
cmake_dependent_option(SYSTEMD "Install the systemd service file (headless only)" OFF
|
||||
"NOT GUI" OFF)
|
||||
cmake_dependent_option(DBUS "Enable use of QtDBus (GUI only)" ON "GUI" OFF)
|
||||
endif(WIN32)
|
||||
|
||||
optional_compile_definitions(COUNTRIES_RESOLUTION FEATURE DESCRIPTION "Enable resolving peers IP addresses to countries"
|
||||
DEFAULT ON DISABLED DISABLE_COUNTRIES_RESOLUTION)
|
||||
optional_compile_definitions(STACKTRACE FEATURE DESCRIPTION "Enable stacktraces"
|
||||
DEFAULT ON ENABLED STACKTRACE)
|
||||
optional_compile_definitions(WEBUI FEATURE DESCRIPTION "Enables built-in HTTP server for headless use"
|
||||
DEFAULT ON DISABLED DISABLE_WEBUI)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(dist)
|
||||
|
||||
feature_summary(DESCRIPTION "\nConfiguration results:" WHAT ALL)
|
||||
|
||||
@@ -1,43 +1,15 @@
|
||||
All new code **must** follow the following coding guidelines.
|
||||
If you make changes in a file that still uses another coding style, make sure that you follow these guidelines for your changes.
|
||||
For programming languages other than C++ (e.g. JavaScript) used in this repository and submodules, unless otherwise specified, coding guidelines listed here applies as much as possible.
|
||||
|
||||
All new code must follow the following coding guidelines.
|
||||
If you make changes in a file that still uses another coding style, make sure that you follow these guidelines for your changes instead.
|
||||
**Note 1:** I will not take your head if you forget and use another style. However, most probably the request will be delayed until you fix your coding style.
|
||||
**Note 2:** You can use the `uncrustify` program/tool to clean up any source file. Use it with the `uncrustify.cfg` configuration file found in the root folder.
|
||||
**Note 3:** There is also a style for QtCreator but it doesn't cover all cases. In QtCreator `Tools->Options...->C++->Code Style->Import...` and choose the `codingStyleQtCreator.xml` file found in the root folder.
|
||||
|
||||
### Table Of Contents
|
||||
|
||||
* [1. New lines & curly braces](#1-new-lines--curly-braces)
|
||||
* [a. Function blocks, class/struct definitions, namespaces](#a-function-blocks-classstruct-definitions-namespaces)
|
||||
* [b. Other code blocks](#b-other-code-blocks)
|
||||
* [c. Blocks in switch's case labels](#c-blocks-in-switchs-case-labels)
|
||||
* [d. If-else statements](#d-if-else-statements)
|
||||
* [e. Single statement if blocks](#e-single-statement-if-blocks)
|
||||
* [f. Acceptable conditions to omit braces](#f-acceptable-conditions-to-omit-braces)
|
||||
* [g. Brace enclosed initializers](#g-brace-enclosed-initializers)
|
||||
* [2. Indentation](#2-indentation)
|
||||
* [3. File encoding and line endings](#3-file-encoding-and-line-endings)
|
||||
* [4. Initialization lists](#4-initialization-lists)
|
||||
* [5. Enums](#5-enums)
|
||||
* [6. Names](#6-names)
|
||||
* [a. Type names and namespaces](#a-type-names-and-namespaces)
|
||||
* [b. Variable names](#b-variable-names)
|
||||
* [c. Private member variable names](#c-private-member-variable-names)
|
||||
* [7. Header inclusion order](#7-header-inclusion-order)
|
||||
* [8. Include guard](#8-include-guard)
|
||||
* [9. Misc](#9-misc)
|
||||
* [10. Git commit message](#10-git-commit-message)
|
||||
* [11. Not covered above](#11-not-covered-above)
|
||||
---
|
||||
|
||||
### 1. New lines & curly braces ###
|
||||
|
||||
### 1. Curly braces ###
|
||||
#### a. Function blocks, class/struct definitions, namespaces ####
|
||||
```c++
|
||||
int myFunction(int a)
|
||||
{
|
||||
// code
|
||||
//code
|
||||
}
|
||||
|
||||
void myFunction() {} // empty body
|
||||
@@ -45,29 +17,29 @@ void myFunction() {} // empty body
|
||||
MyClass::MyClass(int *parent)
|
||||
: m_parent(parent)
|
||||
{
|
||||
// initialize
|
||||
//initialize
|
||||
}
|
||||
|
||||
int MyClass::myMethod(int a)
|
||||
{
|
||||
// code
|
||||
//code
|
||||
}
|
||||
|
||||
class MyOtherClass
|
||||
{
|
||||
public:
|
||||
// code
|
||||
//code
|
||||
|
||||
protected:
|
||||
// code
|
||||
//code
|
||||
|
||||
private:
|
||||
// code
|
||||
//code
|
||||
};
|
||||
|
||||
namespace Name
|
||||
{
|
||||
// code
|
||||
//code
|
||||
}
|
||||
|
||||
// Lambdas
|
||||
@@ -82,20 +54,20 @@ namespace Name
|
||||
#### b. Other code blocks ####
|
||||
```c++
|
||||
if (condition) {
|
||||
// code
|
||||
//code
|
||||
}
|
||||
|
||||
for (int a = 0; a < b; ++b) {
|
||||
// code
|
||||
//code
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
case 1:
|
||||
// blah
|
||||
//blah
|
||||
case 2:
|
||||
// blah
|
||||
//blah
|
||||
default:
|
||||
// blah
|
||||
//blah
|
||||
}
|
||||
```
|
||||
|
||||
@@ -103,81 +75,21 @@ default:
|
||||
```c++
|
||||
switch (var) {
|
||||
case 1: {
|
||||
// declare local variables
|
||||
// code
|
||||
//declare local variables
|
||||
//code
|
||||
}
|
||||
break;
|
||||
case 2: {
|
||||
// declare local variables
|
||||
// code
|
||||
//declare local variables
|
||||
//code
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// code
|
||||
//code
|
||||
}
|
||||
```
|
||||
|
||||
#### d. If-else statements ####
|
||||
The `else if`/`else` must be on their own lines:
|
||||
```c++
|
||||
if (condition) {
|
||||
// code
|
||||
}
|
||||
else if (condition) {
|
||||
// code
|
||||
}
|
||||
else {
|
||||
// code
|
||||
}
|
||||
```
|
||||
|
||||
#### e. Single statement if blocks ####
|
||||
Most single statement if blocks should look like this:
|
||||
```c++
|
||||
if (condition)
|
||||
a = a + b;
|
||||
```
|
||||
|
||||
One acceptable exception to this can be `return`, `break` or `continue` statements,
|
||||
provided that the test condition isn't very long and its body statement occupies only one line.
|
||||
However you can still choose to use the first rule.
|
||||
```c++
|
||||
if (a > 0) return;
|
||||
|
||||
while (p) {
|
||||
// ...
|
||||
if (!b) continue;
|
||||
}
|
||||
```
|
||||
|
||||
#### f. Acceptable conditions to omit braces ####
|
||||
When the conditional statement in `if`/`else` has only one line and its body occupy only one line,
|
||||
this also applies to loops statements.
|
||||
Notice that for a series of `if - else` branches, if one branch needs braces then all branches must add braces.
|
||||
```c++
|
||||
if (a < b) // conditional statement
|
||||
do(a); // body
|
||||
|
||||
if (a < b)
|
||||
do(a);
|
||||
else if (a > b)
|
||||
do(b);
|
||||
else
|
||||
do(c);
|
||||
|
||||
if (a < b) {
|
||||
do(a);
|
||||
}
|
||||
else if (a > b) { // curly braces required here, then all branches should also add them
|
||||
do(b);
|
||||
do(d);
|
||||
}
|
||||
else {
|
||||
do(c);
|
||||
}
|
||||
```
|
||||
|
||||
#### g. Brace enclosed initializers ####
|
||||
#### d. Brace enclosed initializers ####
|
||||
Unlike single-line functions, you must not insert spaces between the brackets and concluded expressions.<br/>
|
||||
But you must insert a space between the variable name and initializer.
|
||||
```c++
|
||||
@@ -187,14 +99,53 @@ Class obj {expr1, /*...,*/ exprN};
|
||||
QVariantMap map {{"key1", 5}, {"key2", 10}};
|
||||
```
|
||||
|
||||
### 2. Indentation ###
|
||||
### 2. If blocks ###
|
||||
#### a. Multiple tests ####
|
||||
```c++
|
||||
if (condition) {
|
||||
//code
|
||||
}
|
||||
else if (condition) {
|
||||
//code
|
||||
}
|
||||
else {
|
||||
//code
|
||||
}
|
||||
```
|
||||
The `else if`/`else` must be on their own lines.
|
||||
|
||||
#### b. Single statement if blocks ####
|
||||
**Most** single statement if blocks should look like this:
|
||||
```c++
|
||||
if (condition)
|
||||
a = a + b;
|
||||
```
|
||||
|
||||
One acceptable exception to this **can be** `return`, `break` or `continue` statements, provided that the test condition isn't very long. However you can choose to use the first rule instead.
|
||||
```c++
|
||||
a = myFunction();
|
||||
b = a * 1500;
|
||||
|
||||
if (b > 0) return;
|
||||
c = 100 / b;
|
||||
```
|
||||
|
||||
#### c. Using curly braces for single statement if blocks ####
|
||||
|
||||
However, there are cases where curly braces for single statement if blocks **should** be used.
|
||||
* If some branch needs braces then all others should use them. Unless you have multiple `else if` in a row and the one needing the braces is only for a very small sub-block of code.
|
||||
* Another exception would be when we have nested if blocks or generally multiple levels of code that affect code readability.
|
||||
|
||||
Generally it will depend on the particular piece of code and would be determined on how readable that piece of code is. **If in doubt** always use braces if one of the above exceptions applies.
|
||||
|
||||
### 3. Indentation ###
|
||||
4 spaces.
|
||||
|
||||
### 3. File encoding and line endings ###
|
||||
### 4. File encoding and line endings. ###
|
||||
|
||||
UTF-8 and Unix-like line ending (LF). Unless some platform specific files need other encodings/line endings.
|
||||
|
||||
### 4. Initialization lists ###
|
||||
### 5. Initialization lists. ###
|
||||
Initialization lists should be vertical. This will allow for more easily readable diffs. The initialization colon should be indented and in its own line along with first argument. The rest of the arguments should be indented too and have the comma prepended.
|
||||
```c++
|
||||
myClass::myClass(int a, int b, int c, int d)
|
||||
@@ -203,11 +154,11 @@ myClass::myClass(int a, int b, int c, int d)
|
||||
, m_c(c)
|
||||
, m_d(d)
|
||||
{
|
||||
// code
|
||||
//code
|
||||
}
|
||||
```
|
||||
|
||||
### 5. Enums ###
|
||||
### 6. Enums. ###
|
||||
Enums should be vertical. This will allow for more easily readable diffs. The members should be indented.
|
||||
```c++
|
||||
enum Days
|
||||
@@ -222,7 +173,7 @@ enum Days
|
||||
};
|
||||
```
|
||||
|
||||
### 6. Names ###
|
||||
### 7. Names. ###
|
||||
All names should be camelCased.
|
||||
|
||||
#### a. Type names and namespaces ####
|
||||
@@ -256,89 +207,40 @@ class MyClass
|
||||
}
|
||||
```
|
||||
|
||||
### 7. Header inclusion order ###
|
||||
The headers should be placed in the following group order:
|
||||
1. Module header (in .cpp)
|
||||
2. C++ Standard Library headers
|
||||
3. System headers
|
||||
4. Boost library headers
|
||||
5. Libtorrent headers
|
||||
6. Qt headers
|
||||
7. qBittorrent's own headers, starting from the *base* headers.
|
||||
|
||||
The headers should be ordered alphabetically within each group.
|
||||
If there are conditionals for the same header group, then put them at the bottom of the respective group.
|
||||
If there are conditionals that contain headers from several different header groups, then put them above the "qBittorrent's own headers" group.
|
||||
|
||||
One exception is the header containing the library version (for example, QtGlobal), this particular header isn't constrained by the aforementioned order.
|
||||
### 8. Header inclusion order. ###
|
||||
The headers should be placed in the following order:
|
||||
1. Module header (in .cpp)
|
||||
2. System/Qt/Boost etc. headers (splitted in subcategories if you have many).
|
||||
3. Application headers, starting from *Base* headers.
|
||||
|
||||
The headers should be ordered alphabetically within each group (subgroup).<br/>
|
||||
<br/>
|
||||
Example:
|
||||
```c++
|
||||
// file: examplewidget.cpp
|
||||
// examplewidget.cpp
|
||||
|
||||
// Module header
|
||||
#include "examplewidget.h"
|
||||
|
||||
// exceptions, headers containing version number
|
||||
#include <boost/version.hpp>
|
||||
#include <libtorrent/version.hpp>
|
||||
#include <QtGlobal>
|
||||
|
||||
// C++ Standard Library headers
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef Q_OS_WIN // conditional
|
||||
#include <cmath>
|
||||
#endif
|
||||
|
||||
// System headers
|
||||
#ifdef Q_OS_WIN
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
// Boost library headers
|
||||
#include <boost/circular_buffer.hpp>
|
||||
|
||||
// Libtorrent headers
|
||||
#include <libtorrent/session.hpp>
|
||||
|
||||
// Qt headers
|
||||
#include <QDateTime>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#ifdef Q_OS_MAC // conditional
|
||||
#include <QFont>
|
||||
#endif
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
// conditional that contains headers from several different header groups
|
||||
#if LIBTORRENT_VERSION_NUM >= 10100
|
||||
#include <memory>
|
||||
#include <QElapsedTimer>
|
||||
#endif
|
||||
|
||||
// qBittorrent's own headers
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/infohash.h"
|
||||
#include "anothermodule.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "ui_examplewidget.h"
|
||||
```
|
||||
|
||||
### 8. Include guard ###
|
||||
`#pragma once` should be used instead of "include guard" in new code:
|
||||
```c++
|
||||
// examplewidget.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class ExampleWidget : public QWidget
|
||||
{
|
||||
// (some code omitted)
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
### 9. Misc ###
|
||||
### 9. Misc. ###
|
||||
|
||||
* Line breaks for long lines with operation:
|
||||
|
||||
@@ -380,32 +282,20 @@ auto spinBox = static_cast<QSpinBox*>(sender());
|
||||
// we know the variable type based on the right-hand expression
|
||||
```
|
||||
|
||||
* Notice the spaces in the following specific situations:
|
||||
* Space around operations eg `a = b + c` or `a=b+c`:
|
||||
|
||||
Before and after the assignment and other binary (and ternary) operators there should be a space.<br/>
|
||||
There should not be a space between increment/decrement and its operand.<br/>
|
||||
Some valid use cases:
|
||||
```c++
|
||||
// Before and after the assignment and other binary (and ternary) operators there should be a space
|
||||
// There should not be a space between increment/decrement and its operand
|
||||
a += 20;
|
||||
a = (b <= MAX_B ? b : MAX_B);
|
||||
++a;
|
||||
--b;
|
||||
b--;
|
||||
|
||||
for (int a = 0; a < b; ++b) {
|
||||
// code
|
||||
}
|
||||
|
||||
// Range-based for loop, spaces before and after the colon
|
||||
for (auto i : container) {
|
||||
}
|
||||
|
||||
// Derived class, spaces before and after the colon
|
||||
class Derived : public Base
|
||||
{
|
||||
};
|
||||
```
|
||||
|
||||
* Prefer pre-increment, pre-decrement operators
|
||||
```c++
|
||||
++i, --j; // Yes
|
||||
i++, j--; // No
|
||||
```
|
||||
|
||||
* private/public/protected must not be indented
|
||||
@@ -414,16 +304,5 @@ i++, j--; // No
|
||||
|
||||
* Method definitions aren't allowed in header files
|
||||
|
||||
### 10. Git commit message ###
|
||||
1. Limit the subject line to 50 characters. Subject should contain only the very essence of the changes (you should avoid extra details and internals)
|
||||
2. Separate subject from body with a blank line
|
||||
3. Capitalize the subject line
|
||||
4. Do not end the subject line with a period
|
||||
5. Use the imperative mood in the subject line (it's like you're ordering the program to do something (e.g. "Don't create temporary substrings")
|
||||
6. Wrap the body at 72 characters
|
||||
7. Use the body to explain what and why vs. how
|
||||
8. If commit fixes a reported issue, mention it in the message body (e.g. `Closes #4134.`)
|
||||
|
||||
### 11. Not covered above ###
|
||||
If something isn't covered above, just follow the same style the file you are editing has.
|
||||
*This guide is not exhaustive and the style for a particular piece of code not specified here will be determined by project members on code review.*
|
||||
### 10. Not covered above ###
|
||||
If something isn't covered above, just follow the same style the file you are editing has. If that particular detail isn't present in the file you are editing, then use whatever the rest of the project uses.
|
||||
|
||||
242
CONTRIBUTING.md
@@ -1,221 +1,35 @@
|
||||
# How to contribute to qBittorrent
|
||||
# Filing an issue
|
||||
|
||||
### Must read
|
||||
* If you aren't sure, you can ask on the [**forum**](http://forum.qbittorrent.org) or read our [**wiki**](http://wiki.qbittorrent.org) first.
|
||||
* Do a quick **search**. Others might already reported the issue.
|
||||
* Write in **English**!
|
||||
* Provide **version** information: (You can find version numbers at menu `Help -> About -> Libraries`)
|
||||
```
|
||||
qBittorrent:
|
||||
Qt:
|
||||
libtorrent:
|
||||
boost:
|
||||
OS version:
|
||||
```
|
||||
* Provide **steps** to reproduce the problem, it will be easier to pinpoint the fault.
|
||||
* **Screenshots**! A screenshot is worth a thousand words. just upload it. [(How?)](https://help.github.com/articles/file-attachments-on-issues-and-pull-requests)
|
||||
|
||||
### Good to know
|
||||
* **Be patient**. The dev team is small and resource limited. Devs finding their free time, analyzing the problem and fixing the issue, it all takes time. :clock3:
|
||||
* If you can code, why not become a **contributor** by fixing the issue and open a pull request? :wink:
|
||||
* Harsh words or threats won't help your situation. What's worse, your complain will (very likely) to be **ignored**. :fearful:
|
||||
|
||||
There are three main ways to contribute to the project.
|
||||
Read the respective section to find out more.
|
||||
|
||||
### Table Of Contents
|
||||
|
||||
* **[Bug reporting etiquette](#bug-reporting-etiquette)**
|
||||
|
||||
|
||||
* **[Submitting an issue/bug report](#submitting-an-issuebug-report)**
|
||||
* [What is an actual bug report?](#what-is-an-actual-bug-report)
|
||||
* [Before submitting a bug report](#before-submitting-a-bug-report)
|
||||
* [Steps to ensure a good bug report](#steps-to-ensure-a-good-bug-report)
|
||||
|
||||
|
||||
* **[Suggesting enhancements/feature requests](#suggesting-enhancementsfeature-requests)**
|
||||
* [Before submitting an enhancement/feature request](#before-submitting-an-enhancementfeature-request)
|
||||
* [Steps to ensure a good enhancement/feature suggestion](#steps-to-ensure-a-good-enhancementfeature-suggestion)
|
||||
|
||||
|
||||
* **[Opening a pull request](#opening-a-pull-request)**
|
||||
* [Must read](#must-read)
|
||||
* [Good to know](#good-to-know)
|
||||
|
||||
# Bug reporting etiquette
|
||||
|
||||
* Issues, pull requests, and comments must always be in **English.**
|
||||
|
||||
* This project is supported by volunteers, do not expect "customer support"-style interaction.
|
||||
|
||||
* **Be patient.** The development team is small and resource limited. Developers and contributors take from their free time to analyze the problem and fix the issue. :clock3:
|
||||
|
||||
* Harsh words or threats won't help your situation. What's worse, your complain will (very likely) be **ignored.** :fearful:
|
||||
|
||||
# Submitting an issue/bug report
|
||||
|
||||
This section guides you through submitting an issue/bug report for qBittorrent.
|
||||
|
||||
Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports.
|
||||
|
||||
Make sure to follow these rules carefully when submitting a bug report. Failure to do so will result in the issue being closed.
|
||||
|
||||
## What is an actual bug report?
|
||||
|
||||
Developers and contributors are not supposed to deal with issues for which little to no investigation to find the actual cause of a purported issue was made by the reporter.
|
||||
|
||||
Positive contributions are those which are reported with efforts to find the actual cause of an issue, or at the very least efforts were made to narrow it as much as possible.
|
||||
|
||||
Requiring people to investigate as much as possible before opening an issue will more than likely avoid burdening the project with invalid issues or issues unrelated to qBittorrent.
|
||||
|
||||
The following are _not_ bug reports. **Check the [wiki][wiki-url], [forum][forum-url] or other places for help and support for issues like these**:
|
||||
|
||||
- Explanation of qBittorrent options (see [wiki][wiki-url]).
|
||||
- Help with WebUI setup.
|
||||
- Help with embedded tracker setup.
|
||||
- Help about BitTorrent in general.
|
||||
- Issues with specific search plugins.
|
||||
- Asking for specific builds of qBittorrent other than the current one. You can install older releases at your own risk or for regression testing purposes. Previous Windows and macOS builds are available [here][builds-url].
|
||||
- If you want older Linux builds, you will have to compile them yourself from the corresponding commits, or ask someone on the [forum][forum-url] to do it for you.
|
||||
- Possibly others. Read on and use common sense.
|
||||
|
||||
The issue tracker is for provable issues only: You will have to make the case that the issue is really with qBittorrent and not something else on your side.
|
||||
|
||||
To make a case means to provide detailed steps so that anybody can reproduce the issue.
|
||||
Be sure to rule out that the issue is not caused by something specific on your side.
|
||||
|
||||
Issue reports for bugs that apparently aren't easily reproducible or that you can't figure out what triggers it even though you tried are OK.
|
||||
|
||||
Any issue opened without effort to provide the required details for developers, contributors or anybody else to reproduce the problem will be closed as invalid.
|
||||
For example:
|
||||
- Crash reports with just a stack trace.
|
||||
- Speculated performance issues that do not come with actual profiling data + analysis supporting the claim.
|
||||
|
||||
## Before submitting a bug report
|
||||
|
||||
- **Do some basic troubleshooting (examples)**:
|
||||
- Restart qBittorrent.
|
||||
- Restart your PC.
|
||||
- Update your OS (e.g. Windows updates).
|
||||
- Update your network card drivers.
|
||||
- Fully reinstall qBittorrent.
|
||||
- etc...
|
||||
- Make sure the problem is not caused by anti-virus or other program messing with your files.
|
||||
- Check if you can reproduce the problem in the latest version of qBittorrent.
|
||||
- **Check [forum][forum-url] and [wiki][wiki-url].** You might be able to find the cause of the problem and fix things yourself.
|
||||
- **Check if the issue exists already in the issue tracker.**
|
||||
- If it does and the issue is still open, add a comment to the existing issue instead of opening a new one.
|
||||
- If you find a Closed issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.
|
||||
- If the issue is with the search functionality:
|
||||
- **Make sure you have [`python`][python-url] installed correctly (remember the search functionality requires a working python installation).**
|
||||
- Make sure it is in fact a problem with the search functionality itself, and not a problem with the plugins. If something does not work properly with the search functionality, the first step is to rule out search plugin-related issues.
|
||||
- For search plugin issues, report on the respective search plugin support page, or at [qbittorrent/search-plugins][search-plugins-url].
|
||||
|
||||
## Steps to ensure a good bug report
|
||||
|
||||
**Follow these guidelines** in order to provide as much useful information as possible right away. Not all of them are applicable to all issues, but you are expected to follow most of these steps (use common sense).
|
||||
Otherwise, we've noticed that a lot of your time (and the developers') gets thrown away on exchanging back and forth to get this information.
|
||||
|
||||
* Use a **clear and descriptive title** for the issue to identify the problem.
|
||||
|
||||
* Post only **one specific issue per submission.**
|
||||
|
||||
* **Fill out the issue template properly.**
|
||||
|
||||
- **Make sure you are using qBittorrent on a supported platform.** Do not submit issues which can only be reproduced on beta/unsupported releases of supported operating systems (e.g. Windows 10 Insider, Ubuntu 12.04 LTS, etc).
|
||||
These are unstable/unsupported platforms, and in all likelihood, whatever the issue is, it is not related to qBittorrent.
|
||||
|
||||
* **Specify the OS you're using, its version and architecture.**
|
||||
* Examples: Windows 8.1 32-bit, Linux Mint 17.1 64-bit, Windows 10 Fall creators Update 64-bit, etc.
|
||||
|
||||
|
||||
* **Report only if you run into the issue with an official stable release, a beta release, or with the most recent upstream changes (in this last case specify the specific commit you are on).** (beta testing is encouraged :smile:). We do not provide support for bugs on unofficial Windows builds.
|
||||
|
||||
* **Specify the version of qBittorrent** you are using, as well as its **architecture** (x86 or x64) and its **libraries' versions** (Help -> About -> Libraries).
|
||||
|
||||
* Specify **how you installed**:
|
||||
- Linux: either from the PPA, your distribution's repositories, or compiled from source, or even possibly third-party repositories.
|
||||
- Windows: either from the installer, or compiled from source, or even possibly third-party repositories.
|
||||
- macOS: either from the installer, or compiled from source, or even possibly third-party repositories.
|
||||
|
||||
|
||||
* **Describe the exact steps which reproduce the problem in as many details as possible.**
|
||||
- For example, start by explaining how you started qBittorrent, e.g. was it via the terminal? Desktop icon? Did you start it as root or normal user?
|
||||
- **When listing steps, don't just say what you did, but explain how you did it.**
|
||||
- For example, if you added a torrent for download, did you do so via a `.torrent` file or via a magnet link? If it was with a torrent file did you do so by dragging the torrent file from the file manager to the transfer list, or did you use the "Add Torrent File" in the Top Bar?
|
||||
- Describe the behavior you observed after following the steps and point out what exactly is the problem with that behavior; this is what we'll be looking for after executing the steps.
|
||||
|
||||
|
||||
* **Explain which behavior you expected to see instead** and why.
|
||||
|
||||
* Use **screenshots/animated GIFs to help describe the issue** whenever appropriate [(How?)][attachments-howto-url].
|
||||
|
||||
* If the problem wasn't triggered by a specific action, describe what you were doing before the problem happened.
|
||||
|
||||
* **If you are reporting that qBittorrent crashes**, include the stack trace in the report; include it in a code block, a file attachment, or put it in a gist and provide link to that gist.
|
||||
|
||||
* **For performance-related issues**, include as much profiling data as you can (resource usage graphs, etc).
|
||||
|
||||
* Paste the **qBittorrent log** (or put the contents of the log in a gist and provide a link to the gist). The log can be viewed in the GUI (View -> Log -> tick all boxes). If you can't do that, the file is at:
|
||||
- Linux: `~/.local/share/data/qBittorrent/logs/qBittorrent.log`
|
||||
- Windows: `%LocalAppData%\qBittorrent\logs`
|
||||
- macOS: `~/Library/Application Support/qBittorrent/qBittorrent.log`
|
||||
|
||||
|
||||
* **Do NOT post comments like "+1" or "me too!"** without providing new relevant info on the issue. Using the built-in reactions is OK though. Remember that you can use the "subscribe" button to receive notifications of that report without having to comment first.
|
||||
|
||||
* If there seems to be an **issue with specific torrent files/magnet links**:
|
||||
- Don't post private `.torrent` files/magnet links, or ones that point to copyrighted content. If you are willing, offer to email a link or the `.torrent` file itself to whoever developer is debugging it and requests it.
|
||||
- Make sure you can't reproduce the problem with another client, to rule out the possibility that the issue is with the `.torrent` file/magnet link itself.
|
||||
|
||||
|
||||
* A screenshot, transcription or file upload of any of **qBittorrent's preferences that differ from the defaults.** Please include everything different from the defaults whether or not it seems relevant to your issue.
|
||||
|
||||
* **Attachment rules**:
|
||||
- Short logs and error messages can be pasted as quotes/code whenever small enough; otherwise make a gist with the contents and post the link to the gist.
|
||||
- Avoid linking/attaching impractical file formats such as PDFs/Word documents with images. If you want to post an image, just post the image.
|
||||
|
||||
### Provide more context by answering these questions (if applicable):
|
||||
|
||||
- Can you **reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens (e.g. only happens with extremely large torrents/only happens after qBittorrent is open for more than 2 days/etc...)
|
||||
|
||||
- Did the problem start happening recently (e.g. after updating to a new version of qBittorrent) or was this always a problem?
|
||||
|
||||
- If the problem started happening recently, can you reproduce the problem in an older version of qBittorrent?
|
||||
|
||||
- Are you saving files locally (in a disk in your machine), or are you saving them remotely (e.g. network drives)?
|
||||
|
||||
- Are you using qBittorrent with multiple monitors? If so, can you reproduce the problem when you use a single monitor?
|
||||
|
||||
Good read: [How to Report Bugs Effectively][howto-report-bugs-url]
|
||||
|
||||
# Suggesting enhancements/feature requests
|
||||
|
||||
This section guides you through submitting an enhancement suggestion for qBittorrent, including completely new features and minor improvements to existing functionality.
|
||||
|
||||
Following these guidelines helps maintainers and the community understand your suggestion and find related suggestions.
|
||||
|
||||
## Before submitting an enhancement/feature request
|
||||
|
||||
* Check the [wiki][wiki-url] and [forum][forum-url] for tips — you might discover that the enhancement is already available.
|
||||
* Most importantly, check if you're using the latest version of qBittorrent and if you can get the desired behavior by changing qBittorrent's settings.
|
||||
* Check in the [releases][releases-url] page or on the [forum][forum-url], see if there's already a alpha/beta version with that enhancement.
|
||||
* Perform a cursory search to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
|
||||
|
||||
## Steps to ensure a good enhancement/feature suggestion
|
||||
|
||||
- Specify which version of qBittorrent you're using.
|
||||
- Specify the name and version of the OS you're using.
|
||||
- Provide a step-by-step description of the suggested enhancement in as many details as possible.
|
||||
- Describe the current behavior and explain which behavior you expected to see instead and why.
|
||||
- Include screenshots and animated GIFs which help you demonstrate the steps or point out the part of qBittorrent which the suggestion is related to.
|
||||
- If this enhancement exists in other BitTorrent clients, list those clients.
|
||||
|
||||
# Opening a pull request
|
||||
|
||||
### Must read
|
||||
* Read our [**coding guidelines**][coding-guidelines-url]. There are some scripts to help you: [uncrustify script][uncrustify-script-url], [astyle script][astyle-script-url], [(related thread)][coding-guidelines-thread-url].
|
||||
* Keep the title **short** and provide a **clear** description about what your pull request does.
|
||||
* Provide **screenshots** for UI related changes.
|
||||
* Keep your git commit history **clean** and **precise.** Refer to the section about "Git commit messages" in the [**coding guidelines**][coding-guidelines-url].
|
||||
* If your commit fixes a reported issue (for example #4134), add the following message to the commit `Closes #4134.`. Example [here][commit-message-fix-issue-example-url].
|
||||
* Read our [**coding guidelines**](https://github.com/qbittorrent/qBittorrent/blob/master/CODING_GUIDELINES.md). There are some scripts to help you: [uncrustify script](https://raw.githubusercontent.com/qbittorrent/qBittorrent/master/uncrustify.cfg), [astyle script](https://gist.github.com/Chocobo1/539cee860d1eef0acfa6), [(related thread)](https://github.com/qbittorrent/qBittorrent/issues/2192).
|
||||
* Keep the title **short** and provide a **clear** description about what your pull request does.
|
||||
* Provide **screenshots** for UI related changes.
|
||||
* Keep your git commit history **clean** and **precise**. Commits like `xxx fixup` should not appear.
|
||||
* If your commit fix a reported issue (for example #4134), add the following message to the commit `Closes #4134.`. Example [here](https://github.com/qbittorrent/qBittorrent/commit/a74bac20c4e8de9776bf9bb77fdc7526135d1988).
|
||||
|
||||
### Good to know
|
||||
* **Search** pull request history! Others might have already implemented your idea and it is waiting to be merged (or got rejected already). Save your precious time by doing a search first.
|
||||
* When resolving merge conflicts, do `git rebase <target_branch_name>`, don't do `git pull`. Then you can start fixing the conflicts. Here is a good explanation: [link][merging-vs-rebasing-url].
|
||||
|
||||
[astyle-script-url]: https://gist.github.com/Chocobo1/539cee860d1eef0acfa6
|
||||
[attachments-howto-url]: https://help.github.com/articles/file-attachments-on-issues-and-pull-requests
|
||||
[coding-guidelines-url]: https://github.com/qbittorrent/qBittorrent/blob/master/CODING_GUIDELINES.md
|
||||
[coding-guidelines-thread-url]: https://github.com/qbittorrent/qBittorrent/issues/2192
|
||||
[commit-message-fix-issue-example-url]: https://github.com/qbittorrent/qBittorrent/commit/c07cd440cd46345297debb47cb260f8688975f50
|
||||
[forum-url]: http://forum.qbittorrent.org/
|
||||
[howto-report-bugs-url]: https://www.chiark.greenend.org.uk/~sgtatham/bugs.html
|
||||
[merging-vs-rebasing-url]: https://www.atlassian.com/git/tutorials/merging-vs-rebasing
|
||||
[python-url]: https://www.python.org/
|
||||
[releases-url]: https://github.com/qbittorrent/qBittorrent/releases
|
||||
[search-plugins-url]: https://github.com/qbittorrent/search-plugins
|
||||
[uncrustify-script-url]: https://raw.githubusercontent.com/qbittorrent/qBittorrent/master/uncrustify.cfg
|
||||
[wiki-url]: https://github.com/qbittorrent/qBittorrent/wiki
|
||||
[builds-url]: https://sourceforge.net/projects/qbittorrent/files/
|
||||
* **Search** pull request history! Others might already implemented your idea and is waiting to be merged (or got rejected already). Save your precious time by doing a search first.
|
||||
* When resolving merge conflicts, do `git rebase <target_branch_name>`, don't do `git pull`. Then you can start fixing the conflicts. Here is a good explanation: [link](https://www.atlassian.com/git/tutorials/merging-vs-rebasing).
|
||||
|
||||
49
INSTALL
@@ -1,49 +1,54 @@
|
||||
qBittorrent - A BitTorrent client in C++ / Qt
|
||||
qBittorrent - A BitTorrent client in C++ / Qt4
|
||||
------------------------------------------
|
||||
|
||||
1) Compile and install qBittorrent with Qt graphical interface
|
||||
1) Compile and install qBittorrent with Qt4 Graphical Interface
|
||||
|
||||
$ ./configure
|
||||
$ make && make install
|
||||
$ qbittorrent
|
||||
|
||||
will install and execute qBittorrent.
|
||||
will install and execute qBittorrent hopefully without any problems.
|
||||
|
||||
Dependencies:
|
||||
- Qt >= 5.5.1
|
||||
- Qt >= 4.6.0 (libqtgui, libqtcore, libqtnetwork, libqtxml, libqtdbus/optional)
|
||||
|
||||
- pkg-config
|
||||
- pkg-config executable
|
||||
|
||||
- libtorrent-rasterbar >= 1.0.6 (by Arvid Norberg)
|
||||
* https://www.libtorrent.org/
|
||||
* Be careful: another library (the one used by rTorrent) uses a similar name
|
||||
- libtorrent-rasterbar by Arvid Norberg (>= 1.0.6)
|
||||
-> http://www.libtorrent.net
|
||||
Be careful: another library (the one used by rTorrent) uses a similar name.
|
||||
|
||||
- Boost >= 1.35
|
||||
- libboost >= 1.35.x (libboost-system)
|
||||
|
||||
- Python >= 2.7.9 / 3.3.0 (optional, runtime only)
|
||||
* Required by the internal search engine
|
||||
- python >= 2.3 (needed by search engine)
|
||||
* Run time only dependency
|
||||
|
||||
2) Compile and install qBittorrent without Qt graphical interface
|
||||
- geoip-database (optional)
|
||||
* If qBittorrent cannot find this database, it will try to resolve countries using the Internet but it will be a lot slower.
|
||||
* Run time only dependency
|
||||
|
||||
2) Compile and install qBittorrent without Qt4 Graphical interface
|
||||
|
||||
$ ./configure --disable-gui
|
||||
$ make && make install
|
||||
$ qbittorrent-nox
|
||||
$ qbittorrent
|
||||
|
||||
will install and execute qBittorrent.
|
||||
will install and execute qBittorrent hopefully without any problems.
|
||||
|
||||
Dependencies:
|
||||
- Qt >= 5.5.1
|
||||
- Qt >= 4.4.0 (libqt-devel, libqtcore, libqtnetwork)
|
||||
|
||||
- pkg-config
|
||||
- pkg-config executable
|
||||
|
||||
- libtorrent-rasterbar >= 1.0.6 (by Arvid Norberg)
|
||||
* https://www.libtorrent.org/
|
||||
* Be careful: another library (the one used by rTorrent) uses a similar name
|
||||
- libtorrent-rasterbar by Arvid Norberg (>= v1.0.6)
|
||||
-> http://www.libtorrent.net
|
||||
Be careful: another library (the one used by rTorrent) uses a similar name.
|
||||
|
||||
- libboost: libboost-filesystem, libboost-date-time, libboost-thread, libboost-serialization
|
||||
|
||||
- Boost >= 1.35
|
||||
|
||||
DOCUMENTATION:
|
||||
Please note that there is a "Compilation" section at http://wiki.qbittorrent.org.
|
||||
Please note that there is a documentation with a "compiling howto" at http://wiki.qbittorrent.org.
|
||||
|
||||
------------------------------------------
|
||||
sledgehammer999 <sledgehammer999@qbittorrent.org>
|
||||
Christophe Dumez <chris@qbittorrent.org>
|
||||
|
||||
@@ -35,7 +35,7 @@ You can also download it from [here](https://github.com/qbittorrent/qBittorrent/
|
||||
|
||||
### Misc:
|
||||
For more information please visit:
|
||||
https://www.qbittorrent.org
|
||||
http://www.qbittorrent.org
|
||||
|
||||
or our wiki here:
|
||||
http://wiki.qbittorrent.org
|
||||
|
||||
74
README.os2
Normal file
@@ -0,0 +1,74 @@
|
||||
qBittorrent - A BitTorrent client in Qt4
|
||||
------------------------------------------
|
||||
|
||||
This is the eComStation (OS/2) qBittorrent part of the readme. See also README for more general information.
|
||||
|
||||
|
||||
Building qBittorrent
|
||||
********************
|
||||
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
- gcc based build env (recommended gcc v4.4.2 or greater)
|
||||
|
||||
- Qt4 for eCS (OS/2) dev package (see http://svn.netlabs.org/qt4 for more information)
|
||||
|
||||
- libtorrent-rasterbar for eCS (OS/2) port (see http://svn.netlabs.org/ports for more information)
|
||||
|
||||
- boost for eCS (OS/2) port (see http://svn.netlabs.org/ports for more information)
|
||||
|
||||
|
||||
How to build
|
||||
============
|
||||
|
||||
First you need to create the conf.pri file in the same dir as this readme.os2 is.
|
||||
the conf.pri file has the following content:
|
||||
|
||||
##### conf.pri content begin #####
|
||||
BINDIR = ./bin
|
||||
INCDIR = ./include
|
||||
LIBDIR = ./lib
|
||||
DATADIR = ./share
|
||||
|
||||
CONFIG += staticlib
|
||||
INCLUDEPATH += x:/trees/libtorrent/trunk/include
|
||||
LIBS += -Lx:/trees/libtorrent/trunk/src/.libs \
|
||||
-Lx:/trees/boost/trunk/stage/lib \
|
||||
-Lx:/trees/openssl \
|
||||
-Lx:/extras/lib
|
||||
##### conf.pri content end #####
|
||||
|
||||
Of course all the above path references have to be adjusted to your build env.
|
||||
|
||||
Now you can either do a normal build or a shadow build. A shadow build has the
|
||||
advantage that no created files are in the same dir as the sources are.
|
||||
|
||||
For a normal build do the following:
|
||||
|
||||
Simply type:
|
||||
$ qmake
|
||||
|
||||
Followed by:
|
||||
$ make
|
||||
|
||||
For a shadow build do the following:
|
||||
given your sources are in x:\trees\qbittorrent\trunk create a
|
||||
x:\trees\qbittorrent\build directory
|
||||
|
||||
Now switch to the created directory and type:
|
||||
$ qmake ..\trunk
|
||||
|
||||
Followed by:
|
||||
$ make
|
||||
|
||||
If all works fine you should get a working qbittorrent executable.
|
||||
|
||||
If you have any question regarding the eCS (OS/2) port of qBittorrent you can meet me (_diver) on IRC:
|
||||
#netlabs on irc.freenode.net
|
||||
|
||||
------------------------------------------
|
||||
Silvan Scherrer <silvan.scherrer@aroa.ch>
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
# Helper function for coupling add_feature_info(), option(), and add_definitions()
|
||||
|
||||
function(optional_compile_definitions _name)
|
||||
set(options FEATURE)
|
||||
set(oneValueArgs DESCRIPTION DEFAULT)
|
||||
set(multiValueArgs ENABLED DISABLED)
|
||||
cmake_parse_arguments(OCD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
option(${_name} "${OCD_DESCRIPTION}" ${OCD_DEFAULT})
|
||||
if (${${_name}})
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY COMPILE_DEFINITIONS ${OCD_ENABLED})
|
||||
else()
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY COMPILE_DEFINITIONS ${OCD_DISABLED})
|
||||
endif()
|
||||
if(${OCD_FEATURE})
|
||||
add_feature_info(${_name} ${_name} "${OCD_DESCRIPTION}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(feature_option _name _description _default)
|
||||
option(${_name} "${_description}" ${_default})
|
||||
add_feature_info(${_name} ${_name} "${_description}")
|
||||
endmacro()
|
||||
@@ -1,355 +0,0 @@
|
||||
# Borrowed from Avogadro project (https://github.com/OpenChemistry/avogadroapp)
|
||||
|
||||
#.rst:
|
||||
# DeployQt5
|
||||
# ---------
|
||||
#
|
||||
# Functions to help assemble a standalone Qt5 executable.
|
||||
#
|
||||
# A collection of CMake utility functions useful for deploying Qt5
|
||||
# executables.
|
||||
#
|
||||
# The following functions are provided by this module:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# write_qt5_conf
|
||||
# resolve_qt5_paths
|
||||
# fixup_qt5_executable
|
||||
# install_qt5_plugin_path
|
||||
# install_qt5_plugin
|
||||
# install_qt5_executable
|
||||
#
|
||||
# Requires CMake 2.8.9 or greater because Qt 5 does.
|
||||
# Also depends on BundleUtilities.cmake.
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# WRITE_QT5_CONF(<qt_conf_dir> <qt_conf_contents>)
|
||||
#
|
||||
# Writes a qt.conf file with the <qt_conf_contents> into <qt_conf_dir>.
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# RESOLVE_QT5_PATHS(<paths_var> [<executable_path>])
|
||||
#
|
||||
# Loop through <paths_var> list and if any don't exist resolve them
|
||||
# relative to the <executable_path> (if supplied) or the
|
||||
# CMAKE_INSTALL_PREFIX.
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# FIXUP_QT5_EXECUTABLE(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>])
|
||||
#
|
||||
# Copies Qt plugins, writes a Qt configuration file (if needed) and
|
||||
# fixes up a Qt5 executable using BundleUtilities so it is standalone
|
||||
# and can be drag-and-drop copied to another machine as long as all of
|
||||
# the system libraries are compatible.
|
||||
#
|
||||
# <executable> should point to the executable to be fixed-up.
|
||||
#
|
||||
# <qtplugins> should contain a list of the names or paths of any Qt
|
||||
# plugins to be installed.
|
||||
#
|
||||
# <libs> will be passed to BundleUtilities and should be a list of any
|
||||
# already installed plugins, libraries or executables to also be
|
||||
# fixed-up.
|
||||
#
|
||||
# <dirs> will be passed to BundleUtilities and should contain and
|
||||
# directories to be searched to find library dependencies.
|
||||
#
|
||||
# <plugins_dir> allows an custom plugins directory to be used.
|
||||
#
|
||||
# <request_qt_conf> will force a qt.conf file to be written even if not
|
||||
# needed.
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# INSTALL_QT5_PLUGIN_PATH(plugin executable copy installed_plugin_path_var <plugins_dir> <component> <configurations>)
|
||||
#
|
||||
# Install (or copy) a resolved <plugin> to the default plugins directory
|
||||
# (or <plugins_dir>) relative to <executable> and store the result in
|
||||
# <installed_plugin_path_var>.
|
||||
#
|
||||
# If <copy> is set to TRUE then the plugins will be copied rather than
|
||||
# installed. This is to allow this module to be used at CMake time
|
||||
# rather than install time.
|
||||
#
|
||||
# If <component> is set then anything installed will use this COMPONENT.
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# INSTALL_QT5_PLUGIN(plugin executable copy installed_plugin_path_var <plugins_dir> <component>)
|
||||
#
|
||||
# Install (or copy) an unresolved <plugin> to the default plugins
|
||||
# directory (or <plugins_dir>) relative to <executable> and store the
|
||||
# result in <installed_plugin_path_var>. See documentation of
|
||||
# INSTALL_QT5_PLUGIN_PATH.
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# INSTALL_QT5_EXECUTABLE(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf> <component>])
|
||||
#
|
||||
# Installs Qt plugins, writes a Qt configuration file (if needed) and
|
||||
# fixes up a Qt5 executable using BundleUtilities so it is standalone
|
||||
# and can be drag-and-drop copied to another machine as long as all of
|
||||
# the system libraries are compatible. The executable will be fixed-up
|
||||
# at install time. <component> is the COMPONENT used for bundle fixup
|
||||
# and plugin installation. See documentation of FIXUP_QT5_BUNDLE.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2011 Mike McQuaid <mike@mikemcquaid.com>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# The functions defined in this file depend on the fixup_bundle function
|
||||
# (and others) found in BundleUtilities.cmake
|
||||
|
||||
include(BundleUtilities)
|
||||
set(DeployQt5_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
|
||||
set(DeployQt5_apple_plugins_dir "PlugIns")
|
||||
|
||||
function(write_qt5_conf qt_conf_dir qt_conf_contents)
|
||||
set(qt_conf_path "${qt_conf_dir}/qt.conf")
|
||||
message(STATUS "Writing ${qt_conf_path}")
|
||||
file(WRITE "${qt_conf_path}" "${qt_conf_contents}")
|
||||
endfunction()
|
||||
|
||||
function(resolve_qt5_paths paths_var)
|
||||
set(executable_path ${ARGV1})
|
||||
|
||||
set(paths_resolved)
|
||||
foreach(path ${${paths_var}})
|
||||
if(EXISTS "${path}")
|
||||
list(APPEND paths_resolved "${path}")
|
||||
else()
|
||||
if(${executable_path})
|
||||
list(APPEND paths_resolved "${executable_path}/${path}")
|
||||
else()
|
||||
list(APPEND paths_resolved "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${path}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
set(${paths_var} ${paths_resolved} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(fixup_qt5_executable executable)
|
||||
set(qtplugins ${ARGV1})
|
||||
set(libs ${ARGV2})
|
||||
set(dirs ${ARGV3})
|
||||
set(plugins_dir ${ARGV4})
|
||||
set(request_qt_conf ${ARGV5})
|
||||
|
||||
message(STATUS "fixup_qt5_executable")
|
||||
message(STATUS " executable='${executable}'")
|
||||
message(STATUS " qtplugins='${qtplugins}'")
|
||||
message(STATUS " libs='${libs}'")
|
||||
message(STATUS " dirs='${dirs}'")
|
||||
message(STATUS " plugins_dir='${plugins_dir}'")
|
||||
message(STATUS " request_qt_conf='${request_qt_conf}'")
|
||||
|
||||
if(QT_LIBRARY_DIR)
|
||||
list(APPEND dirs "${QT_LIBRARY_DIR}")
|
||||
endif()
|
||||
if(QT_BINARY_DIR)
|
||||
list(APPEND dirs "${QT_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(qt_conf_dir "${executable}/Contents/Resources")
|
||||
set(executable_path "${executable}")
|
||||
set(write_qt_conf TRUE)
|
||||
if(NOT plugins_dir)
|
||||
set(plugins_dir "${DeployQt5_apple_plugins_dir}")
|
||||
endif()
|
||||
else()
|
||||
get_filename_component(executable_path "${executable}" PATH)
|
||||
if(NOT executable_path)
|
||||
set(executable_path ".")
|
||||
endif()
|
||||
set(qt_conf_dir "${executable_path}")
|
||||
set(write_qt_conf ${request_qt_conf})
|
||||
endif()
|
||||
|
||||
foreach(plugin ${qtplugins})
|
||||
set(installed_plugin_path "")
|
||||
install_qt5_plugin("${plugin}" "${executable}" 1 installed_plugin_path)
|
||||
list(APPEND libs ${installed_plugin_path})
|
||||
endforeach()
|
||||
|
||||
foreach(lib ${libs})
|
||||
if(NOT EXISTS "${lib}")
|
||||
message(FATAL_ERROR "Library does not exist: ${lib}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
resolve_qt5_paths(libs "${executable_path}")
|
||||
|
||||
if(write_qt_conf)
|
||||
set(qt_conf_contents "[Paths]\nPlugins = ${plugins_dir}")
|
||||
write_qt5_conf("${qt_conf_dir}" "${qt_conf_contents}")
|
||||
endif()
|
||||
|
||||
fixup_bundle("${executable}" "${libs}" "${dirs}")
|
||||
endfunction()
|
||||
|
||||
function(install_qt5_plugin_path plugin executable copy installed_plugin_path_var)
|
||||
set(plugins_dir ${ARGV4})
|
||||
set(component ${ARGV5})
|
||||
set(configurations ${ARGV6})
|
||||
if(EXISTS "${plugin}")
|
||||
if(APPLE)
|
||||
if(NOT plugins_dir)
|
||||
set(plugins_dir "${DeployQt5_apple_plugins_dir}")
|
||||
endif()
|
||||
set(plugins_path "${executable}/Contents/${plugins_dir}")
|
||||
else()
|
||||
get_filename_component(plugins_path "${executable}" PATH)
|
||||
if(NOT plugins_path)
|
||||
set(plugins_path ".")
|
||||
endif()
|
||||
if(plugins_dir)
|
||||
set(plugins_path "${plugins_path}/${plugins_dir}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(plugin_group "")
|
||||
|
||||
get_filename_component(plugin_path "${plugin}" PATH)
|
||||
get_filename_component(plugin_parent_path "${plugin_path}" PATH)
|
||||
get_filename_component(plugin_parent_dir_name "${plugin_parent_path}" NAME)
|
||||
get_filename_component(plugin_name "${plugin}" NAME)
|
||||
string(TOLOWER "${plugin_parent_dir_name}" plugin_parent_dir_name)
|
||||
|
||||
if("${plugin_parent_dir_name}" STREQUAL "plugins")
|
||||
get_filename_component(plugin_group "${plugin_path}" NAME)
|
||||
set(${plugin_group_var} "${plugin_group}")
|
||||
endif()
|
||||
set(plugins_path "${plugins_path}/${plugin_group}")
|
||||
|
||||
if(${copy})
|
||||
file(MAKE_DIRECTORY "${plugins_path}")
|
||||
file(COPY "${plugin}" DESTINATION "${plugins_path}")
|
||||
else()
|
||||
if(configurations AND (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE))
|
||||
set(configurations CONFIGURATIONS ${configurations})
|
||||
else()
|
||||
unset(configurations)
|
||||
endif()
|
||||
install(FILES "${plugin}" DESTINATION "${plugins_path}" ${configurations} ${component})
|
||||
endif()
|
||||
set(${installed_plugin_path_var} "${plugins_path}/${plugin_name}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(install_qt5_plugin plugin executable copy installed_plugin_path_var)
|
||||
set(plugins_dir ${ARGV4})
|
||||
set(component ${ARGV5})
|
||||
if(EXISTS "${plugin}")
|
||||
install_qt5_plugin_path("${plugin}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}")
|
||||
else()
|
||||
string(TOUPPER "QT_${plugin}_PLUGIN" plugin_var)
|
||||
set(plugin_release_var "${plugin_var}_RELEASE")
|
||||
set(plugin_debug_var "${plugin_var}_DEBUG")
|
||||
set(plugin_release "${${plugin_release_var}}")
|
||||
set(plugin_debug "${${plugin_debug_var}}")
|
||||
if(DEFINED "${plugin_release_var}" AND DEFINED "${plugin_debug_var}" AND NOT EXISTS "${plugin_release}" AND NOT EXISTS "${plugin_debug}")
|
||||
message(WARNING "Qt plugin \"${plugin}\" not recognized or found.")
|
||||
endif()
|
||||
if(NOT EXISTS "${${plugin_debug_var}}")
|
||||
set(plugin_debug "${plugin_release}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
|
||||
install_qt5_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}_release" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel")
|
||||
install_qt5_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}_debug" "${plugins_dir}" "${component}" "Debug")
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^Debug$")
|
||||
set(${installed_plugin_path_var} ${${installed_plugin_path_var}_debug})
|
||||
else()
|
||||
set(${installed_plugin_path_var} ${${installed_plugin_path_var}_release})
|
||||
endif()
|
||||
else()
|
||||
install_qt5_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}")
|
||||
endif()
|
||||
endif()
|
||||
set(${installed_plugin_path_var} ${${installed_plugin_path_var}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(install_qt5_executable executable)
|
||||
set(qtplugins ${ARGV1})
|
||||
set(libs ${ARGV2})
|
||||
set(dirs ${ARGV3})
|
||||
set(plugins_dir ${ARGV4})
|
||||
set(request_qt_conf ${ARGV5})
|
||||
set(component ${ARGV6})
|
||||
if(QT_LIBRARY_DIR)
|
||||
list(APPEND dirs "${QT_LIBRARY_DIR}")
|
||||
endif()
|
||||
if(QT_BINARY_DIR)
|
||||
list(APPEND dirs "${QT_BINARY_DIR}")
|
||||
endif()
|
||||
if(TARGET Qt5::Core)
|
||||
get_property(_locCore TARGET Qt5::Core PROPERTY LOCATION_RELEASE)
|
||||
get_filename_component(_loc ${_locCore} DIRECTORY)
|
||||
message(STATUS "Adding Qt 5 directory: ${_loc}")
|
||||
list(APPEND dirs "${_loc}")
|
||||
else()
|
||||
message(FATAL_ERROR "No Qt5::Core target found, ensure it is available")
|
||||
endif()
|
||||
if(component)
|
||||
set(component COMPONENT ${component})
|
||||
else()
|
||||
unset(component)
|
||||
endif()
|
||||
|
||||
get_filename_component(executable_absolute "${executable}" ABSOLUTE)
|
||||
if(EXISTS "${QT_QTCORE_LIBRARY_RELEASE}")
|
||||
gp_file_type("${executable_absolute}" "${QT_QTCORE_LIBRARY_RELEASE}" qtcore_type)
|
||||
elseif(EXISTS "${QT_QTCORE_LIBRARY_DEBUG}")
|
||||
gp_file_type("${executable_absolute}" "${QT_QTCORE_LIBRARY_DEBUG}" qtcore_type)
|
||||
endif()
|
||||
if(qtcore_type STREQUAL "system")
|
||||
set(qt_plugins_dir "")
|
||||
endif()
|
||||
|
||||
if(QT_IS_STATIC)
|
||||
message(WARNING "Qt built statically: not installing plugins.")
|
||||
else()
|
||||
if(APPLE)
|
||||
get_property(loc TARGET Qt5::QCocoaIntegrationPlugin
|
||||
PROPERTY LOCATION_RELEASE)
|
||||
install_qt5_plugin("${loc}" "${executable}" 0 installed_plugin_paths
|
||||
"PlugIns" "${component}")
|
||||
list(APPEND libs ${installed_plugin_paths})
|
||||
elseif(WIN32)
|
||||
get_property(loc TARGET Qt5::QWindowsIntegrationPlugin
|
||||
PROPERTY LOCATION_RELEASE)
|
||||
install_qt5_plugin("${loc}" "${executable}" 0 installed_plugin_paths
|
||||
"" "${component}")
|
||||
list(APPEND libs ${installed_plugin_paths})
|
||||
endif()
|
||||
foreach(plugin ${qtplugins})
|
||||
set(installed_plugin_paths "")
|
||||
install_qt5_plugin("${plugin}" "${executable}" 0 installed_plugin_paths "${plugins_dir}" "${component}")
|
||||
list(APPEND libs ${installed_plugin_paths})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
resolve_qt5_paths(libs "")
|
||||
|
||||
install(CODE
|
||||
"include(\"${DeployQt5_cmake_dir}/DeployQt5.cmake\")
|
||||
set(BU_CHMOD_BUNDLE_ITEMS TRUE)
|
||||
fixup_qt5_executable(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${executable}\" \"\" \"${libs}\" \"${dirs}\" \"${plugins_dir}\" \"${request_qt_conf}\")"
|
||||
${component}
|
||||
)
|
||||
endfunction()
|
||||
@@ -99,7 +99,6 @@ list(FIND LibtorrentRasterbar_DEFINITIONS -DTORRENT_USE_OPENSSL LibtorrentRaster
|
||||
if(LibtorrentRasterbar_ENCRYPTION_INDEX GREATER -1)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
set(LibtorrentRasterbar_LIBRARIES ${LibtorrentRasterbar_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
|
||||
list(APPEND LibtorrentRasterbar_INCLUDE_DIRS "${OPENSSL_INCLUDE_DIR}")
|
||||
set(LibtorrentRasterbar_OPENSSL_ENABLED ON)
|
||||
endif()
|
||||
|
||||
@@ -114,10 +113,10 @@ mark_as_advanced(LibtorrentRasterbar_INCLUDE_DIR LibtorrentRasterbar_LIBRARY
|
||||
LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES
|
||||
LibtorrentRasterbar_ENCRYPTION_INDEX)
|
||||
|
||||
if (LibtorrentRasterbar_FOUND AND NOT TARGET LibtorrentRasterbar::torrent-rasterbar)
|
||||
add_library(LibtorrentRasterbar::torrent-rasterbar UNKNOWN IMPORTED)
|
||||
if (LibtorrentRasterbar_FOUND AND NOT TARGET LibtorrentRasterbar::LibTorrent)
|
||||
add_library(LibtorrentRasterbar::LibTorrent UNKNOWN IMPORTED)
|
||||
|
||||
set_target_properties(LibtorrentRasterbar::torrent-rasterbar PROPERTIES
|
||||
set_target_properties(LibtorrentRasterbar::LibTorrent PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${LibtorrentRasterbar_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LibtorrentRasterbar_INCLUDE_DIRS}"
|
||||
|
||||
@@ -1,79 +1,94 @@
|
||||
# - Try to find the QtSingleApplication includes and library
|
||||
# which defines
|
||||
#
|
||||
# QtSingleApplication_FOUND - system has QtSingleApplication
|
||||
# QtSingleApplication_INCLUDE_DIR - where to find header QtSingleApplication
|
||||
# QtSingleApplication_LIBRARIES - the libraries to link against to use QtSingleApplication
|
||||
# QtSingleApplication_LIBRARY - where to find the QtSingleApplication library (not for general use)
|
||||
# QTSINGLEAPPLICATION_FOUND - system has QtSingleApplication
|
||||
# QTSINGLEAPPLICATION_INCLUDE_DIR - where to find header QtSingleApplication
|
||||
# QTSINGLEAPPLICATION_LIBRARIES - the libraries to link against to use QtSingleApplication
|
||||
# QTSINGLEAPPLICATION_LIBRARY - where to find the QtSingleApplication library (not for general use)
|
||||
|
||||
# copyright (c) 2013 TI_Eugene ti.eugene@gmail.com
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the FreeBSD license.
|
||||
|
||||
SET(QtSingleApplication_FOUND FALSE)
|
||||
SET(QTSINGLEAPPLICATION_FOUND FALSE)
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
set(_includeFileName qtsingleapplication.h)
|
||||
else()
|
||||
set(_includeFileName qtsinglecoreapplication.h)
|
||||
endif()
|
||||
IF(QT4_FOUND)
|
||||
message(STATUS "Looking for Qt4 single application library")
|
||||
FIND_PATH(QTSINGLEAPPLICATION_INCLUDE_DIR QtSingleApplication
|
||||
# standard locations
|
||||
/usr/include
|
||||
/usr/include/QtSolutions
|
||||
# qt4 location except mac's frameworks
|
||||
"${QT_INCLUDE_DIR}/QtSolutions"
|
||||
# mac's frameworks
|
||||
${FRAMEWORK_INCLUDE_DIR}/QtSolutions
|
||||
)
|
||||
|
||||
FOREACH(TOP_INCLUDE_PATH in ${Qt5Core_INCLUDE_DIRS} ${FRAMEWORK_INCLUDE_DIR})
|
||||
FIND_PATH(QtSingleApplication_INCLUDE_DIR ${_includeFileName} ${TOP_INCLUDE_PATH}/QtSolutions)
|
||||
SET(QTSINGLEAPPLICATION_NAMES ${QTSINGLEAPPLICATION_NAMES}
|
||||
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
|
||||
FIND_LIBRARY(QTSINGLEAPPLICATION_LIBRARY
|
||||
NAMES ${QTSINGLEAPPLICATION_NAMES}
|
||||
PATHS ${QT_LIBRARY_DIR}
|
||||
)
|
||||
ELSEIF(Qt5Widgets_FOUND)
|
||||
message(STATUS "Looking for Qt5 single application library")
|
||||
FOREACH(TOP_INCLUDE_PATH in ${Qt5Widgets_INCLUDE_DIRS} ${FRAMEWORK_INCLUDE_DIR})
|
||||
FIND_PATH(QTSINGLEAPPLICATION_INCLUDE_DIR QtSingleApplication ${TOP_INCLUDE_PATH}/QtSolutions)
|
||||
|
||||
IF(QtSingleApplication_INCLUDE_DIR)
|
||||
BREAK()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
IF(QTSINGLEAPPLICATION_INCLUDE_DIR)
|
||||
BREAK()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
SET(QtSingleApplication_NAMES ${QtSingleApplication_NAMES}
|
||||
Qt5Solutions_SingleApplication-2.6 libQt5Solutions_SingleApplication-2.6
|
||||
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
|
||||
GET_TARGET_PROPERTY(_QT5_CORELIBRARY Qt5::Core LOCATION)
|
||||
GET_FILENAME_COMPONENT(_QT5_CORELIBRARYPATH ${_QT5_CORELIBRARY} PATH)
|
||||
SET(QTSINGLEAPPLICATION_NAMES ${QTSINGLEAPPLICATION_NAMES}
|
||||
Qt5Solutions_SingleApplication-2.6 libQt5Solutions_SingleApplication-2.6
|
||||
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
|
||||
GET_TARGET_PROPERTY(QT5_WIDGETSLIBRARY Qt5::Widgets LOCATION)
|
||||
GET_FILENAME_COMPONENT(QT5_WIDGETSLIBRARYPATH ${QT5_WIDGETSLIBRARY} PATH)
|
||||
|
||||
FIND_LIBRARY(QtSingleApplication_LIBRARY
|
||||
NAMES ${QtSingleApplication_NAMES}
|
||||
PATHS ${_QT5_CORELIBRARYPATH}
|
||||
)
|
||||
FIND_LIBRARY(QTSINGLEAPPLICATION_LIBRARY
|
||||
NAMES ${QTSINGLEAPPLICATION_NAMES}
|
||||
PATHS ${QT5_WIDGETSLIBRARYPATH}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
IF (QtSingleApplication_LIBRARY AND QtSingleApplication_INCLUDE_DIR)
|
||||
IF (QTSINGLEAPPLICATION_LIBRARY AND QTSINGLEAPPLICATION_INCLUDE_DIR)
|
||||
|
||||
SET(QtSingleApplication_LIBRARIES ${QtSingleApplication_LIBRARY})
|
||||
SET(QtSingleApplication_FOUND TRUE)
|
||||
SET(QTSINGLEAPPLICATION_LIBRARIES ${QTSINGLEAPPLICATION_LIBRARY})
|
||||
SET(QTSINGLEAPPLICATION_FOUND TRUE)
|
||||
|
||||
IF (CYGWIN)
|
||||
IF(BUILD_SHARED_LIBS)
|
||||
# No need to define QtSingleApplication_USE_DLL here, because it's default for Cygwin.
|
||||
# No need to define QTSINGLEAPPLICATION_USE_DLL here, because it's default for Cygwin.
|
||||
ELSE(BUILD_SHARED_LIBS)
|
||||
SET (QtSingleApplication_DEFINITIONS -DQTSINGLEAPPLICATION_STATIC)
|
||||
SET (QTSINGLEAPPLICATION_DEFINITIONS -DQTSINGLEAPPLICATION_STATIC)
|
||||
ENDIF(BUILD_SHARED_LIBS)
|
||||
ENDIF (CYGWIN)
|
||||
|
||||
ENDIF (QtSingleApplication_LIBRARY AND QtSingleApplication_INCLUDE_DIR)
|
||||
ENDIF (QTSINGLEAPPLICATION_LIBRARY AND QTSINGLEAPPLICATION_INCLUDE_DIR)
|
||||
|
||||
IF (QtSingleApplication_FOUND)
|
||||
IF (NOT QtSingleApplication_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found QtSingleApplication: ${QtSingleApplication_LIBRARY}")
|
||||
MESSAGE(STATUS " includes: ${QtSingleApplication_INCLUDE_DIR}")
|
||||
ENDIF (NOT QtSingleApplication_FIND_QUIETLY)
|
||||
if(NOT TARGET QtSingleApplication::QtSingleApplication)
|
||||
add_library(QtSingleApplication::QtSingleApplication UNKNOWN IMPORTED)
|
||||
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${QtSingleApplication_INCLUDE_DIR}"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${QtSingleApplication_INCLUDE_DIR}"
|
||||
)
|
||||
if(EXISTS "${QtSingleApplication_LIBRARY}")
|
||||
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${QtSingleApplication_LIBRARY}")
|
||||
endif()
|
||||
endif(NOT TARGET QtSingleApplication::QtSingleApplication)
|
||||
|
||||
ELSE (QtSingleApplication_FOUND)
|
||||
IF (QTSINGLEAPPLICATION_FOUND)
|
||||
IF (NOT QtSingleApplication_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found QtSingleApplication: ${QTSINGLEAPPLICATION_LIBRARY}")
|
||||
MESSAGE(STATUS " includes: ${QTSINGLEAPPLICATION_INCLUDE_DIR}")
|
||||
ENDIF (NOT QtSingleApplication_FIND_QUIETLY)
|
||||
ELSE (QTSINGLEAPPLICATION_FOUND)
|
||||
IF (QtSingleApplication_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find QtSingleApplication library")
|
||||
ENDIF (QtSingleApplication_FIND_REQUIRED)
|
||||
ENDIF (QtSingleApplication_FOUND)
|
||||
ENDIF (QTSINGLEAPPLICATION_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(QtSingleApplication_INCLUDE_DIR QtSingleApplication_LIBRARY)
|
||||
MARK_AS_ADVANCED(QTSINGLEAPPLICATION_INCLUDE_DIR QTSINGLEAPPLICATION_LIBRARY)
|
||||
|
||||
if(NOT TARGET QtSingleApplication::QtSingleApplication)
|
||||
add_library(QtSingleApplication::QtSingleApplication UNKNOWN IMPORTED)
|
||||
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${QTSINGLEAPPLICATION_INCLUDE_DIR}"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${QTSINGLEAPPLICATION_INCLUDE_DIR}"
|
||||
)
|
||||
if(EXISTS "${QTSINGLEAPPLICATION_LIBRARY}")
|
||||
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${QTSINGLEAPPLICATION_LIBRARY}")
|
||||
endif()
|
||||
endif(NOT TARGET QtSingleApplication::QtSingleApplication)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# - macro similar to target_link_libraries, which links Qt components
|
||||
# names of the components are passed in Qt4/Qt5 agnostic way (Core, DBus, Xml...)
|
||||
# names of the components are pased in Qt4/Qt5 agnostic way (Core, DBus, Xml...)
|
||||
# and the macro links Qt4 ones if QT4_FOUND is set or Qt5 ones if not
|
||||
|
||||
macro (target_link_qt_components target)
|
||||
|
||||
@@ -11,17 +11,18 @@ macro(qbt_set_compiler_options)
|
||||
#-Wshadow -Wconversion ?
|
||||
set(_GCC_COMMON_C_AND_CXX_FLAGS "-Wall -Wextra"
|
||||
"-Wfloat-equal -Wcast-qual -Wcast-align"
|
||||
"-Wsign-conversion -Winvalid-pch -Wno-long-long"
|
||||
#"-fstack-protector-all"
|
||||
#"-Werror -Wno-error=deprecated-declarations"
|
||||
"-Wsign-conversion -Winvalid-pch -Werror=return-type -Wno-long-long"
|
||||
# -fstack-protector-all
|
||||
"-Werror -Wno-error=deprecated-declarations"
|
||||
)
|
||||
set(_GCC_COMMON_CXX_FLAGS "-fexceptions -frtti"
|
||||
"-Woverloaded-virtual -Wold-style-cast"
|
||||
set (_GCC_COMMON_CXX_FLAGS "-fexceptions -frtti"
|
||||
"-Woverloaded-virtual -Wold-style-cast -Wstrict-null-sentinel"
|
||||
"-Wnon-virtual-dtor -Wfloat-equal -Wcast-qual -Wcast-align"
|
||||
#"-Weffc++"
|
||||
#"-Werror -Wno-error=cpp"
|
||||
"-Werror=overloaded-virtual"
|
||||
# "-Weffc++"
|
||||
"-Werror -Wno-error=cpp"
|
||||
# we should modify code to make these ones obsolete
|
||||
#"-Wno-error=sign-conversion -Wno-error=float-equal"
|
||||
"-Wno-error=old-style-cast -Wno-error=sign-conversion -Wno-error=float-equal"
|
||||
)
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
|
||||
@@ -53,20 +54,6 @@ macro(qbt_set_compiler_options)
|
||||
endif(${GLIBC_VERSION})
|
||||
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# Clang 5.0 still doesn't support -Wstrict-null-sentinel
|
||||
check_cxx_compiler_flag(-Wstrict-null-sentinel _STRICT_NULL_SENTINEL_IS_SUPPORTED)
|
||||
if (_STRICT_NULL_SENTINEL_IS_SUPPORTED)
|
||||
list(APPEND _GCC_COMMON_CXX_FLAGS "-Wstrict-null-sentinel")
|
||||
endif (_STRICT_NULL_SENTINEL_IS_SUPPORTED)
|
||||
|
||||
# Code should be improved to render this not needed
|
||||
list(APPEND _GCC_COMMON_CXX_FLAGS "-Wno-error=unused-function -Wno-error=inconsistent-missing-override")
|
||||
else ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# GCC supports it
|
||||
list(APPEND _GCC_COMMON_CXX_FLAGS "-Wstrict-null-sentinel")
|
||||
endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
|
||||
string(REPLACE ";" " " _GCC_COMMON_C_AND_CXX_FLAGS_STRING "${_GCC_COMMON_C_AND_CXX_FLAGS}")
|
||||
string(REPLACE ";" " " _GCC_COMMON_CXX_FLAGS_STRING "${_GCC_COMMON_CXX_FLAGS}")
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
# a helper function which appends source to the target
|
||||
# sources file names are relative to the the target source dir
|
||||
# a helper function which appends source to the main qBt target
|
||||
# the target name is read from QBT_TARGET_NAME variable
|
||||
# sources file names are relative to the the ${qbt_executable_SOURCE_DIR}
|
||||
|
||||
function (qbt_target_sources _target _scope)
|
||||
get_target_property(targetSourceDir ${_target} SOURCE_DIR)
|
||||
set(sourcesRelative "")
|
||||
foreach(source IN ITEMS ${ARGN})
|
||||
if(IS_ABSOLUTE "${source}")
|
||||
set(sourceAbsolutePath "${source}")
|
||||
function (qbt_target_sources)
|
||||
set (_sources_rel "")
|
||||
foreach (_source IN ITEMS ${ARGN})
|
||||
if (IS_ABSOLUTE "${_source}")
|
||||
set(source_abs "${_source}")
|
||||
else()
|
||||
get_filename_component(sourceAbsolutePath "${source}" ABSOLUTE)
|
||||
get_filename_component(_source_abs "${_source}" ABSOLUTE)
|
||||
endif()
|
||||
file(RELATIVE_PATH sourceRelativePath "${targetSourceDir}" "${sourceAbsolutePath}")
|
||||
list(APPEND sourcesRelative "${sourceRelativePath}")
|
||||
file (RELATIVE_PATH _source_rel "${qbt_executable_SOURCE_DIR}" "${_source_abs}")
|
||||
list (APPEND _sources_rel "${_source_rel}")
|
||||
endforeach()
|
||||
target_sources(${_target} ${_scope} "${sourcesRelative}")
|
||||
endfunction(qbt_target_sources)
|
||||
target_sources (${QBT_TARGET_NAME} PRIVATE "${_sources_rel}")
|
||||
endfunction (qbt_target_sources)
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
# macros to handle translation files
|
||||
|
||||
# qbt_add_translations(<target> QRC_FILE <filename> TS_FILES <filenames>)
|
||||
# handles out of source builds for Qt resource files that include translations
|
||||
# The function generates translations out of the supplied list of .ts files in the build directory,
|
||||
# copies the .qrc file there, calls qt5_add_resources() adds its output to the target sources list.
|
||||
function(qbt_add_translations _target)
|
||||
set(oneValueArgs QRC_FILE)
|
||||
set(multiValueArgs TS_FILES)
|
||||
cmake_parse_arguments(QBT_TR "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
get_target_property(_binaryDir ${_target} BINARY_DIR)
|
||||
|
||||
if (NOT QBT_TR_QRC_FILE)
|
||||
message(FATAL_ERROR "QRC file is empty")
|
||||
endif()
|
||||
if (NOT QBT_TR_TS_FILES)
|
||||
message(FATAL_ERROR "TS_FILES files are empty")
|
||||
endif()
|
||||
|
||||
if(IS_ABSOLUTE "${QBT_TR_QRC_FILE}")
|
||||
file(RELATIVE_PATH _qrcToTs "${CMAKE_CURRENT_SOURCE_DIR}" "${QBT_TR_QRC_FILE}")
|
||||
else()
|
||||
set(_qrcToTs "${QBT_TR_QRC_FILE}")
|
||||
endif()
|
||||
|
||||
get_filename_component(_qrcToTsDir "${_qrcToTs}" DIRECTORY)
|
||||
|
||||
get_filename_component(_qmFilesBinaryDir "${CMAKE_CURRENT_BINARY_DIR}/${_qrcToTsDir}" ABSOLUTE)
|
||||
# to make qt5_add_translation() work as we need
|
||||
set_source_files_properties(${QBT_TR_TS_FILES} PROPERTIES OUTPUT_LOCATION "${_qmFilesBinaryDir}")
|
||||
qt5_add_translation(_qmFiles ${QBT_TR_TS_FILES})
|
||||
|
||||
set(_qrc_dest_dir "${_binaryDir}/${_qrcToTsDir}")
|
||||
set(_qrc_dest_file "${_binaryDir}/${QBT_TR_QRC_FILE}")
|
||||
|
||||
message(STATUS "copying ${QBT_TR_QRC_FILE} to ${_qrc_dest_dir}")
|
||||
file(COPY ${QBT_TR_QRC_FILE} DESTINATION ${_qrc_dest_dir})
|
||||
|
||||
set_source_files_properties("${_qrc_dest_file}" PROPERTIES
|
||||
GENERATED True
|
||||
OBJECT_DEPENDS "${_qmFiles}")
|
||||
|
||||
# With AUTORCC enabled rcc is ran by cmake before language files are generated,
|
||||
# and thus we call rcc explicitly
|
||||
qt5_add_resources(_resources "${_qrc_dest_file}")
|
||||
target_sources(${_target} PRIVATE "${_resources}")
|
||||
endfunction()
|
||||
@@ -1,21 +0,0 @@
|
||||
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
||||
include(DeployQt5)
|
||||
|
||||
set(plugins "")
|
||||
|
||||
get_property(svgIconPluginLocation TARGET Qt5::QSvgIconPlugin
|
||||
PROPERTY LOCATION_RELEASE)
|
||||
list(APPEND plugins "${svgIconPluginLocation}")
|
||||
get_property(svgPluginLocation TARGET Qt5::QSvgPlugin
|
||||
PROPERTY LOCATION_RELEASE)
|
||||
list(APPEND plugins "${svgPluginLocation}")
|
||||
|
||||
set(sfx "")
|
||||
if(APPLE)
|
||||
set(sfx ".app")
|
||||
elseif(WIN32)
|
||||
set(sfx "${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
endif()
|
||||
|
||||
get_target_property(exe qBittorrent OUTPUT_NAME)
|
||||
install_qt5_executable("${exe}${sfx}" "${plugins}" "" "" "")
|
||||
@@ -1,9 +1,9 @@
|
||||
if (STACKTRACE)
|
||||
if (STACKTRACE_WIN)
|
||||
if ("${WINXXBITS}" NOT STREQUAL "Win64")
|
||||
add_compile_options(-fno-omit-frame-pointer)
|
||||
endif ("${WINXXBITS}" NOT STREQUAL "Win64")
|
||||
link_libraries(libdbghelp -Wl,--export-all-symbols)
|
||||
endif (STACKTRACE)
|
||||
endif (STACKTRACE_WIN)
|
||||
|
||||
if (("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") OR ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo"))
|
||||
link_libraries(-Wl,--dynamicbase)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
if (STACKTRACE)
|
||||
if (STACKTRACE_WIN)
|
||||
if ("${WINXXBITS}" STREQUAL "Win64")
|
||||
add_compile_options(-Zi)
|
||||
else ("${WINXXBITS}" STREQUAL "Win64")
|
||||
@@ -6,7 +6,7 @@ if (STACKTRACE)
|
||||
add_compile_options(-Oy-)
|
||||
endif ("${WINXXBITS}" STREQUAL "Win64")
|
||||
link_libraries(dbghelp.lib)
|
||||
endif (STACKTRACE)
|
||||
endif (STACKTRACE_WIN)
|
||||
|
||||
# Enable Wide characters
|
||||
add_definitions(-DTORRENT_USE_WPATH)
|
||||
|
||||
@@ -24,7 +24,6 @@ add_definitions(-DUNICODE
|
||||
-D_WIN32_IE=0x0501
|
||||
-D_CRT_SECURE_NO_DEPRECATE
|
||||
-D_SCL_SECURE_NO_DEPRECATE
|
||||
-DNOMINMAX
|
||||
)
|
||||
# and boost
|
||||
set(Boost_USE_STATIC_LIBS True)
|
||||
|
||||
@@ -5,8 +5,6 @@ BINDIR = @EXPAND_BINDIR@
|
||||
DATADIR = @EXPAND_DATADIR@
|
||||
MANPREFIX = @EXPAND_MANDIR@
|
||||
|
||||
QMAKE_CC = @QBT_CC@
|
||||
QMAKE_CXX = @QBT_CXX@
|
||||
QMAKE_CXXFLAGS += @QBT_CONF_EXTRA_CFLAGS@
|
||||
|
||||
EXTERNAL_INCLUDES = @QBT_CONF_INCLUDES@
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
# Adapt these paths
|
||||
# Point these to the include folders
|
||||
INCLUDEPATH += $$quote(C:/qBittorrent/boost)
|
||||
INCLUDEPATH += $$quote(C:/qBittorrent/libtorrent/include)
|
||||
INCLUDEPATH += $$quote(C:/qBittorrent/zlib/include)
|
||||
INCLUDEPATH += $$quote(C:/qBittorrent/openssl/include)
|
||||
# Point these to the lib folders
|
||||
LIBS += $$quote(-LC:/qBittorrent/boost/stage/lib)
|
||||
LIBS += $$quote(-LC:/qBittorrent/libtorrent/lib)
|
||||
LIBS += $$quote(-LC:/qBittorrent/zlib/lib)
|
||||
LIBS += $$quote(-LC:/qBittorrent/openssl/lib)
|
||||
|
||||
# Adapt the lib names/versions accordingly
|
||||
# If you want to use Boost auto-linking then disable
|
||||
# BOOST_ALL_NO_LIB below and omit Boost libraries here
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += libtorrentd.lib \
|
||||
libboost_system-vc140-mt-sgd-1_64.lib
|
||||
}
|
||||
else {
|
||||
LIBS += libtorrent.lib \
|
||||
libboost_system-vc140-mt-s-1_64.lib
|
||||
}
|
||||
LIBS += libeay32.lib ssleay32.lib
|
||||
LIBS += zlib.lib
|
||||
# ...or if you use MinGW
|
||||
#CONFIG(debug, debug|release) {
|
||||
# LIBS += libtorrent-rasterbar \
|
||||
# libboost_system-mt
|
||||
#}
|
||||
#else {
|
||||
# LIBS += libtorrent-rasterbar \
|
||||
# libboost_system-mt
|
||||
#}
|
||||
#LIBS += libcrypto libssl
|
||||
#LIBS += libz
|
||||
|
||||
DEFINES += NTDDI_VERSION=0x05010000
|
||||
DEFINES += _WIN32_WINNT=0x0501
|
||||
DEFINES += _WIN32_IE=0x0501
|
||||
|
||||
# Disable to use Boost auto-linking
|
||||
DEFINES += BOOST_ALL_NO_LIB
|
||||
# Use one of the following options
|
||||
DEFINES += BOOST_SYSTEM_STATIC_LINK
|
||||
#DEFINES += BOOST_SYSTEM_DYN_LINK
|
||||
# Boost 1.60+ defaults to Vista+ support. The define below enables XP support again.
|
||||
DEFINES += BOOST_USE_WINAPI_VERSION=0x0501
|
||||
# Enable if building against libtorrent 1.0.x (RC_1_0) (static linking)
|
||||
#DEFINES += BOOST_ASIO_SEPARATE_COMPILATION
|
||||
# Enable if building against libtorrent 1.0.x (RC_1_0) (dynamic linking)
|
||||
#DEFINES += BOOST_ASIO_DYN_LINK
|
||||
# Enable if encountered build error with boost version <= 1.59
|
||||
#DEFINES += BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
# Enable if building against libtorrent 1.1.x (RC_1_1)
|
||||
# built with this flag defined
|
||||
#DEFINES += TORRENT_NO_DEPRECATE
|
||||
# Enable if linking dynamically against libtorrent
|
||||
#DEFINES += TORRENT_LINKING_SHARED
|
||||
|
||||
# Enable stack trace support
|
||||
CONFIG += stacktrace
|
||||
|
||||
win32-msvc* {
|
||||
QMAKE_CXXFLAGS += "/guard:cf"
|
||||
QMAKE_LFLAGS += "/guard:cf"
|
||||
QMAKE_LFLAGS_RELEASE += "/OPT:REF /OPT:ICF"
|
||||
}
|
||||
154
configure.ac
@@ -1,4 +1,4 @@
|
||||
AC_INIT([qbittorrent], [v4.1.6], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
|
||||
AC_INIT([qbittorrent], [v3.2.0alpha], [bugs.qbittorrent.org], [], [http://www.qbittorrent.org/])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_PROG_CC
|
||||
@@ -8,30 +8,34 @@ AC_LANG(C++)
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
# use compiler from env variables if available
|
||||
QBT_CC="$CC"
|
||||
QBT_CXX="$CXX"
|
||||
|
||||
|
||||
# Define --wth-* and --enable-* arguments
|
||||
|
||||
AC_ARG_WITH(qt4,
|
||||
[AS_HELP_STRING([--with-qt4],
|
||||
[Compile using Qt4 (default=no)])],
|
||||
[],
|
||||
[with_qt4=no])
|
||||
|
||||
AC_ARG_WITH(qtsingleapplication,
|
||||
[AS_HELP_STRING([--with-qtsingleapplication=@<:@system|shipped@:>@],
|
||||
[Use the shipped qtsingleapplication library or the system one (default=shipped)])],
|
||||
[],
|
||||
[with_qtsingleapplication=shipped])
|
||||
|
||||
AC_ARG_WITH(qjson,
|
||||
[AS_HELP_STRING([--with-qjson=@<:@system|shipped@:>@],
|
||||
[Use the shipped qjson library or the system one (default=shipped) (Qt4 only)])],
|
||||
[],
|
||||
[with_qjson=shipped])
|
||||
|
||||
AC_ARG_ENABLE(debug,
|
||||
[AS_HELP_STRING([--enable-debug],
|
||||
[Enable debug build])],
|
||||
[],
|
||||
[enable_debug=no])
|
||||
|
||||
AC_ARG_ENABLE(stacktrace,
|
||||
[AS_HELP_STRING([--enable-stacktrace],
|
||||
[Enable stacktrace feature (default=auto)])],
|
||||
[],
|
||||
[enable_stacktrace=auto])
|
||||
|
||||
AC_ARG_ENABLE(gui,
|
||||
[AS_HELP_STRING([--disable-gui],
|
||||
[Disable the GUI for headless running. Disables QtDBus and the GeoIP Database.])],
|
||||
@@ -88,23 +92,6 @@ AS_CASE(["x$enable_debug"],
|
||||
[AC_MSG_RESULT([$enable_debug])
|
||||
AC_MSG_ERROR([Unknown option "$enable_debug". Use either "yes" or "no".])])
|
||||
|
||||
AC_MSG_CHECKING([whether to enable the stacktrace feature])
|
||||
AS_CASE(["x$enable_stacktrace"],
|
||||
["xno"],
|
||||
[AC_MSG_RESULT([no])
|
||||
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG stacktrace"],
|
||||
["xyes"],
|
||||
[AC_MSG_RESULT([yes])
|
||||
QBT_ADD_CONFIG="$QBT_ADD_CONFIG stacktrace"],
|
||||
["xauto"],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <execinfo.h>]])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
QBT_ADD_CONFIG="$QBT_ADD_CONFIG stacktrace"],
|
||||
[AC_MSG_RESULT([no])
|
||||
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG stacktrace"])],
|
||||
[AC_MSG_RESULT([$enable_stacktrace])
|
||||
AC_MSG_ERROR([Unknown option "$enable_stacktrace". Use either "yes" or "no".])])
|
||||
|
||||
AC_MSG_CHECKING([whether to enable the GUI])
|
||||
AS_CASE(["x$enable_gui"],
|
||||
["xyes"],
|
||||
@@ -140,13 +127,20 @@ AS_CASE(["x$enable_webui"],
|
||||
[AC_MSG_RESULT([$enable_webui])
|
||||
AC_MSG_ERROR([Unknown option "$enable_webui". Use either "yes" or "no".])])
|
||||
|
||||
FIND_QT5()
|
||||
AC_MSG_CHECKING([whether Qt4 should be enabled])
|
||||
AS_CASE(["x$with_qt4"],
|
||||
["xno"],
|
||||
[AC_MSG_RESULT([no])
|
||||
FIND_QT5()],
|
||||
["xyes"],
|
||||
[AC_MSG_RESULT([yes])
|
||||
FIND_QT4()],
|
||||
[AC_MSG_RESULT([$with_qt4])
|
||||
AC_MSG_ERROR([Unknown option "$with_qt4". Use either "yes" or "no".])])
|
||||
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.5.1])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether QtDBus should be enabled])
|
||||
AS_CASE(["x$enable_qt_dbus"],
|
||||
["xyes"],
|
||||
@@ -163,25 +157,22 @@ AS_CASE(["x$enable_qt_dbus"],
|
||||
AC_MSG_ERROR([Unknown option "$enable_qt_dbus". Use either "yes" or "no".])])
|
||||
|
||||
|
||||
AX_BOOST_BASE([1.35],
|
||||
[AC_MSG_NOTICE([Boost CXXFLAGS: "$BOOST_CPPFLAGS"])
|
||||
AC_MSG_NOTICE([Boost LDFLAGS: "$BOOST_LDFLAGS"])],
|
||||
[AC_MSG_ERROR([Could not find Boost])])
|
||||
CXXFLAGS="$BOOST_CPPFLAGS $CXXFLAGS"
|
||||
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
|
||||
|
||||
# add workaround for problematic boost version
|
||||
# taken from ax_boost_base.m4
|
||||
m4_define([DETECT_BOOST_VERSION_PROGRAM],
|
||||
[AC_LANG_PROGRAM([[#include <boost/version.hpp>]],
|
||||
[[(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($1))]));]])])
|
||||
|
||||
AC_COMPILE_IFELSE([DETECT_BOOST_VERSION_PROGRAM(106000)], [],
|
||||
[QBT_ADD_DEFINES="$QBT_ADD_DEFINES BOOST_NO_CXX11_RVALUE_REFERENCES"])
|
||||
AX_BOOST_BASE([1.35])
|
||||
# HAVE_BOOST is set to an empty value when Boost is found. I don't know
|
||||
# how to test for a set vs unset variable.
|
||||
AS_IF([test "x$BOOST_CPPFLAGS" = "x"],
|
||||
[AC_MSG_ERROR([Could not find Boost])],
|
||||
[AC_MSG_NOTICE([Boost CPPFLAGS: $BOOST_CPPFLAGS])
|
||||
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
|
||||
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"])
|
||||
|
||||
AX_BOOST_SYSTEM()
|
||||
AC_MSG_NOTICE([Boost.System LIB: "$BOOST_SYSTEM_LIB"])
|
||||
LIBS="$BOOST_SYSTEM_LIB $LIBS"
|
||||
# HAVE_BOOST_SYSTEM is set to an empty value when Boost.System is found.
|
||||
# I don't know how to test for a set vs unset variable.
|
||||
AS_IF([test "x$BOOST_SYSTEM_LIB" = "x"],
|
||||
[AC_MSG_ERROR([Could not find Boost.System])],
|
||||
[AC_MSG_NOTICE([Boost.System LIB: $BOOST_SYSTEM_LIB])
|
||||
LIBS="$BOOST_SYSTEM_LIB $LIBS"])
|
||||
|
||||
AC_MSG_CHECKING([which qtsingleapplication to use])
|
||||
AS_CASE(["x$with_qtsingleapplication"],
|
||||
@@ -194,48 +185,33 @@ AS_CASE(["x$with_qtsingleapplication"],
|
||||
[AC_MSG_RESULT([$with_qtsingleapplication])
|
||||
AC_MSG_ERROR([Unknown option "$with_qtsingleapplication". Use either "system" or "shipped".])])
|
||||
|
||||
AS_IF([test "x$with_qt4" = "xyes"],
|
||||
[AC_MSG_CHECKING([which qjson to use])
|
||||
AS_CASE(["x$with_qjson"],
|
||||
["xshipped"],
|
||||
[AC_MSG_RESULT([shipped])
|
||||
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG usesystemqjson"],
|
||||
["xsystem"],
|
||||
[AC_MSG_RESULT([system])
|
||||
PKG_CHECK_MODULES(qjson,
|
||||
[QJson >= 0.8.1],
|
||||
[CPPFLAGS="$qjson_CFLAGS $CPPFLAGS"
|
||||
LIBS="$qjson_LIBS $LIBS"])
|
||||
QBT_ADD_CONFIG="$QBT_ADD_CONFIG usesystemqjson"],
|
||||
[AC_MSG_RESULT([$with_qjson])
|
||||
AC_MSG_ERROR([Unknown option "$with_qjson". Use either "system" or "shipped".])])
|
||||
])
|
||||
|
||||
PKG_CHECK_MODULES(libtorrent,
|
||||
[libtorrent-rasterbar >= 1.0.6],
|
||||
[CXXFLAGS="$libtorrent_CFLAGS $CXXFLAGS"
|
||||
[CPPFLAGS="$libtorrent_CFLAGS $CPPFLAGS"
|
||||
LIBS="$libtorrent_LIBS $LIBS"])
|
||||
|
||||
PKG_CHECK_MODULES(zlib,
|
||||
[zlib >= 1.2.5.2],
|
||||
[CXXFLAGS="$zlib_CFLAGS $CXXFLAGS"
|
||||
[CPPFLAGS="$zlib_CFLAGS $CPPFLAGS"
|
||||
LIBS="$zlib_LIBS $LIBS"])
|
||||
|
||||
# Check if already in >= C++11 mode because of the flags returned by one of the above packages
|
||||
AC_MSG_CHECKING([if compiler is using C++11 or later mode])
|
||||
AC_COMPILE_IFELSE([DETECT_CPP11_PROGRAM()],
|
||||
[AC_MSG_RESULT([yes])
|
||||
QBT_CXX11_FOUND="yes"],
|
||||
[AC_MSG_RESULT([no])
|
||||
QBT_CXX11_FOUND="no"])
|
||||
|
||||
# In case of no, check if the compiler can support at least C++11
|
||||
# and if yes, enable it leaving a warning to the user
|
||||
AS_IF([test "x$QBT_CXX11_FOUND" = "xno"],
|
||||
[AC_MSG_CHECKING([if compiler supports C++11])
|
||||
TMP_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -std=c++11"
|
||||
AC_COMPILE_IFELSE([DETECT_CPP11_PROGRAM()],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_MSG_CHECKING([if C++11 is disabled by the set compiler flags])
|
||||
# prepend the flag so it won't override conflicting user defined flags
|
||||
CXXFLAGS="-std=c++11 $TMP_CXXFLAGS"
|
||||
AC_COMPILE_IFELSE([DETECT_CPP11_PROGRAM()],
|
||||
[AC_MSG_RESULT([no])
|
||||
CXXFLAGS="$TMP_CXXFLAGS -std=c++11"
|
||||
AC_MSG_WARN([C++11 mode is now force enabled.
|
||||
Make sure you use the same C++ mode for qBittorrent and its dependencies.
|
||||
To explicitly set qBittorrent to a later mode use CXXFLAGS.
|
||||
Example: `CXXFLAGS="\$CXXFLAGS -std=c++14" ./configure`])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_MSG_ERROR([The compiler supports C++11 but the user or a dependency has explicitly enabled a lower mode.])])],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([A compiler supporting C++11 is required.])])
|
||||
])
|
||||
|
||||
# These are required because autoconf doesn't expand these **particular**
|
||||
# vars automatically. And qmake cannot autoexpand them.
|
||||
AX_DEFINE_DIR([EXPAND_PREFIX], [prefix])
|
||||
@@ -256,26 +232,25 @@ extract() {
|
||||
new_line='
|
||||
'
|
||||
# Convert " -" to "\n" if not between quotes and remove possible leading white spaces
|
||||
string=$(echo " $*" | $SED -e "s: -:\\${new_line}:g" -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g" -e 's/^[[[:space:]]]*//')
|
||||
string=$(echo " $*" | $SED -e "s: -:\\${new_line}:g" -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g" -e 's/^[[:space:]]*//')
|
||||
SAVEIFS=$IFS
|
||||
IFS=$(printf "\n\b")
|
||||
for i in $string; do
|
||||
case "$(echo "$i" | cut -c1)" in
|
||||
'') ;;
|
||||
D) QBT_CONF_DEFINES="$QBT_CONF_DEFINES $(echo $i | cut -c2-)";;
|
||||
I) QBT_CONF_INCLUDES="$QBT_CONF_INCLUDES $(echo $i | cut -c2-)";;
|
||||
*) QBT_CONF_EXTRA_CFLAGS="$QBT_CONF_EXTRA_CFLAGS -$i";;
|
||||
D) QBT_CONF_DEFINES="$(echo $i | cut -c2-) $QBT_CONF_DEFINES";;
|
||||
I) QBT_CONF_INCLUDES="$(echo $i | cut -c2-) $QBT_CONF_INCLUDES";;
|
||||
*) QBT_CONF_EXTRA_CFLAGS="-$i $QBT_CONF_EXTRA_CFLAGS";;
|
||||
esac
|
||||
done
|
||||
IFS=$SAVEIFS
|
||||
}
|
||||
|
||||
extract "$CFLAGS $CXXFLAGS"
|
||||
extract $CPPFLAGS
|
||||
QBT_ADD_DEFINES="$QBT_ADD_DEFINES $QBT_CONF_DEFINES"
|
||||
QBT_CONF_EXTRA_CFLAGS="$QBT_CONF_EXTRA_CFLAGS $CXXFLAGS"
|
||||
|
||||
# Substitute the values of these vars in conf.pri.in
|
||||
AC_SUBST(QBT_CC)
|
||||
AC_SUBST(QBT_CXX)
|
||||
AC_SUBST(QBT_CONF_INCLUDES)
|
||||
AC_SUBST(QBT_CONF_EXTRA_CFLAGS)
|
||||
AC_SUBST(QBT_ADD_CONFIG)
|
||||
@@ -301,3 +276,4 @@ AS_IF([test "x$ret" = "x0"],
|
||||
[AC_MSG_NOTICE([Good, your configure finished.])],
|
||||
[AC_MSG_ERROR([Failed running $QT_QMAKE to generate the makefile])])
|
||||
AS_ECHO()
|
||||
|
||||
|
||||
2
dist/CMakeLists.txt
vendored
@@ -1,5 +1,3 @@
|
||||
find_package(Qt5Widgets ${requiredQtVersion}) # to conditionally install desktop-related files
|
||||
|
||||
if (APPLE)
|
||||
add_subdirectory(mac)
|
||||
else (APPLE)
|
||||
|
||||
22
dist/mac/Info.plist
vendored
@@ -2,10 +2,6 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>qBittorrent</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
@@ -25,10 +21,6 @@
|
||||
<array>
|
||||
<string>org.bittorrent.torrent</string>
|
||||
</array>
|
||||
<key>NSExportableTypes</key>
|
||||
<array>
|
||||
<string>org.bittorrent.torrent</string>
|
||||
</array>
|
||||
<key>LSIsAppleDefaultForType</key>
|
||||
<true/>
|
||||
</dict>
|
||||
@@ -36,8 +28,6 @@
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>magnet</string>
|
||||
@@ -55,19 +45,21 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.1.6</string>
|
||||
<string>3.3.14</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>qBit</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>@EXECUTABLE@</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.qbittorrent.qBittorrent</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}.0</string>
|
||||
<string>org.qbittorrent</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>True</string>
|
||||
<key>NSAppleScriptEnabled</key>
|
||||
<string>YES</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2006-2019 The qBittorrent project</string>
|
||||
<string>Copyright © 2006-2017 The qBittorrent project</string>
|
||||
<key>UTExportedTypeDeclarations</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
||||
3
dist/mac/bundle.cmake
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
||||
include(BundleUtilities)
|
||||
fixup_bundle("$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/qbittorrent.app" "" "")
|
||||
BIN
dist/mac/qBitTorrentDocument.icns
vendored
BIN
dist/mac/qbittorrent_mac.icns
vendored
45
dist/unix/CMakeLists.txt
vendored
@@ -1,48 +1,39 @@
|
||||
if (NOT Qt5Widgets_FOUND)
|
||||
feature_option(SYSTEMD "Install systemd service file (headless only)" OFF)
|
||||
if (SYSTEMD)
|
||||
if (NOT Systemd_SERVICES_INSTALL_DIR)
|
||||
find_package(Systemd)
|
||||
if (NOT Systemd_FOUND)
|
||||
message(FATAL_ERROR "Could not locate systemd services install dir."
|
||||
" Either pass -DSystemd_SERVICES_INSTALL_DIR=/path/to/systemd/services option or install systemd pkg-config")
|
||||
endif(NOT Systemd_FOUND)
|
||||
endif(NOT Systemd_SERVICES_INSTALL_DIR)
|
||||
if (SYSTEMD)
|
||||
find_package(Systemd)
|
||||
if (SYSTEMD_FOUND)
|
||||
set(EXPAND_BINDIR ${CMAKE_INSTALL_FULL_BINDIR})
|
||||
configure_file(systemd/qbittorrent-nox@.service.in ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service
|
||||
DESTINATION ${Systemd_SERVICES_INSTALL_DIR}
|
||||
DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR}
|
||||
COMPONENT data)
|
||||
endif(SYSTEMD)
|
||||
endif()
|
||||
endif(SYSTEMD_FOUND)
|
||||
endif(SYSTEMD)
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
|
||||
if (GUI)
|
||||
list(APPEND MAN_FILES ${qBittorrent_SOURCE_DIR}/doc/qbittorrent.1)
|
||||
else (Qt5Widgets_FOUND)
|
||||
else (GUI)
|
||||
list(APPEND MAN_FILES ${qBittorrent_SOURCE_DIR}/doc/qbittorrent-nox.1)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
endif (GUI)
|
||||
|
||||
install(FILES ${MAN_FILES}
|
||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
|
||||
COMPONENT doc)
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
if (GUI)
|
||||
install(DIRECTORY menuicons/
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor
|
||||
FILES_MATCHING PATTERN "*.png")
|
||||
|
||||
install(FILES org.qbittorrent.qBittorrent.desktop
|
||||
install(FILES ${qBittorrent_SOURCE_DIR}/src/icons/qbittorrent.png
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps/
|
||||
COMPONENT data)
|
||||
|
||||
install(FILES ${qBittorrent_SOURCE_DIR}/src/icons/qbittorrent.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/
|
||||
COMPONENT data)
|
||||
|
||||
install(FILES org.qbittorrent.qBittorrent.appdata.xml
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo/
|
||||
install(FILES qbittorrent.appdata.xml
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/appdata/
|
||||
COMPONENT data)
|
||||
|
||||
install(FILES
|
||||
${qBittorrent_SOURCE_DIR}/src/icons/skin/qbittorrent-tray.svg
|
||||
${qBittorrent_SOURCE_DIR}/src/icons/skin/qbittorrent-tray-dark.svg
|
||||
${qBittorrent_SOURCE_DIR}/src/icons/skin/qbittorrent-tray-light.svg
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status
|
||||
COMPONENT data)
|
||||
endif()
|
||||
|
||||
BIN
dist/unix/menuicons/128x128/apps/qbittorrent.png
vendored
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 21 KiB |
BIN
dist/unix/menuicons/16x16/apps/qbittorrent.png
vendored
|
Before Width: | Height: | Size: 986 B After Width: | Height: | Size: 893 B |
|
Before Width: | Height: | Size: 986 B After Width: | Height: | Size: 893 B |
BIN
dist/unix/menuicons/192x192/apps/qbittorrent.png
vendored
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 36 KiB |
BIN
dist/unix/menuicons/22x22/apps/qbittorrent.png
vendored
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
dist/unix/menuicons/24x24/apps/qbittorrent.png
vendored
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
dist/unix/menuicons/32x32/apps/qbittorrent.png
vendored
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.4 KiB |
BIN
dist/unix/menuicons/36x36/apps/qbittorrent.png
vendored
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.9 KiB |
BIN
dist/unix/menuicons/48x48/apps/qbittorrent.png
vendored
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 4.5 KiB |
BIN
dist/unix/menuicons/64x64/apps/qbittorrent.png
vendored
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 7.3 KiB |
BIN
dist/unix/menuicons/72x72/apps/qbittorrent.png
vendored
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 8.9 KiB |
BIN
dist/unix/menuicons/96x96/apps/qbittorrent.png
vendored
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 14 KiB |
@@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright 2014 sledgehammer999 <sledgehammer999@qbittorrent.org> -->
|
||||
<component type="desktop">
|
||||
<id>org.qbittorrent.qBittorrent</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-2.0 and OpenSSL</project_license>
|
||||
<name>qBittorrent</name>
|
||||
<summary>An open-source Bittorrent client</summary>
|
||||
<description>
|
||||
<p>
|
||||
The qBittorrent project aims to provide an open-source software alternative to µTorrent.
|
||||
Additionally, qBittorrent runs and provides the same features on all major platforms (FreeBSD, Linux, macOS, OS/2, Windows).
|
||||
qBittorrent is based on the Qt toolkit and libtorrent-rasterbar library.
|
||||
</p>
|
||||
<ul>
|
||||
<li>Polished µTorrent-like User Interface</li>
|
||||
<li>
|
||||
Well-integrated and extensible Search Engine
|
||||
<ul>
|
||||
<li>Simultaneous search in many Torrent search sites</li>
|
||||
<li>Category-specific search requests (e.g. Books, Music, Software)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>RSS feed support with advanced download filters (incl. regex)</li>
|
||||
<li>
|
||||
Many Bittorrent extensions supported:
|
||||
<ul>
|
||||
<li>Magnet links</li>
|
||||
<li>Distributed hash table (DHT), peer exchange protocol (PEX), local peer discovery (LSD)</li>
|
||||
<li>Private torrents</li>
|
||||
<li>Encrypted connections</li>
|
||||
<li>and many more...</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Remote control through Web user interface, written with AJAX</li>
|
||||
<li>Sequential downloading (Download in order)</li>
|
||||
<li>
|
||||
Advanced control over torrents, trackers and peers
|
||||
<ul>
|
||||
<li>Torrents queueing and prioritizing</li>
|
||||
<li>Torrent content selection and prioritizing</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Bandwidth scheduler</li>
|
||||
<li>Torrent creation tool</li>
|
||||
<li>IP Filtering (eMule & PeerGuardian format compatible)</li>
|
||||
<li>IPv6 compliant</li>
|
||||
<li>UPnP / NAT-PMP port forwarding support</li>
|
||||
<li>Available on all platforms: Windows, Linux, macOS, FreeBSD, OS/2</li>
|
||||
<li>Available in ~70 languages</li>
|
||||
</ul>
|
||||
</description>
|
||||
<launchable type="desktop-id">org.qbittorrent.qBittorrent.desktop</launchable>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image height="675" width="1200">https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_01.png</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image height="675" width="1200">https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_02.png</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image height="675" width="1200">https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_03.png</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image height="675" width="1200">https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_04.png</image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<update_contact>sledgehammer999@qbittorrent.org</update_contact>
|
||||
<developer_name>The qBittorrent Project</developer_name>
|
||||
<url type="homepage">https://www.qbittorrent.org/</url>
|
||||
<url type="bugtracker">http://bugs.qbittorrent.org/</url>
|
||||
<url type="donation">https://www.qbittorrent.org/donate</url>
|
||||
<url type="help">http://forum.qbittorrent.org/</url>
|
||||
<url type="translate">https://github.com/qbittorrent/qBittorrent/wiki/How-to-translate-qBittorrent</url>
|
||||
</component>
|
||||
66
dist/unix/qbittorrent.appdata.xml
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright 2014 sledgehammer999 <sledgehammer999@qbittorrent.org> -->
|
||||
<component type="desktop">
|
||||
<id>qbittorrent.desktop</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-2.0 and OpenSSL</project_license>
|
||||
<name>qBittorrent</name>
|
||||
<summary>A Bittorrent Client</summary>
|
||||
<description>
|
||||
<p>
|
||||
Aiming to be a good alternative to all other bittorrent clients out
|
||||
there, qBittorrent is fast, stable and provides unicode support as well
|
||||
as many other features. Additionally, qBittorrent runs and provides those
|
||||
same features on all major platforms (Linux, Mac OS X, Windows, OS/2, FreeBSD).
|
||||
</p>
|
||||
<p>
|
||||
It is programmed in C++ / Qt and uses libtorrent (sometimes called
|
||||
libtorrent-rasterbar) by Arvid Norberg. GeoLite data, created by MaxMind,
|
||||
are included in qBittorrent. Its features include:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Polished µTorrent-like User Interface</li>
|
||||
<li>Well-integrated and extensible Search Engine</li>
|
||||
<li>All Bittorrent extensions (DHT, Peer Exchange, Full encryption, Magnet/BitComet URIs, ...)</li>
|
||||
<li>Remote control through a Web user interface</li>
|
||||
<li>Advanced control over trackers, peers and torrents</li>
|
||||
<li>UPnP / NAT-PMP port forwarding support</li>
|
||||
<li>Available in ~25 languages (Unicode support)</li>
|
||||
<li>Torrent creation tool</li>
|
||||
<li>Advanced RSS support with download filters (inc. regex)</li>
|
||||
<li>Bandwidth scheduler</li>
|
||||
<li>IP Filtering (eMule and PeerGuardian compatible)</li>
|
||||
<li>IPv6 compliant</li>
|
||||
<li>Sequential downloading (aka "Download in order")</li>
|
||||
</ul>
|
||||
</description>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image height="675" width="1200">
|
||||
https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_01.png
|
||||
</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image height="675" width="1200">
|
||||
https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_02.png
|
||||
</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image height="675" width="1200">
|
||||
https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_03.png
|
||||
</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image height="675" width="1200">
|
||||
https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_04.png
|
||||
</image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<url type="homepage">http://www.qbittorrent.org/</url>
|
||||
<update_contact>sledgehammer999@qbittorrent.org</update_contact>
|
||||
<developer_name>The qBittorrent Project</developer_name>
|
||||
<url type="bugtracker">http://bugs.qbittorrent.org/</url>
|
||||
<url type="donation">https://www.qbittorrent.org/donate</url>
|
||||
<url type="help">http://forum.qbittorrent.org/</url>
|
||||
<url type="translate">https://github.com/qbittorrent/qBittorrent/wiki/How-to-translate-qBittorrent</url>
|
||||
</component>
|
||||
2
dist/windows/installer.nsi
vendored
@@ -86,7 +86,7 @@ Section $(inst_qbt_req) ;"qBittorrent (required)"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "UninstallString" '"$INSTDIR\uninst.exe"'
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "DisplayIcon" '"$INSTDIR\qbittorrent.exe",0'
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "Publisher" "The qBittorrent project"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "URLInfoAbout" "https://www.qbittorrent.org"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "URLInfoAbout" "http://www.qbittorrent.org"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "DisplayVersion" "${PROG_VERSION}"
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "NoModify" 1
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "NoRepair" 1
|
||||
|
||||
BIN
dist/windows/nsis plugins/FindProc Unicode-source.zip
vendored
Normal file
BIN
dist/windows/nsis plugins/FindProcDLL Unicode bin.zip
vendored
Normal file
4
dist/windows/options.nsi
vendored
@@ -27,7 +27,7 @@ XPStyle on
|
||||
!define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
|
||||
|
||||
; Program specific
|
||||
!define PROG_VERSION "4.1.6"
|
||||
!define PROG_VERSION "3.3.14"
|
||||
|
||||
!define MUI_FINISHPAGE_RUN
|
||||
!define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
|
||||
@@ -50,7 +50,7 @@ XPStyle on
|
||||
;Installer Version Information
|
||||
VIAddVersionKey "ProductName" "qBittorrent"
|
||||
VIAddVersionKey "CompanyName" "The qBittorrent project"
|
||||
VIAddVersionKey "LegalCopyright" "Copyright ©2006-2019 The qBittorrent project"
|
||||
VIAddVersionKey "LegalCopyright" "Copyright ©2006-2017 The qBittorrent project"
|
||||
VIAddVersionKey "FileDescription" "qBittorrent - A Bittorrent Client"
|
||||
VIAddVersionKey "FileVersion" "${PROG_VERSION}"
|
||||
|
||||
|
||||
2
dist/windows/qt.conf
vendored
@@ -2,4 +2,4 @@
|
||||
Translations = translations
|
||||
|
||||
[Platforms]
|
||||
;WindowsArguments = dpiawareness=1
|
||||
WindowsArguments = dpiawareness=0
|
||||
|
||||
187
install.os2
Normal file
@@ -0,0 +1,187 @@
|
||||
QBittorrent installation
|
||||
|
||||
|
||||
|
||||
0. CONTENTS OF THIS FILE
|
||||
========================
|
||||
|
||||
1. INTRODUCTION
|
||||
|
||||
2. REQUIREMENTS
|
||||
|
||||
3. INSTALLATION
|
||||
|
||||
4. BUGREPORTS
|
||||
|
||||
5. CREDITS
|
||||
|
||||
6. SUPPORT AND DONATIONS
|
||||
|
||||
7. HISTORY
|
||||
|
||||
|
||||
1. INTRODUCTION
|
||||
===============
|
||||
|
||||
Welcome to QBittorrent port for OS/2 and eComStation.
|
||||
|
||||
|
||||
2. REQUIREMENTS
|
||||
===============
|
||||
|
||||
The following requirements can be installed either by rpm or by zip files.
|
||||
|
||||
RPM Installation:
|
||||
|
||||
klibc
|
||||
-----
|
||||
|
||||
1. yum install libc
|
||||
|
||||
openssl 1.0
|
||||
-----------
|
||||
|
||||
1. yum install openssl
|
||||
|
||||
pthread
|
||||
-------
|
||||
|
||||
1. yum install pthread
|
||||
|
||||
GCC4Core
|
||||
--------
|
||||
|
||||
1. yum install libgcc
|
||||
2. yum install gcc-stack-protector
|
||||
3. yum install gcc-stdc++-shared-library
|
||||
4. yum install gcc-supc++-shared-library
|
||||
|
||||
Qt4 dll
|
||||
-------
|
||||
|
||||
1. yum install libqt4
|
||||
|
||||
|
||||
ZIP Installation:
|
||||
|
||||
klibc
|
||||
-----
|
||||
|
||||
1. Download klibc 0.6.5 or better (see http://svn.netlabs.org/libc for more information)
|
||||
2. Install the files to your libpath eg x:\ecs\dll
|
||||
|
||||
openssl 1.0
|
||||
-----------
|
||||
|
||||
1. Download the zip file from http://rpm.netlabs.org/release/00/zip
|
||||
2. Install the files to your libpath eg. x:\ecs\dll
|
||||
|
||||
pthread
|
||||
-------
|
||||
|
||||
1. Download pthread 2012-03-13 or better from http://rpm.netlabs.org/release/00/zip
|
||||
2. Install the files to your libpath eg. x:\ecs\dll
|
||||
|
||||
GCC4Core
|
||||
--------
|
||||
|
||||
1. Download GCC4Core 1.2.1 or better from http://ftp.netlabs.org/pub/gcc
|
||||
2. Install the files to your libpath eg. x:\ecs\dll
|
||||
|
||||
Qt4 dll
|
||||
-------
|
||||
|
||||
1. Download Qt4 4.7.3 or better (see http://svn.netlabs.org/qt4 for more information)
|
||||
2. Install the files according to the readme
|
||||
|
||||
|
||||
3. INSTALLATION
|
||||
===============
|
||||
|
||||
To install QBittorrent, do the following:
|
||||
|
||||
1. Create a directory for QBittorrent.
|
||||
2. Extract the QBittorrent package to the new directory.
|
||||
3. Create a WPS object for QBittorrent.exe.
|
||||
4. Start QBittorrent
|
||||
5. Happy torrenting
|
||||
|
||||
|
||||
4. BUGREPORTS
|
||||
=============
|
||||
|
||||
Please create bugreports at http://svn.netlabs.org/qtapps
|
||||
Only bug reports with a reproducible bug are accepted. :-)
|
||||
|
||||
|
||||
5. CREDITS
|
||||
==========
|
||||
|
||||
The port was done by:
|
||||
|
||||
Silvan Scherrer aka _diver
|
||||
|
||||
Thanks go to:
|
||||
|
||||
* Dmitry A. Kuminov
|
||||
|
||||
They either helped me when I had some nasty questions or did some testing for
|
||||
me.
|
||||
|
||||
|
||||
6. SUPPORT AND DONATIONS
|
||||
========================
|
||||
|
||||
QBittorrent port is based on volunteer work. If you would like to support further
|
||||
development, you can do so in one of the following ways:
|
||||
|
||||
|
||||
* Donate to the Qt4 project: see qt.netlabs.org for more information
|
||||
|
||||
* Contribute to the project: Besides actual development, this also includes
|
||||
maintaining the documentation and the project web site as well as help
|
||||
for users.
|
||||
|
||||
|
||||
7. HISTORY
|
||||
==========
|
||||
|
||||
2012-09-19
|
||||
|
||||
* updated to 3.0.4 code level of QBittorrent
|
||||
* updated libtorrent to 0.16.3 level
|
||||
|
||||
2012-09-06
|
||||
|
||||
* updated to 3.0.2 code level of QBittorrent
|
||||
|
||||
2012-05-14
|
||||
|
||||
* updated to 2.9.8 code level of QBittorrent
|
||||
|
||||
2012-03-15
|
||||
|
||||
* updated to 2.9.5 code level of QBittorrent
|
||||
|
||||
2011-09-26
|
||||
|
||||
* updated to 2.8.5 code level of QBittorrent
|
||||
* updated to Qt 4.7.3
|
||||
|
||||
2011-06-20
|
||||
|
||||
* updated to 2.7.3 code level of QBittorrent
|
||||
* updated libtorrent to 0.15.6 level
|
||||
|
||||
2010-12-23
|
||||
|
||||
* updated to 2.5.2 code level of QBittorrent
|
||||
|
||||
2010-11-22
|
||||
|
||||
* updated to 2.4.11 code level of QBittorrent
|
||||
|
||||
2010-xx-xx
|
||||
|
||||
* initial port
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_boost_base.html
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
@@ -33,15 +33,7 @@
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 42
|
||||
|
||||
# example boost program (need to pass version)
|
||||
m4_define([_AX_BOOST_BASE_PROGRAM],
|
||||
[AC_LANG_PROGRAM([[
|
||||
#include <boost/version.hpp>
|
||||
]],[[
|
||||
(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($1))]));
|
||||
]])])
|
||||
#serial 26
|
||||
|
||||
AC_DEFUN([AX_BOOST_BASE],
|
||||
[
|
||||
@@ -52,121 +44,104 @@ AC_ARG_WITH([boost],
|
||||
or disable it (ARG=no)
|
||||
@<:@ARG=yes@:>@ ])],
|
||||
[
|
||||
AS_CASE([$withval],
|
||||
[no],[want_boost="no";_AX_BOOST_BASE_boost_path=""],
|
||||
[yes],[want_boost="yes";_AX_BOOST_BASE_boost_path=""],
|
||||
[want_boost="yes";_AX_BOOST_BASE_boost_path="$withval"])
|
||||
if test "$withval" = "no"; then
|
||||
want_boost="no"
|
||||
elif test "$withval" = "yes"; then
|
||||
want_boost="yes"
|
||||
ac_boost_path=""
|
||||
else
|
||||
want_boost="yes"
|
||||
ac_boost_path="$withval"
|
||||
fi
|
||||
],
|
||||
[want_boost="yes"])
|
||||
|
||||
|
||||
AC_ARG_WITH([boost-libdir],
|
||||
[AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
|
||||
[Force given directory for boost libraries.
|
||||
Note that this will override library path detection,
|
||||
so use this parameter only if default library detection fails
|
||||
and you know exactly where your boost libraries are located.])],
|
||||
[
|
||||
AS_IF([test -d "$withval"],
|
||||
[_AX_BOOST_BASE_boost_lib_path="$withval"],
|
||||
[AC_MSG_ERROR([--with-boost-libdir expected directory name])])
|
||||
],
|
||||
[_AX_BOOST_BASE_boost_lib_path=""])
|
||||
AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
|
||||
[Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
|
||||
[
|
||||
if test -d "$withval"
|
||||
then
|
||||
ac_boost_lib_path="$withval"
|
||||
else
|
||||
AC_MSG_ERROR(--with-boost-libdir expected directory name)
|
||||
fi
|
||||
],
|
||||
[ac_boost_lib_path=""]
|
||||
)
|
||||
|
||||
BOOST_LDFLAGS=""
|
||||
BOOST_CPPFLAGS=""
|
||||
AS_IF([test "x$want_boost" = "xyes"],
|
||||
[_AX_BOOST_BASE_RUNDETECT([$1],[$2],[$3])])
|
||||
AC_SUBST(BOOST_CPPFLAGS)
|
||||
AC_SUBST(BOOST_LDFLAGS)
|
||||
])
|
||||
|
||||
|
||||
# convert a version string in $2 to numeric and affect to polymorphic var $1
|
||||
AC_DEFUN([_AX_BOOST_BASE_TONUMERICVERSION],[
|
||||
AS_IF([test "x$2" = "x"],[_AX_BOOST_BASE_TONUMERICVERSION_req="1.20.0"],[_AX_BOOST_BASE_TONUMERICVERSION_req="$2"])
|
||||
_AX_BOOST_BASE_TONUMERICVERSION_req_shorten=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\.[[0-9]]*\)'`
|
||||
_AX_BOOST_BASE_TONUMERICVERSION_req_major=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\)'`
|
||||
AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_major" = "x"],
|
||||
[AC_MSG_ERROR([You should at least specify libboost major version])])
|
||||
_AX_BOOST_BASE_TONUMERICVERSION_req_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.\([[0-9]]*\)'`
|
||||
AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_minor" = "x"],
|
||||
[_AX_BOOST_BASE_TONUMERICVERSION_req_minor="0"])
|
||||
_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
|
||||
AS_IF([test "X$_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor" = "X"],
|
||||
[_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor="0"])
|
||||
_AX_BOOST_BASE_TONUMERICVERSION_RET=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req_major \* 100000 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_minor \* 100 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor`
|
||||
AS_VAR_SET($1,$_AX_BOOST_BASE_TONUMERICVERSION_RET)
|
||||
])
|
||||
|
||||
dnl Run the detection of boost should be run only if $want_boost
|
||||
AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
|
||||
_AX_BOOST_BASE_TONUMERICVERSION(WANT_BOOST_VERSION,[$1])
|
||||
if test "x$want_boost" = "xyes"; then
|
||||
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
|
||||
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
|
||||
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
|
||||
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
|
||||
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
|
||||
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
|
||||
boost_lib_version_req_sub_minor="0"
|
||||
fi
|
||||
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
|
||||
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
|
||||
succeeded=no
|
||||
|
||||
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
dnl On 64-bit systems check for system libraries in both lib64 and lib.
|
||||
dnl The former is specified by FHS, but e.g. Debian does not adhere to
|
||||
dnl this (as it rises problems for generic multi-arch support).
|
||||
dnl The last entry in the list is chosen by default when no libraries
|
||||
dnl are found, e.g. when only header-only libraries are installed!
|
||||
AS_CASE([${host_cpu}],
|
||||
[x86_64],[libsubdirs="lib64 libx32 lib lib64"],
|
||||
[ppc64|s390x|sparc64|aarch64|ppc64le],[libsubdirs="lib64 lib lib64"],
|
||||
[libsubdirs="lib"]
|
||||
)
|
||||
libsubdirs="lib"
|
||||
ax_arch=`uname -m`
|
||||
case $ax_arch in
|
||||
x86_64)
|
||||
libsubdirs="lib64 libx32 lib lib64"
|
||||
;;
|
||||
ppc64|s390x|sparc64|aarch64|ppc64le)
|
||||
libsubdirs="lib64 lib lib64 ppc64le"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
|
||||
dnl them priority over the other paths since, if libs are found there, they
|
||||
dnl are almost assuredly the ones desired.
|
||||
AS_CASE([${host_cpu}],
|
||||
[i?86],[multiarch_libsubdir="lib/i386-${host_os}"],
|
||||
[multiarch_libsubdir="lib/${host_cpu}-${host_os}"]
|
||||
)
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
|
||||
|
||||
case ${host_cpu} in
|
||||
i?86)
|
||||
libsubdirs="lib/i386-${host_os} $libsubdirs"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl first we check the system location for boost libraries
|
||||
dnl this location ist chosen if boost libraries are installed with the --layout=system option
|
||||
dnl or if you install boost with RPM
|
||||
AS_IF([test "x$_AX_BOOST_BASE_boost_path" != "x"],[
|
||||
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) includes in "$_AX_BOOST_BASE_boost_path/include"])
|
||||
AS_IF([test -d "$_AX_BOOST_BASE_boost_path/include" && test -r "$_AX_BOOST_BASE_boost_path/include"],[
|
||||
AC_MSG_RESULT([yes])
|
||||
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include"
|
||||
for _AX_BOOST_BASE_boost_path_tmp in $multiarch_libsubdir $libsubdirs; do
|
||||
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) lib path in "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp"])
|
||||
AS_IF([test -d "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" && test -r "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" ],[
|
||||
AC_MSG_RESULT([yes])
|
||||
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp";
|
||||
break;
|
||||
],
|
||||
[AC_MSG_RESULT([no])])
|
||||
done],[
|
||||
AC_MSG_RESULT([no])])
|
||||
],[
|
||||
if test X"$cross_compiling" = Xyes; then
|
||||
search_libsubdirs=$multiarch_libsubdir
|
||||
else
|
||||
search_libsubdirs="$multiarch_libsubdir $libsubdirs"
|
||||
fi
|
||||
for _AX_BOOST_BASE_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
|
||||
if test -d "$_AX_BOOST_BASE_boost_path_tmp/include/boost" && test -r "$_AX_BOOST_BASE_boost_path_tmp/include/boost" ; then
|
||||
for libsubdir in $search_libsubdirs ; do
|
||||
if ls "$_AX_BOOST_BASE_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
|
||||
if test "$ac_boost_path" != ""; then
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path/include"
|
||||
for ac_boost_path_tmp in $libsubdirs; do
|
||||
if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
|
||||
BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
|
||||
break
|
||||
fi
|
||||
done
|
||||
elif test "$cross_compiling" != yes; then
|
||||
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
|
||||
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
|
||||
for libsubdir in $libsubdirs ; do
|
||||
if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
|
||||
done
|
||||
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path_tmp/$libsubdir"
|
||||
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path_tmp/include"
|
||||
BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
|
||||
break;
|
||||
fi
|
||||
done
|
||||
])
|
||||
fi
|
||||
|
||||
dnl overwrite ld flags if we have required special directory with
|
||||
dnl --with-boost-libdir parameter
|
||||
AS_IF([test "x$_AX_BOOST_BASE_boost_lib_path" != "x"],
|
||||
[BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_lib_path"])
|
||||
if test "$ac_boost_lib_path" != ""; then
|
||||
BOOST_LDFLAGS="-L$ac_boost_lib_path"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION)])
|
||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
export CPPFLAGS
|
||||
@@ -177,7 +152,15 @@ AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
|
||||
|
||||
AC_REQUIRE([AC_PROG_CXX])
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
@%:@include <boost/version.hpp>
|
||||
]], [[
|
||||
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
||||
// Everything is okay
|
||||
#else
|
||||
# error Boost version is too old
|
||||
#endif
|
||||
]])],[
|
||||
AC_MSG_RESULT(yes)
|
||||
succeeded=yes
|
||||
found_system=yes
|
||||
@@ -189,50 +172,40 @@ AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
|
||||
|
||||
dnl if we found no boost with system layout we search for boost libraries
|
||||
dnl built and installed without the --layout=system option or for a staged(not installed) version
|
||||
if test "x$succeeded" != "xyes" ; then
|
||||
if test "x$succeeded" != "xyes"; then
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
BOOST_CPPFLAGS=
|
||||
if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
|
||||
BOOST_LDFLAGS=
|
||||
fi
|
||||
BOOST_LDFLAGS=
|
||||
_version=0
|
||||
if test -n "$_AX_BOOST_BASE_boost_path" ; then
|
||||
if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path"; then
|
||||
for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
|
||||
_version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
||||
if test "$ac_boost_path" != ""; then
|
||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
||||
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
||||
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
||||
V_CHECK=`expr $_version_tmp \> $_version`
|
||||
if test "x$V_CHECK" = "x1" ; then
|
||||
if test "$V_CHECK" = "1" ; then
|
||||
_version=$_version_tmp
|
||||
fi
|
||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
||||
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include/boost-$VERSION_UNDERSCORE"
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
|
||||
done
|
||||
dnl if nothing found search for layout used in Windows distributions
|
||||
if test -z "$BOOST_CPPFLAGS"; then
|
||||
if test -d "$_AX_BOOST_BASE_boost_path/boost" && test -r "$_AX_BOOST_BASE_boost_path/boost"; then
|
||||
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path"
|
||||
if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path"
|
||||
fi
|
||||
fi
|
||||
dnl if we found something and BOOST_LDFLAGS was unset before
|
||||
dnl (because "$_AX_BOOST_BASE_boost_lib_path" = ""), set it here.
|
||||
if test -n "$BOOST_CPPFLAGS" && test -z "$BOOST_LDFLAGS"; then
|
||||
for libsubdir in $libsubdirs ; do
|
||||
if ls "$_AX_BOOST_BASE_boost_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
|
||||
done
|
||||
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$libsubdir"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if test "x$cross_compiling" != "xyes" ; then
|
||||
for _AX_BOOST_BASE_boost_path in /usr /usr/local /opt /opt/local ; do
|
||||
if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path" ; then
|
||||
for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
|
||||
_version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
||||
if test "$cross_compiling" != yes; then
|
||||
for ac_boost_path in /usr /usr/local /opt /opt/local ; do
|
||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
||||
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
||||
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
||||
V_CHECK=`expr $_version_tmp \> $_version`
|
||||
if test "x$V_CHECK" = "x1" ; then
|
||||
if test "$V_CHECK" = "1" ; then
|
||||
_version=$_version_tmp
|
||||
best_path=$_AX_BOOST_BASE_boost_path
|
||||
best_path=$ac_boost_path
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -240,7 +213,7 @@ AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
|
||||
|
||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
||||
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
|
||||
if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
|
||||
if test "$ac_boost_lib_path" = ""; then
|
||||
for libsubdir in $libsubdirs ; do
|
||||
if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
|
||||
done
|
||||
@@ -248,7 +221,7 @@ AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$BOOST_ROOT" ; then
|
||||
if test "x$BOOST_ROOT" != "x"; then
|
||||
for libsubdir in $libsubdirs ; do
|
||||
if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
|
||||
done
|
||||
@@ -257,7 +230,7 @@ AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
|
||||
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
|
||||
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
|
||||
V_CHECK=`expr $stage_version_shorten \>\= $_version`
|
||||
if test "x$V_CHECK" = "x1" && test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
|
||||
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
|
||||
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
|
||||
BOOST_CPPFLAGS="-I$BOOST_ROOT"
|
||||
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
|
||||
@@ -272,7 +245,15 @@ AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
|
||||
export LDFLAGS
|
||||
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
@%:@include <boost/version.hpp>
|
||||
]], [[
|
||||
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
||||
// Everything is okay
|
||||
#else
|
||||
# error Boost version is too old
|
||||
#endif
|
||||
]])],[
|
||||
AC_MSG_RESULT(yes)
|
||||
succeeded=yes
|
||||
found_system=yes
|
||||
@@ -281,15 +262,17 @@ AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
|
||||
AC_LANG_POP([C++])
|
||||
fi
|
||||
|
||||
if test "x$succeeded" != "xyes" ; then
|
||||
if test "x$_version" = "x0" ; then
|
||||
AC_MSG_NOTICE([[We could not detect the boost libraries (version $1 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
|
||||
if test "$succeeded" != "yes" ; then
|
||||
if test "$_version" = "0" ; then
|
||||
AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
|
||||
else
|
||||
AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
|
||||
fi
|
||||
# execute ACTION-IF-NOT-FOUND (if present):
|
||||
ifelse([$3], , :, [$3])
|
||||
else
|
||||
AC_SUBST(BOOST_CPPFLAGS)
|
||||
AC_SUBST(BOOST_LDFLAGS)
|
||||
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
|
||||
# execute ACTION-IF-FOUND (if present):
|
||||
ifelse([$2], , :, [$2])
|
||||
@@ -297,5 +280,6 @@ AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_boost_system.html
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_boost_system.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
@@ -31,7 +31,7 @@
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 19
|
||||
#serial 18
|
||||
|
||||
AC_DEFUN([AX_BOOST_SYSTEM],
|
||||
[
|
||||
|
||||
@@ -1,13 +1,38 @@
|
||||
# Checking for pkg-config. If found, check for QtCore and query pkg-config
|
||||
# for its exec-prefix variable.
|
||||
|
||||
# FIND_QT4()
|
||||
# Sets the QT_QMAKE variable to the path of Qt4 qmake if found.
|
||||
# --------------------------------------
|
||||
AC_DEFUN([FIND_QT4],
|
||||
[PKG_CHECK_EXISTS([QtCore >= 4.8.0],
|
||||
[PKG_CHECK_VAR(QT_QMAKE,
|
||||
[QtCore >= 4.8.0],
|
||||
[moc_location],
|
||||
[QT_QMAKE=`AS_DIRNAME(["$QT_QMAKE"])`])
|
||||
])
|
||||
|
||||
AS_IF([test -f "$QT_QMAKE/qmake"],
|
||||
[QT_QMAKE="$QT_QMAKE/qmake"],
|
||||
[AS_IF([test -f "$QT_QMAKE/qmake-qt4"],
|
||||
[QT_QMAKE="$QT_QMAKE/qmake-qt4"],
|
||||
[QT_QMAKE=""])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for Qt4 qmake >= 4.8.0])
|
||||
AS_IF([test "x$QT_QMAKE" != "x"],
|
||||
[AC_MSG_RESULT([$QT_QMAKE])],
|
||||
[AC_MSG_RESULT([not found])]
|
||||
)
|
||||
])
|
||||
|
||||
# FIND_QT5()
|
||||
# Sets the QT_QMAKE variable to the path of Qt5 qmake if found.
|
||||
# --------------------------------------
|
||||
AC_DEFUN([FIND_QT5],
|
||||
[PKG_CHECK_EXISTS([Qt5Core >= 5.5.1],
|
||||
[PKG_CHECK_EXISTS([Qt5Core >= 5.2.0],
|
||||
[PKG_CHECK_VAR(QT_QMAKE,
|
||||
[Qt5Core >= 5.5.1],
|
||||
[Qt5Core >= 5.2.0],
|
||||
[host_bins])
|
||||
])
|
||||
|
||||
@@ -18,7 +43,7 @@ AS_IF([test -f "$QT_QMAKE/qmake"],
|
||||
[QT_QMAKE=""])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for Qt5 qmake >= 5.5.1])
|
||||
AC_MSG_CHECKING([for Qt5 qmake >= 5.2.0])
|
||||
AS_IF([test "x$QT_QMAKE" != "x"],
|
||||
[AC_MSG_RESULT([$QT_QMAKE])],
|
||||
[AC_MSG_RESULT([not found])]
|
||||
@@ -29,23 +54,19 @@ 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.5.1])
|
||||
PKG_CHECK_EXISTS([Qt5DBus >= 5.5.1],
|
||||
[AS_IF([test "x$with_qt4" = "xno"],
|
||||
[AC_MSG_CHECKING([for Qt5DBus >= 5.2.0])
|
||||
PKG_CHECK_EXISTS([Qt5DBus >= 5.2.0],
|
||||
[AC_MSG_RESULT([found])
|
||||
HAVE_QTDBUS=[true]],
|
||||
[AC_MSG_RESULT([not found])
|
||||
HAVE_QTDBUS=[false]])
|
||||
])
|
||||
|
||||
# DETECT_CPP11_PROGRAM()
|
||||
# Detects if at least C++11 mode is enabled.
|
||||
# --------------------------------------
|
||||
AC_DEFUN([DETECT_CPP11_PROGRAM],
|
||||
[AC_LANG_PROGRAM([[
|
||||
#ifndef __cplusplus
|
||||
#error "This is not a C++ compiler"
|
||||
#elif __cplusplus < 201103L
|
||||
#error "This is not a C++11 compiler"
|
||||
#endif]],
|
||||
[[]])
|
||||
],
|
||||
[AC_MSG_CHECKING([for QtDBus >= 4.8.0])
|
||||
PKG_CHECK_EXISTS([QtDBus >= 4.8.0],
|
||||
[AC_MSG_RESULT([found])
|
||||
HAVE_QTDBUS=[true]],
|
||||
[AC_MSG_RESULT([not found])
|
||||
HAVE_QTDBUS=[false]])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -9,7 +9,10 @@ exists($$OUT_PWD/../conf.pri) {
|
||||
include(conf.pri)
|
||||
}
|
||||
|
||||
LIBS += -framework Carbon -framework IOKit -framework AppKit
|
||||
LIBS += -framework Carbon -framework IOKit
|
||||
|
||||
# C++11 support
|
||||
lessThan(QT_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=c++11
|
||||
|
||||
QT_LANG_PATH = ../dist/qt-translations
|
||||
DIST_PATH = ../dist/mac
|
||||
|
||||
19
os2conf.pri
Normal file
@@ -0,0 +1,19 @@
|
||||
# C++11 support
|
||||
lessThan(QT_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=c++11
|
||||
|
||||
exists(conf.pri) {
|
||||
# to the conf.pri goes all system dependent stuff
|
||||
include(conf.pri)
|
||||
}
|
||||
|
||||
LIBS += \
|
||||
-ltorrent-rasterbar \
|
||||
-lboost_thread \
|
||||
-lboost_system \
|
||||
-lboost_filesystem \
|
||||
-lssl -lcrypto -lidn -lpthread -lz
|
||||
|
||||
RC_FILE = qbittorrent_os2.rc
|
||||
|
||||
# LIBTORRENT DEFINES
|
||||
DEFINES += BOOST_ASIO_DYN_LINK
|
||||
@@ -3,6 +3,7 @@ TEMPLATE = subdirs
|
||||
SUBDIRS += src
|
||||
|
||||
include(version.pri)
|
||||
include(qm_gen.pri)
|
||||
|
||||
# Make target to create release tarball. Use 'make tarball'
|
||||
tarball.commands += rm -fR ../$${PROJECT_NAME}-$${PROJECT_VERSION}/ &&
|
||||
@@ -16,11 +17,3 @@ tarball.commands += xz -f $${PROJECT_NAME}-$${PROJECT_VERSION}.tar &&
|
||||
tarball.commands += rm -fR $${PROJECT_NAME}-$${PROJECT_VERSION}
|
||||
|
||||
QMAKE_EXTRA_TARGETS += tarball
|
||||
|
||||
# Translations included here (at top level) is to avoid regenerating the .qm files
|
||||
# every time when src.pro is processed
|
||||
include(src/lang/lang.pri)
|
||||
|
||||
# For Qt Creator beautifier
|
||||
DISTFILES += \
|
||||
uncrustify.cfg
|
||||
|
||||
24
qm_gen.pri
Normal file
@@ -0,0 +1,24 @@
|
||||
TS_IN = $$fromfile(src/src.pro,TRANSLATIONS)
|
||||
TS_IN_NOEXT = $$replace(TS_IN,".ts","")
|
||||
|
||||
isEmpty(QMAKE_LRELEASE) {
|
||||
win32|os2:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe
|
||||
else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
|
||||
unix {
|
||||
equals(QT_MAJOR_VERSION, 4) {
|
||||
!exists($$QMAKE_LRELEASE) { QMAKE_LRELEASE = lrelease-qt4 }
|
||||
}
|
||||
equals(QT_MAJOR_VERSION, 5) {
|
||||
!exists($$QMAKE_LRELEASE) { QMAKE_LRELEASE = lrelease-qt5 }
|
||||
}
|
||||
} else {
|
||||
!exists($$QMAKE_LRELEASE) { QMAKE_LRELEASE = lrelease }
|
||||
}
|
||||
}
|
||||
|
||||
message("Building translations")
|
||||
for(L,TS_IN_NOEXT) {
|
||||
message("Processing $${L}")
|
||||
system("$$QMAKE_LRELEASE -silent src/$${L}.ts -qm src/$${L}.qm")
|
||||
!exists("src/$${L}.qm"):error("Building translations failed, cannot continue")
|
||||
}
|
||||
@@ -1,89 +1,110 @@
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
# If C++14 is available, use it as libtorent ABI depends on 11/14 version
|
||||
if (cxx_std_14 IN_LIST CMAKE_CXX_COMPILE_FEATURES)
|
||||
message(STATUS "Building in C++14 mode")
|
||||
set(CMAKE_CXX_STANDARD "14")
|
||||
else()
|
||||
message(STATUS "Building in C++11 mode")
|
||||
set(CMAKE_CXX_STANDARD "11")
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD "11")
|
||||
add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
include(MacroQbtCompilerSettings)
|
||||
qbt_set_compiler_options()
|
||||
|
||||
include(MacroLinkQtComponents)
|
||||
include(QbtTargetSources)
|
||||
|
||||
find_package(Boost ${requiredBoostVersion} REQUIRED)
|
||||
find_package(LibtorrentRasterbar REQUIRED)
|
||||
|
||||
if (Boost_VERSION VERSION_LESS 106000)
|
||||
add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
endif()
|
||||
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml LinguistTools)
|
||||
find_package(Qt5Widgets ${requiredQtVersion})
|
||||
if (Qt5Widgets_FOUND)
|
||||
find_package(Qt5DBus ${requiredQtVersion})
|
||||
else()
|
||||
add_definitions(-DDISABLE_GUI)
|
||||
endif()
|
||||
|
||||
set_package_properties(Qt5Widgets PROPERTIES
|
||||
DESCRIPTION "Set of components for creating classic desktop-style UIs for the Qt5 framework"
|
||||
PURPOSE "Enables qBittorrent GUI. Unneeded for headless configuration."
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
|
||||
set_package_properties(Qt5DBus PROPERTIES
|
||||
DESCRIPTION "Qt5 module for inter-process communication over the D-Bus protocol"
|
||||
PURPOSE "Enables communication with other system components (e.g. notification service) via D-Bus. "
|
||||
TYPE RECOMMENDED
|
||||
)
|
||||
# Qt
|
||||
if (QT5)
|
||||
add_definitions(-DQBT_USES_QT5)
|
||||
list(APPEND QBT_QT_COMPONENTS Core Network Xml)
|
||||
if (GUI)
|
||||
list (APPEND QBT_QT_COMPONENTS Concurrent Gui Widgets)
|
||||
endif (GUI)
|
||||
if (DBUS)
|
||||
list (APPEND QBT_QT_COMPONENTS DBus)
|
||||
endif (DBUS)
|
||||
find_package(Qt5 5.2.0 COMPONENTS ${QBT_QT_COMPONENTS} REQUIRED)
|
||||
else (QT5)
|
||||
list(APPEND QBT_QT_COMPONENTS QtCore QtNetwork QtXml)
|
||||
if (GUI)
|
||||
list (APPEND QBT_QT_COMPONENTS QtGui)
|
||||
endif (GUI)
|
||||
if (DBUS)
|
||||
list (APPEND QBT_QT_COMPONENTS QtDBus)
|
||||
endif (DBUS)
|
||||
find_package(Qt4 4.8.0 COMPONENTS ${QBT_QT_COMPONENTS} REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
add_definitions(-DQStringLiteral=QLatin1String)
|
||||
endif (QT5)
|
||||
|
||||
set(CMAKE_AUTOMOC True)
|
||||
list(APPEND CMAKE_AUTORCC_OPTIONS -compress 9 -threshold 5)
|
||||
if (APPLE)
|
||||
# Workaround CMake bug (autogen does not pass required parameters to moc)
|
||||
# Relevant issue: https://gitlab.kitware.com/cmake/cmake/issues/18041
|
||||
list(APPEND CMAKE_AUTOMOC_MOC_OPTIONS -DQ_OS_MAC -DQ_OS_DARWIN)
|
||||
endif ()
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# defines
|
||||
add_definitions(-DQT_NO_CAST_TO_ASCII)
|
||||
# Efficient construction for QString & QByteArray (Qt >= 4.8)
|
||||
add_definitions(-DQT_USE_QSTRINGBUILDER)
|
||||
# Fast concatenation (Qt >= 4.6)
|
||||
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
|
||||
if (WIN32)
|
||||
add_definitions(-DNOMINMAX)
|
||||
endif (WIN32)
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
if (NOT GUI)
|
||||
add_definitions(-DDISABLE_GUI -DDISABLE_COUNTRIES_RESOLUTION)
|
||||
endif (NOT GUI)
|
||||
|
||||
if (NOT WEBUI)
|
||||
add_definitions(-DDISABLE_WEBUI)
|
||||
endif (NOT WEBUI)
|
||||
|
||||
if (STACKTRACE_WIN)
|
||||
add_definitions(-DSTACKTRACE_WIN)
|
||||
endif(STACKTRACE_WIN)
|
||||
# nogui {
|
||||
# TARGET = qbittorrent-nox
|
||||
# } else {
|
||||
# CONFIG(static) {
|
||||
# DEFINES += QBT_STATIC_QT
|
||||
# QTPLUGIN += qico
|
||||
# }
|
||||
# TARGET = qbittorrent
|
||||
# }
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
add_compile_options(-Wformat -Wformat-security)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
message(STATUS "Project is built in DEBUG mode.")
|
||||
else()
|
||||
else (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
message(STATUS "Project is built in RELEASE mode.")
|
||||
message(STATUS "Disabling debug output.")
|
||||
add_definitions(-DQT_NO_DEBUG_OUTPUT)
|
||||
endif()
|
||||
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
|
||||
set(QBT_USE_GUI ${GUI})
|
||||
set(QBT_USE_WEBUI ${WEBUI})
|
||||
set(QBT_USES_QT5 ${QT5})
|
||||
|
||||
configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
find_package(QtSingleApplication)
|
||||
set_package_properties(QtSingleApplication PROPERTIES
|
||||
URL "https://code.qt.io/cgit/qt-solutions/qt-solutions.git/"
|
||||
DESCRIPTION "Qt library to start applications only once per user"
|
||||
TYPE RECOMMENDED
|
||||
PURPOSE "Use the system qtsingleapplication library or shipped one otherwise"
|
||||
)
|
||||
if (GUI)
|
||||
set(QBT_TARGET_NAME qbittorrent)
|
||||
else (GUI)
|
||||
set(QBT_TARGET_NAME qbittorrent-nox)
|
||||
endif (GUI)
|
||||
|
||||
if (NOT QtSingleApplication_FOUND)
|
||||
|
||||
if (SYSTEM_QTSINGLEAPPLICATION)
|
||||
find_package(QtSingleApplication REQUIRED)
|
||||
else (SYSTEM_QTSINGLEAPPLICATION)
|
||||
add_subdirectory(app/qtsingleapplication)
|
||||
endif ()
|
||||
endif (SYSTEM_QTSINGLEAPPLICATION)
|
||||
|
||||
add_subdirectory(app)
|
||||
add_subdirectory(base)
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
if (GUI)
|
||||
add_subdirectory(gui)
|
||||
endif ()
|
||||
endif (GUI)
|
||||
|
||||
if (WEBUI)
|
||||
add_subdirectory(webui)
|
||||
|
||||
@@ -1,84 +1,102 @@
|
||||
add_executable(qBittorrent
|
||||
project(qbt_executable)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(QBT_APP_HEADERS
|
||||
application.h
|
||||
cmdoptions.h
|
||||
filelogger.h
|
||||
upgrade.h
|
||||
)
|
||||
|
||||
set(QBT_APP_SOURCES
|
||||
application.cpp
|
||||
cmdoptions.cpp
|
||||
filelogger.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_include_directories(qBittorrent PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_link_libraries(qBittorrent
|
||||
PRIVATE
|
||||
qbt_base
|
||||
)
|
||||
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
AUTOUIC True
|
||||
AUTORCC True
|
||||
MACOSX_BUNDLE True
|
||||
)
|
||||
|
||||
# translations
|
||||
include(QbtTranslations)
|
||||
|
||||
file(GLOB QBT_TS_FILES ../lang/*.ts)
|
||||
qbt_add_translations(qBittorrent QRC_FILE "../lang/lang.qrc" TS_FILES ${QBT_TS_FILES})
|
||||
get_filename_component(QBT_QM_FILES_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/../lang" ABSOLUTE)
|
||||
set_source_files_properties(${QBT_TS_FILES} PROPERTIES OUTPUT_LOCATION "${QBT_QM_FILES_BINARY_DIR}")
|
||||
|
||||
if (WEBUI)
|
||||
file(GLOB QBT_WEBUI_TS_FILES ../webui/www/translations/*.ts)
|
||||
qbt_add_translations(qBittorrent QRC_FILE "../webui/www/translations/webui_translations.qrc" TS_FILES ${QBT_WEBUI_TS_FILES})
|
||||
endif()
|
||||
if (QT5)
|
||||
find_package(Qt5 COMPONENTS LinguistTools REQUIRED)
|
||||
qt5_add_translation(QBT_QM_FILES ${QBT_TS_FILES})
|
||||
else (QT5)
|
||||
qt4_add_translation(QBT_QM_FILES ${QBT_TS_FILES})
|
||||
endif (QT5)
|
||||
|
||||
get_filename_component(_lang_qrc_src "${CMAKE_CURRENT_SOURCE_DIR}/../lang.qrc" ABSOLUTE)
|
||||
get_filename_component(_lang_qrc_dst "${CMAKE_CURRENT_BINARY_DIR}/../lang.qrc" ABSOLUTE)
|
||||
get_filename_component(_lang_qrc_dst_dir "${CMAKE_CURRENT_BINARY_DIR}/../" ABSOLUTE)
|
||||
|
||||
message(STATUS "copying ${_lang_qrc_src} -> ${_lang_qrc_dst}")
|
||||
file(COPY ${_lang_qrc_src} DESTINATION ${_lang_qrc_dst_dir})
|
||||
|
||||
set_source_files_properties("${_lang_qrc_dst}" PROPERTIES GENERATED True)
|
||||
foreach(qm_file ${QBT_QM_FILES})
|
||||
set_source_files_properties("${_lang_qrc_dst}" PROPERTIES OBJECT_DEPENDS ${qm_file})
|
||||
endforeach()
|
||||
|
||||
set(QBT_APP_RESOURCES
|
||||
../icons/icons.qrc
|
||||
../searchengine/searchengine.qrc
|
||||
../icons.qrc
|
||||
../searchengine.qrc
|
||||
"${_lang_qrc_dst}"
|
||||
)
|
||||
|
||||
# With AUTORCC rcc is ran by cmake before language files are generated,
|
||||
# and thus we call rcc explicitly
|
||||
qt5_add_resources(QBT_APP_RESOURCE_SOURCE ${QBT_APP_RESOURCES})
|
||||
if (QT5)
|
||||
qt5_add_resources(QBT_APP_RESOURCE_SOURCE ${QBT_APP_RESOURCES})
|
||||
else (QT5)
|
||||
qt4_add_resources(QBT_APP_RESOURCE_SOURCE ${QBT_APP_RESOURCES})
|
||||
endif (QT5)
|
||||
|
||||
if (WIN32)
|
||||
if (MINGW)
|
||||
target_sources(qBittorrent PRIVATE ../qbittorrent_mingw.rc)
|
||||
list (APPEND QBT_APP_SOURCES ../qbittorrent_mingw.rc)
|
||||
else (MINGW)
|
||||
target_sources(qBittorrent PRIVATE ../qbittorrent.rc)
|
||||
list (APPEND QBT_APP_SOURCES ../qbittorrent.rc)
|
||||
endif (MINGW)
|
||||
target_sources(qBittorrent PRIVATE ../qbittorrent.exe.manifest)
|
||||
list(APPEND QBT_APP_SOURCES ../qbittorrent.exe.manifest)
|
||||
endif (WIN32)
|
||||
|
||||
if (STACKTRACE)
|
||||
if (UNIX)
|
||||
target_sources(qBittorrent PRIVATE stacktrace.h)
|
||||
else (UNIX)
|
||||
target_sources(qBittorrent PRIVATE stacktrace_win.h)
|
||||
if (Qt5Widgets_FOUND)
|
||||
target_sources(qBittorrent PRIVATE stacktracedialog.h)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
endif (UNIX)
|
||||
endif (STACKTRACE)
|
||||
if (UNIX)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace.h)
|
||||
endif (UNIX)
|
||||
|
||||
if (STACKTRACE_WIN)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace_win.h)
|
||||
if (GUI)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace_win_dlg.h)
|
||||
endif (GUI)
|
||||
endif (STACKTRACE_WIN)
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
target_link_libraries(qBittorrent PRIVATE qbt_searchengine qbt_gui)
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
OUTPUT_NAME qbittorrent
|
||||
WIN32_EXECUTABLE True
|
||||
# usesystemqtsingleapplication {
|
||||
# nogui {
|
||||
# CONFIG += qtsinglecoreapplication
|
||||
# } else {
|
||||
# CONFIG += qtsingleapplication
|
||||
# }
|
||||
# } else {
|
||||
# nogui {
|
||||
# include(qtsingleapplication/qtsinglecoreapplication.pri)
|
||||
# } else {
|
||||
# include(qtsingleapplication/qtsingleapplication.pri)
|
||||
# }
|
||||
# }
|
||||
|
||||
# upgrade code
|
||||
list(APPEND QBT_APP_HEADERS upgrade.h)
|
||||
list(APPEND QBT_TARGET_LIBRARIES qbt_base)
|
||||
|
||||
if (GUI)
|
||||
list(APPEND QBT_TARGET_LIBRARIES qbt_searchengine qbt_gui)
|
||||
include_directories(../gui
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../gui
|
||||
)
|
||||
else(Qt5Widgets_FOUND)
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
OUTPUT_NAME qbittorrent-nox
|
||||
)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
endif (GUI)
|
||||
|
||||
if (WEBUI)
|
||||
target_link_libraries(qBittorrent PRIVATE qbt_webui)
|
||||
list(APPEND QBT_TARGET_LIBRARIES qbt_webui)
|
||||
endif (WEBUI)
|
||||
|
||||
# we have to include resources into the bundle
|
||||
@@ -130,32 +148,39 @@ if (APPLE)
|
||||
PROPERTIES MACOSX_PACKAGE_LOCATION translations)
|
||||
endif (APPLE)
|
||||
|
||||
target_sources(qBittorrent PRIVATE ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
|
||||
add_executable(${QBT_TARGET_NAME} ${QBT_APP_HEADERS} ${QBT_APP_SOURCES} ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
|
||||
set_target_properties(${QBT_TARGET_NAME}
|
||||
PROPERTIES
|
||||
AUTOUIC True
|
||||
AUTORCC True
|
||||
MACOSX_BUNDLE True
|
||||
)
|
||||
|
||||
get_target_property(QBT_EXECUTABLE_NAME qBittorrent OUTPUT_NAME)
|
||||
if (GUI AND WIN32)
|
||||
set_target_properties(${QBT_TARGET_NAME} PROPERTIES WIN32_EXECUTABLE True)
|
||||
endif (GUI AND WIN32)
|
||||
|
||||
target_link_libraries(qBittorrent PRIVATE ${QBT_TARGET_LIBRARIES} QtSingleApplication::QtSingleApplication)
|
||||
target_link_libraries(${QBT_TARGET_NAME} ${QBT_TARGET_LIBRARIES} QtSingleApplication::QtSingleApplication)
|
||||
|
||||
if (APPLE)
|
||||
set(qbt_BUNDLE_NAME ${QBT_EXECUTABLE_NAME})
|
||||
set(qbt_BUNDLE_NAME "${QBT_TARGET_NAME}")
|
||||
|
||||
# substitute @EXECUTABLE@ in dist/mac/Info.plist
|
||||
set(EXECUTABLE ${qbt_BUNDLE_NAME})
|
||||
configure_file(${qBittorrent_SOURCE_DIR}/dist/mac/Info.plist ${qBittorrent_BINARY_DIR}/dist/mac/Info.plist @ONLY)
|
||||
|
||||
set_target_properties(qBittorrent PROPERTIES
|
||||
set_target_properties(${QBT_TARGET_NAME} PROPERTIES
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "${qbt_BUNDLE_NAME}"
|
||||
MACOSX_BUNDLE_INFO_PLIST ${qBittorrent_BINARY_DIR}/dist/mac/Info.plist
|
||||
)
|
||||
endif (APPLE)
|
||||
|
||||
# installation
|
||||
install(TARGETS qBittorrent
|
||||
install(TARGETS ${QBT_TARGET_NAME}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
BUNDLE DESTINATION .
|
||||
COMPONENT runtime)
|
||||
|
||||
if (Qt5Widgets_FOUND AND APPLE)
|
||||
find_package(Qt5Svg REQUIRED)
|
||||
include(bundle)
|
||||
endif (Qt5Widgets_FOUND AND APPLE)
|
||||
if (APPLE AND GUI)
|
||||
install(SCRIPT ${OSX_RES_SRC_DIR}/bundle.cmake)
|
||||
endif (APPLE AND GUI)
|
||||
|
||||
@@ -16,25 +16,19 @@ usesystemqtsingleapplication {
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/application.h \
|
||||
$$PWD/cmdoptions.h \
|
||||
$$PWD/filelogger.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/application.cpp \
|
||||
$$PWD/cmdoptions.cpp \
|
||||
$$PWD/filelogger.cpp \
|
||||
$$PWD/main.cpp
|
||||
|
||||
stacktrace {
|
||||
unix {
|
||||
HEADERS += $$PWD/stacktrace.h
|
||||
}
|
||||
else {
|
||||
HEADERS += $$PWD/stacktrace_win.h
|
||||
!nogui {
|
||||
HEADERS += $$PWD/stacktracedialog.h
|
||||
FORMS += $$PWD/stacktracedialog.ui
|
||||
}
|
||||
unix: HEADERS += $$PWD/stacktrace.h
|
||||
strace_win {
|
||||
HEADERS += $$PWD/stacktrace_win.h
|
||||
!nogui {
|
||||
HEADERS += $$PWD/stacktrace_win_dlg.h
|
||||
FORMS += $$PWD/stacktrace_win_dlg.ui
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,136 +27,107 @@
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#include "application.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QAtomicInt>
|
||||
#include <QDebug>
|
||||
#include <QLibraryInfo>
|
||||
#include <QFileInfo>
|
||||
#include <QLocale>
|
||||
#include <QProcess>
|
||||
#include <QLibraryInfo>
|
||||
#include <QSysInfo>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <memory>
|
||||
#include <Shellapi.h>
|
||||
#endif
|
||||
#include <QProcess>
|
||||
#include <QAtomicInt>
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
#include <QMessageBox>
|
||||
#include "gui/guiiconprovider.h"
|
||||
#ifdef Q_OS_WIN
|
||||
#include <QSessionManager>
|
||||
#include <windows.h>
|
||||
#include <QSharedMemory>
|
||||
#include <QSessionManager>
|
||||
#endif // Q_OS_WIN
|
||||
#ifdef Q_OS_MAC
|
||||
#include <QFileOpenEvent>
|
||||
#include <QFont>
|
||||
#include <QUrl>
|
||||
#endif // Q_OS_MAC
|
||||
#include "addnewtorrentdialog.h"
|
||||
#include "gui/guiiconprovider.h"
|
||||
#include "mainwindow.h"
|
||||
#include "shutdownconfirmdialog.h"
|
||||
#include "addnewtorrentdialog.h"
|
||||
#include "shutdownconfirmdlg.h"
|
||||
#else // DISABLE_GUI
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/exceptions.h"
|
||||
#include "base/iconprovider.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/net/geoipmanager.h"
|
||||
#include "base/net/proxyconfigurationmanager.h"
|
||||
#include "base/net/smtp.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/profile.h"
|
||||
#include "base/rss/rss_autodownloader.h"
|
||||
#include "base/rss/rss_session.h"
|
||||
#include "base/scanfoldersmodel.h"
|
||||
#include "base/search/searchpluginmanager.h"
|
||||
#include "base/settingsstorage.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "filelogger.h"
|
||||
|
||||
#ifndef DISABLE_WEBUI
|
||||
#include "webui/webui.h"
|
||||
#endif
|
||||
|
||||
#include "application.h"
|
||||
#include "filelogger.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/settingsstorage.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/iconprovider.h"
|
||||
#include "base/scanfoldersmodel.h"
|
||||
#include "base/net/smtp.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/net/geoipmanager.h"
|
||||
#include "base/net/proxyconfigurationmanager.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
#define SETTINGS_KEY(name) "Application/" name
|
||||
|
||||
// FileLogger properties keys
|
||||
#define FILELOGGER_SETTINGS_KEY(name) QStringLiteral(SETTINGS_KEY("FileLogger/") name)
|
||||
#define FILELOGGER_SETTINGS_KEY(name) SETTINGS_KEY("FileLogger/") name
|
||||
const QString KEY_FILELOGGER_ENABLED = FILELOGGER_SETTINGS_KEY("Enabled");
|
||||
const QString KEY_FILELOGGER_PATH = FILELOGGER_SETTINGS_KEY("Path");
|
||||
const QString KEY_FILELOGGER_BACKUP = FILELOGGER_SETTINGS_KEY("Backup");
|
||||
const QString KEY_FILELOGGER_DELETEOLD = FILELOGGER_SETTINGS_KEY("DeleteOld");
|
||||
const QString KEY_FILELOGGER_MAXSIZEBYTES = FILELOGGER_SETTINGS_KEY("MaxSizeBytes");
|
||||
const QString KEY_FILELOGGER_MAXSIZE = FILELOGGER_SETTINGS_KEY("MaxSize");
|
||||
const QString KEY_FILELOGGER_AGE = FILELOGGER_SETTINGS_KEY("Age");
|
||||
const QString KEY_FILELOGGER_AGETYPE = FILELOGGER_SETTINGS_KEY("AgeType");
|
||||
|
||||
// just a shortcut
|
||||
//just a shortcut
|
||||
inline SettingsStorage *settings() { return SettingsStorage::instance(); }
|
||||
|
||||
const QString LOG_FOLDER = QStringLiteral("logs");
|
||||
const QChar PARAMS_SEPARATOR = '|';
|
||||
|
||||
const QString DEFAULT_PORTABLE_MODE_PROFILE_DIR = QStringLiteral("profile");
|
||||
|
||||
const int MIN_FILELOG_SIZE = 1024; // 1KiB
|
||||
const int MAX_FILELOG_SIZE = 1000 * 1024 * 1024; // 1000MiB
|
||||
const int DEFAULT_FILELOG_SIZE = 65 * 1024; // 65KiB
|
||||
const QString LOG_FOLDER("logs");
|
||||
const char PARAMS_SEPARATOR[] = "|";
|
||||
}
|
||||
|
||||
Application::Application(const QString &id, int &argc, char **argv)
|
||||
: BaseApplication(id, argc, argv)
|
||||
, m_running(false)
|
||||
, m_shutdownAct(ShutdownDialogAction::Exit)
|
||||
, m_commandLineArgs(parseCommandLine(this->arguments()))
|
||||
#ifndef DISABLE_WEBUI
|
||||
, m_webui(nullptr)
|
||||
#endif
|
||||
{
|
||||
qRegisterMetaType<Log::Msg>("Log::Msg");
|
||||
|
||||
setApplicationName("qBittorrent");
|
||||
setOrganizationDomain("qbittorrent.org");
|
||||
validateCommandLineParameters();
|
||||
|
||||
QString profileDir = m_commandLineArgs.portableMode
|
||||
? QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(DEFAULT_PORTABLE_MODE_PROFILE_DIR)
|
||||
: m_commandLineArgs.profileDir;
|
||||
|
||||
Profile::initialize(profileDir, m_commandLineArgs.configurationName,
|
||||
m_commandLineArgs.relativeFastresumePaths || m_commandLineArgs.portableMode);
|
||||
|
||||
Logger::initInstance();
|
||||
SettingsStorage::initInstance();
|
||||
Preferences::initInstance();
|
||||
|
||||
if (m_commandLineArgs.webUiPort > 0) // it will be -1 when user did not set any value
|
||||
Preferences::instance()->setWebUiPort(m_commandLineArgs.webUiPort);
|
||||
#if defined(Q_OS_MACX) && !defined(DISABLE_GUI)
|
||||
if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) {
|
||||
// fix Mac OS X 10.9 (mavericks) font issue
|
||||
// https://bugreports.qt-project.org/browse/QTBUG-32789
|
||||
QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
|
||||
}
|
||||
#endif
|
||||
|
||||
setApplicationName("qBittorrent");
|
||||
initializeTranslation();
|
||||
|
||||
#if !defined(DISABLE_GUI)
|
||||
#ifdef QBT_USES_QT5
|
||||
setAttribute(Qt::AA_UseHighDpiPixmaps, true); // opt-in to the high DPI pixmap support
|
||||
#endif // QBT_USES_QT5
|
||||
setQuitOnLastWindowClosed(false);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
setDesktopFileName("org.qbittorrent.qBittorrent");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(DISABLE_GUI)
|
||||
connect(this, &QGuiApplication::commitDataRequest, this, &Application::shutdownCleanup, Qt::DirectConnection);
|
||||
connect(this, SIGNAL(commitDataRequest(QSessionManager &)), this, SLOT(shutdownCleanup(QSessionManager &)), Qt::DirectConnection);
|
||||
#endif
|
||||
|
||||
connect(this, &Application::messageReceived, this, &Application::processMessage);
|
||||
connect(this, &QCoreApplication::aboutToQuit, this, &Application::cleanup);
|
||||
connect(this, SIGNAL(messageReceived(const QString &)), SLOT(processMessage(const QString &)));
|
||||
connect(this, SIGNAL(aboutToQuit()), SLOT(cleanup()));
|
||||
|
||||
if (isFileLoggerEnabled())
|
||||
m_fileLogger = new FileLogger(fileLoggerPath(), isFileLoggerBackup(), fileLoggerMaxSize(), isFileLoggerDeleteOld(), fileLoggerAge(), static_cast<FileLogger::FileLogAgeType>(fileLoggerAgeType()));
|
||||
@@ -164,13 +135,6 @@ Application::Application(const QString &id, int &argc, char **argv)
|
||||
Logger::instance()->addMessage(tr("qBittorrent %1 started", "qBittorrent v3.2.0alpha started").arg(QBT_VERSION));
|
||||
}
|
||||
|
||||
Application::~Application()
|
||||
{
|
||||
// we still need to call cleanup()
|
||||
// in case the App failed to start
|
||||
cleanup();
|
||||
}
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
QPointer<MainWindow> Application::mainWindow()
|
||||
{
|
||||
@@ -178,11 +142,6 @@ QPointer<MainWindow> Application::mainWindow()
|
||||
}
|
||||
#endif
|
||||
|
||||
const QBtCommandLineParameters &Application::commandLineArgs() const
|
||||
{
|
||||
return m_commandLineArgs;
|
||||
}
|
||||
|
||||
bool Application::isFileLoggerEnabled() const
|
||||
{
|
||||
return settings()->loadValue(KEY_FILELOGGER_ENABLED, true).toBool();
|
||||
@@ -199,15 +158,14 @@ void Application::setFileLoggerEnabled(bool value)
|
||||
|
||||
QString Application::fileLoggerPath() const
|
||||
{
|
||||
return settings()->loadValue(KEY_FILELOGGER_PATH,
|
||||
QVariant(specialFolderLocation(SpecialFolder::Data) + LOG_FOLDER)).toString();
|
||||
return settings()->loadValue(KEY_FILELOGGER_PATH, QVariant(Utils::Fs::QDesktopServicesDataLocation() + LOG_FOLDER)).toString();
|
||||
}
|
||||
|
||||
void Application::setFileLoggerPath(const QString &path)
|
||||
void Application::setFileLoggerPath(const QString &value)
|
||||
{
|
||||
if (m_fileLogger)
|
||||
m_fileLogger->changePath(path);
|
||||
settings()->storeValue(KEY_FILELOGGER_PATH, path);
|
||||
m_fileLogger->changePath(value);
|
||||
settings()->storeValue(KEY_FILELOGGER_PATH, value);
|
||||
}
|
||||
|
||||
bool Application::isFileLoggerBackup() const
|
||||
@@ -236,22 +194,29 @@ void Application::setFileLoggerDeleteOld(bool value)
|
||||
|
||||
int Application::fileLoggerMaxSize() const
|
||||
{
|
||||
int val = settings()->loadValue(KEY_FILELOGGER_MAXSIZEBYTES, DEFAULT_FILELOG_SIZE).toInt();
|
||||
return std::min(std::max(val, MIN_FILELOG_SIZE), MAX_FILELOG_SIZE);
|
||||
int val = settings()->loadValue(KEY_FILELOGGER_MAXSIZE, 10).toInt();
|
||||
if (val < 1)
|
||||
return 1;
|
||||
if (val > 1000)
|
||||
return 1000;
|
||||
return val;
|
||||
}
|
||||
|
||||
void Application::setFileLoggerMaxSize(const int bytes)
|
||||
void Application::setFileLoggerMaxSize(const int value)
|
||||
{
|
||||
int clampedValue = std::min(std::max(bytes, MIN_FILELOG_SIZE), MAX_FILELOG_SIZE);
|
||||
if (m_fileLogger)
|
||||
m_fileLogger->setMaxSize(clampedValue);
|
||||
settings()->storeValue(KEY_FILELOGGER_MAXSIZEBYTES, clampedValue);
|
||||
m_fileLogger->setMaxSize(value);
|
||||
settings()->storeValue(KEY_FILELOGGER_MAXSIZE, std::min(std::max(value, 1), 1000));
|
||||
}
|
||||
|
||||
int Application::fileLoggerAge() const
|
||||
{
|
||||
int val = settings()->loadValue(KEY_FILELOGGER_AGE, 1).toInt();
|
||||
return std::min(std::max(val, 1), 365);
|
||||
int val = settings()->loadValue(KEY_FILELOGGER_AGE, 6).toInt();
|
||||
if (val < 1)
|
||||
return 1;
|
||||
if (val > 365)
|
||||
return 365;
|
||||
return val;
|
||||
}
|
||||
|
||||
void Application::setFileLoggerAge(const int value)
|
||||
@@ -262,17 +227,17 @@ void Application::setFileLoggerAge(const int value)
|
||||
int Application::fileLoggerAgeType() const
|
||||
{
|
||||
int val = settings()->loadValue(KEY_FILELOGGER_AGETYPE, 1).toInt();
|
||||
return ((val < 0) || (val > 2)) ? 1 : val;
|
||||
return (val < 0 || val > 2) ? 1 : val;
|
||||
}
|
||||
|
||||
void Application::setFileLoggerAgeType(const int value)
|
||||
{
|
||||
settings()->storeValue(KEY_FILELOGGER_AGETYPE, ((value < 0) || (value > 2)) ? 1 : value);
|
||||
settings()->storeValue(KEY_FILELOGGER_AGETYPE, (value < 0 || value > 2) ? 1 : value);
|
||||
}
|
||||
|
||||
void Application::processMessage(const QString &message)
|
||||
{
|
||||
QStringList params = message.split(PARAMS_SEPARATOR, QString::SkipEmptyParts);
|
||||
QStringList params = message.split(QLatin1String(PARAMS_SEPARATOR), QString::SkipEmptyParts);
|
||||
// If Application is not running (i.e., other
|
||||
// components are not ready) store params
|
||||
if (m_running)
|
||||
@@ -281,77 +246,66 @@ void Application::processMessage(const QString &message)
|
||||
m_paramsQueue.append(params);
|
||||
}
|
||||
|
||||
void Application::runExternalProgram(const BitTorrent::TorrentHandle *torrent) const
|
||||
void Application::runExternalProgram(BitTorrent::TorrentHandle *const torrent) const
|
||||
{
|
||||
QString program = Preferences::instance()->getAutoRunProgram().trimmed();
|
||||
QString program = Preferences::instance()->getAutoRunProgram();
|
||||
program.replace("%N", torrent->name());
|
||||
program.replace("%L", torrent->category());
|
||||
|
||||
QStringList tags = torrent->tags().toList();
|
||||
std::sort(tags.begin(), tags.end(), Utils::String::naturalLessThan<Qt::CaseInsensitive>);
|
||||
program.replace("%G", tags.join(','));
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
const auto chopPathSep = [](const QString &str) -> QString
|
||||
{
|
||||
if (str.endsWith('\\'))
|
||||
return str.mid(0, (str.length() -1));
|
||||
return str;
|
||||
};
|
||||
program.replace("%F", chopPathSep(Utils::Fs::toNativePath(torrent->contentPath())));
|
||||
program.replace("%R", chopPathSep(Utils::Fs::toNativePath(torrent->rootPath())));
|
||||
program.replace("%D", chopPathSep(Utils::Fs::toNativePath(torrent->savePath())));
|
||||
#else
|
||||
program.replace("%F", Utils::Fs::toNativePath(torrent->contentPath()));
|
||||
program.replace("%R", Utils::Fs::toNativePath(torrent->rootPath()));
|
||||
program.replace("%D", Utils::Fs::toNativePath(torrent->savePath()));
|
||||
#endif
|
||||
program.replace("%C", QString::number(torrent->filesCount()));
|
||||
program.replace("%Z", QString::number(torrent->totalSize()));
|
||||
program.replace("%T", torrent->currentTracker());
|
||||
program.replace("%I", torrent->hash());
|
||||
|
||||
Logger *logger = Logger::instance();
|
||||
logger->addMessage(tr("Torrent: %1, running external program, command: %2").arg(torrent->name(), program));
|
||||
logger->addMessage(tr("Torrent: %1, running external program, command: %2").arg(torrent->name()).arg(program));
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
std::unique_ptr<wchar_t[]> programWchar(new wchar_t[program.length() + 1] {});
|
||||
program.toWCharArray(programWchar.get());
|
||||
|
||||
// Need to split arguments manually because QProcess::startDetached(QString)
|
||||
// will strip off empty parameters.
|
||||
// E.g. `python.exe "1" "" "3"` will become `python.exe "1" "3"`
|
||||
int argCount = 0;
|
||||
LPWSTR *args = ::CommandLineToArgvW(programWchar.get(), &argCount);
|
||||
|
||||
QStringList argList;
|
||||
for (int i = 1; i < argCount; ++i)
|
||||
argList += QString::fromWCharArray(args[i]);
|
||||
|
||||
QProcess::startDetached(QString::fromWCharArray(args[0]), argList);
|
||||
|
||||
::LocalFree(args);
|
||||
#else
|
||||
#if defined(Q_OS_UNIX)
|
||||
QProcess::startDetached(QLatin1String("/bin/sh"), {QLatin1String("-c"), program});
|
||||
#elif defined(Q_OS_WIN) // test cmd: `echo "%F" > "c:\ab ba.txt"`
|
||||
program.prepend(QLatin1String("\"")).append(QLatin1String("\""));
|
||||
program.prepend(Utils::Misc::windowsSystemPath() + QLatin1String("\\cmd.exe /C "));
|
||||
const int cmdMaxLength = 32768; // max length (incl. terminate char) for `lpCommandLine` in `CreateProcessW()`
|
||||
if ((program.size() + 1) > cmdMaxLength) {
|
||||
logger->addMessage(tr("Torrent: %1, run external program command too long (length > %2), execution failed.").arg(torrent->name()).arg(cmdMaxLength), Log::CRITICAL);
|
||||
return;
|
||||
}
|
||||
|
||||
STARTUPINFOW si = {0};
|
||||
si.cb = sizeof(si);
|
||||
PROCESS_INFORMATION pi = {0};
|
||||
|
||||
WCHAR *arg = new WCHAR[program.size() + 1];
|
||||
program.toWCharArray(arg);
|
||||
arg[program.size()] = L'\0';
|
||||
if (CreateProcessW(NULL, arg, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) {
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseHandle(pi.hThread);
|
||||
}
|
||||
delete[] arg;
|
||||
#else
|
||||
QProcess::startDetached(program);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Application::sendNotificationEmail(const BitTorrent::TorrentHandle *torrent)
|
||||
void Application::sendNotificationEmail(BitTorrent::TorrentHandle *const torrent)
|
||||
{
|
||||
// Prepare mail content
|
||||
const QString content = tr("Torrent name: %1").arg(torrent->name()) + '\n'
|
||||
+ tr("Torrent size: %1").arg(Utils::Misc::friendlyUnit(torrent->wantedSize())) + '\n'
|
||||
+ tr("Save path: %1").arg(torrent->savePath()) + "\n\n"
|
||||
+ tr("The torrent was downloaded in %1.", "The torrent was downloaded in 1 hour and 20 seconds")
|
||||
.arg(Utils::Misc::userFriendlyDuration(torrent->activeTime())) + "\n\n\n"
|
||||
+ tr("Thank you for using qBittorrent.") + '\n';
|
||||
QString content = QObject::tr("Torrent name: %1").arg(torrent->name()) + "\n";
|
||||
content += QObject::tr("Torrent size: %1").arg(Utils::Misc::friendlyUnit(torrent->wantedSize())) + "\n";
|
||||
content += QObject::tr("Save path: %1").arg(torrent->savePath()) + "\n\n";
|
||||
content += QObject::tr("The torrent was downloaded in %1.",
|
||||
"The torrent was downloaded in 1 hour and 20 seconds")
|
||||
.arg(Utils::Misc::userFriendlyDuration(torrent->activeTime())) + "\n\n\n";
|
||||
content += QObject::tr("Thank you for using qBittorrent.") + "\n";
|
||||
|
||||
// Send the notification email
|
||||
const Preferences *pref = Preferences::instance();
|
||||
Net::Smtp *smtp = new Net::Smtp(this);
|
||||
smtp->sendMail(pref->getMailNotificationSender(),
|
||||
pref->getMailNotificationEmail(),
|
||||
tr("[qBittorrent] '%1' has finished downloading").arg(torrent->name()),
|
||||
Net::Smtp *sender = new Net::Smtp;
|
||||
sender->sendMail("notification@qbittorrent.org",
|
||||
Preferences::instance()->getMailNotificationEmail(),
|
||||
QObject::tr("[qBittorrent] '%1' has finished downloading").arg(torrent->name()),
|
||||
content);
|
||||
}
|
||||
|
||||
@@ -395,7 +349,7 @@ void Application::allTorrentsFinished()
|
||||
// do nothing & skip confirm
|
||||
}
|
||||
else {
|
||||
if (!ShutdownConfirmDialog::askForConfirmation(m_window, action)) return;
|
||||
if (!ShutdownConfirmDlg::askForConfirmation(action)) return;
|
||||
}
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
@@ -416,7 +370,7 @@ void Application::allTorrentsFinished()
|
||||
|
||||
bool Application::sendParams(const QStringList ¶ms)
|
||||
{
|
||||
return sendMessage(params.join(PARAMS_SEPARATOR));
|
||||
return sendMessage(params.join(QLatin1String(PARAMS_SEPARATOR)));
|
||||
}
|
||||
|
||||
// As program parameters, we can get paths or urls.
|
||||
@@ -431,63 +385,15 @@ void Application::processParams(const QStringList ¶ms)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
BitTorrent::AddTorrentParams torrentParams;
|
||||
TriStateBool skipTorrentDialog;
|
||||
|
||||
for (QString param : params) {
|
||||
foreach (QString param, params) {
|
||||
param = param.trimmed();
|
||||
|
||||
// Process strings indicating options specified by the user.
|
||||
|
||||
if (param.startsWith(QLatin1String("@savePath="))) {
|
||||
torrentParams.savePath = param.mid(10);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (param.startsWith(QLatin1String("@addPaused="))) {
|
||||
torrentParams.addPaused = param.midRef(11).toInt() ? TriStateBool::True : TriStateBool::False;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (param == QLatin1String("@skipChecking")) {
|
||||
torrentParams.skipChecking = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (param.startsWith(QLatin1String("@category="))) {
|
||||
torrentParams.category = param.mid(10);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (param == QLatin1String("@sequential")) {
|
||||
torrentParams.sequential = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (param == QLatin1String("@firstLastPiecePriority")) {
|
||||
torrentParams.firstLastPiecePriority = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (param.startsWith(QLatin1String("@skipDialog="))) {
|
||||
skipTorrentDialog = param.midRef(12).toInt() ? TriStateBool::True : TriStateBool::False;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
// There are two circumstances in which we want to show the torrent
|
||||
// dialog. One is when the application settings specify that it should
|
||||
// be shown and skipTorrentDialog is undefined. The other is when
|
||||
// skipTorrentDialog is false, meaning that the application setting
|
||||
// should be overridden.
|
||||
const bool showDialogForThisTorrent =
|
||||
((AddNewTorrentDialog::isEnabled() && skipTorrentDialog == TriStateBool::Undefined)
|
||||
|| skipTorrentDialog == TriStateBool::False);
|
||||
if (showDialogForThisTorrent)
|
||||
AddNewTorrentDialog::show(param, torrentParams, m_window);
|
||||
if (AddNewTorrentDialog::isEnabled())
|
||||
AddNewTorrentDialog::show(param, m_window);
|
||||
else
|
||||
#endif
|
||||
BitTorrent::Session::instance()->addTorrent(param, torrentParams);
|
||||
BitTorrent::Session::instance()->addTorrent(param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,57 +407,30 @@ int Application::exec(const QStringList ¶ms)
|
||||
GuiIconProvider::initInstance();
|
||||
#endif
|
||||
|
||||
try {
|
||||
BitTorrent::Session::initInstance();
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentFinished, this, &Application::torrentFinished);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::allTorrentsFinished, this, &Application::allTorrentsFinished, Qt::QueuedConnection);
|
||||
BitTorrent::Session::initInstance();
|
||||
connect(BitTorrent::Session::instance(), SIGNAL(torrentFinished(BitTorrent::TorrentHandle *const)), SLOT(torrentFinished(BitTorrent::TorrentHandle *const)));
|
||||
connect(BitTorrent::Session::instance(), SIGNAL(allTorrentsFinished()), SLOT(allTorrentsFinished()), Qt::QueuedConnection);
|
||||
|
||||
#ifndef DISABLE_COUNTRIES_RESOLUTION
|
||||
Net::GeoIPManager::initInstance();
|
||||
Net::GeoIPManager::initInstance();
|
||||
#endif
|
||||
ScanFoldersModel::initInstance(this);
|
||||
ScanFoldersModel::initInstance(this);
|
||||
|
||||
#ifndef DISABLE_WEBUI
|
||||
m_webui = new WebUI;
|
||||
#ifdef DISABLE_GUI
|
||||
if (m_webui->isErrored())
|
||||
return 1;
|
||||
connect(m_webui, &WebUI::fatalError, this, []() { QCoreApplication::exit(1); });
|
||||
#endif // DISABLE_GUI
|
||||
#endif // DISABLE_WEBUI
|
||||
|
||||
new RSS::Session; // create RSS::Session singleton
|
||||
new RSS::AutoDownloader; // create RSS::AutoDownloader singleton
|
||||
}
|
||||
catch (const RuntimeError &err) {
|
||||
#ifdef DISABLE_GUI
|
||||
fprintf(stderr, "%s", err.what());
|
||||
#else
|
||||
QMessageBox msgBox;
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setText(tr("Application failed to start."));
|
||||
msgBox.setInformativeText(err.message());
|
||||
msgBox.show(); // Need to be shown or to moveToCenter does not work
|
||||
msgBox.move(Utils::Misc::screenCenter(&msgBox));
|
||||
msgBox.exec();
|
||||
m_webui = new WebUI;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef DISABLE_GUI
|
||||
#ifndef DISABLE_WEBUI
|
||||
Preferences *const pref = Preferences::instance();
|
||||
Preferences* const pref = Preferences::instance();
|
||||
// Display some information to the user
|
||||
const QString mesg = QString("\n******** %1 ********\n").arg(tr("Information"))
|
||||
+ tr("To control qBittorrent, access the Web UI at %1")
|
||||
.arg(QString("http://localhost:") + QString::number(pref->getWebUiPort())) + '\n'
|
||||
+ tr("The Web UI administrator user name is: %1").arg(pref->getWebUiUsername()) + '\n';
|
||||
printf("%s", qUtf8Printable(mesg));
|
||||
std::cout << std::endl << "******** " << qPrintable(tr("Information")) << " ********" << std::endl;
|
||||
std::cout << qPrintable(tr("To control qBittorrent, access the Web UI at http://localhost:%1").arg(QString::number(pref->getWebUiPort()))) << std::endl;
|
||||
std::cout << qPrintable(tr("The Web UI administrator user name is: %1").arg(pref->getWebUiUsername())) << std::endl;
|
||||
qDebug() << "Password:" << pref->getWebUiPassword();
|
||||
if (pref->getWebUiPassword() == "f6fdffe48c908deb0f4c3bd36c032e72") {
|
||||
const QString warning = tr("The Web UI administrator password is still the default one: %1").arg("adminadmin") + '\n'
|
||||
+ tr("This is a security risk, please consider changing your password from program preferences.") + '\n';
|
||||
printf("%s", qUtf8Printable(warning));
|
||||
std::cout << qPrintable(tr("The Web UI administrator password is still the default one: %1").arg("adminadmin")) << std::endl;
|
||||
std::cout << qPrintable(tr("This is a security risk, please consider changing your password from program preferences.")) << std::endl;
|
||||
}
|
||||
#endif // DISABLE_WEBUI
|
||||
#else
|
||||
@@ -559,15 +438,15 @@ int Application::exec(const QStringList ¶ms)
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
m_running = true;
|
||||
|
||||
// Now UI is ready to process signals from Session
|
||||
BitTorrent::Session::instance()->startUpTorrents();
|
||||
|
||||
m_paramsQueue = params + m_paramsQueue;
|
||||
if (!m_paramsQueue.isEmpty()) {
|
||||
processParams(m_paramsQueue);
|
||||
m_paramsQueue.clear();
|
||||
}
|
||||
|
||||
// Now UI is ready to process signals from Session
|
||||
BitTorrent::Session::instance()->startUpTorrents();
|
||||
|
||||
return BaseApplication::exec();
|
||||
}
|
||||
|
||||
@@ -607,7 +486,7 @@ bool Application::event(QEvent *ev)
|
||||
if (path.isEmpty())
|
||||
// Get the url instead
|
||||
path = static_cast<QFileOpenEvent *>(ev)->url().toString();
|
||||
qDebug("Received a mac file open event: %s", qUtf8Printable(path));
|
||||
qDebug("Received a mac file open event: %s", qPrintable(path));
|
||||
if (m_running)
|
||||
processParams(QStringList(path));
|
||||
else
|
||||
@@ -636,22 +515,24 @@ bool Application::notify(QObject *receiver, QEvent *event)
|
||||
|
||||
void Application::initializeTranslation()
|
||||
{
|
||||
Preferences *const pref = Preferences::instance();
|
||||
Preferences* const pref = Preferences::instance();
|
||||
// Load translation
|
||||
QString localeStr = pref->getLocale();
|
||||
|
||||
if (m_qtTranslator.load(QLatin1String("qtbase_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) ||
|
||||
m_qtTranslator.load(QLatin1String("qt_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
|
||||
qDebug("Qt %s locale recognized, using translation.", qUtf8Printable(localeStr));
|
||||
if (
|
||||
#ifdef QBT_USES_QT5
|
||||
m_qtTranslator.load(QString::fromUtf8("qtbase_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) ||
|
||||
#endif
|
||||
m_qtTranslator.load(QString::fromUtf8("qt_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
|
||||
qDebug("Qt %s locale recognized, using translation.", qPrintable(localeStr));
|
||||
else
|
||||
qDebug("Qt %s locale unrecognized, using default (en).", qUtf8Printable(localeStr));
|
||||
|
||||
qDebug("Qt %s locale unrecognized, using default (en).", qPrintable(localeStr));
|
||||
installTranslator(&m_qtTranslator);
|
||||
|
||||
if (m_translator.load(QLatin1String(":/lang/qbittorrent_") + localeStr))
|
||||
qDebug("%s locale recognized, using translation.", qUtf8Printable(localeStr));
|
||||
if (m_translator.load(QString::fromUtf8(":/lang/qbittorrent_") + localeStr))
|
||||
qDebug("%s locale recognized, using translation.", qPrintable(localeStr));
|
||||
else
|
||||
qDebug("%s locale unrecognized, using default (en).", qUtf8Printable(localeStr));
|
||||
qDebug("%s locale unrecognized, using default (en).", qPrintable(localeStr));
|
||||
installTranslator(&m_translator);
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
@@ -689,51 +570,49 @@ void Application::shutdownCleanup(QSessionManager &manager)
|
||||
// According to the qt docs we shouldn't call quit() inside a slot.
|
||||
// aboutToQuit() is never emitted if the user hits "Cancel" in
|
||||
// the above dialog.
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
QTimer::singleShot(0, qApp, SLOT(quit()));
|
||||
}
|
||||
#endif
|
||||
|
||||
void Application::cleanup()
|
||||
{
|
||||
#ifndef DISABLE_GUI
|
||||
#ifdef Q_OS_WIN
|
||||
// cleanup() can be called multiple times during shutdown. We only need it once.
|
||||
static QAtomicInt alreadyDone;
|
||||
if (!alreadyDone.testAndSetAcquire(0, 1))
|
||||
return;
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
if (m_window) {
|
||||
// Hide the window and don't leave it on screen as
|
||||
// unresponsive. Also for Windows take the WinId
|
||||
// after it's hidden, because hide() may cause a
|
||||
// WinId change.
|
||||
m_window->hide();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
typedef BOOL (WINAPI *PSHUTDOWNBRCREATE)(HWND, LPCWSTR);
|
||||
const auto shutdownBRCreate = Utils::Misc::loadWinAPI<PSHUTDOWNBRCREATE>("User32.dll", "ShutdownBlockReasonCreate");
|
||||
// Only available on Vista+
|
||||
if (shutdownBRCreate)
|
||||
shutdownBRCreate((HWND)m_window->effectiveWinId(), tr("Saving torrent progress...").toStdWString().c_str());
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
// Do manual cleanup in MainWindow to force widgets
|
||||
// to save their Preferences, stop all timers and
|
||||
// delete as many widgets as possible to leave only
|
||||
// a 'shell' MainWindow.
|
||||
// We need a valid window handle for Windows Vista+
|
||||
// otherwise the system shutdown will continue even
|
||||
// though we created a ShutdownBlockReason
|
||||
m_window->cleanup();
|
||||
}
|
||||
// Hide the window and not leave it on screen as
|
||||
// unresponsive. Also for Windows take the WinId
|
||||
// after it's hidden, because hide() may cause a
|
||||
// WinId change.
|
||||
m_window->hide();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
typedef BOOL (WINAPI *PSHUTDOWNBRCREATE)(HWND, LPCWSTR);
|
||||
PSHUTDOWNBRCREATE shutdownBRCreate = (PSHUTDOWNBRCREATE)::GetProcAddress(::GetModuleHandleW(L"User32.dll"), "ShutdownBlockReasonCreate");
|
||||
// Only available on Vista+
|
||||
if (shutdownBRCreate)
|
||||
shutdownBRCreate((HWND)m_window->effectiveWinId(), tr("Saving torrent progress...").toStdWString().c_str());
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
// Do manual cleanup in MainWindow to force widgets
|
||||
// to save their Preferences, stop all timers and
|
||||
// delete as many widgets as possible to leave only
|
||||
// a 'shell' MainWindow.
|
||||
// We need a valid window handle for Windows Vista+
|
||||
// otherwise the system shutdown will continue even
|
||||
// though we created a ShutdownBlockReason
|
||||
m_window->cleanup();
|
||||
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
#ifndef DISABLE_WEBUI
|
||||
delete m_webui;
|
||||
#endif
|
||||
|
||||
delete RSS::AutoDownloader::instance();
|
||||
delete RSS::Session::instance();
|
||||
|
||||
ScanFoldersModel::freeInstance();
|
||||
BitTorrent::Session::freeInstance();
|
||||
#ifndef DISABLE_COUNTRIES_RESOLUTION
|
||||
@@ -746,20 +625,17 @@ void Application::cleanup()
|
||||
delete m_fileLogger;
|
||||
Logger::freeInstance();
|
||||
IconProvider::freeInstance();
|
||||
SearchPluginManager::freeInstance();
|
||||
Utils::Fs::removeDirRecursive(Utils::Fs::tempPath());
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
if (m_window) {
|
||||
#ifdef Q_OS_WIN
|
||||
typedef BOOL (WINAPI *PSHUTDOWNBRDESTROY)(HWND);
|
||||
const auto shutdownBRDestroy = Utils::Misc::loadWinAPI<PSHUTDOWNBRDESTROY>("User32.dll", "ShutdownBlockReasonDestroy");
|
||||
// Only available on Vista+
|
||||
if (shutdownBRDestroy)
|
||||
shutdownBRDestroy((HWND)m_window->effectiveWinId());
|
||||
typedef BOOL (WINAPI *PSHUTDOWNBRDESTROY)(HWND);
|
||||
PSHUTDOWNBRDESTROY shutdownBRDestroy = (PSHUTDOWNBRDESTROY)::GetProcAddress(::GetModuleHandleW(L"User32.dll"), "ShutdownBlockReasonDestroy");
|
||||
// Only available on Vista+
|
||||
if (shutdownBRDestroy)
|
||||
shutdownBRDestroy((HWND)m_window->effectiveWinId());
|
||||
#endif // Q_OS_WIN
|
||||
delete m_window;
|
||||
}
|
||||
delete m_window;
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
if (m_shutdownAct != ShutdownDialogAction::Exit) {
|
||||
@@ -767,12 +643,3 @@ void Application::cleanup()
|
||||
Utils::Misc::shutdownComputer(m_shutdownAct);
|
||||
}
|
||||
}
|
||||
|
||||
void Application::validateCommandLineParameters()
|
||||
{
|
||||
if (m_commandLineArgs.portableMode && !m_commandLineArgs.profileDir.isEmpty())
|
||||
throw CommandLineParameterError(tr("Portable mode and explicit profile directory options are mutually exclusive"));
|
||||
|
||||
if (m_commandLineArgs.portableMode && m_commandLineArgs.relativeFastresumePaths)
|
||||
Logger::instance()->addMessage(tr("Portable mode implies relative fastresume"), Log::WARNING);
|
||||
}
|
||||
|
||||
@@ -40,16 +40,17 @@ typedef QtSingleApplication BaseApplication;
|
||||
class MainWindow;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSessionManager;
|
||||
QT_END_NAMESPACE
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
#else
|
||||
#include "qtsinglecoreapplication.h"
|
||||
typedef QtSingleCoreApplication BaseApplication;
|
||||
#endif // DISABLE_GUI
|
||||
#endif
|
||||
|
||||
#include "base/utils/misc.h"
|
||||
#include "cmdoptions.h"
|
||||
|
||||
#ifndef DISABLE_WEBUI
|
||||
class WebUI;
|
||||
@@ -62,20 +63,12 @@ namespace BitTorrent
|
||||
class TorrentHandle;
|
||||
}
|
||||
|
||||
namespace RSS
|
||||
{
|
||||
class Session;
|
||||
class AutoDownloader;
|
||||
}
|
||||
|
||||
class Application : public BaseApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(Application)
|
||||
|
||||
public:
|
||||
Application(const QString &id, int &argc, char **argv);
|
||||
~Application() override;
|
||||
|
||||
#if (defined(Q_OS_WIN) && !defined(DISABLE_GUI))
|
||||
bool isRunning();
|
||||
@@ -87,8 +80,6 @@ public:
|
||||
QPointer<MainWindow> mainWindow();
|
||||
#endif
|
||||
|
||||
const QBtCommandLineParameters &commandLineArgs() const;
|
||||
|
||||
// FileLogger properties
|
||||
bool isFileLoggerEnabled() const;
|
||||
void setFileLoggerEnabled(bool value);
|
||||
@@ -99,7 +90,7 @@ public:
|
||||
bool isFileLoggerDeleteOld() const;
|
||||
void setFileLoggerDeleteOld(bool value);
|
||||
int fileLoggerMaxSize() const;
|
||||
void setFileLoggerMaxSize(const int bytes);
|
||||
void setFileLoggerMaxSize(const int value);
|
||||
int fileLoggerAge() const;
|
||||
void setFileLoggerAge(const int value);
|
||||
int fileLoggerAgeType() const;
|
||||
@@ -108,9 +99,9 @@ public:
|
||||
protected:
|
||||
#ifndef DISABLE_GUI
|
||||
#ifdef Q_OS_MAC
|
||||
bool event(QEvent *) override;
|
||||
bool event(QEvent *);
|
||||
#endif
|
||||
bool notify(QObject *receiver, QEvent *event) override;
|
||||
bool notify(QObject* receiver, QEvent* event);
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
@@ -125,14 +116,13 @@ private slots:
|
||||
private:
|
||||
bool m_running;
|
||||
ShutdownDialogAction m_shutdownAct;
|
||||
QBtCommandLineParameters m_commandLineArgs;
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
QPointer<MainWindow> m_window;
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_WEBUI
|
||||
WebUI *m_webui;
|
||||
QPointer<WebUI> m_webui;
|
||||
#endif
|
||||
|
||||
// FileLog
|
||||
@@ -144,9 +134,8 @@ private:
|
||||
|
||||
void initializeTranslation();
|
||||
void processParams(const QStringList ¶ms);
|
||||
void runExternalProgram(const BitTorrent::TorrentHandle *torrent) const;
|
||||
void sendNotificationEmail(const BitTorrent::TorrentHandle *torrent);
|
||||
void validateCommandLineParameters();
|
||||
void runExternalProgram(BitTorrent::TorrentHandle *const torrent) const;
|
||||
void sendNotificationEmail(BitTorrent::TorrentHandle *const torrent);
|
||||
};
|
||||
|
||||
#endif // APPLICATION_H
|
||||
|
||||
@@ -1,587 +0,0 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2016 Eugene Shalygin <eugene.shalygin@gmail.com>
|
||||
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* 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 "cmdoptions.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QTextStream>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <QMessageBox>
|
||||
#endif
|
||||
|
||||
#include "base/global.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
const int USAGE_INDENTATION = 4;
|
||||
const int USAGE_TEXT_COLUMN = 31;
|
||||
const int WRAP_AT_COLUMN = 80;
|
||||
|
||||
// Base option class. Encapsulates name operations.
|
||||
class Option
|
||||
{
|
||||
protected:
|
||||
constexpr Option(const char *name, char shortcut = 0)
|
||||
: m_name {name}
|
||||
, m_shortcut {shortcut}
|
||||
{
|
||||
}
|
||||
|
||||
QString fullParameter() const
|
||||
{
|
||||
return QLatin1String("--") + QLatin1String(m_name);
|
||||
}
|
||||
|
||||
QString shortcutParameter() const
|
||||
{
|
||||
return QLatin1String("-") + QLatin1Char(m_shortcut);
|
||||
}
|
||||
|
||||
bool hasShortcut() const
|
||||
{
|
||||
return m_shortcut != 0;
|
||||
}
|
||||
|
||||
QString envVarName() const
|
||||
{
|
||||
return QLatin1String("QBT_")
|
||||
+ QString(QLatin1String(m_name)).toUpper().replace(QLatin1Char('-'), QLatin1Char('_'));
|
||||
}
|
||||
|
||||
public:
|
||||
static QString padUsageText(const QString &usage)
|
||||
{
|
||||
QString res = QString(USAGE_INDENTATION, ' ') + usage;
|
||||
|
||||
if ((USAGE_TEXT_COLUMN - usage.length() - 4) > 0)
|
||||
return res + QString(USAGE_TEXT_COLUMN - usage.length() - 4, ' ');
|
||||
else
|
||||
return res;
|
||||
}
|
||||
|
||||
private:
|
||||
const char *m_name;
|
||||
const char m_shortcut;
|
||||
};
|
||||
|
||||
// Boolean option.
|
||||
class BoolOption : protected Option
|
||||
{
|
||||
public:
|
||||
constexpr BoolOption(const char *name, char shortcut = 0)
|
||||
: Option {name, shortcut}
|
||||
{
|
||||
}
|
||||
|
||||
bool operator==(const QString &arg) const
|
||||
{
|
||||
return (hasShortcut() && ((arg.size() == 2) && (arg == shortcutParameter())))
|
||||
|| (arg == fullParameter());
|
||||
}
|
||||
|
||||
bool value(const QProcessEnvironment &env) const
|
||||
{
|
||||
QString val = env.value(envVarName());
|
||||
// we accept "1" and "true" (upper or lower cased) as boolean 'true' values
|
||||
return ((val == QLatin1String("1")) || (val.toUpper() == QLatin1String("TRUE")));
|
||||
}
|
||||
|
||||
QString usage() const
|
||||
{
|
||||
QString res;
|
||||
if (hasShortcut())
|
||||
res += shortcutParameter() + QLatin1String(" | ");
|
||||
res += fullParameter();
|
||||
return padUsageText(res);
|
||||
}
|
||||
};
|
||||
|
||||
bool operator==(const QString &s, const BoolOption &o)
|
||||
{
|
||||
return o == s;
|
||||
}
|
||||
|
||||
// Option with string value. May not have a shortcut
|
||||
struct StringOption : protected Option
|
||||
{
|
||||
public:
|
||||
constexpr StringOption(const char *name)
|
||||
: Option {name, 0}
|
||||
{
|
||||
}
|
||||
|
||||
bool operator==(const QString &arg) const
|
||||
{
|
||||
return arg.startsWith(parameterAssignment());
|
||||
}
|
||||
|
||||
QString value(const QString &arg) const
|
||||
{
|
||||
QStringList parts = arg.split(QLatin1Char('='));
|
||||
if (parts.size() == 2)
|
||||
return Utils::String::unquote(parts[1], QLatin1String("'\""));
|
||||
throw CommandLineParameterError(QObject::tr("Parameter '%1' must follow syntax '%1=%2'",
|
||||
"e.g. Parameter '--webui-port' must follow syntax '--webui-port=value'")
|
||||
.arg(fullParameter()).arg(QLatin1String("<value>")));
|
||||
}
|
||||
|
||||
QString value(const QProcessEnvironment &env, const QString &defaultValue = QString()) const
|
||||
{
|
||||
QString val = env.value(envVarName());
|
||||
return val.isEmpty() ? defaultValue : Utils::String::unquote(val, QLatin1String("'\""));
|
||||
}
|
||||
|
||||
QString usage(const QString &valueName) const
|
||||
{
|
||||
return padUsageText(parameterAssignment() + QLatin1Char('<') + valueName + QLatin1Char('>'));
|
||||
}
|
||||
|
||||
private:
|
||||
QString parameterAssignment() const
|
||||
{
|
||||
return fullParameter() + QLatin1Char('=');
|
||||
}
|
||||
};
|
||||
|
||||
bool operator==(const QString &s, const StringOption &o)
|
||||
{
|
||||
return o == s;
|
||||
}
|
||||
|
||||
// Option with integer value. May not have a shortcut
|
||||
class IntOption : protected StringOption
|
||||
{
|
||||
public:
|
||||
constexpr IntOption(const char *name)
|
||||
: StringOption {name}
|
||||
{
|
||||
}
|
||||
|
||||
using StringOption::operator==;
|
||||
using StringOption::usage;
|
||||
|
||||
int value(const QString &arg) const
|
||||
{
|
||||
QString val = StringOption::value(arg);
|
||||
bool ok = false;
|
||||
int res = val.toInt(&ok);
|
||||
if (!ok)
|
||||
throw CommandLineParameterError(QObject::tr("Parameter '%1' must follow syntax '%1=%2'",
|
||||
"e.g. Parameter '--webui-port' must follow syntax '--webui-port=<value>'")
|
||||
.arg(fullParameter()).arg(QLatin1String("<integer value>")));
|
||||
return res;
|
||||
}
|
||||
|
||||
int value(const QProcessEnvironment &env, int defaultValue) const
|
||||
{
|
||||
QString val = env.value(envVarName());
|
||||
if (val.isEmpty()) return defaultValue;
|
||||
|
||||
bool ok;
|
||||
int res = val.toInt(&ok);
|
||||
if (!ok) {
|
||||
qDebug() << QObject::tr("Expected integer number in environment variable '%1', but got '%2'")
|
||||
.arg(envVarName(), val);
|
||||
return defaultValue;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
bool operator==(const QString &s, const IntOption &o)
|
||||
{
|
||||
return o == s;
|
||||
}
|
||||
|
||||
// Option that is explicitly set to true or false, and whose value is undefined when unspecified.
|
||||
// May not have a shortcut.
|
||||
class TriStateBoolOption : protected Option
|
||||
{
|
||||
public:
|
||||
constexpr TriStateBoolOption(const char *name, bool defaultValue)
|
||||
: Option {name, 0}
|
||||
, m_defaultValue(defaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
bool operator==(const QString &arg) const
|
||||
{
|
||||
QStringList parts = arg.split(QLatin1Char('='));
|
||||
return parts[0] == fullParameter();
|
||||
}
|
||||
|
||||
QString usage() const
|
||||
{
|
||||
return padUsageText(fullParameter() + QLatin1String("=<true|false>"));
|
||||
}
|
||||
|
||||
TriStateBool value(const QString &arg) const
|
||||
{
|
||||
QStringList parts = arg.split(QLatin1Char('='));
|
||||
|
||||
if (parts.size() == 1) {
|
||||
return TriStateBool(m_defaultValue);
|
||||
}
|
||||
else if (parts.size() == 2) {
|
||||
QString val = parts[1];
|
||||
|
||||
if ((val.toUpper() == QLatin1String("TRUE")) || (val == QLatin1String("1"))) {
|
||||
return TriStateBool::True;
|
||||
}
|
||||
else if ((val.toUpper() == QLatin1String("FALSE")) || (val == QLatin1String("0"))) {
|
||||
return TriStateBool::False;
|
||||
}
|
||||
}
|
||||
|
||||
throw CommandLineParameterError(QObject::tr("Parameter '%1' must follow syntax '%1=%2'",
|
||||
"e.g. Parameter '--add-paused' must follow syntax "
|
||||
"'--add-paused=<true|false>'")
|
||||
.arg(fullParameter())
|
||||
.arg(QLatin1String("<true|false>")));
|
||||
}
|
||||
|
||||
TriStateBool value(const QProcessEnvironment &env) const
|
||||
{
|
||||
QString val = env.value(envVarName(), "-1");
|
||||
|
||||
if (val.isEmpty()) {
|
||||
return TriStateBool(m_defaultValue);
|
||||
}
|
||||
else if (val == QLatin1String("-1")) {
|
||||
return TriStateBool::Undefined;
|
||||
}
|
||||
else if ((val.toUpper() == QLatin1String("TRUE")) || (val == QLatin1String("1"))) {
|
||||
return TriStateBool::True;
|
||||
}
|
||||
else if ((val.toUpper() == QLatin1String("FALSE")) || (val == QLatin1String("0"))) {
|
||||
return TriStateBool::False;
|
||||
}
|
||||
else {
|
||||
qDebug() << QObject::tr("Expected %1 in environment variable '%2', but got '%3'")
|
||||
.arg(QLatin1String("true|false"), envVarName(), val);
|
||||
return TriStateBool::Undefined;
|
||||
}
|
||||
}
|
||||
|
||||
bool m_defaultValue;
|
||||
};
|
||||
|
||||
bool operator==(const QString &s, const TriStateBoolOption &o)
|
||||
{
|
||||
return o == s;
|
||||
}
|
||||
|
||||
constexpr const BoolOption SHOW_HELP_OPTION = {"help", 'h'};
|
||||
constexpr const BoolOption SHOW_VERSION_OPTION = {"version", 'v'};
|
||||
#ifdef DISABLE_GUI
|
||||
constexpr const BoolOption DAEMON_OPTION = {"daemon", 'd'};
|
||||
#else
|
||||
constexpr const BoolOption NO_SPLASH_OPTION = {"no-splash"};
|
||||
#endif
|
||||
constexpr const IntOption WEBUI_PORT_OPTION = {"webui-port"};
|
||||
constexpr const StringOption PROFILE_OPTION = {"profile"};
|
||||
constexpr const StringOption CONFIGURATION_OPTION = {"configuration"};
|
||||
constexpr const BoolOption PORTABLE_OPTION = {"portable"};
|
||||
constexpr const BoolOption RELATIVE_FASTRESUME = {"relative-fastresume"};
|
||||
constexpr const StringOption SAVE_PATH_OPTION = {"save-path"};
|
||||
constexpr const TriStateBoolOption PAUSED_OPTION = {"add-paused", true};
|
||||
constexpr const BoolOption SKIP_HASH_CHECK_OPTION = {"skip-hash-check"};
|
||||
constexpr const StringOption CATEGORY_OPTION = {"category"};
|
||||
constexpr const BoolOption SEQUENTIAL_OPTION = {"sequential"};
|
||||
constexpr const BoolOption FIRST_AND_LAST_OPTION = {"first-and-last"};
|
||||
constexpr const TriStateBoolOption SKIP_DIALOG_OPTION = {"skip-dialog", true};
|
||||
}
|
||||
|
||||
QBtCommandLineParameters::QBtCommandLineParameters(const QProcessEnvironment &env)
|
||||
: showHelp(false)
|
||||
, relativeFastresumePaths(RELATIVE_FASTRESUME.value(env))
|
||||
, portableMode(PORTABLE_OPTION.value(env))
|
||||
, skipChecking(SKIP_HASH_CHECK_OPTION.value(env))
|
||||
, sequential(SEQUENTIAL_OPTION.value(env))
|
||||
, firstLastPiecePriority(FIRST_AND_LAST_OPTION.value(env))
|
||||
#ifndef Q_OS_WIN
|
||||
, showVersion(false)
|
||||
#endif
|
||||
#ifndef DISABLE_GUI
|
||||
, noSplash(NO_SPLASH_OPTION.value(env))
|
||||
#else
|
||||
, shouldDaemonize(DAEMON_OPTION.value(env))
|
||||
#endif
|
||||
, webUiPort(WEBUI_PORT_OPTION.value(env, -1))
|
||||
, addPaused(PAUSED_OPTION.value(env))
|
||||
, skipDialog(SKIP_DIALOG_OPTION.value(env))
|
||||
, profileDir(PROFILE_OPTION.value(env))
|
||||
, configurationName(CONFIGURATION_OPTION.value(env))
|
||||
, savePath(SAVE_PATH_OPTION.value(env))
|
||||
, category(CATEGORY_OPTION.value(env))
|
||||
{
|
||||
}
|
||||
|
||||
QStringList QBtCommandLineParameters::paramList() const
|
||||
{
|
||||
QStringList result;
|
||||
// Because we're passing a string list to the currently running
|
||||
// qBittorrent process, we need some way of passing along the options
|
||||
// the user has specified. Here we place special strings that are
|
||||
// almost certainly not going to collide with a file path or URL
|
||||
// specified by the user, and placing them at the beginning of the
|
||||
// string list so that they will be processed before the list of
|
||||
// torrent paths or URLs.
|
||||
|
||||
if (!savePath.isEmpty())
|
||||
result.append(QString("@savePath=%1").arg(savePath));
|
||||
|
||||
if (addPaused == TriStateBool::True) {
|
||||
result.append(QLatin1String("@addPaused=1"));
|
||||
}
|
||||
else if (addPaused == TriStateBool::False) {
|
||||
result.append(QLatin1String("@addPaused=0"));
|
||||
}
|
||||
|
||||
if (skipChecking)
|
||||
result.append(QLatin1String("@skipChecking"));
|
||||
|
||||
if (!category.isEmpty())
|
||||
result.append(QString("@category=%1").arg(category));
|
||||
|
||||
if (sequential)
|
||||
result.append(QLatin1String("@sequential"));
|
||||
|
||||
if (firstLastPiecePriority)
|
||||
result.append(QLatin1String("@firstLastPiecePriority"));
|
||||
|
||||
if (skipDialog == TriStateBool::True) {
|
||||
result.append(QLatin1String("@skipDialog=1"));
|
||||
}
|
||||
else if (skipDialog == TriStateBool::False) {
|
||||
result.append(QLatin1String("@skipDialog=0"));
|
||||
}
|
||||
|
||||
result += torrents;
|
||||
return result;
|
||||
}
|
||||
|
||||
QBtCommandLineParameters parseCommandLine(const QStringList &args)
|
||||
{
|
||||
QBtCommandLineParameters result {QProcessEnvironment::systemEnvironment()};
|
||||
|
||||
for (int i = 1; i < args.count(); ++i) {
|
||||
const QString &arg = args[i];
|
||||
|
||||
if ((arg.startsWith("--") && !arg.endsWith(".torrent"))
|
||||
|| (arg.startsWith('-') && (arg.size() == 2))) {
|
||||
// Parse known parameters
|
||||
if (arg == SHOW_HELP_OPTION) {
|
||||
result.showHelp = true;
|
||||
}
|
||||
#ifndef Q_OS_WIN
|
||||
else if (arg == SHOW_VERSION_OPTION) {
|
||||
result.showVersion = true;
|
||||
}
|
||||
#endif
|
||||
else if (arg == WEBUI_PORT_OPTION) {
|
||||
result.webUiPort = WEBUI_PORT_OPTION.value(arg);
|
||||
if ((result.webUiPort < 1) || (result.webUiPort > 65535))
|
||||
throw CommandLineParameterError(QObject::tr("%1 must specify a valid port (1 to 65535).")
|
||||
.arg(QLatin1String("--webui-port")));
|
||||
}
|
||||
#ifndef DISABLE_GUI
|
||||
else if (arg == NO_SPLASH_OPTION) {
|
||||
result.noSplash = true;
|
||||
}
|
||||
#else
|
||||
else if (arg == DAEMON_OPTION) {
|
||||
result.shouldDaemonize = true;
|
||||
}
|
||||
#endif
|
||||
else if (arg == PROFILE_OPTION) {
|
||||
result.profileDir = PROFILE_OPTION.value(arg);
|
||||
}
|
||||
else if (arg == RELATIVE_FASTRESUME) {
|
||||
result.relativeFastresumePaths = true;
|
||||
}
|
||||
else if (arg == PORTABLE_OPTION) {
|
||||
result.portableMode = true;
|
||||
}
|
||||
else if (arg == CONFIGURATION_OPTION) {
|
||||
result.configurationName = CONFIGURATION_OPTION.value(arg);
|
||||
}
|
||||
else if (arg == SAVE_PATH_OPTION) {
|
||||
result.savePath = SAVE_PATH_OPTION.value(arg);
|
||||
}
|
||||
else if (arg == PAUSED_OPTION) {
|
||||
result.addPaused = PAUSED_OPTION.value(arg);
|
||||
}
|
||||
else if (arg == SKIP_HASH_CHECK_OPTION) {
|
||||
result.skipChecking = true;
|
||||
}
|
||||
else if (arg == CATEGORY_OPTION) {
|
||||
result.category = CATEGORY_OPTION.value(arg);
|
||||
}
|
||||
else if (arg == SEQUENTIAL_OPTION) {
|
||||
result.sequential = true;
|
||||
}
|
||||
else if (arg == FIRST_AND_LAST_OPTION) {
|
||||
result.firstLastPiecePriority = true;
|
||||
}
|
||||
else if (arg == SKIP_DIALOG_OPTION) {
|
||||
result.skipDialog = SKIP_DIALOG_OPTION.value(arg);
|
||||
}
|
||||
else {
|
||||
// Unknown argument
|
||||
result.unknownParameter = arg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
QFileInfo torrentPath;
|
||||
torrentPath.setFile(arg);
|
||||
|
||||
if (torrentPath.exists())
|
||||
result.torrents += torrentPath.absoluteFilePath();
|
||||
else
|
||||
result.torrents += arg;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
CommandLineParameterError::CommandLineParameterError(const QString &messageForUser)
|
||||
: std::runtime_error(messageForUser.toLocal8Bit().data())
|
||||
, m_messageForUser(messageForUser)
|
||||
{
|
||||
}
|
||||
|
||||
const QString &CommandLineParameterError::messageForUser() const
|
||||
{
|
||||
return m_messageForUser;
|
||||
}
|
||||
|
||||
QString wrapText(const QString &text, int initialIndentation = USAGE_TEXT_COLUMN, int wrapAtColumn = WRAP_AT_COLUMN)
|
||||
{
|
||||
QStringList words = text.split(' ');
|
||||
QStringList lines = {words.first()};
|
||||
int currentLineMaxLength = wrapAtColumn - initialIndentation;
|
||||
|
||||
for (const QString &word : asConst(words.mid(1))) {
|
||||
if (lines.last().length() + word.length() + 1 < currentLineMaxLength) {
|
||||
lines.last().append(' ' + word);
|
||||
}
|
||||
else {
|
||||
lines.append(QString(initialIndentation, ' ') + word);
|
||||
currentLineMaxLength = wrapAtColumn;
|
||||
}
|
||||
}
|
||||
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
QString makeUsage(const QString &prgName)
|
||||
{
|
||||
QString text;
|
||||
QTextStream stream(&text, QIODevice::WriteOnly);
|
||||
QString indentation = QString(USAGE_INDENTATION, ' ');
|
||||
|
||||
stream << QObject::tr("Usage:") << '\n';
|
||||
stream << indentation << prgName << QLatin1String(" [options] [(<filename> | <url>)...]") << '\n';
|
||||
|
||||
stream << QObject::tr("Options:") << '\n';
|
||||
#ifndef Q_OS_WIN
|
||||
stream << SHOW_VERSION_OPTION.usage() << wrapText(QObject::tr("Display program version and exit")) << '\n';
|
||||
#endif
|
||||
stream << SHOW_HELP_OPTION.usage() << wrapText(QObject::tr("Display this help message and exit")) << '\n';
|
||||
stream << WEBUI_PORT_OPTION.usage(QObject::tr("port"))
|
||||
<< wrapText(QObject::tr("Change the Web UI port"))
|
||||
<< '\n';
|
||||
#ifndef DISABLE_GUI
|
||||
stream << NO_SPLASH_OPTION.usage() << wrapText(QObject::tr("Disable splash screen")) << '\n';
|
||||
#else
|
||||
stream << DAEMON_OPTION.usage() << wrapText(QObject::tr("Run in daemon-mode (background)")) << '\n';
|
||||
#endif
|
||||
//: Use appropriate short form or abbreviation of "directory"
|
||||
stream << PROFILE_OPTION.usage(QObject::tr("dir"))
|
||||
<< wrapText(QObject::tr("Store configuration files in <dir>")) << '\n';
|
||||
stream << CONFIGURATION_OPTION.usage(QObject::tr("name"))
|
||||
<< wrapText(QObject::tr("Store configuration files in directories qBittorrent_<name>")) << '\n';
|
||||
stream << RELATIVE_FASTRESUME.usage()
|
||||
<< wrapText(QObject::tr("Hack into libtorrent fastresume files and make file paths relative "
|
||||
"to the profile directory")) << '\n';
|
||||
stream << PORTABLE_OPTION.usage()
|
||||
<< wrapText(QObject::tr("Shortcut for %1", "Shortcut for --profile=<exe dir>/profile --relative-fastresume")
|
||||
.arg(QLatin1String("--profile=<exe dir>/profile --relative-fastresume"))) << '\n';
|
||||
stream << Option::padUsageText(QObject::tr("files or URLs"))
|
||||
<< wrapText(QObject::tr("Download the torrents passed by the user")) << '\n'
|
||||
<< '\n';
|
||||
|
||||
stream << wrapText(QObject::tr("Options when adding new torrents:"), 0) << '\n';
|
||||
stream << SAVE_PATH_OPTION.usage(QObject::tr("path")) << wrapText(QObject::tr("Torrent save path")) << '\n';
|
||||
stream << PAUSED_OPTION.usage() << wrapText(QObject::tr("Add torrents as started or paused")) << '\n';
|
||||
stream << SKIP_HASH_CHECK_OPTION.usage() << wrapText(QObject::tr("Skip hash check")) << '\n';
|
||||
stream << CATEGORY_OPTION.usage(QObject::tr("name"))
|
||||
<< wrapText(QObject::tr("Assign torrents to category. If the category doesn't exist, it will be "
|
||||
"created.")) << '\n';
|
||||
stream << SEQUENTIAL_OPTION.usage() << wrapText(QObject::tr("Download files in sequential order")) << '\n';
|
||||
stream << FIRST_AND_LAST_OPTION.usage()
|
||||
<< wrapText(QObject::tr("Download first and last pieces first")) << '\n';
|
||||
stream << SKIP_DIALOG_OPTION.usage()
|
||||
<< wrapText(QObject::tr("Specify whether the \"Add New Torrent\" dialog opens when adding a "
|
||||
"torrent.")) << '\n';
|
||||
stream << '\n';
|
||||
|
||||
stream << wrapText(QObject::tr("Option values may be supplied via environment variables. For option named "
|
||||
"'parameter-name', environment variable name is 'QBT_PARAMETER_NAME' (in upper "
|
||||
"case, '-' replaced with '_'). To pass flag values, set the variable to '1' or "
|
||||
"'TRUE'. For example, to disable the splash screen: "), 0) << "\n"
|
||||
<< QLatin1String("QBT_NO_SPLASH=1 ") << prgName << '\n'
|
||||
<< wrapText(QObject::tr("Command line parameters take precedence over environment variables"), 0) << '\n';
|
||||
|
||||
stream << flush;
|
||||
return text;
|
||||
}
|
||||
|
||||
void displayUsage(const QString &prgName)
|
||||
{
|
||||
#ifndef Q_OS_WIN
|
||||
printf("%s\n", qUtf8Printable(makeUsage(prgName)));
|
||||
#else
|
||||
QMessageBox msgBox(QMessageBox::Information, QObject::tr("Help"), makeUsage(prgName), QMessageBox::Ok);
|
||||
msgBox.show(); // Need to be shown or to moveToCenter does not work
|
||||
msgBox.move(Utils::Misc::screenCenter(&msgBox));
|
||||
msgBox.exec();
|
||||
#endif
|
||||
}
|
||||
@@ -26,14 +26,11 @@
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#include "filelogger.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "base/global.h"
|
||||
#include "filelogger.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/utils/fs.h"
|
||||
|
||||
@@ -44,17 +41,17 @@ FileLogger::FileLogger(const QString &path, const bool backup, const int maxSize
|
||||
{
|
||||
m_flusher.setInterval(0);
|
||||
m_flusher.setSingleShot(true);
|
||||
connect(&m_flusher, &QTimer::timeout, this, &FileLogger::flushLog);
|
||||
connect(&m_flusher, SIGNAL(timeout()), SLOT(flushLog()));
|
||||
|
||||
changePath(path);
|
||||
if (deleteOld)
|
||||
this->deleteOld(age, ageType);
|
||||
|
||||
const Logger *const logger = Logger::instance();
|
||||
for (const Log::Msg &msg : asConst(logger->getMessages()))
|
||||
const Logger* const logger = Logger::instance();
|
||||
foreach (const Log::Msg& msg, logger->getMessages())
|
||||
addLogMessage(msg);
|
||||
|
||||
connect(logger, &Logger::newLogMessage, this, &FileLogger::addLogMessage);
|
||||
connect(logger, SIGNAL(newLogMessage(const Log::Msg &)), SLOT(addLogMessage(const Log::Msg &)));
|
||||
}
|
||||
|
||||
FileLogger::~FileLogger()
|
||||
@@ -64,7 +61,7 @@ FileLogger::~FileLogger()
|
||||
delete m_logFile;
|
||||
}
|
||||
|
||||
void FileLogger::changePath(const QString &newPath)
|
||||
void FileLogger::changePath(const QString& newPath)
|
||||
{
|
||||
QString tmpPath = Utils::Fs::fromNativePath(newPath);
|
||||
QDir dir(tmpPath);
|
||||
@@ -86,21 +83,21 @@ void FileLogger::changePath(const QString &newPath)
|
||||
void FileLogger::deleteOld(const int age, const FileLogAgeType ageType)
|
||||
{
|
||||
QDateTime date = QDateTime::currentDateTime();
|
||||
QDir dir(Utils::Fs::branchPath(m_path));
|
||||
QDir dir(m_path);
|
||||
|
||||
for (const QFileInfo &file : asConst(dir.entryInfoList(QStringList("qbittorrent.log.bak*"), QDir::Files | QDir::Writable, QDir::Time | QDir::Reversed))) {
|
||||
QDateTime modificationDate = file.lastModified();
|
||||
switch (ageType) {
|
||||
case DAYS:
|
||||
modificationDate = modificationDate.addDays(age);
|
||||
break;
|
||||
case MONTHS:
|
||||
modificationDate = modificationDate.addMonths(age);
|
||||
break;
|
||||
default:
|
||||
modificationDate = modificationDate.addYears(age);
|
||||
}
|
||||
if (modificationDate > date)
|
||||
switch (ageType) {
|
||||
case DAYS:
|
||||
date = date.addDays(age);
|
||||
break;
|
||||
case MONTHS:
|
||||
date = date.addMonths(age);
|
||||
break;
|
||||
default:
|
||||
date = date.addYears(age);
|
||||
}
|
||||
|
||||
foreach (const QFileInfo file, dir.entryInfoList(QStringList("qbittorrent.log.bak*"), QDir::Files | QDir::Writable, QDir::Time | QDir::Reversed)) {
|
||||
if (file.lastModified() < date)
|
||||
break;
|
||||
Utils::Fs::forceRemove(file.absoluteFilePath());
|
||||
}
|
||||
@@ -138,7 +135,7 @@ void FileLogger::addLogMessage(const Log::Msg &msg)
|
||||
|
||||
str << QDateTime::fromMSecsSinceEpoch(msg.timestamp).toString(Qt::ISODate) << " - " << msg.message << endl;
|
||||
|
||||
if (m_backup && (m_logFile->size() >= m_maxSize)) {
|
||||
if (m_backup && (m_logFile->size() >= (m_maxSize * 1024 * 1024))) {
|
||||
closeLogFile();
|
||||
int counter = 0;
|
||||
QString backupLogFilename = m_path + ".bak";
|
||||
@@ -168,7 +165,7 @@ void FileLogger::openLogFile()
|
||||
|| !m_logFile->setPermissions(QFile::ReadOwner | QFile::WriteOwner)) {
|
||||
delete m_logFile;
|
||||
m_logFile = nullptr;
|
||||
Logger::instance()->addMessage(tr("An error occurred while trying to open the log file. Logging to file is disabled."), Log::CRITICAL);
|
||||
Logger::instance()->addMessage(tr("An error occured while trying to open the log file. Logging to file is disabled."), Log::CRITICAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,3 +76,4 @@ private:
|
||||
};
|
||||
|
||||
#endif // FILELOGGER_H
|
||||
|
||||
|
||||
510
src/app/main.cpp
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
* Copyright (C) 2006 Christophe Dumez
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -25,13 +25,12 @@
|
||||
* 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.
|
||||
*
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QScopedPointer>
|
||||
#include <QThread>
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
// GUI-only includes
|
||||
@@ -44,7 +43,11 @@
|
||||
|
||||
#ifdef QBT_STATIC_QT
|
||||
#include <QtPlugin>
|
||||
#ifdef QBT_USES_QT5
|
||||
Q_IMPORT_PLUGIN(QICOPlugin)
|
||||
#else
|
||||
Q_IMPORT_PLUGIN(qico)
|
||||
#endif
|
||||
#endif // QBT_STATIC_QT
|
||||
|
||||
#else
|
||||
@@ -55,53 +58,85 @@ Q_IMPORT_PLUGIN(QICOPlugin)
|
||||
#endif
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
#include <signal.h>
|
||||
#ifdef STACKTRACE
|
||||
#ifdef Q_OS_UNIX
|
||||
#include <signal.h>
|
||||
#include <execinfo.h>
|
||||
#include "stacktrace.h"
|
||||
#else
|
||||
#include "stacktrace_win.h"
|
||||
#include "stacktracedialog.h"
|
||||
#endif // Q_OS_UNIX
|
||||
#endif //STACKTRACE
|
||||
|
||||
#include "base/preferences.h"
|
||||
#include "base/profile.h"
|
||||
#include "base/utils/misc.h"
|
||||
#ifdef STACKTRACE_WIN
|
||||
#include <signal.h>
|
||||
#include "stacktrace_win.h"
|
||||
#include "stacktrace_win_dlg.h"
|
||||
#endif //STACKTRACE_WIN
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include "application.h"
|
||||
#include "cmdoptions.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/preferences.h"
|
||||
|
||||
#include "upgrade.h"
|
||||
|
||||
// Signal handlers
|
||||
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
||||
void sigNormalHandler(int signum);
|
||||
#ifdef STACKTRACE
|
||||
void sigAbnormalHandler(int signum);
|
||||
#endif
|
||||
// sys_signame[] is only defined in BSD
|
||||
const char *sysSigName[] = {
|
||||
#if defined(Q_OS_WIN)
|
||||
"", "", "SIGINT", "", "SIGILL", "", "SIGABRT_COMPAT", "", "SIGFPE", "",
|
||||
"", "SIGSEGV", "", "", "", "SIGTERM", "", "", "", "",
|
||||
"", "SIGBREAK", "SIGABRT", "", "", "", "", "", "", "",
|
||||
"", ""
|
||||
#else
|
||||
"", "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", "SIGABRT", "SIGBUS", "SIGFPE", "SIGKILL",
|
||||
"SIGUSR1", "SIGSEGV", "SIGUSR2", "SIGPIPE", "SIGALRM", "SIGTERM", "SIGSTKFLT", "SIGCHLD", "SIGCONT", "SIGSTOP",
|
||||
"SIGTSTP", "SIGTTIN", "SIGTTOU", "SIGURG", "SIGXCPU", "SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH", "SIGIO",
|
||||
"SIGPWR", "SIGUNUSED"
|
||||
};
|
||||
#endif
|
||||
|
||||
struct QBtCommandLineParameters
|
||||
{
|
||||
bool showHelp;
|
||||
#ifndef Q_OS_WIN
|
||||
bool showVersion;
|
||||
#endif
|
||||
#ifndef DISABLE_GUI
|
||||
bool noSplash;
|
||||
#else
|
||||
bool shouldDaemonize;
|
||||
#endif
|
||||
int webUiPort;
|
||||
QStringList torrents;
|
||||
QString unknownParameter;
|
||||
|
||||
QBtCommandLineParameters()
|
||||
: showHelp(false)
|
||||
#ifndef Q_OS_WIN
|
||||
, showVersion(false)
|
||||
#endif
|
||||
#ifndef DISABLE_GUI
|
||||
, noSplash(Preferences::instance()->isSplashScreenDisabled())
|
||||
#else
|
||||
, shouldDaemonize(false)
|
||||
#endif
|
||||
, webUiPort(Preferences::instance()->getWebUiPort())
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||
void reportToUser(const char *str);
|
||||
void reportToUser(const char* str);
|
||||
#endif
|
||||
|
||||
void displayVersion();
|
||||
void displayUsage(const QString &prg_name);
|
||||
bool userAgreesWithLegalNotice();
|
||||
void displayBadArgMessage(const QString &message);
|
||||
QBtCommandLineParameters parseCommandLine();
|
||||
|
||||
#if !defined(DISABLE_GUI)
|
||||
void showSplashScreen();
|
||||
|
||||
#if defined(Q_OS_UNIX)
|
||||
void setupDpi();
|
||||
#endif // Q_OS_UNIX
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
// Main
|
||||
@@ -116,150 +151,214 @@ int main(int argc, char *argv[])
|
||||
macMigratePlists();
|
||||
#endif
|
||||
|
||||
try {
|
||||
// Create Application
|
||||
QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString();
|
||||
QScopedPointer<Application> app(new Application(appId, argc, argv));
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
// after the application object creation because we need a profile to be set already
|
||||
// for the migration
|
||||
migrateRSS();
|
||||
#if !defined(DISABLE_GUI) && defined(Q_OS_UNIX)
|
||||
setupDpi();
|
||||
#endif
|
||||
|
||||
const QBtCommandLineParameters params = app->commandLineArgs();
|
||||
|
||||
if (!params.unknownParameter.isEmpty()) {
|
||||
throw CommandLineParameterError(QObject::tr("%1 is an unknown command line parameter.",
|
||||
"--random-parameter is an unknown command line parameter.")
|
||||
.arg(params.unknownParameter));
|
||||
}
|
||||
#ifndef DISABLE_GUI
|
||||
migrateRSS();
|
||||
#endif
|
||||
|
||||
// Create Application
|
||||
QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString();
|
||||
QScopedPointer<Application> app(new Application(appId, argc, argv));
|
||||
|
||||
const QBtCommandLineParameters params = parseCommandLine();
|
||||
|
||||
if (!params.unknownParameter.isEmpty()) {
|
||||
displayBadArgMessage(QObject::tr("%1 is an unknown command line parameter.", "--random-parameter is an unknown command line parameter.")
|
||||
.arg(params.unknownParameter));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
if (params.showVersion) {
|
||||
if (isOneArg) {
|
||||
displayVersion();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
throw CommandLineParameterError(QObject::tr("%1 must be the single command line parameter.")
|
||||
.arg(QLatin1String("-v (or --version)")));
|
||||
if (params.showVersion) {
|
||||
if (isOneArg) {
|
||||
displayVersion();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
else {
|
||||
displayBadArgMessage(QObject::tr("%1 must be the single command line parameter.")
|
||||
.arg(QLatin1String("-v (or --version)")));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (params.showHelp) {
|
||||
if (isOneArg) {
|
||||
displayUsage(argv[0]);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
throw CommandLineParameterError(QObject::tr("%1 must be the single command line parameter.")
|
||||
|
||||
if (params.showHelp) {
|
||||
if (isOneArg) {
|
||||
displayUsage(argv[0]);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
else {
|
||||
displayBadArgMessage(QObject::tr("%1 must be the single command line parameter.")
|
||||
.arg(QLatin1String("-h (or --help)")));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
// Set environment variable
|
||||
if (!qputenv("QBITTORRENT", QBT_VERSION))
|
||||
fprintf(stderr, "Couldn't set environment variable...\n");
|
||||
if ((params.webUiPort > 0) && (params.webUiPort <= 65535)) {
|
||||
Preferences::instance()->setWebUiPort(params.webUiPort);
|
||||
}
|
||||
else {
|
||||
displayBadArgMessage(QObject::tr("%1 must specify the correct port (1 to 65535).")
|
||||
.arg(QLatin1String("--webui-port")));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Set environment variable
|
||||
if (!qputenv("QBITTORRENT", QBT_VERSION))
|
||||
std::cerr << "Couldn't set environment variable...\n";
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
if (!userAgreesWithLegalNotice())
|
||||
return EXIT_SUCCESS;
|
||||
if (!userAgreesWithLegalNotice())
|
||||
return EXIT_SUCCESS;
|
||||
#else
|
||||
if (!params.shouldDaemonize
|
||||
&& isatty(fileno(stdin))
|
||||
&& isatty(fileno(stdout))
|
||||
&& !userAgreesWithLegalNotice())
|
||||
return EXIT_SUCCESS;
|
||||
if (!params.shouldDaemonize
|
||||
&& isatty(fileno(stdin))
|
||||
&& isatty(fileno(stdout))
|
||||
&& !userAgreesWithLegalNotice())
|
||||
return EXIT_SUCCESS;
|
||||
#endif
|
||||
|
||||
// Check if qBittorrent is already running for this user
|
||||
if (app->isRunning()) {
|
||||
#ifdef DISABLE_GUI
|
||||
if (params.shouldDaemonize) {
|
||||
throw CommandLineParameterError(QObject::tr("You cannot use %1: qBittorrent is already running for this user.")
|
||||
.arg(QLatin1String("-d (or --daemon)")));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
qDebug("qBittorrent is already running for this user.");
|
||||
|
||||
QThread::msleep(300);
|
||||
app->sendParams(params.paramList());
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
// This affects only Windows apparently and Qt5.
|
||||
// When QNetworkAccessManager is instantiated it regularly starts polling
|
||||
// the network interfaces to see what's available and their status.
|
||||
// This polling creates jitter and high ping with wifi interfaces.
|
||||
// So here we disable it for lack of better measure.
|
||||
// It will also spew this message in the console: QObject::startTimer: Timers cannot have negative intervals
|
||||
// For more info see:
|
||||
// 1. https://github.com/qbittorrent/qBittorrent/issues/4209
|
||||
// 2. https://bugreports.qt.io/browse/QTBUG-40332
|
||||
// 3. https://bugreports.qt.io/browse/QTBUG-46015
|
||||
|
||||
qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1));
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
// this is the default in Qt6
|
||||
app->setAttribute(Qt::AA_DisableWindowContextHelpButton);
|
||||
#endif
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
// Since Apple made difficult for users to set PATH, we set here for convenience.
|
||||
// Users are supposed to install Homebrew Python for search function.
|
||||
// For more info see issue #5571.
|
||||
QByteArray path = "/usr/local/bin:";
|
||||
path += qgetenv("PATH");
|
||||
qputenv("PATH", path.constData());
|
||||
|
||||
// On OS X the standard is to not show icons in the menus
|
||||
app->setAttribute(Qt::AA_DontShowIconsInMenus);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
if (!upgrade()) return EXIT_FAILURE;
|
||||
#else
|
||||
if (!upgrade(!params.shouldDaemonize
|
||||
&& isatty(fileno(stdin))
|
||||
&& isatty(fileno(stdout)))) return EXIT_FAILURE;
|
||||
#endif
|
||||
// Check if qBittorrent is already running for this user
|
||||
if (app->isRunning()) {
|
||||
#ifdef DISABLE_GUI
|
||||
if (params.shouldDaemonize) {
|
||||
app.reset(); // Destroy current application
|
||||
if (daemon(1, 0) == 0) {
|
||||
app.reset(new Application(appId, argc, argv));
|
||||
if (app->isRunning()) {
|
||||
// Another instance had time to start.
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qCritical("Something went wrong while daemonizing, exiting...");
|
||||
displayBadArgMessage(QObject::tr("You cannot use %1: qBittorrent is already running for this user.")
|
||||
.arg(QLatin1String("-d (or --daemon)")));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
qDebug("qBittorrent is already running for this user.");
|
||||
|
||||
Utils::Misc::msleep(300);
|
||||
app->sendParams(params.torrents);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN) && defined(QBT_USES_QT5)
|
||||
// This affects only Windows apparently and Qt5.
|
||||
// When QNetworkAccessManager is instantiated it regularly starts polling
|
||||
// the network interfaces to see what's available and their status.
|
||||
// This polling creates jitter and high ping with wifi interfaces.
|
||||
// So here we disable it for lack of better measure.
|
||||
// It will also spew this message in the console: QObject::startTimer: Timers cannot have negative intervals
|
||||
// For more info see:
|
||||
// 1. https://github.com/qbittorrent/qBittorrent/issues/4209
|
||||
// 2. https://bugreports.qt.io/browse/QTBUG-40332
|
||||
// 3. https://bugreports.qt.io/browse/QTBUG-46015
|
||||
|
||||
qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1));
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
{
|
||||
// Since Apple made difficult for users to set PATH, we set here for convenience.
|
||||
// Users are supposed to install Homebrew Python for search function.
|
||||
// For more info see issue #5571.
|
||||
QByteArray path = "/usr/local/bin:";
|
||||
path += qgetenv("PATH");
|
||||
qputenv("PATH", path.constData());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
if (!upgrade()) return EXIT_FAILURE;
|
||||
#else
|
||||
if (!upgrade(!params.shouldDaemonize
|
||||
&& isatty(fileno(stdin))
|
||||
&& isatty(fileno(stdout)))) return EXIT_FAILURE;
|
||||
#endif
|
||||
|
||||
#ifdef DISABLE_GUI
|
||||
if (params.shouldDaemonize) {
|
||||
app.reset(); // Destroy current application
|
||||
if ((daemon(1, 0) == 0)) {
|
||||
app.reset(new Application(appId, argc, argv));
|
||||
if (app->isRunning()) {
|
||||
// Another instance had time to start.
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qCritical("Something went wrong while daemonizing, exiting...");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (!(params.noSplash || Preferences::instance()->isSplashScreenDisabled()))
|
||||
showSplashScreen();
|
||||
if (!params.noSplash)
|
||||
showSplashScreen();
|
||||
#endif
|
||||
|
||||
signal(SIGINT, sigNormalHandler);
|
||||
signal(SIGTERM, sigNormalHandler);
|
||||
#ifdef STACKTRACE
|
||||
signal(SIGABRT, sigAbnormalHandler);
|
||||
signal(SIGSEGV, sigAbnormalHandler);
|
||||
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
||||
signal(SIGINT, sigNormalHandler);
|
||||
signal(SIGTERM, sigNormalHandler);
|
||||
signal(SIGABRT, sigAbnormalHandler);
|
||||
signal(SIGSEGV, sigAbnormalHandler);
|
||||
#endif
|
||||
|
||||
return app->exec(params.paramList());
|
||||
}
|
||||
catch (CommandLineParameterError &er) {
|
||||
displayBadArgMessage(er.messageForUser());
|
||||
return EXIT_FAILURE;
|
||||
return app->exec(params.torrents);
|
||||
}
|
||||
|
||||
QBtCommandLineParameters parseCommandLine()
|
||||
{
|
||||
QBtCommandLineParameters result;
|
||||
QStringList appArguments = qApp->arguments();
|
||||
|
||||
for (int i = 1; i < appArguments.size(); ++i) {
|
||||
const QString& arg = appArguments[i];
|
||||
|
||||
if ((arg.startsWith("--") && !arg.endsWith(".torrent")) ||
|
||||
(arg.startsWith("-") && arg.size() == 2)) {
|
||||
//Parse known parameters
|
||||
if ((arg == QLatin1String("-h")) || (arg == QLatin1String("--help"))) {
|
||||
result.showHelp = true;
|
||||
}
|
||||
#ifndef Q_OS_WIN
|
||||
else if ((arg == QLatin1String("-v")) || (arg == QLatin1String("--version"))) {
|
||||
result.showVersion = true;
|
||||
}
|
||||
#endif
|
||||
else if (arg.startsWith(QLatin1String("--webui-port="))) {
|
||||
QStringList parts = arg.split(QLatin1Char('='));
|
||||
if (parts.size() == 2)
|
||||
result.webUiPort = parts.last().toInt();
|
||||
}
|
||||
#ifndef DISABLE_GUI
|
||||
else if (arg == QLatin1String("--no-splash")) {
|
||||
result.noSplash = true;
|
||||
}
|
||||
#else
|
||||
else if ((arg == QLatin1String("-d")) || (arg == QLatin1String("--daemon"))) {
|
||||
result.shouldDaemonize = true;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
//Unknown argument
|
||||
result.unknownParameter = arg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
QFileInfo torrentPath;
|
||||
torrentPath.setFile(arg);
|
||||
|
||||
if (torrentPath.exists())
|
||||
result.torrents += torrentPath.absoluteFilePath();
|
||||
else
|
||||
result.torrents += arg;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||
void reportToUser(const char *str)
|
||||
void reportToUser(const char* str)
|
||||
{
|
||||
const size_t strLen = strlen(str);
|
||||
if (write(STDERR_FILENO, str, strLen) < static_cast<ssize_t>(strLen)) {
|
||||
@@ -269,67 +368,120 @@ void reportToUser(const char *str)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
||||
void sigNormalHandler(int signum)
|
||||
{
|
||||
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||
const char msg1[] = "Catching signal: ";
|
||||
const char msg2[] = "\nExiting cleanly\n";
|
||||
reportToUser(msg1);
|
||||
reportToUser(sysSigName[signum]);
|
||||
reportToUser(msg2);
|
||||
const char str1[] = "Catching signal: ";
|
||||
const char *sigName = sysSigName[signum];
|
||||
const char str2[] = "\nExiting cleanly\n";
|
||||
reportToUser(str1);
|
||||
reportToUser(sigName);
|
||||
reportToUser(str2);
|
||||
#endif // !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||
signal(signum, SIG_DFL);
|
||||
qApp->exit(); // unsafe, but exit anyway
|
||||
}
|
||||
|
||||
#ifdef STACKTRACE
|
||||
void sigAbnormalHandler(int signum)
|
||||
{
|
||||
const char *sigName = sysSigName[signum];
|
||||
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||
const char msg[] = "\n\n*************************************************************\n"
|
||||
"Please file a bug report at http://bug.qbittorrent.org and provide the following information:\n\n"
|
||||
"qBittorrent version: " QBT_VERSION "\n\n"
|
||||
"Caught signal: ";
|
||||
reportToUser(msg);
|
||||
const char str1[] = "\n\n*************************************************************\nCatching signal: ";
|
||||
const char *sigName = sysSigName[signum];
|
||||
const char str2[] = "\nPlease file a bug report at http://bug.qbittorrent.org and provide the following information:\n\n"
|
||||
"qBittorrent version: " QBT_VERSION "\n";
|
||||
reportToUser(str1);
|
||||
reportToUser(sigName);
|
||||
reportToUser("\n");
|
||||
reportToUser(str2);
|
||||
print_stacktrace(); // unsafe
|
||||
#endif
|
||||
|
||||
#if defined Q_OS_WIN
|
||||
StacktraceDialog dlg; // unsafe
|
||||
dlg.setStacktraceString(QLatin1String(sigName), straceWin::getBacktrace());
|
||||
#endif // !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||
#ifdef STACKTRACE_WIN
|
||||
StraceDlg dlg; // unsafe
|
||||
dlg.setStacktraceString(straceWin::getBacktrace());
|
||||
dlg.exec();
|
||||
#endif
|
||||
|
||||
#endif // STACKTRACE_WIN
|
||||
signal(signum, SIG_DFL);
|
||||
raise(signum);
|
||||
}
|
||||
#endif // STACKTRACE
|
||||
#endif // defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
||||
|
||||
#if !defined(DISABLE_GUI)
|
||||
void showSplashScreen()
|
||||
{
|
||||
QPixmap splashImg(":/icons/skin/splash.png");
|
||||
QPainter painter(&splashImg);
|
||||
QPixmap splash_img(":/icons/skin/splash.png");
|
||||
QPainter painter(&splash_img);
|
||||
QString version = QBT_VERSION;
|
||||
painter.setPen(QPen(Qt::white));
|
||||
painter.setFont(QFont("Arial", 22, QFont::Black));
|
||||
painter.drawText(224 - painter.fontMetrics().width(version), 270, version);
|
||||
QSplashScreen *splash = new QSplashScreen(splashImg);
|
||||
QSplashScreen *splash = new QSplashScreen(splash_img);
|
||||
splash->show();
|
||||
QTimer::singleShot(1500, splash, &QObject::deleteLater);
|
||||
QTimer::singleShot(1500, splash, SLOT(deleteLater()));
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
#if defined(Q_OS_UNIX)
|
||||
void setupDpi()
|
||||
{
|
||||
if (qgetenv("QT_AUTO_SCREEN_SCALE_FACTOR").isEmpty())
|
||||
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1");
|
||||
}
|
||||
#endif // Q_OS_UNIX
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
void displayVersion()
|
||||
{
|
||||
printf("%s %s\n", qUtf8Printable(qApp->applicationName()), QBT_VERSION);
|
||||
std::cout << qPrintable(qApp->applicationName()) << " " << QBT_VERSION << std::endl;
|
||||
}
|
||||
|
||||
void displayBadArgMessage(const QString &message)
|
||||
QString makeUsage(const QString &prg_name)
|
||||
{
|
||||
QString text;
|
||||
|
||||
text += QObject::tr("Usage:") + QLatin1Char('\n');
|
||||
#ifndef Q_OS_WIN
|
||||
text += QLatin1Char('\t') + prg_name + QLatin1String(" (-v | --version)") + QLatin1Char('\n');
|
||||
#endif
|
||||
text += QLatin1Char('\t') + prg_name + QLatin1String(" (-h | --help)") + QLatin1Char('\n');
|
||||
text += QLatin1Char('\t') + prg_name
|
||||
+ QLatin1String(" [--webui-port=<port>]")
|
||||
#ifndef DISABLE_GUI
|
||||
+ QLatin1String(" [--no-splash]")
|
||||
#else
|
||||
+ QLatin1String(" [-d | --daemon]")
|
||||
#endif
|
||||
+ QLatin1String("[(<filename> | <url>)...]") + QLatin1Char('\n');
|
||||
text += QObject::tr("Options:") + QLatin1Char('\n');
|
||||
#ifndef Q_OS_WIN
|
||||
text += QLatin1String("\t-v | --version\t\t") + QObject::tr("Displays program version") + QLatin1Char('\n');
|
||||
#endif
|
||||
text += QLatin1String("\t-h | --help\t\t") + QObject::tr("Displays this help message") + QLatin1Char('\n');
|
||||
text += QLatin1String("\t--webui-port=<port>\t")
|
||||
+ QObject::tr("Changes the Web UI port (current: %1)").arg(QString::number(Preferences::instance()->getWebUiPort()))
|
||||
+ QLatin1Char('\n');
|
||||
#ifndef DISABLE_GUI
|
||||
text += QLatin1String("\t--no-splash\t\t") + QObject::tr("Disable splash screen") + QLatin1Char('\n');
|
||||
#else
|
||||
text += QLatin1String("\t-d | --daemon\t\t") + QObject::tr("Run in daemon-mode (background)") + QLatin1Char('\n');
|
||||
#endif
|
||||
text += QLatin1String("\tfiles or urls\t\t") + QObject::tr("Downloads the torrents passed by the user");
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
void displayUsage(const QString& prg_name)
|
||||
{
|
||||
#ifndef Q_OS_WIN
|
||||
std::cout << qPrintable(makeUsage(prg_name)) << std::endl;
|
||||
#else
|
||||
QMessageBox msgBox(QMessageBox::Information, QObject::tr("Help"), makeUsage(prg_name), QMessageBox::Ok);
|
||||
msgBox.show(); // Need to be shown or to moveToCenter does not work
|
||||
msgBox.move(Utils::Misc::screenCenter(&msgBox));
|
||||
msgBox.exec();
|
||||
#endif
|
||||
}
|
||||
|
||||
void displayBadArgMessage(const QString& message)
|
||||
{
|
||||
QString help = QObject::tr("Run application with -h option to read about command line parameters.");
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -339,28 +491,24 @@ void displayBadArgMessage(const QString &message)
|
||||
msgBox.move(Utils::Misc::screenCenter(&msgBox));
|
||||
msgBox.exec();
|
||||
#else
|
||||
const QString errMsg = QObject::tr("Bad command line: ") + '\n'
|
||||
+ message + '\n'
|
||||
+ help + '\n';
|
||||
fprintf(stderr, "%s", qUtf8Printable(errMsg));
|
||||
std::cerr << qPrintable(QObject::tr("Bad command line: "));
|
||||
std::cerr << qPrintable(message) << std::endl;
|
||||
std::cerr << qPrintable(help) << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool userAgreesWithLegalNotice()
|
||||
{
|
||||
Preferences *const pref = Preferences::instance();
|
||||
Preferences* const pref = Preferences::instance();
|
||||
if (pref->getAcceptedLegal()) // Already accepted once
|
||||
return true;
|
||||
|
||||
#ifdef DISABLE_GUI
|
||||
const QString eula = QString("\n*** %1 ***\n").arg(QObject::tr("Legal Notice"))
|
||||
+ QObject::tr("qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.") + "\n\n"
|
||||
+ QObject::tr("No further notices will be issued.") + "\n\n"
|
||||
+ QObject::tr("Press %1 key to accept and continue...").arg("'y'") + '\n';
|
||||
printf("%s", qUtf8Printable(eula));
|
||||
|
||||
std::cout << std::endl << "*** " << qPrintable(QObject::tr("Legal Notice")) << " ***" << std::endl;
|
||||
std::cout << qPrintable(QObject::tr("qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.\n\nNo further notices will be issued.")) << std::endl << std::endl;
|
||||
std::cout << qPrintable(QObject::tr("Press %1 key to accept and continue...").arg("'y'")) << std::endl;
|
||||
char ret = getchar(); // Read pressed key
|
||||
if ((ret == 'y') || (ret == 'Y')) {
|
||||
if (ret == 'y' || ret == 'Y') {
|
||||
// Save the answer
|
||||
pref->setAcceptedLegal(true);
|
||||
return true;
|
||||
@@ -370,16 +518,16 @@ bool userAgreesWithLegalNotice()
|
||||
msgBox.setText(QObject::tr("qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.\n\nNo further notices will be issued."));
|
||||
msgBox.setWindowTitle(QObject::tr("Legal notice"));
|
||||
msgBox.addButton(QObject::tr("Cancel"), QMessageBox::RejectRole);
|
||||
QAbstractButton *agreeButton = msgBox.addButton(QObject::tr("I Agree"), QMessageBox::AcceptRole);
|
||||
QAbstractButton *agree_button = msgBox.addButton(QObject::tr("I Agree"), QMessageBox::AcceptRole);
|
||||
msgBox.show(); // Need to be shown or to moveToCenter does not work
|
||||
msgBox.move(Utils::Misc::screenCenter(&msgBox));
|
||||
msgBox.exec();
|
||||
if (msgBox.clickedButton() == agreeButton) {
|
||||
if (msgBox.clickedButton() == agree_button) {
|
||||
// Save the answer
|
||||
pref->setAcceptedLegal(true);
|
||||
return true;
|
||||
}
|
||||
#endif // DISABLE_GUI
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -8,24 +8,29 @@ set(QBT_QTSINGLEAPPLICATION_SOURCES
|
||||
qtlocalpeer.cpp
|
||||
)
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
if (GUI)
|
||||
list(APPEND QBT_QTSINGLEAPPLICATION_HEADERS qtsingleapplication.h)
|
||||
list(APPEND QBT_QTSINGLEAPPLICATION_SOURCES qtsingleapplication.cpp)
|
||||
else (Qt5Widgets_FOUND)
|
||||
else (GUI)
|
||||
list(APPEND QBT_QTSINGLEAPPLICATION_HEADERS qtsinglecoreapplication.h)
|
||||
list(APPEND QBT_QTSINGLEAPPLICATION_SOURCES qtsinglecoreapplication.cpp)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
endif (GUI)
|
||||
|
||||
add_library(qtsingleapplication STATIC ${QBT_QTSINGLEAPPLICATION_HEADERS} ${QBT_QTSINGLEAPPLICATION_SOURCES})
|
||||
add_library(qtsingleapplication ${QBT_QTSINGLEAPPLICATION_HEADERS} ${QBT_QTSINGLEAPPLICATION_SOURCES})
|
||||
target_include_directories(qtsingleapplication INTERFACE "${qtsingleapplication_SOURCE_DIR}")
|
||||
target_link_libraries(qtsingleapplication PRIVATE Qt5::Network)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
target_compile_options(qtsingleapplication PRIVATE "-w") # disable warning for 3rdparty code
|
||||
endif()
|
||||
if (QT4_FOUND)
|
||||
target_link_libraries(qtsingleapplication Qt4::QtNetwork)
|
||||
else (QT4_FOUND)
|
||||
target_link_libraries(qtsingleapplication Qt5::Network)
|
||||
endif (QT4_FOUND)
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
target_link_libraries(qtsingleapplication PRIVATE Qt5::Widgets)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
if (GUI)
|
||||
if (QT4_FOUND)
|
||||
target_link_libraries(qtsingleapplication Qt4::QtGui)
|
||||
else (QT4_FOUND)
|
||||
target_link_libraries(qtsingleapplication Qt5::Widgets)
|
||||
endif(QT4_FOUND)
|
||||
endif (GUI)
|
||||
|
||||
add_library(QtSingleApplication::QtSingleApplication ALIAS qtsingleapplication)
|
||||
|
||||
@@ -176,17 +176,8 @@ void QtLocalPeer::receiveConnection()
|
||||
if (!socket)
|
||||
return;
|
||||
|
||||
while (true) {
|
||||
if (socket->state() == QLocalSocket::UnconnectedState) {
|
||||
qWarning("QtLocalPeer: Peer disconnected");
|
||||
delete socket;
|
||||
return;
|
||||
}
|
||||
if (socket->bytesAvailable() >= qint64(sizeof(quint32)))
|
||||
break;
|
||||
while (socket->bytesAvailable() < (int)sizeof(quint32))
|
||||
socket->waitForReadyRead();
|
||||
}
|
||||
|
||||
QDataStream ds(socket);
|
||||
QByteArray uMsg;
|
||||
quint32 remaining;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
/** Print a demangled stack backtrace of the caller function to FILE* out. */
|
||||
static inline void print_stacktrace(FILE *out = stderr, unsigned int max_frames = 63)
|
||||
{
|
||||
fprintf(out, "Stack trace:\n");
|
||||
fprintf(out, "stack trace:\n");
|
||||
|
||||
// storage array for stack trace address data
|
||||
std::vector<void *> addrlist(max_frames + 1);
|
||||
@@ -33,7 +33,7 @@ static inline void print_stacktrace(FILE *out = stderr, unsigned int max_frames
|
||||
|
||||
// allocate string which will be filled with the demangled function name
|
||||
size_t funcnamesize = 256;
|
||||
char *funcname = static_cast<char *>(malloc(funcnamesize));
|
||||
char *funcname = (char *)malloc(funcnamesize);
|
||||
|
||||
int functionNamesFound = 0;
|
||||
// iterate over the returned symbol lines. skip the first, it is the
|
||||
|
||||
@@ -138,7 +138,7 @@ bool straceWin::makeRelativePath(const QString& dir, QString& file)
|
||||
|
||||
QString straceWin::getSourcePathAndLineNumber(HANDLE hProcess, DWORD64 addr)
|
||||
{
|
||||
IMAGEHLP_LINE64 line {};
|
||||
IMAGEHLP_LINE64 line = {0};
|
||||
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
|
||||
DWORD dwDisplacement = 0;
|
||||
|
||||
@@ -291,7 +291,7 @@ const QString straceWin::getBacktrace()
|
||||
demangle(funcName);
|
||||
#endif
|
||||
|
||||
// now ihsf.InstructionOffset points to the instruction that follows CALL instruction
|
||||
// now ihsf.InstructionOffset points to the instruction that follows CALL instuction
|
||||
// decrease the query address by one byte to point somewhere in the CALL instruction byte sequence
|
||||
sourceFile = getSourcePathAndLineNumber(hProcess, ihsf.InstructionOffset - 1);
|
||||
}
|
||||
|
||||
@@ -27,27 +27,26 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STACKTRACEDIALOG_H
|
||||
#define STACKTRACEDIALOG_H
|
||||
#ifndef STACKTRACE_WIN_DLG_H
|
||||
#define STACKTRACE_WIN_DLG_H
|
||||
|
||||
#include <QString>
|
||||
#include <QDialog>
|
||||
|
||||
#include "base/utils/misc.h"
|
||||
#include "ui_stacktracedialog.h"
|
||||
#include "ui_stacktrace_win_dlg.h"
|
||||
|
||||
class StacktraceDialog : public QDialog, private Ui::StacktraceDialog
|
||||
class StraceDlg : public QDialog, private Ui::errorDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StacktraceDialog(QWidget *parent = nullptr)
|
||||
StraceDlg(QWidget* parent = 0)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
void setStacktraceString(const QString &sigName, const QString &trace)
|
||||
void setStacktraceString(const QString& trace)
|
||||
{
|
||||
// try to call Qt function as less as possible
|
||||
QString htmlStr = QString(
|
||||
@@ -69,19 +68,17 @@ public:
|
||||
"Libtorrent version: %1<br/>"
|
||||
"Qt version: " QT_VERSION_STR "<br/>"
|
||||
"Boost version: %2<br/>"
|
||||
"OS version: %3<br/><br/>"
|
||||
"Caught signal: %4"
|
||||
"</font></p>"
|
||||
"<pre><code>%5</code></pre>"
|
||||
"OS version: %3"
|
||||
"</font></p><br/>"
|
||||
"<pre><code>%4</code></pre>"
|
||||
"<br/><hr><br/><br/>")
|
||||
.arg(Utils::Misc::libtorrentVersionString())
|
||||
.arg(Utils::Misc::boostVersionString())
|
||||
.arg(Utils::Misc::osName())
|
||||
.arg(sigName)
|
||||
.arg(trace);
|
||||
.arg(Utils::Misc::libtorrentVersionString())
|
||||
.arg(Utils::Misc::boostVersionString())
|
||||
.arg(Utils::Misc::osName())
|
||||
.arg(trace);
|
||||
|
||||
errorText->setHtml(htmlStr);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // STACKTRACEDIALOG_H
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>StacktraceDialog</class>
|
||||
<widget class="QDialog" name="StacktraceDialog">
|
||||
<class>errorDialog</class>
|
||||
<widget class="QDialog" name="errorDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@@ -29,43 +29,39 @@
|
||||
#ifndef UPGRADE_H
|
||||
#define UPGRADE_H
|
||||
|
||||
#include <libtorrent/bencode.hpp>
|
||||
#include <libtorrent/entry.hpp>
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
#if LIBTORRENT_VERSION_NUM >= 10100
|
||||
#include <libtorrent/bdecode.hpp>
|
||||
#else
|
||||
#endif
|
||||
#include <libtorrent/bencode.hpp>
|
||||
#include <libtorrent/entry.hpp>
|
||||
#if LIBTORRENT_VERSION_NUM < 10100
|
||||
#include <libtorrent/lazy_entry.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
#include <QMessageBox>
|
||||
#endif
|
||||
#ifdef Q_OS_MAC
|
||||
#include <QSettings>
|
||||
#endif
|
||||
#include <QRegExp>
|
||||
#include <QString>
|
||||
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/profile.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/qinisettings.h"
|
||||
|
||||
bool userAcceptsUpgrade()
|
||||
{
|
||||
#ifdef DISABLE_GUI
|
||||
printf("\n*** %s ***\n", qUtf8Printable(QObject::tr("Upgrade")));
|
||||
std::cout << std::endl << "*** " << qPrintable(QObject::tr("Upgrade")) << " ***" << std::endl;
|
||||
char ret = '\0';
|
||||
do {
|
||||
printf("%s\n"
|
||||
, qUtf8Printable(QObject::tr("You updated from an older version that saved things differently. You must migrate to the new saving system. You will not be able to use an older version than v3.3.0 again. Continue? [y/n]")));
|
||||
std::cout << qPrintable(QObject::tr("You updated from an older version that saved things differently. You must migrate to the new saving system. You will not be able to use an older version than v3.3.0 again. Continue? [y/n]")) << std::endl;
|
||||
ret = getchar(); // Read pressed key
|
||||
}
|
||||
while ((ret != 'y') && (ret != 'Y') && (ret != 'n') && (ret != 'N'));
|
||||
@@ -83,7 +79,7 @@ bool userAcceptsUpgrade()
|
||||
msgBox.move(Utils::Misc::screenCenter(&msgBox));
|
||||
if (msgBox.exec() == QMessageBox::Ok)
|
||||
return true;
|
||||
#endif // DISABLE_GUI
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -114,47 +110,22 @@ bool upgradeResumeFile(const QString &filepath, const QVariantHash &oldTorrent =
|
||||
bool v3_3 = false;
|
||||
int queuePosition = 0;
|
||||
QString outFilePath = filepath;
|
||||
static const QRegularExpression rx(QLatin1String("([A-Fa-f0-9]{40})\\.fastresume\\.(.+)$"));
|
||||
const QRegularExpressionMatch rxMatch = rx.match(filepath);
|
||||
if (rxMatch.hasMatch()) {
|
||||
// Old v3.3.x format had a number at the end indicating the queue position.
|
||||
// The naming scheme was '<infohash>.fastresume.<queueposition>'.
|
||||
// However, QSaveFile, which uses QTemporaryFile internally, might leave
|
||||
// non-commited files behind eg after a crash. These files have the
|
||||
// naming scheme '<infohash>.fastresume.XXXXXX' where each X is a random
|
||||
// character. So we detect if the last part is present. Then check if it
|
||||
// is 6 chars long. If all the 6 chars are digits we assume it is an old
|
||||
// v3.3.x format. Otherwise it is considered a non-commited fastresume
|
||||
// and is deleted, because it may be a corrupted/incomplete fastresume.
|
||||
// NOTE: When the upgrade code is removed, we must continue to perform
|
||||
// cleanup of non-commited QSaveFile/QTemporaryFile fastresumes
|
||||
queuePosition = rxMatch.captured(2).toInt();
|
||||
if ((rxMatch.captured(2).size() == 6) && (queuePosition <= 99999)) {
|
||||
Utils::Fs::forceRemove(filepath);
|
||||
return true;
|
||||
}
|
||||
|
||||
QRegExp rx(QLatin1String("([A-Fa-f0-9]{40})\\.fastresume\\.(\\d+)$"));
|
||||
if (rx.indexIn(filepath) != -1) {
|
||||
// old v3.3.x format
|
||||
queuePosition = rx.cap(2).toInt();
|
||||
v3_3 = true;
|
||||
outFilePath.replace(QRegularExpression("\\.fastresume\\..+$"), ".fastresume");
|
||||
outFilePath.replace(QRegExp("\\.\\d+$"), "");
|
||||
}
|
||||
else {
|
||||
queuePosition = fastOld.dict_find_int_value("qBt-queuePosition", 0);
|
||||
fastNew["qBt-name"] = oldTorrent.value("name").toString().toStdString();
|
||||
fastNew["qBt-name"] = Utils::String::toStdString(oldTorrent.value("name").toString());
|
||||
fastNew["qBt-tempPathDisabled"] = false;
|
||||
}
|
||||
|
||||
// in versions < 3.3 we have -1 for seeding torrents, so we convert it to 0
|
||||
fastNew["qBt-queuePosition"] = (queuePosition >= 0 ? queuePosition : 0);
|
||||
|
||||
if (v3_3) {
|
||||
QFileInfo oldFile(filepath);
|
||||
QFileInfo newFile(outFilePath);
|
||||
if (newFile.exists()
|
||||
&& (oldFile.lastModified() < newFile.lastModified())) {
|
||||
Utils::Fs::forceRemove(filepath);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
QFile file2(outFilePath);
|
||||
QVector<char> out;
|
||||
libtorrent::bencode(std::back_inserter(out), fastNew);
|
||||
@@ -174,21 +145,26 @@ bool upgrade(bool ask = true)
|
||||
// Upgrade preferences
|
||||
Preferences::instance()->upgrade();
|
||||
|
||||
QString backupFolderPath = Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Data) + "BT_backup");
|
||||
QString backupFolderPath = Utils::Fs::expandPathAbs(Utils::Fs::QDesktopServicesDataLocation() + "BT_backup");
|
||||
QDir backupFolderDir(backupFolderPath);
|
||||
|
||||
// ****************************************************************************************
|
||||
// Silently converts old v3.3.x .fastresume files
|
||||
const QStringList backupFiles_3_3 = backupFolderDir.entryList(
|
||||
QStringList backupFiles_3_3 = backupFolderDir.entryList(
|
||||
QStringList(QLatin1String("*.fastresume.*")), QDir::Files, QDir::Unsorted);
|
||||
for (const QString &backupFile : backupFiles_3_3)
|
||||
foreach (const QString &backupFile, backupFiles_3_3)
|
||||
upgradeResumeFile(backupFolderDir.absoluteFilePath(backupFile));
|
||||
// ****************************************************************************************
|
||||
|
||||
SettingsPtr oldResumeSettings = Profile::instance().applicationSettings(QLatin1String("qBittorrent-resume"));
|
||||
#ifdef Q_OS_MAC
|
||||
// native .plist
|
||||
QSettings *oldResumeSettings = new QSettings("qBittorrent", "qBittorrent-resume");
|
||||
#else
|
||||
QIniSettings *oldResumeSettings = new QIniSettings("qBittorrent", "qBittorrent-resume");
|
||||
#endif
|
||||
QString oldResumeFilename = oldResumeSettings->fileName();
|
||||
QVariantHash oldResumeData = oldResumeSettings->value("torrents").toHash();
|
||||
oldResumeSettings.reset();
|
||||
delete oldResumeSettings;
|
||||
|
||||
if (oldResumeData.isEmpty()) {
|
||||
Utils::Fs::forceRemove(oldResumeFilename);
|
||||
@@ -197,36 +173,33 @@ bool upgrade(bool ask = true)
|
||||
|
||||
if (ask && !userAcceptsUpgrade()) return false;
|
||||
|
||||
const QStringList backupFiles = backupFolderDir.entryList(
|
||||
QStringList backupFiles = backupFolderDir.entryList(
|
||||
QStringList(QLatin1String("*.fastresume")), QDir::Files, QDir::Unsorted);
|
||||
const QRegularExpression rx(QLatin1String("^([A-Fa-f0-9]{40})\\.fastresume$"));
|
||||
for (const QString &backupFile : backupFiles) {
|
||||
const QRegularExpressionMatch rxMatch = rx.match(backupFile);
|
||||
if (rxMatch.hasMatch()) {
|
||||
const QString hashStr = rxMatch.captured(1);
|
||||
if (upgradeResumeFile(backupFolderDir.absoluteFilePath(backupFile), oldResumeData[hashStr].toHash()))
|
||||
oldResumeData.remove(hashStr);
|
||||
QRegExp rx(QLatin1String("^([A-Fa-f0-9]{40})\\.fastresume$"));
|
||||
foreach (QString backupFile, backupFiles) {
|
||||
if (rx.indexIn(backupFile) != -1) {
|
||||
if (upgradeResumeFile(backupFolderDir.absoluteFilePath(backupFile), oldResumeData[rx.cap(1)].toHash()))
|
||||
oldResumeData.remove(rx.cap(1));
|
||||
else
|
||||
Logger::instance()->addMessage(QObject::tr("Couldn't migrate torrent with hash: %1").arg(hashStr), Log::WARNING);
|
||||
Logger::instance()->addMessage(QObject::tr("Couldn't migrate torrent with hash: %1").arg(rx.cap(1)), Log::WARNING);
|
||||
}
|
||||
else {
|
||||
Logger::instance()->addMessage(QObject::tr("Couldn't migrate torrent. Invalid fastresume file name: %1").arg(backupFile), Log::WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto i = oldResumeData.cbegin(); i != oldResumeData.cend(); ++i) {
|
||||
const QVariantHash oldTorrent = i.value().toHash();
|
||||
foreach (const QString &hash, oldResumeData.keys()) {
|
||||
QVariantHash oldTorrent = oldResumeData[hash].toHash();
|
||||
if (oldTorrent.value("is_magnet", false).toBool()) {
|
||||
const QString &hash = i.key();
|
||||
libtorrent::entry resumeData;
|
||||
resumeData["qBt-magnetUri"] = oldTorrent.value("magnet_uri").toString().toStdString();
|
||||
resumeData["qBt-magnetUri"] = Utils::String::toStdString(oldTorrent.value("magnet_uri").toString());
|
||||
resumeData["qBt-paused"] = false;
|
||||
resumeData["qBt-forced"] = false;
|
||||
|
||||
resumeData["qBt-savePath"] = oldTorrent.value("save_path").toString().toStdString();
|
||||
resumeData["qBt-ratioLimit"] = static_cast<int>(oldTorrent.value("max_ratio", -2).toReal() * 1000);
|
||||
resumeData["qBt-label"] = oldTorrent.value("label").toString().toStdString();
|
||||
resumeData["qBt-name"] = oldTorrent.value("name").toString().toStdString();
|
||||
resumeData["qBt-savePath"] = Utils::String::toStdString(oldTorrent.value("save_path").toString());
|
||||
resumeData["qBt-ratioLimit"] = Utils::String::toStdString(QString::number(oldTorrent.value("max_ratio", -2).toReal()));
|
||||
resumeData["qBt-label"] = Utils::String::toStdString(oldTorrent.value("label").toString());
|
||||
resumeData["qBt-name"] = Utils::String::toStdString(oldTorrent.value("name").toString());
|
||||
resumeData["qBt-seedStatus"] = oldTorrent.value("seed").toBool();
|
||||
resumeData["qBt-tempPathDisabled"] = false;
|
||||
|
||||
@@ -258,14 +231,14 @@ bool upgrade(bool ask = true)
|
||||
#ifdef Q_OS_MAC
|
||||
void migratePlistToIni(const QString &application)
|
||||
{
|
||||
QSettings iniFile(QSettings::IniFormat, QSettings::UserScope, "qBittorrent", application);
|
||||
QIniSettings iniFile("qBittorrent", application);
|
||||
if (!iniFile.allKeys().isEmpty()) return; // We copy the contents of plist, only if inifile does not exist(is empty).
|
||||
|
||||
QSettings *plistFile = new QSettings("qBittorrent", application);
|
||||
plistFile->setFallbacksEnabled(false);
|
||||
const QStringList plist = plistFile->allKeys();
|
||||
if (!plist.isEmpty()) {
|
||||
for (const QString &key : plist)
|
||||
foreach (const QString &key, plist)
|
||||
iniFile.setValue(key, plistFile->value(key));
|
||||
plistFile->clear();
|
||||
}
|
||||
@@ -287,18 +260,18 @@ void macMigratePlists()
|
||||
void migrateRSS()
|
||||
{
|
||||
// Copy old feed items to new file if needed
|
||||
SettingsPtr qBTRSS = Profile::instance().applicationSettings(QLatin1String("qBittorrent-rss-feeds"));
|
||||
if (!qBTRSS->allKeys().isEmpty()) return; // We move the contents of RSS old_items only if inifile does not exist (is empty).
|
||||
QIniSettings qBTRSS("qBittorrent", "qBittorrent-rss-feeds");
|
||||
if (!qBTRSS.allKeys().isEmpty()) return; // We move the contents of RSS old_items only if inifile does not exist (is empty).
|
||||
|
||||
SettingsPtr qBTRSSLegacy = Profile::instance().applicationSettings(QLatin1String("qBittorrent-rss"));
|
||||
QHash<QString, QVariant> allOldItems = qBTRSSLegacy->value("old_items", QHash<QString, QVariant>()).toHash();
|
||||
QIniSettings qBTRSSLegacy("qBittorrent", "qBittorrent-rss");
|
||||
QHash<QString, QVariant> allOldItems = qBTRSSLegacy.value("old_items", QHash<QString, QVariant>()).toHash();
|
||||
|
||||
if (!allOldItems.empty()) {
|
||||
qDebug("Moving %d old items for feeds to qBittorrent-rss-feeds", allOldItems.size());
|
||||
qBTRSS->setValue("old_items", allOldItems);
|
||||
qBTRSSLegacy->remove("old_items");
|
||||
qBTRSS.setValue("old_items", allOldItems);
|
||||
qBTRSSLegacy.remove("old_items");
|
||||
}
|
||||
}
|
||||
#endif // DISABLE_GUI
|
||||
#endif
|
||||
|
||||
#endif // UPGRADE_H
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
find_package(ZLIB 1.2.5.2 REQUIRED)
|
||||
|
||||
add_library(qbt_base STATIC
|
||||
# headers
|
||||
bittorrent/addtorrentparams.h
|
||||
set(QBT_BASE_HEADERS
|
||||
bittorrent/cachestatus.h
|
||||
bittorrent/filepriority.h
|
||||
bittorrent/infohash.h
|
||||
bittorrent/magneturi.h
|
||||
bittorrent/peerinfo.h
|
||||
@@ -21,7 +18,6 @@ bittorrent/torrentinfo.h
|
||||
bittorrent/tracker.h
|
||||
bittorrent/trackerentry.h
|
||||
http/connection.h
|
||||
http/httperror.h
|
||||
http/irequesthandler.h
|
||||
http/requestparser.h
|
||||
http/responsebuilder.h
|
||||
@@ -37,47 +33,37 @@ net/private/geoipdatabase.h
|
||||
net/proxyconfigurationmanager.h
|
||||
net/reverseresolution.h
|
||||
net/smtp.h
|
||||
private/profile_p.h
|
||||
rss/private/rss_parser.h
|
||||
rss/rss_article.h
|
||||
rss/rss_autodownloader.h
|
||||
rss/rss_autodownloadrule.h
|
||||
rss/rss_feed.h
|
||||
rss/rss_folder.h
|
||||
rss/rss_item.h
|
||||
rss/rss_session.h
|
||||
search/searchdownloadhandler.h
|
||||
search/searchhandler.h
|
||||
search/searchpluginmanager.h
|
||||
utils/bytearray.h
|
||||
utils/foreignapps.h
|
||||
rss/private/rssparser.h
|
||||
rss/rssarticle.h
|
||||
rss/rssdownloadrule.h
|
||||
rss/rssdownloadrulelist.h
|
||||
rss/rssfeed.h
|
||||
rss/rssfile.h
|
||||
rss/rssfolder.h
|
||||
rss/rssmanager.h
|
||||
utils/fs.h
|
||||
utils/gzip.h
|
||||
utils/misc.h
|
||||
utils/net.h
|
||||
utils/random.h
|
||||
utils/string.h
|
||||
utils/version.h
|
||||
algorithm.h
|
||||
asyncfilestorage.h
|
||||
exceptions.h
|
||||
filesystemwatcher.h
|
||||
global.h
|
||||
iconprovider.h
|
||||
indexrange.h
|
||||
logger.h
|
||||
preferences.h
|
||||
profile.h
|
||||
qinisettings.h
|
||||
scanfoldersmodel.h
|
||||
searchengine.h
|
||||
settingsstorage.h
|
||||
torrentfileguard.h
|
||||
torrentfilter.h
|
||||
tristatebool.h
|
||||
types.h
|
||||
unicodestrings.h
|
||||
)
|
||||
|
||||
# sources
|
||||
bittorrent/filepriority.cpp
|
||||
set(QBT_BASE_SOURCES
|
||||
bittorrent/cachestatus.cpp
|
||||
bittorrent/infohash.cpp
|
||||
bittorrent/magneturi.cpp
|
||||
bittorrent/peerinfo.cpp
|
||||
@@ -87,13 +73,13 @@ bittorrent/private/resumedatasavingmanager.cpp
|
||||
bittorrent/private/speedmonitor.cpp
|
||||
bittorrent/private/statistics.cpp
|
||||
bittorrent/session.cpp
|
||||
bittorrent/sessionstatus.cpp
|
||||
bittorrent/torrentcreatorthread.cpp
|
||||
bittorrent/torrenthandle.cpp
|
||||
bittorrent/torrentinfo.cpp
|
||||
bittorrent/tracker.cpp
|
||||
bittorrent/trackerentry.cpp
|
||||
http/connection.cpp
|
||||
http/httperror.cpp
|
||||
http/requestparser.cpp
|
||||
http/responsebuilder.cpp
|
||||
http/responsegenerator.cpp
|
||||
@@ -107,59 +93,50 @@ net/private/geoipdatabase.cpp
|
||||
net/proxyconfigurationmanager.cpp
|
||||
net/reverseresolution.cpp
|
||||
net/smtp.cpp
|
||||
private/profile_p.cpp
|
||||
rss/private/rss_parser.cpp
|
||||
rss/rss_article.cpp
|
||||
rss/rss_autodownloader.cpp
|
||||
rss/rss_autodownloadrule.cpp
|
||||
rss/rss_feed.cpp
|
||||
rss/rss_folder.cpp
|
||||
rss/rss_item.cpp
|
||||
rss/rss_session.cpp
|
||||
search/searchdownloadhandler.cpp
|
||||
search/searchhandler.cpp
|
||||
search/searchpluginmanager.cpp
|
||||
utils/bytearray.cpp
|
||||
utils/foreignapps.cpp
|
||||
rss/private/rssparser.cpp
|
||||
rss/rssarticle.cpp
|
||||
rss/rssdownloadrule.cpp
|
||||
rss/rssdownloadrulelist.cpp
|
||||
rss/rssfeed.cpp
|
||||
rss/rssfile.cpp
|
||||
rss/rssfolder.cpp
|
||||
rss/rssmanager.cpp
|
||||
utils/fs.cpp
|
||||
utils/gzip.cpp
|
||||
utils/misc.cpp
|
||||
utils/net.cpp
|
||||
utils/random.cpp
|
||||
utils/string.cpp
|
||||
asyncfilestorage.cpp
|
||||
exceptions.cpp
|
||||
filesystemwatcher.cpp
|
||||
iconprovider.cpp
|
||||
logger.cpp
|
||||
preferences.cpp
|
||||
profile.cpp
|
||||
scanfoldersmodel.cpp
|
||||
searchengine.cpp
|
||||
settingsstorage.cpp
|
||||
torrentfileguard.cpp
|
||||
torrentfilter.cpp
|
||||
tristatebool.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(qbt_base
|
||||
PRIVATE
|
||||
ZLIB::ZLIB
|
||||
PUBLIC
|
||||
LibtorrentRasterbar::torrent-rasterbar
|
||||
Qt5::Core Qt5::Network Qt5::Xml
|
||||
)
|
||||
add_library(qbt_base STATIC ${QBT_BASE_HEADERS} ${QBT_BASE_SOURCES})
|
||||
target_link_libraries(qbt_base PRIVATE ZLIB::ZLIB PUBLIC LibtorrentRasterbar::LibTorrent)
|
||||
target_link_qt_components(qbt_base PUBLIC Core Network Xml)
|
||||
if (QT4_FOUND)
|
||||
if (GUI)
|
||||
target_link_libraries(qbt_base PUBLIC Qt4::QtGui)
|
||||
endif (GUI)
|
||||
else (QT4_FOUND)
|
||||
if (GUI)
|
||||
target_link_libraries(qbt_base PUBLIC Qt5::Gui Qt5::Widgets)
|
||||
endif (GUI)
|
||||
endif (QT4_FOUND)
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
target_link_libraries(qbt_base PUBLIC Qt5::Gui Qt5::Widgets)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
|
||||
if (Qt5DBus_FOUND)
|
||||
target_link_libraries(qbt_base PRIVATE Qt5::DBus)
|
||||
if (DBUS)
|
||||
target_link_qt_components(qbt_base PRIVATE DBus)
|
||||
endif ()
|
||||
|
||||
if (APPLE)
|
||||
find_library(IOKit_LIBRARY IOKit)
|
||||
find_library(Carbon_LIBRARY Carbon)
|
||||
find_library(AppKit_LIBRARY AppKit)
|
||||
target_link_libraries(qbt_base PRIVATE ${Carbon_LIBRARY} ${IOKit_LIBRARY} ${AppKit_LIBRARY})
|
||||
target_link_libraries(qbt_base PRIVATE ${Carbon_LIBRARY} ${IOKit_LIBRARY})
|
||||
endif (APPLE)
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 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
|
||||
|
||||
namespace Dict
|
||||
{
|
||||
// To be used with QMap, QHash and it's variants
|
||||
template <typename Dictionary, typename BinaryPredicate>
|
||||
void removeIf(Dictionary &&dict, BinaryPredicate p)
|
||||
{
|
||||
auto it = dict.begin();
|
||||
while (it != dict.end())
|
||||
it = (p(it.key(), it.value()) ? dict.erase(it) : it + 1);
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2017 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 "asyncfilestorage.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMetaObject>
|
||||
#include <QSaveFile>
|
||||
|
||||
AsyncFileStorage::AsyncFileStorage(const QString &storageFolderPath, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_storageDir(storageFolderPath)
|
||||
, m_lockFile(m_storageDir.absoluteFilePath(QStringLiteral("storage.lock")))
|
||||
{
|
||||
if (!m_storageDir.mkpath(m_storageDir.absolutePath()))
|
||||
throw AsyncFileStorageError {tr("Could not create directory '%1'.")
|
||||
.arg(m_storageDir.absolutePath())};
|
||||
|
||||
// TODO: This folder locking approach does not work for UNIX systems. Implement it.
|
||||
if (!m_lockFile.open(QFile::WriteOnly))
|
||||
throw AsyncFileStorageError {m_lockFile.errorString()};
|
||||
}
|
||||
|
||||
AsyncFileStorage::~AsyncFileStorage()
|
||||
{
|
||||
m_lockFile.close();
|
||||
m_lockFile.remove();
|
||||
}
|
||||
|
||||
void AsyncFileStorage::store(const QString &fileName, const QByteArray &data)
|
||||
{
|
||||
QMetaObject::invokeMethod(this, "store_impl", Qt::QueuedConnection
|
||||
, Q_ARG(QString, fileName), Q_ARG(QByteArray, data));
|
||||
}
|
||||
|
||||
QDir AsyncFileStorage::storageDir() const
|
||||
{
|
||||
return m_storageDir;
|
||||
}
|
||||
|
||||
void AsyncFileStorage::store_impl(const QString &fileName, const QByteArray &data)
|
||||
{
|
||||
const QString filePath = m_storageDir.absoluteFilePath(fileName);
|
||||
QSaveFile file(filePath);
|
||||
qDebug() << "AsyncFileStorage: Saving data to" << filePath;
|
||||
if (file.open(QIODevice::WriteOnly)) {
|
||||
file.write(data);
|
||||
if (!file.commit()) {
|
||||
qDebug() << "AsyncFileStorage: Failed to save data";
|
||||
emit failed(filePath, file.errorString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2017 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 <QFile>
|
||||
#include <QObject>
|
||||
|
||||
#include "base/exceptions.h"
|
||||
|
||||
class AsyncFileStorageError : public RuntimeError
|
||||
{
|
||||
public:
|
||||
using RuntimeError::RuntimeError;
|
||||
};
|
||||
|
||||
class AsyncFileStorage : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(AsyncFileStorage)
|
||||
|
||||
public:
|
||||
explicit AsyncFileStorage(const QString &storageFolderPath, QObject *parent = nullptr);
|
||||
~AsyncFileStorage() override;
|
||||
|
||||
void store(const QString &fileName, const QByteArray &data);
|
||||
|
||||
QDir storageDir() const;
|
||||
|
||||
signals:
|
||||
void failed(const QString &fileName, const QString &errorString);
|
||||
|
||||
private:
|
||||
Q_INVOKABLE void store_impl(const QString &fileName, const QByteArray &data);
|
||||
|
||||
QDir m_storageDir;
|
||||
QFile m_lockFile;
|
||||
};
|
||||
@@ -1,139 +1,116 @@
|
||||
HEADERS += \
|
||||
$$PWD/algorithm.h \
|
||||
$$PWD/asyncfilestorage.h \
|
||||
$$PWD/bittorrent/addtorrentparams.h \
|
||||
$$PWD/bittorrent/cachestatus.h \
|
||||
$$PWD/bittorrent/filepriority.h \
|
||||
$$PWD/bittorrent/infohash.h \
|
||||
$$PWD/bittorrent/magneturi.h \
|
||||
$$PWD/bittorrent/peerinfo.h \
|
||||
$$PWD/bittorrent/private/bandwidthscheduler.h \
|
||||
$$PWD/bittorrent/private/filterparserthread.h \
|
||||
$$PWD/bittorrent/private/resumedatasavingmanager.h \
|
||||
$$PWD/bittorrent/private/speedmonitor.h \
|
||||
$$PWD/bittorrent/private/statistics.h \
|
||||
$$PWD/bittorrent/session.h \
|
||||
$$PWD/bittorrent/sessionstatus.h \
|
||||
$$PWD/bittorrent/torrentcreatorthread.h \
|
||||
$$PWD/bittorrent/torrenthandle.h \
|
||||
$$PWD/bittorrent/torrentinfo.h \
|
||||
$$PWD/bittorrent/tracker.h \
|
||||
$$PWD/bittorrent/trackerentry.h \
|
||||
$$PWD/exceptions.h \
|
||||
$$PWD/types.h \
|
||||
$$PWD/tristatebool.h \
|
||||
$$PWD/filesystemwatcher.h \
|
||||
$$PWD/global.h \
|
||||
$$PWD/http/connection.h \
|
||||
$$PWD/http/httperror.h \
|
||||
$$PWD/qinisettings.h \
|
||||
$$PWD/logger.h \
|
||||
$$PWD/settingsstorage.h \
|
||||
$$PWD/settingvalue.h \
|
||||
$$PWD/preferences.h \
|
||||
$$PWD/indexrange.h \
|
||||
$$PWD/iconprovider.h \
|
||||
$$PWD/http/irequesthandler.h \
|
||||
$$PWD/http/connection.h \
|
||||
$$PWD/http/requestparser.h \
|
||||
$$PWD/http/responsebuilder.h \
|
||||
$$PWD/http/responsegenerator.h \
|
||||
$$PWD/http/server.h \
|
||||
$$PWD/http/types.h \
|
||||
$$PWD/iconprovider.h \
|
||||
$$PWD/indexrange.h \
|
||||
$$PWD/logger.h \
|
||||
$$PWD/http/responsebuilder.h \
|
||||
$$PWD/net/dnsupdater.h \
|
||||
$$PWD/net/downloadhandler.h \
|
||||
$$PWD/net/downloadmanager.h \
|
||||
$$PWD/net/downloadhandler.h \
|
||||
$$PWD/net/geoipmanager.h \
|
||||
$$PWD/net/portforwarder.h \
|
||||
$$PWD/net/private/geoipdatabase.h \
|
||||
$$PWD/net/proxyconfigurationmanager.h \
|
||||
$$PWD/net/reverseresolution.h \
|
||||
$$PWD/net/smtp.h \
|
||||
$$PWD/preferences.h \
|
||||
$$PWD/private/profile_p.h \
|
||||
$$PWD/profile.h \
|
||||
$$PWD/rss/private/rss_parser.h \
|
||||
$$PWD/rss/rss_article.h \
|
||||
$$PWD/rss/rss_autodownloader.h \
|
||||
$$PWD/rss/rss_autodownloadrule.h \
|
||||
$$PWD/rss/rss_feed.h \
|
||||
$$PWD/rss/rss_folder.h \
|
||||
$$PWD/rss/rss_item.h \
|
||||
$$PWD/rss/rss_session.h \
|
||||
$$PWD/scanfoldersmodel.h \
|
||||
$$PWD/search/searchhandler.h \
|
||||
$$PWD/search/searchdownloadhandler.h \
|
||||
$$PWD/search/searchpluginmanager.h \
|
||||
$$PWD/settingsstorage.h \
|
||||
$$PWD/settingvalue.h \
|
||||
$$PWD/torrentfileguard.h \
|
||||
$$PWD/torrentfilter.h \
|
||||
$$PWD/tristatebool.h \
|
||||
$$PWD/types.h \
|
||||
$$PWD/unicodestrings.h \
|
||||
$$PWD/utils/bytearray.h \
|
||||
$$PWD/utils/foreignapps.h \
|
||||
$$PWD/net/private/geoipdatabase.h \
|
||||
$$PWD/bittorrent/infohash.h \
|
||||
$$PWD/bittorrent/session.h \
|
||||
$$PWD/bittorrent/sessionstatus.h \
|
||||
$$PWD/bittorrent/cachestatus.h \
|
||||
$$PWD/bittorrent/magneturi.h \
|
||||
$$PWD/bittorrent/torrentinfo.h \
|
||||
$$PWD/bittorrent/torrenthandle.h \
|
||||
$$PWD/bittorrent/peerinfo.h \
|
||||
$$PWD/bittorrent/trackerentry.h \
|
||||
$$PWD/bittorrent/tracker.h \
|
||||
$$PWD/bittorrent/torrentcreatorthread.h \
|
||||
$$PWD/bittorrent/private/speedmonitor.h \
|
||||
$$PWD/bittorrent/private/bandwidthscheduler.h \
|
||||
$$PWD/bittorrent/private/filterparserthread.h \
|
||||
$$PWD/bittorrent/private/statistics.h \
|
||||
$$PWD/bittorrent/private/resumedatasavingmanager.h \
|
||||
$$PWD/rss/rssmanager.h \
|
||||
$$PWD/rss/rssfeed.h \
|
||||
$$PWD/rss/rssfolder.h \
|
||||
$$PWD/rss/rssfile.h \
|
||||
$$PWD/rss/rssarticle.h \
|
||||
$$PWD/rss/rssdownloadrule.h \
|
||||
$$PWD/rss/rssdownloadrulelist.h \
|
||||
$$PWD/rss/private/rssparser.h \
|
||||
$$PWD/utils/fs.h \
|
||||
$$PWD/utils/gzip.h \
|
||||
$$PWD/utils/misc.h \
|
||||
$$PWD/utils/net.h \
|
||||
$$PWD/utils/random.h \
|
||||
$$PWD/utils/string.h \
|
||||
$$PWD/utils/version.h
|
||||
$$PWD/unicodestrings.h \
|
||||
$$PWD/torrentfileguard.h \
|
||||
$$PWD/torrentfilter.h \
|
||||
$$PWD/scanfoldersmodel.h \
|
||||
$$PWD/searchengine.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/asyncfilestorage.cpp \
|
||||
$$PWD/bittorrent/filepriority.cpp \
|
||||
$$PWD/bittorrent/infohash.cpp \
|
||||
$$PWD/bittorrent/magneturi.cpp \
|
||||
$$PWD/bittorrent/peerinfo.cpp \
|
||||
$$PWD/bittorrent/private/bandwidthscheduler.cpp \
|
||||
$$PWD/bittorrent/private/filterparserthread.cpp \
|
||||
$$PWD/bittorrent/private/resumedatasavingmanager.cpp \
|
||||
$$PWD/bittorrent/private/speedmonitor.cpp \
|
||||
$$PWD/bittorrent/private/statistics.cpp \
|
||||
$$PWD/bittorrent/session.cpp \
|
||||
$$PWD/bittorrent/torrentcreatorthread.cpp \
|
||||
$$PWD/bittorrent/torrenthandle.cpp \
|
||||
$$PWD/bittorrent/torrentinfo.cpp \
|
||||
$$PWD/bittorrent/tracker.cpp \
|
||||
$$PWD/bittorrent/trackerentry.cpp \
|
||||
$$PWD/exceptions.cpp \
|
||||
$$PWD/tristatebool.cpp \
|
||||
$$PWD/filesystemwatcher.cpp \
|
||||
$$PWD/logger.cpp \
|
||||
$$PWD/settingsstorage.cpp \
|
||||
$$PWD/preferences.cpp \
|
||||
$$PWD/iconprovider.cpp \
|
||||
$$PWD/http/connection.cpp \
|
||||
$$PWD/http/httperror.cpp \
|
||||
$$PWD/http/requestparser.cpp \
|
||||
$$PWD/http/responsebuilder.cpp \
|
||||
$$PWD/http/responsegenerator.cpp \
|
||||
$$PWD/http/server.cpp \
|
||||
$$PWD/iconprovider.cpp \
|
||||
$$PWD/logger.cpp \
|
||||
$$PWD/http/responsebuilder.cpp \
|
||||
$$PWD/net/dnsupdater.cpp \
|
||||
$$PWD/net/downloadhandler.cpp \
|
||||
$$PWD/net/downloadmanager.cpp \
|
||||
$$PWD/net/downloadhandler.cpp \
|
||||
$$PWD/net/geoipmanager.cpp \
|
||||
$$PWD/net/portforwarder.cpp \
|
||||
$$PWD/net/private/geoipdatabase.cpp \
|
||||
$$PWD/net/proxyconfigurationmanager.cpp \
|
||||
$$PWD/net/reverseresolution.cpp \
|
||||
$$PWD/net/smtp.cpp \
|
||||
$$PWD/preferences.cpp \
|
||||
$$PWD/private/profile_p.cpp \
|
||||
$$PWD/profile.cpp \
|
||||
$$PWD/rss/private/rss_parser.cpp \
|
||||
$$PWD/rss/rss_article.cpp \
|
||||
$$PWD/rss/rss_autodownloader.cpp \
|
||||
$$PWD/rss/rss_autodownloadrule.cpp \
|
||||
$$PWD/rss/rss_feed.cpp \
|
||||
$$PWD/rss/rss_folder.cpp \
|
||||
$$PWD/rss/rss_item.cpp \
|
||||
$$PWD/rss/rss_session.cpp \
|
||||
$$PWD/scanfoldersmodel.cpp \
|
||||
$$PWD/search/searchdownloadhandler.cpp \
|
||||
$$PWD/search/searchhandler.cpp \
|
||||
$$PWD/search/searchpluginmanager.cpp \
|
||||
$$PWD/settingsstorage.cpp \
|
||||
$$PWD/torrentfileguard.cpp \
|
||||
$$PWD/torrentfilter.cpp \
|
||||
$$PWD/tristatebool.cpp \
|
||||
$$PWD/utils/bytearray.cpp \
|
||||
$$PWD/utils/foreignapps.cpp \
|
||||
$$PWD/net/private/geoipdatabase.cpp \
|
||||
$$PWD/bittorrent/infohash.cpp \
|
||||
$$PWD/bittorrent/session.cpp \
|
||||
$$PWD/bittorrent/sessionstatus.cpp \
|
||||
$$PWD/bittorrent/cachestatus.cpp \
|
||||
$$PWD/bittorrent/magneturi.cpp \
|
||||
$$PWD/bittorrent/torrentinfo.cpp \
|
||||
$$PWD/bittorrent/torrenthandle.cpp \
|
||||
$$PWD/bittorrent/peerinfo.cpp \
|
||||
$$PWD/bittorrent/trackerentry.cpp \
|
||||
$$PWD/bittorrent/tracker.cpp \
|
||||
$$PWD/bittorrent/torrentcreatorthread.cpp \
|
||||
$$PWD/bittorrent/private/speedmonitor.cpp \
|
||||
$$PWD/bittorrent/private/bandwidthscheduler.cpp \
|
||||
$$PWD/bittorrent/private/filterparserthread.cpp \
|
||||
$$PWD/bittorrent/private/statistics.cpp \
|
||||
$$PWD/bittorrent/private/resumedatasavingmanager.cpp \
|
||||
$$PWD/rss/rssmanager.cpp \
|
||||
$$PWD/rss/rssfeed.cpp \
|
||||
$$PWD/rss/rssfolder.cpp \
|
||||
$$PWD/rss/rssarticle.cpp \
|
||||
$$PWD/rss/rssdownloadrule.cpp \
|
||||
$$PWD/rss/rssdownloadrulelist.cpp \
|
||||
$$PWD/rss/rssfile.cpp \
|
||||
$$PWD/rss/private/rssparser.cpp \
|
||||
$$PWD/utils/fs.cpp \
|
||||
$$PWD/utils/gzip.cpp \
|
||||
$$PWD/utils/misc.cpp \
|
||||
$$PWD/utils/net.cpp \
|
||||
$$PWD/utils/random.cpp \
|
||||
$$PWD/utils/string.cpp
|
||||
$$PWD/utils/string.cpp \
|
||||
$$PWD/torrentfileguard.cpp \
|
||||
$$PWD/torrentfilter.cpp \
|
||||
$$PWD/scanfoldersmodel.cpp \
|
||||
$$PWD/searchengine.cpp
|
||||
|
||||
@@ -26,33 +26,44 @@
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <libtorrent/version.hpp>
|
||||
#include "cachestatus.h"
|
||||
|
||||
#include <QSet>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
using namespace BitTorrent;
|
||||
|
||||
#include "../tristatebool.h"
|
||||
|
||||
namespace BitTorrent
|
||||
CacheStatus::CacheStatus(const libtorrent::cache_status &nativeStatus)
|
||||
: m_nativeStatus(nativeStatus)
|
||||
{
|
||||
struct AddTorrentParams
|
||||
{
|
||||
QString name;
|
||||
QString category;
|
||||
QSet<QString> tags;
|
||||
QString savePath;
|
||||
bool disableTempPath = false; // e.g. for imported torrents
|
||||
bool sequential = false;
|
||||
bool firstLastPiecePriority = false;
|
||||
TriStateBool addForced;
|
||||
TriStateBool addPaused;
|
||||
QVector<int> filePriorities; // used if TorrentInfo is set
|
||||
bool ignoreShareLimits = false;
|
||||
bool skipChecking = false;
|
||||
TriStateBool createSubfolder;
|
||||
TriStateBool useAutoTMM;
|
||||
int uploadLimit = -1;
|
||||
int downloadLimit = -1;
|
||||
};
|
||||
}
|
||||
|
||||
int CacheStatus::totalUsedBuffers() const
|
||||
{
|
||||
return m_nativeStatus.total_used_buffers;
|
||||
}
|
||||
|
||||
qreal CacheStatus::readRatio() const
|
||||
{
|
||||
if (m_nativeStatus.blocks_read > 0)
|
||||
return (static_cast<qreal>(m_nativeStatus.blocks_read_hit) / m_nativeStatus.blocks_read);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
int CacheStatus::jobQueueLength() const
|
||||
{
|
||||
#if LIBTORRENT_VERSION_NUM < 10100
|
||||
return m_nativeStatus.job_queue_length;
|
||||
#else
|
||||
return m_nativeStatus.queued_jobs;
|
||||
#endif
|
||||
}
|
||||
|
||||
int CacheStatus::averageJobTime() const
|
||||
{
|
||||
return m_nativeStatus.average_job_time;
|
||||
}
|
||||
|
||||
qlonglong CacheStatus::queuedBytes() const
|
||||
{
|
||||
return m_nativeStatus.queued_bytes;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2015, 2017 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2015 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
|
||||
@@ -30,16 +30,23 @@
|
||||
#define BITTORRENT_CACHESTATUS_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <libtorrent/disk_io_thread.hpp>
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
struct CacheStatus
|
||||
class CacheStatus
|
||||
{
|
||||
quint64 totalUsedBuffers = 0;
|
||||
quint64 jobQueueLength = 0;
|
||||
quint64 averageJobTime = 0;
|
||||
quint64 queuedBytes = 0;
|
||||
qreal readRatio = 0.0;
|
||||
public:
|
||||
CacheStatus(const libtorrent::cache_status &nativeStatus);
|
||||
|
||||
int totalUsedBuffers() const;
|
||||
qreal readRatio() const;
|
||||
int jobQueueLength() const;
|
||||
int averageJobTime() const;
|
||||
qlonglong queuedBytes() const;
|
||||
|
||||
private:
|
||||
libtorrent::cache_status m_nativeStatus;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2018 Thomas Piccirello <thomas.piccirello@gmail.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., 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 "filepriority.h"
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
bool isValidFilePriority(const BitTorrent::FilePriority priority)
|
||||
{
|
||||
switch (priority) {
|
||||
case BitTorrent::FilePriority::Ignored:
|
||||
case BitTorrent::FilePriority::Normal:
|
||||
case BitTorrent::FilePriority::High:
|
||||
case BitTorrent::FilePriority::Maximum:
|
||||
case BitTorrent::FilePriority::Mixed:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2018 Thomas Piccirello <thomas.piccirello@gmail.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., 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
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
enum class FilePriority : int
|
||||
{
|
||||
Ignored = 0,
|
||||
Normal = 1,
|
||||
High = 6,
|
||||
Maximum = 7,
|
||||
Mixed = -1
|
||||
};
|
||||
|
||||
bool isValidFilePriority(BitTorrent::FilePriority priority);
|
||||
}
|
||||
@@ -26,9 +26,8 @@
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#include "infohash.h"
|
||||
|
||||
#include <QHash>
|
||||
#include "infohash.h"
|
||||
|
||||
using namespace BitTorrent;
|
||||
|
||||
@@ -42,7 +41,7 @@ InfoHash::InfoHash(const libtorrent::sha1_hash &nativeHash)
|
||||
, m_nativeHash(nativeHash)
|
||||
{
|
||||
char out[(libtorrent::sha1_hash::size * 2) + 1];
|
||||
libtorrent::to_hex(reinterpret_cast<const char*>(&m_nativeHash[0]), libtorrent::sha1_hash::size, out);
|
||||
libtorrent::to_hex((char const*)&m_nativeHash[0], libtorrent::sha1_hash::size, out);
|
||||
m_hashString = QString(out);
|
||||
}
|
||||
|
||||
@@ -52,7 +51,7 @@ InfoHash::InfoHash(const QString &hashString)
|
||||
{
|
||||
QByteArray raw = m_hashString.toLatin1();
|
||||
if (raw.size() == 40)
|
||||
m_valid = libtorrent::from_hex(raw.constData(), 40, reinterpret_cast<char*>(&m_nativeHash[0]));
|
||||
m_valid = libtorrent::from_hex(raw.constData(), 40, (char*)&m_nativeHash[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +91,7 @@ bool InfoHash::operator!=(const InfoHash &other) const
|
||||
return (m_nativeHash != other.m_nativeHash);
|
||||
}
|
||||
|
||||
uint BitTorrent::qHash(const InfoHash &key, uint seed)
|
||||
uint qHash(const InfoHash &key, uint seed)
|
||||
{
|
||||
return qHash(static_cast<QString>(key), seed);
|
||||
}
|
||||
|
||||