Compare commits

..

146 Commits

Author SHA1 Message Date
sledgehammer999
15e7726233 Bump to 3.3.13 2017-06-01 02:32:05 +03:00
sledgehammer999
9258a9ae78 Update Changelog. 2017-06-01 02:29:53 +03:00
Chocobo1
7c2437e5f2 [WebUI]: Implement CSRF defense
Bump API version
2017-06-01 02:28:07 +03:00
sledgehammer999
dc315c080b Revert "Remove workaround". Required since we also support Qt4 in this branch.
This reverts commit 2ba3104337.
2017-06-01 02:28:06 +03:00
sledgehammer999
971c340b53 Fix format-truncation warning. 2017-06-01 01:19:55 +03:00
Chocobo1
76b9b02177 Fix focusing on the previously opened dialog didn't work
Placing modeless dialog A on top of modeless dialog B, then open dialog B again,
the expected behavior is B on top of A.
2017-06-01 01:19:47 +03:00
sledgehammer999
375c2dfd0b Merge pull request #6876 from evsh/fix-cmake-qt4
cmake: fix compilation with Qt 4
2017-05-31 22:41:11 +03:00
Eugene Shalygin
6a3e7a12d8 cmake: fix compilation with Qt 4
In qmake we define QStringLiteral=QLatin1String, so define it in cmake
builds too.
2017-05-31 19:28:32 +02:00
sledgehammer999
d92ef3fa4d Fix Qt4 build. 2017-05-31 00:34:21 +03:00
Eugene Shalygin
89d4cb257f Fix crash in download piece bar
When torrent size is smaller than the image width, bytes per pixel was
set to zero and code was crashing. Set it to -1 instead, as we do when
image is empty. This will disable highliting, but our algorithm does not
work in this case anyway.
2017-05-31 00:34:21 +03:00
Chocobo1
47ebb0df58 Add new webUI API. Closes #6457.
Now getting piece information for a specific torrent is possible via:

* Returns an array of states (integers) of pieces in order. Defined as:
  "0=not downloaded", "1=downloading", "2=downloaded".
  GET /query/getPieceStates/<torrent_hash>

* Returns an array of hashes (strings) of pieces in order:
  GET /query/getPieceHashes/<torrent_hash>
2017-05-31 00:34:20 +03:00
Chocobo1
71169abaa6 [WebUI] Make cookie parsing robust
Previously cookie name such as "<any string>SID" will be mistakenly
accepted as "SID" session ID, this commit fixes it.

Use QString::isEmpty()
2017-05-31 00:34:19 +03:00
Chocobo1
83dd0ae86e Refactor out helper function Utils::String::unquote
Remove redundant include
2017-05-31 00:34:18 +03:00
Chocobo1
c9500d933b Fix renaming files is not case sensitive on Windows platform. Closes #5128. 2017-05-31 00:34:17 +03:00
Naikel Aparicio
b8787460a4 Fix slow filtering in WebUI. Fixup 7aadf644e0. 2017-05-31 00:34:17 +03:00
Naikel Aparicio
d031264d62 Cosmetic fixes for WebUI upload and download windows 2017-05-31 00:34:16 +03:00
KingLucius
63b408c743 remove ExtraTorrent plugin 2017-05-31 00:34:15 +03:00
Eugene Shalygin
1ac4458d13 cmake: fix FindSystemd.cmake
Apparently, recent version of CMake made PkgConfig stuff scooped and we
need to call find_package(PkgConfig) in FindSystemd.cmake too, the call
in FindLibtorrentRasterbar.cmake, that is always used first, is not
enough now.
2017-05-31 00:34:14 +03:00
Chocobo1
6b91510d71 Set icon height in html instead of js
Fixup of d302e4fb92
2017-05-31 00:34:14 +03:00
Chocobo1
f1a7e8921a [WebUI] Fix connection status icon too large. Closes #6804. 2017-05-31 00:34:13 +03:00
Eugene Shalygin
78c34b948e Fix build error. 2017-05-31 00:34:12 +03:00
Frédéric Brière
690db070c7 Properly sort categories case-insensitively in filter widget. Closes #6708. 2017-05-31 00:34:11 +03:00
Frédéric Brière
0979936266 Turn isSpecialItem() into a CategoryFilterModel static method. 2017-05-31 00:34:11 +03:00
Frédéric Brière
ba23b41616 Set "category" column as case-insensitive in TransferListSortModel.
(From what I can tell, it would appear that the sorting was already
case-insensitive by default.  This makes it explicit.)
2017-05-31 00:34:10 +03:00
Frédéric Brière
412584e9c3 Leave categories order intact in "Add new torrent" dialog.
The categories are already properly sorted in AddNewTorrentDialog; this
second case-sensitive sort undid all that.

This partially addresses #6708.
2017-05-31 00:34:09 +03:00
Thomas Piccirello
13aa3c3088 Use less permissive Content Security Policy
Adjust content order
2017-05-31 00:34:08 +03:00
thalieht
067c406c94 webUI: increase the number of digits after the decimal point 2017-05-31 00:34:08 +03:00
Eugene Shalygin
8536e79f2a cmake: include searchengine resources 2017-05-31 00:34:07 +03:00
Thomas Piccirello
70b98d903e Return status indicating if at least one torrent was successfully added 2017-05-31 00:34:06 +03:00
Chocobo1
1997a29769 Tweak CachedSettingValue
* Add another constructor to save a call to proxyFunc when its not needed
  note that this call is a virtual function call
* Pass in proxyFunc by const reference
* Move get methods together
2017-05-31 00:34:05 +03:00
Chocobo1
f6e4f48386 Fix double click on system tray icon causing program to open and
minimize immediately

Closes #5826.
Simply ignore DoubleClick event, as it always come after Trigger
event
2017-05-31 00:34:05 +03:00
Eugene Shalygin
10002984e6 Follow project coding style. Issue #2192. 2017-05-31 00:34:04 +03:00
Frédéric Brière
2fa2d36c3b findIncompleteFiles(): Replace dir listing with individual checks. Closes #6265.
Looking for incomplete files in a new torrent by using a pre-generated
directory listing presents several disadvantages:

  - It requires us to extract the top-level directory name (in case it
    was renamed).
  - It requires us to know whether the top-level directory was stripped.
  - In the latter case, it may result in recursively traversing the
    entire contents of all downloaded torrents.

Calling QFile::exists() individually for each file solves all these
issues.

In so doing, the handling of single-file and multiple-file torrents are
rendered pretty much identical, and can therefore be merged.
2017-05-31 00:34:03 +03:00
Eugene Shalygin
ceed9b468e Do not attempt to show detailed tooltips without torrent metadata. Closes #6768.
Computations for detailed tooltips are not protected against unavailable
metadata, that leads to asserts or crashes. But since those tooltips are
useless in this case, do not show them at all. Inform user that detailed
tooltip becomes available once torrent metadata are fetched.
2017-05-31 00:34:02 +03:00
sledgehammer999
f19854c054 [WebUI]Use the same layout in the Speed tab in preferences as the GUI. 2017-05-31 00:34:02 +03:00
sledgehammer999
989cbda29c Add missing unit sizes in misc.js 2017-05-31 00:34:01 +03:00
sledgehammer999
881f79b76d [WebUI]Use translatable strings in Statistics dialog. 2017-05-31 00:34:00 +03:00
sledgehammer999
51986f3ac8 [WebUI]Make the context obligatory for translatable strings. Also delete duplicate strings from extra translations. 2017-05-31 00:33:59 +03:00
Eugene Shalygin
943a837570 Fix release CMake build
write() is declared with __attribute__ ((__warn_unused_result__)) and as
such we shall check its return value. Took opportunity and adjusted
error reporting a bit: if writing to stderr fails, try to write to
stdout.
2017-05-31 00:33:59 +03:00
Chocobo1
a6cf386073 .gitignore: ignore moc_*.h 2017-05-31 00:33:58 +03:00
Vladimir Golovnev
b6e1b6e501 Revert "Guard the flag used for deferred session configure." (#6733)
This reverts commit 5cbc7b16c0.
2017-05-31 00:33:57 +03:00
Chocobo1
cee308a517 Fix stack overflow in Utils::Gzip::decompress
Anyway, use std::vector to allocate memory on the heap (in compress() too)
2017-05-31 00:33:56 +03:00
Brian Kendall
390d22bc66 Fixed macOS-specific bug in AddNewTorrentDialog
Because AddNewTorrentDialog is a sheet in macOS, repositioning it causes bad things to happen, particularly if the main dialog is on a secondary monitor.
2017-05-31 00:33:56 +03:00
Chocobo1
e4a5b8d352 Setup DPI at startup 2017-05-31 00:33:55 +03:00
Chocobo1
2ba3104337 Remove workaround
Upstream confirmed bug fixed in Qt 5.2
2017-05-31 00:33:54 +03:00
Chocobo1
d1dfdd1306 Refactor 2017-05-31 00:33:53 +03:00
Chocobo1
8a02a69924 Temporary revert to the old behavior. 2017-05-31 00:33:53 +03:00
sledgehammer999
8ffc72b626 TravisCI: Install latest zlib and switch to container-based infrastructure. 2017-05-31 00:33:52 +03:00
Chocobo1
e85479dfd7 Specify lib requirement: zlib >= 1.2.5.2 2017-05-31 00:33:51 +03:00
Chocobo1
104bed7cc8 Revise Utils::Gzip::decompress
Rename from uncompress to decompress
Change signature
Use proper casting
Use larger buffer for the output of inflate()
Reserve 1 MBytes for output buffer
Change function signature
2017-05-31 00:33:50 +03:00
Chocobo1
75f3dd6d1d Revise Utils::Gzip::compress code
Change signature
Add ZLIB_CONST define to make  z_stream.next_in const
Cast to zlib defined type Bytef*
Set memLevel to 9 in deflateInit2() for maximum performance
Revise compression loop
On returning false, free memory correctly by calling deflateEnd()
Reserve space by the estimation of deflateBound()
2017-05-31 00:33:50 +03:00
Chocobo1
751f64c98b Rewrite rules for gzipping http response content 2017-05-31 00:33:49 +03:00
Chocobo1
6353c2ca3c Implement robust acceptsGzipEncoding()
Adhere more to http/1.1 standard
2017-05-31 00:33:48 +03:00
Chocobo1
f51e467ce3 Fix "Content-Encoding" header is always created.
Was side effect of operator[]
2017-05-31 00:33:47 +03:00
Chocobo1
358d182c82 Cleanup Http::responseGenerator()
Add CRLF definition
Rewrite loop using iterator, slightly more efficient
Rename variables
2017-05-31 00:33:47 +03:00
Chocobo1
7d2802cf2c Demote to helper function
Rename function
2017-05-31 00:33:46 +03:00
Chocobo1
a739d86e3d Convert Qstring to char arrays
Cleanup header
Sort constants
2017-05-31 00:33:45 +03:00
Chocobo1
6ff614ebea Send Date http header
It's not strict required but often expected.
change class to namespace
cleanup header
2017-05-31 00:33:44 +03:00
Chocobo1
d9f4141221 Always send Content-Length header.
Because without it, HTTP/1.1 (with persistence connection) clients will
keep waiting for more data.
2017-05-31 00:33:44 +03:00
Chocobo1
415a805818 Implement http persistence connection
Max simultaneous connection limit set to 500
This also release allocated memory of Connection instances at runtime instead of at program shutdown.
2017-05-31 00:33:43 +03:00
Chocobo1
b8fff68230 WebUI: Fix checkbox hidden. Closes #6642. 2017-05-31 00:33:42 +03:00
Eugene Shalygin
44f81a2d2b cmake: set warning and error options
The set is far from perfect, but guards against common errors with GCC.
2017-05-31 00:33:41 +03:00
Eugene Shalygin
b98ef9905e cmake: use environment variable LIB on Windows
Append its value to CMAKE_LIBRARY_PATH to simplify life of on Windows.
2017-05-31 00:33:41 +03:00
Eugene Shalygin
e4f472e0f8 Replace variable length array with std::vector in print_stacktrace()
The function does memory allocation from heap anyway, so should not be
a problem to use STL container.
2017-05-31 00:33:40 +03:00
Vladimir Golovnev (Glassez)
91a38193f5 Remove torrent temp folder when torrent is deleted 2017-05-31 00:33:39 +03:00
Vladimir Golovnev (Glassez)
66b92f3bb4 Remove torrent temp folder if it becomes unneeded 2017-05-31 00:33:38 +03:00
Eugene Shalygin
a911dc57f3 Fix formatting in CONTRIBUTING.md (#6704)
Fix formatting in CONTRIBUTING.md
2017-05-31 00:33:38 +03:00
Chocobo1
c43c473105 Disable Qt embedding manifest automatically
Embedding manifest fails for me after upgrading to VS2017, this fixes it.
2017-05-31 00:33:37 +03:00
wevsty
d079b71f63 update chinese windows installer translation 2017-05-31 00:33:36 +03:00
ngosang
8b0b398a5f [Search engine] Add btdb plugin 2017-05-31 00:33:35 +03:00
ngosang
9400aac003 [Search engine] Update legittorrents plugin 2017-05-31 00:33:35 +03:00
ngosang
7856863b3e [Search engine] Remove mininova plugin 2017-05-31 00:33:34 +03:00
ngosang
b1f598a1d3 [Search engine] Update demonoid plugin 2017-05-31 00:33:33 +03:00
Eugene Shalygin
9c7ed80292 cmake: use import libraries for Boost and OpenSSL in Libtorrent find module 2017-05-31 00:33:32 +03:00
Eugene Shalygin
1835ec6086 cmake: fix typo in the manifest file name 2017-05-31 00:33:32 +03:00
Chocobo1
3d4cead200 Uncrustify 2017-05-31 00:33:31 +03:00
Chocobo1
112a24f9b6 Relax comparsion for floating point 2017-05-31 00:33:30 +03:00
Chocobo1
cdcafecb44 Cleanup & refactor 2017-05-31 00:33:29 +03:00
Chocobo1
4e173d34d3 Setup parent pointer
Rely on Qt to do the delete, since the parent ownership is setup
correctly.
2017-05-31 00:33:28 +03:00
Chocobo1
df5d31b52b Always draw background 2017-05-31 00:33:28 +03:00
Chocobo1
be745551e6 Fix downloaded/uploaded columns were not highlighted properly when selected.
Refactor
2017-05-31 00:33:27 +03:00
opengg
a3e4bcd1dd [WebUI] Add skip_checking and paused to /command/download and /command/upload 2017-05-31 00:33:26 +03:00
opengg
36cc6909f8 [WebUI] bugfix: RequestParser::splitMultipartData drop extra trailing newline. 2017-05-31 00:33:25 +03:00
Chocobo1
3987e677d5 Refactor: move methods under the same #if section. 2017-05-31 00:33:24 +03:00
Chocobo1
13f27c6d3b Refactor: move the validation of certificates & key functions under Server class
Rename method
Add log messages
2017-05-31 00:33:24 +03:00
Chocobo1
68f88f7907 Rename class variables 2017-05-31 00:33:23 +03:00
Chocobo1
6c2c08c6dd Refactor: group port forwarding code together
Unify log message
2017-05-31 00:33:22 +03:00
Eugene Shalygin
b8eee9e1b8 Start up torrents after UI was created. Fixes #6454.
Commit dd0537d changed torrents startup code adding alerts processing
into it. Therefore alerts were processed before UI code subscribed to
signals and therefore part of alerts was not reflected in the UI.

Thus here we do not start torrents in Session constructor, but do that
from Application::exec() after UI was constructed and is ready to process
signals.
2017-05-31 00:33:21 +03:00
Eugene Shalygin
ef08b4269d Rename .desktop and appdata files to match executable name. Fixes #6625. 2017-05-31 00:33:21 +03:00
schnurlos
b5a67aefdb Update of german.nsi
Translation of 64-bit text done.
2017-05-31 00:33:20 +03:00
Eugene Shalygin
a302c995f8 Create Ukrainian translation for the Windows installer. 2017-05-31 00:33:19 +03:00
ngosang
f2877cbec4 Update Spanish translation for the installer 2017-05-31 00:33:06 +03:00
sledgehammer999
4a95291fcc Merge pull request #6648 from evsh/v3_3_x
CMake 3.8 fixes for v3_3_x branch. Closes #6634.
2017-04-17 20:59:23 +03:00
Eugene Shalygin
6717e3d30c Remove generated include from headers. Closes #6634.
Not only fixes compilation with CMake 3.8 (without messing with include
paths) but makes sources cleaner.
2017-04-17 19:30:38 +02:00
Eugene Shalygin
778209ae49 cmake: fixes for cmake 3.8
AUTOUIC seems to became stricter.
2017-04-17 18:26:11 +02:00
sledgehammer999
258efe261d Bump to 3.3.12 2017-04-06 19:51:12 +03:00
sledgehammer999
59abbab9b9 Update Changelog. 2017-04-06 19:48:23 +03:00
Chocobo1
7cc32cbe97 Bump _WIN32_IE in cmake build 2017-04-06 19:47:21 +03:00
Chocobo1
5783f7bafe Fix NTDDI_VERSION define
Fixup of 5958585e3a
2017-04-06 19:47:08 +03:00
sledgehammer999
0e64e6887a Bump API_VERSION and API_VERSION_MIN to 13. 2017-04-06 02:04:31 +03:00
sledgehammer999
c25cb29e61 Sync translations of .desktop file from Transifex. 2017-04-06 02:04:29 +03:00
sledgehammer999
bca9b60db8 Revert "Refactor: initialize class variable directly"
This reverts commit b4bca7cfb7.
2017-04-06 00:43:03 +03:00
Chocobo1
1ec122c4ab Set cookie SID value to empty on logout
Set cookie SID expiration date to 1 day in the past on logout
2017-04-05 18:40:53 +03:00
Chocobo1
562dd41ab2 Fire up the timer to clean inactive sessions 2017-04-05 18:40:52 +03:00
Chocobo1
b4bca7cfb7 Refactor: initialize class variable directly 2017-04-05 18:40:51 +03:00
Chocobo1
b985bb43fa Refactor: reorder headers 2017-04-05 18:40:50 +03:00
Chocobo1
bf8a438a6f Set HttpOnly attribute to SID cookie 2017-04-05 18:40:48 +03:00
vlakoff
7cd9b6f750 Update French translation for the installer 2017-04-05 18:40:41 +03:00
sledgehammer999
d487c69dcc Fix running the uninstaller if the user chose a different path in the installer. Closes #6080. 2017-04-05 03:05:46 +03:00
sledgehammer999
444c2bdf19 Revert "Use Perl-compatible regexes for RSS rules. Closes #6367."
This reverts commit 8d11af94f2.
2017-04-04 03:25:27 +03:00
sledgehammer999
f86064e322 Revert "Cache rule regular expressions for performance"
This reverts commit bacef1ca24.
2017-04-04 03:25:24 +03:00
sledgehammer999
6675544c23 Revert "Change named of getter function."
This reverts commit 20b30dd4b5.
2017-04-04 03:25:14 +03:00
FranciscoPombal
10205ca67e fixed "remaining" column in WebUI
the key had the wrong name. In the js code, the expected key is "amount_left" and not "remaining".
2017-04-04 02:04:36 +03:00
sledgehammer999
2dfed3c41e Better 64-bit handling in the installer. 2017-04-04 02:04:35 +03:00
Eugene Shalygin
db29a61fbf cmake: fix OSX bundle creation 2017-04-04 02:04:33 +03:00
Chocobo1
3497c5307c Fix cancel "Set location" causes files move to installation dir.
Closes #6568.
2017-04-04 02:04:32 +03:00
Chocobo1
565f263ecb Add log message 2017-04-04 02:04:31 +03:00
Chocobo1
c94a61f434 code formatting 2017-04-04 02:04:30 +03:00
Chocobo1
d390d941eb Add NTDDI_VERSION define 2017-04-04 02:04:29 +03:00
Chocobo1
f1de249c9e NSIS: set exit code to 0 on install/uninstall success
Closes #6129.
2017-04-04 02:04:28 +03:00
Chocobo1
f85768412c NSIS: trim whitespaces 2017-04-04 02:04:26 +03:00
regs01
5a28e8c5e9 Update options.nsi
dpi-aware installer
2017-04-04 02:04:25 +03:00
epicgirl1998
5b72595547 Remove extra space
fixes https://github.com/qbittorrent/qBittorrent/issues/6523
2017-04-04 02:04:24 +03:00
sheeit
a363ed6d7c Fixed Markdown formatting for headers 2017-04-04 02:04:23 +03:00
sledgehammer999
077469d5a0 Indicate bitness in stackstrace and about dialog. Closes #6172. 2017-04-04 01:54:37 +03:00
sledgehammer999
66df7c47b2 Some improvements in travis.yml for macOS. Closes #6089. 2017-04-04 01:54:18 +03:00
sledgehammer999
20b30dd4b5 Change named of getter function. 2017-04-04 01:54:17 +03:00
Tim Delaney
bacef1ca24 Cache rule regular expressions for performance
--HG--
branch : magao-dev
2017-04-04 01:54:16 +03:00
Tim Delaney
8d11af94f2 Use Perl-compatible regexes for RSS rules. Closes #6367.
--HG--
branch : magao-dev
2017-04-04 01:52:02 +03:00
sledgehammer999
02c96fa5e2 Change the user-agent format in the session.cpp too. 2017-04-04 01:48:43 +03:00
Chocobo1
65b491fed0 Add comment 2017-04-04 01:48:41 +03:00
Chocobo1
f0eab3f085 Follow http user-agent format
Add version variable without the starting "v"
2017-04-04 01:48:27 +03:00
Chocobo1
21212fdfe5 Prepend QBT_ for preprocessor variables 2017-04-04 01:48:26 +03:00
FranciscoPombal
f39465c25a Implement statistics window in web UI 2017-04-04 01:48:25 +03:00
Vladimir Golovnev (Glassez)
a3eaee7e7e Remove exception-suppress macros
Remove SAFE_* macros from TorrentHandle class.
These macros using seems to be unneeded.
2017-04-04 01:48:03 +03:00
sledgehammer999
1e28bbb47e Revert "Set default locale". Closes #6436 and #6459.
This reverts commit 75ef6356d3.
2017-04-04 01:48:02 +03:00
sledgehammer999
c5b98339ae Update stuff in appdata.xml and run 'appstream-utl upgrade' on it. 2017-04-04 01:48:01 +03:00
sledgehammer999
edb1b727c6 Add keywords to the .desktop file. 2017-04-04 01:47:38 +03:00
Chocobo1
78aeb5eee7 Capitalize title strings
Remove DISCARDABLE keyword which is ignored on 32-bit windows
2017-04-04 01:47:37 +03:00
Chocobo1
9dd93c3d17 Embed manifest when compiling with MSVC
Update manifest
2017-04-04 01:47:25 +03:00
buinsky
2d64405eb8 Improve performance of updating 'progress' column 2017-03-05 18:47:50 +02:00
Chocobo1
dff560d8c2 Workaround thread_local not supported on OSX
Drop back to xcode7.3 on TravisCI
2017-03-05 18:47:49 +02:00
Chocobo1
b3c973612f Fix compile error: ‘escape’ is not a member of ‘Qt’ 2017-03-05 18:47:48 +02:00
Chocobo1
3480d3d10c Fix incomplete type compile error with Qt4 2017-03-05 18:47:47 +02:00
Chocobo1
f45d21d3a2 Enable thread_local support in TravisCI 2017-03-05 18:47:46 +02:00
Chocobo1
8dcb792ac0 Replace rand() by a true uniform distribution generator 2017-03-05 18:47:37 +02:00
228 changed files with 3675 additions and 2451 deletions

1
.gitignore vendored
View File

@@ -17,6 +17,7 @@ Makefile*
# Generated MOC, resource and UI files
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.moc

View File

@@ -34,16 +34,15 @@ notifications:
on_success: change
on_failure: change
# container-based builds
#sudo: false
cache:
ccache: true
directories:
- $HOME/hombebrew_cache
# opt-in Ubuntu Trusty
sudo: required
dist: trusty
# container-based builds
sudo: false
addons:
coverity_scan:
@@ -55,20 +54,27 @@ addons:
branch_pattern: $coverity_branch
notification_email: sledgehammer999@qbittorrent.org
apt:
#sources:
# sources list: https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
#- ubuntu-toolchain-r-test
#- boost-latest
sources:
# 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-whitelist/blob/master/ubuntu-precise
- autoconf
- automake
- colormake
- libssl-dev
- libboost-dev
- libboost-system-dev
# uncomment when Travis upgraded "Ubuntu 12.04 LTS" to a newer version whose repo will have a more up-to-date libtorrent package
#- libtorrent-rasterbar6
# packages list: https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
- autoconf
- automake
- colormake
- libssl-dev
- libboost-dev
- libboost-system-dev
- libtorrent-rasterbar-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
@@ -79,7 +85,7 @@ before_install:
#- libt_path="$HOME/libt_install"
#- ltconf="$ltconf --prefix="$libt_path" --disable-geoip"
- qbt_path="$HOME/qbt_install"
- qbtconf="$qbtconf --prefix="$qbt_path" PKG_CONFIG_PATH="$libt_path/lib/pkgconfig":$PKG_CONFIG_PATH"
- 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
@@ -88,10 +94,9 @@ before_install:
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 ;
fi
- |
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
qbtconf="$qbtconf --disable-qt-dbus" ;
# Qt 5
PATH=/opt/qt55/bin:${PATH}
fi
# print settings
@@ -101,31 +106,23 @@ before_install:
- echo $qbtconf
install:
- |
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
# libtorrent
sudo add-apt-repository --yes ppa:qbittorrent-team/qbittorrent-stable ;
sudo apt-get update -qq ;
sudo apt-get install -qq libtorrent-rasterbar-dev ;
#- |
#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 ;
# Qt
if [ "$qt" = 4 ]; then sudo apt-get -qq install qt4-default libqt4-dev ; fi ;
if [ "$qt" = 5 ]; then sudo apt-get -qq install qt5-default qtbase5-dev qttools5-dev-tools ; fi ;
# ccache
if [ "$TRAVIS_BRANCH" != "$coverity_branch" ]; then
dpkg-query -L ccache && export use_ccache=true ;
ccache -V && ccache --show-stats && ccache --zero-stats ;
fi ;
fi
#fi
- |
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
# dependencies
brew update > /dev/null
brew install colormake ccache zlib
PATH="/usr/local/opt/ccache/libexec:$PATH"
brew link --force zlib
brew outdated "pkg-config" || brew upgrade "pkg-config"
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." ;
@@ -140,10 +137,6 @@ install:
wget https://builds.shiki.hu/homebrew/qt5-5.7.1_1.el_capitan.bottle.tar.gz ;
fi
# dependencies
brew update > /dev/null ;
brew install colormake ccache ;
brew outdated "pkg-config" || brew upgrade "pkg-config" ;
# 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.
@@ -160,12 +153,11 @@ install:
brew install "$HOME/hombebrew_cache/qt5.rb" ;
brew link --force qt5 ;
fi
# ccache
if [ "$TRAVIS_BRANCH" != "$coverity_branch" ]; then
export PATH="/usr/local/opt/ccache/libexec:$PATH" && export use_ccache=true ;
ccache -V && ccache --show-stats && ccache --zero-stats ;
fi ;
fi
- |
if [ "$TRAVIS_BRANCH" != "$coverity_branch" ]; then
export use_ccache=true
ccache -V && ccache --show-stats && ccache --zero-stats
fi
script:
@@ -182,7 +174,11 @@ script:
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 cd "$TRAVIS_BUILD_DIR/src/" && macdeployqt "$qbt_exe.app" && cd "$qbt_exe.app/Contents/MacOS" ; fi
- |
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
macdeployqt "$TRAVIS_BUILD_DIR/src/$qbt_exe.app" ;
cd "$TRAVIS_BUILD_DIR/src/$qbt_exe.app/Contents/MacOS" ;
fi
- ./$qbt_exe --version
after_script:

View File

@@ -17,18 +17,19 @@ endif()
set(PROJECT_VERSION "${PROJECT_VERSION}${VER_STATUS}")
add_definitions(-DVERSION_MAJOR=${VER_MAJOR})
add_definitions(-DVERSION_MINOR=${VER_MINOR})
add_definitions(-DVERSION_BUGFIX=${VER_BUGFIX})
add_definitions(-DVERSION_BUILD=${VER_BUILD})
add_definitions(-DQBT_VERSION_MAJOR=${VER_MAJOR})
add_definitions(-DQBT_VERSION_MINOR=${VER_MINOR})
add_definitions(-DQBT_VERSION_BUGFIX=${VER_BUGFIX})
add_definitions(-DQBT_VERSION_BUILD=${VER_BUILD})
# os2 {
# DEFINES += VERSION=\'\"v$${PROJECT_VERSION}\"\'
# DEFINES += DQBT_VERSION=\'\"v$${PROJECT_VERSION}\"\'
# DEFINES += DQBT_VERSION_2=\'\"$${PROJECT_VERSION}\"\'
# } else {
add_definitions(-DVERSION="v${PROJECT_VERSION}")
add_definitions(-DQBT_VERSION="v${PROJECT_VERSION}")
add_definitions(-DQBT_VERSION_2="${PROJECT_VERSION}")
# }
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og")
if (UNIX AND NOT APPLE)
include(GNUInstallDirs)
endif (UNIX AND NOT APPLE)

View File

@@ -138,14 +138,14 @@ However, there are cases where curly braces for single statement if blocks **sho
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###
### 3. Indentation ###
4 spaces.
### 4. 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.
### 5. 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)
@@ -158,7 +158,7 @@ myClass::myClass(int a, int b, int c, int d)
}
```
### 6. Enums.###
### 6. Enums. ###
Enums should be vertical. This will allow for more easily readable diffs. The members should be indented.
```c++
enum Days
@@ -173,7 +173,7 @@ enum Days
};
```
### 7. Names.###
### 7. Names. ###
All names should be camelCased.
#### a. Type names and namespaces ####
@@ -207,7 +207,7 @@ class MyClass
}
```
### 8. Header inclusion 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).
@@ -240,7 +240,7 @@ Example:
```
### 9. Misc.###
### 9. Misc. ###
* Line breaks for long lines with operation:
@@ -304,5 +304,5 @@ for (int a = 0; a < b; ++b) {
* Method definitions aren't allowed in header files
###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.
### 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.

View File

@@ -1,4 +1,4 @@
# Filing an issue
# 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.
@@ -6,12 +6,11 @@
* Write in **English**!
* Provide **version** information: (You can find version numbers at menu `Help -> About -> Libraries`)
```
qBittorrent:
Qt:
libtorrent:
boost:
OS version:
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)

View File

@@ -1,3 +1,71 @@
* Thu Jun 01 2017 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.3.13
- BUGFIX: Fixed UI glitch about torrent numbers in the sidepanel. Fixes #6454. (evsh)
- BUGFIX: Fix downloaded/uploaded columns were not highlighted properly when selected. (Chocobo1)
- BUGFIX: Always draw background in files list and search result list (Chocobo1)
- BUGFIX: Remove torrent temp folder if it becomes unneeded (glassez)
- BUGFIX: Remove torrent temp folder when torrent is deleted (glassez)
- BUGFIX: Setup DPI at startup (Chocobo1)
- BUGFIX: Do not attempt to show detailed tooltips without torrent metadata. Closes #6768. (evsh)
- BUGFIX: Better detection of already present files when adding a torrent. (fbriere)
- BUGFIX: Fix double click on system tray icon causing program to open and minimize immediately. Closes #5826. (Chocobo1)
- BUGIFX: Fix categories sorting in AddNewTorrentDialog. Partially fixes #6708. (fbriere)
- BUGFIX: Set "category" column as case-insensitive in transfer list. (fbriere)
- BUGFIX: Properly sort categories case-insensitively in filter widget. Closes #6708. (fbriere)
- BUGFIX: Fix renaming files is not case sensitive on Windows platform. Closes #5128. (Chocobo1)
- BUGFIX: Fix crash in download piece bar (evsh)
- BUGFIX: Fix focusing on the previously opened dialog didn't work (Chocobo1)
- WEBUI: Bugfix: `RequestParser::splitMultipartData` drop extra trailing newline. (OpenGG)
- WEBUI: Add `skip_checking` and `paused` to `/command/download` and `/command/upload` (OpenGG)
- WEBUI: Fix checkbox hidden. Closes #6642. (Chocobo1)
- WEBUI: Implement http persistence connection. Max simultaneous connection limit set to 500. This also release allocated memory of Connection instances at runtime instead of at program shutdown. (Chocobo1)
- WEBUI: Always send Content-Length header. (Chocobo1)
- WEBUI: Send Date http header (Chocobo1)
- WEBUI: Fix "Content-Encoding" header is always created. (Chocobo1)
- WEBUI: Implement robust checking for gzip encoding and revise gzip compressing/decompressing code. (Chocobo1)
- WEBUI: Make the context obligatory for translatable strings. Also delete duplicate strings from extra translations. (sledgehammer999)
- WEBUI: Use translatable strings in Statistics dialog. (sledgehammer999)
- WEBUI: Add missing unit sizes in misc.js (sledgehammer999)
- WEBUI: Use the same layout in the Speed tab in preferences as the GUI. (sledgehammer999)
- WEBUI: Return status indicating if at least one torrent was successfully added (Thomas Piccirello)
- WEBUI: Increase the number of digits after the decimal point (thalieht)
- WEBUI: Use less permissive Content Security Policy (Thomas Piccirello)
- WEBUI: Fix connection status icon too large. Closes #6804. (Chocobo1)
- WEBUI: Cosmetic fixes for WebUI upload and download windows (naikel)
- WEBUI: Fix slow filtering in WebUI. (naikel)
- WEBUI: Make cookie parsing robust (Chocobo1)
- WEBUI: New API for getting torrent piece info (Chocobo1)
- WEBUI: Implement Cross-Site Request Forgery defense. Due to this the HTTP referer header is now expected in (almost) all HTTP requests. qBittorrent will drop the request sent without the referer header. That's why we bump the API_VERSION_MIN too. (reported by OpenGG, fixed by Chocobo1)
- SEARCH: Update demonoid, legittorrents plugins (ngosang)
- SEARCH: Remove mininova, ExtraTorrent plugins (ngosang, KingLucius)
- SEARCH: Add btdb plugin (ngosang)
- WINDOWS: Updated Spanish, Ukrainian, German, Chinese languages of the installer. (ngosang, evsh, schnurlos, wevsty)
- LINUX: Rename .desktop and appdata files to match executable name. Fixes #6625. (evsh)
- MACOS: Fix UI responsiveness after AddNewTorrentDialog received metadata. (Brian Kendall)
* Thu Apr 06 2017 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.3.12
- FEATURE: Indicate bitness in stackstrace and about dialog. Closes #6172. (sledgehammer999)
- BUGFIX: Fix incomplete type compile error with Qt4 (Chocobo1)
- BUGFIX: Fix compile error: escape is not a member of Qt (Chocobo1)
- BUGFIX: Use system locale to format dates/time/etc (sledgehammer999)
- BUGFIX: Follow http user-agent format (Chocobo1)
- BUGFIX: Fix cancel "Set location" causes files move to installation dir. (Chocobo1)
- WEBUI: Improve performance of updating 'progress' column (buinsky)
- WEBUI: Implement statistics window in web UI (FranciscoPombal)
- WEBUI: fixed "remaining" column in WebUI (FranciscoPombal)
- WEBUI: Set HttpOnly attribute to SID cookie (Chocobo1)
- WEBUI: Fire up the timer to clean inactive sessions (Chocobo1)
- WEBUI: Set cookie SID value to empty on logout (Chocobo1)
- WINDOWS: Make the installer DPI aware (regs01)
- WINDOWS: Set exit code to 0 on install/uninstall success. Fixes problem with silent installations. (Chocobo1)
- WINDOWS: The 64-bit installer refuses to install on 32-bit systems. (sledgehammer999)
- WINDOWS: The 64-bit installer uses the correct "Program Files" now. Detection will not work if you install on top of previous installer. (sledgehammer999)
- WINDOWS: Fix running the uninstaller if the user chose a different path in the installer. Closes #6080. (sledgehammer999)
- LINUX: Add keywords to the .desktop file. (sledgehammer999)
- LINUX: Update stuff in appdata.xml and run 'appstream-utl upgrade' on it. (sledgehammer999)
- OTHER: Replace rand() by a true uniform distribution generator (Chocobo1)
- OTHER: Change our user-agent format as indicated earlier in the news section (Chocobo1)
- OTHER: cmake: fix OSX bundle creation (evsh)
* Fri Mar 03 2017 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.3.11
- FEATURE: Always show progress and remaining bytes for unselected files. (sledgehammer999)
- FEATURE: Allow to change priority for unselected files through the combobox like it is done via the context menu. (sledgehammer999)

View File

@@ -93,13 +93,12 @@ foreach(_boost_cmpnt IN LISTS _boost_components)
list(APPEND LibtorrentRasterbar_LIBRARIES "Boost::${_boost_cmpnt}")
endforeach(_boost_cmpnt)
set(LibtorrentRasterbar_INCLUDE_DIRS ${LibtorrentRasterbar_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
set(LibtorrentRasterbar_INCLUDE_DIRS ${LibtorrentRasterbar_INCLUDE_DIRS})
list(FIND LibtorrentRasterbar_DEFINITIONS -DTORRENT_USE_OPENSSL LibtorrentRasterbar_ENCRYPTION_INDEX)
if(LibtorrentRasterbar_ENCRYPTION_INDEX GREATER -1)
find_package(OpenSSL REQUIRED)
set(LibtorrentRasterbar_LIBRARIES ${LibtorrentRasterbar_LIBRARIES} ${OPENSSL_LIBRARIES})
set(LibtorrentRasterbar_INCLUDE_DIRS ${LibtorrentRasterbar_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS})
set(LibtorrentRasterbar_LIBRARIES ${LibtorrentRasterbar_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
set(LibtorrentRasterbar_OPENSSL_ENABLED ON)
endif()

View File

@@ -3,6 +3,9 @@
# sets variables
# SYSTEMD_FOUND
# SYSTEMD_SERVICES_INSTALL_DIR
find_package(PkgConfig QUIET REQUIRED)
if (NOT SYSTEMD_FOUND)
pkg_check_modules(SYSTEMD "systemd")
endif(NOT SYSTEMD_FOUND)

View File

@@ -0,0 +1,49 @@
###############################################################
#
# Copyright 2011 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in compliance with the License. You may
# obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###############################################################
MACRO (GLIBC_DETECT _VERSION)
# there are multiple ways to detect glibc, but given nmi's
# cons'd up paths I will trust only gcc. I guess I could also use
# ldd --version to detect.
set(_GLIB_SOURCE_DETECT "
#include <limits.h>
#include <stdio.h>
int main()
{
printf(\"%d%d\",__GLIBC__, __GLIBC_MINOR__);
return 0;
}
")
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/build/cmake/glibc.cpp "${_GLIB_SOURCE_DETECT}\n")
try_run(POST26_GLIBC_DETECTED
POST26_GLIBC_COMPILE
${CMAKE_CURRENT_BINARY_DIR}/build/cmake
${CMAKE_CURRENT_BINARY_DIR}/build/cmake/glibc.cpp
RUN_OUTPUT_VARIABLE GLIBC_VERSION )
if (GLIBC_VERSION AND POST26_GLIBC_COMPILE )
set(${_VERSION} ${GLIBC_VERSION})
else()
message(STATUS "NOTE: Could not detect GLIBC_VERSION from compiler")
endif()
ENDMACRO (GLIBC_DETECT)

View File

@@ -0,0 +1,89 @@
# Sets cache variable QBT_ADDITONAL_FLAGS and QBT_ADDITONAL_CXX_FLAGS to list of additional
# compiler flags for C and C++ (QBT_ADDITONAL_FLAGS) and for C++ only (QBT_ADDITONAL_CXX_FLAGS)
# and appends them to CMAKE_XXX_FLAGS variables.
# It could use add_compile_options(), but then it is needed to use generator expressions,
# and most interesting of them are not compatible with Visual Studio :(
macro(qbt_set_compiler_options)
# if (NOT QBT_ADDITONAL_FLAGS)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
#-Wshadow -Wconversion ?
set(_GCC_COMMON_C_AND_CXX_FLAGS "-Wall -Wextra"
"-Wfloat-equal -Wcast-qual -Wcast-align"
"-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 -Wstrict-null-sentinel"
"-Wnon-virtual-dtor -Wfloat-equal -Wcast-qual -Wcast-align"
"-Werror=overloaded-virtual"
# "-Weffc++"
"-Werror -Wno-error=cpp"
# we should modify code to make these ones obsolete
"-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)
# GCC 4.8 has problems with std::array and its initialization
list(APPEND _GCC_COMMON_CXX_FLAGS "-Wno-error=missing-field-initializers")
endif()
include(CheckCXXCompilerFlag)
# check for -pedantic
check_cxx_compiler_flag(-pedantic _PEDANTIC_IS_SUPPORTED)
if (_PEDANTIC_IS_SUPPORTED)
list(APPEND _GCC_COMMON_CXX_FLAGS "-pedantic -pedantic-errors")
else (_PEDANTIC_IS_SUPPORTED)
list(APPEND _GCC_COMMON_CXX_FLAGS "-Wpedantic")
endif (_PEDANTIC_IS_SUPPORTED)
if (CMAKE_SYSTEM_NAME MATCHES Linux)
# if Glibc version is 2.20 or higher, set -D_DEFAULT_SOURCE
include(MacroGlibcDetect)
message(STATUS "Detecting Glibc version...")
glibc_detect(GLIBC_VERSION)
if(${GLIBC_VERSION})
if(GLIBC_VERSION LESS "220")
message(STATUS "Glibc version is ${GLIBC_VERSION}")
else(GLIBC_VERSION LESS "220")
message(STATUS "Glibc version is ${GLIBC_VERSION}, adding -D_DEFAULT_SOURCE")
add_definitions(-D_DEFAULT_SOURCE)
endif(GLIBC_VERSION LESS "220")
endif(${GLIBC_VERSION})
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
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}")
string(APPEND CMAKE_C_FLAGS " ${_GCC_COMMON_C_AND_CXX_FLAGS_STRING}")
string(APPEND CMAKE_CXX_FLAGS " ${_GCC_COMMON_C_AND_CXX_FLAGS_STRING} ${_GCC_COMMON_CXX_FLAGS_STRING}")
set(QBT_ADDITONAL_FLAGS "${_GCC_COMMON_C_AND_CXX_FLAGS_STRING}" CACHE STRING
"Additional qBittorent compile flags" FORCE)
set(QBT_ADDITONAL_CXX_FLAGS "${_GCC_COMMON_CXX_FLAGS_STRING}" CACHE STRING
"Additional qBittorent C++ compile flags" FORCE)
# check whether we can enable -Og optimization for debug build
# also let's enable -march=native for debug builds
check_cxx_compiler_flag(-Og _DEBUG_OPTIMIZATION_LEVEL_IS_SUPPORTED)
if (_DEBUG_OPTIMIZATION_LEVEL_IS_SUPPORTED)
string(APPEND CMAKE_C_FLAGS_DEBUG " -Og -g3 -march=native -pipe" )
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Og -g3 -march=native -pipe" )
else(_DEBUG_OPTIMIZATION_LEVEL_IS_SUPPORTED)
string(APPEND CMAKE_C_FLAGS_DEBUG " -O0 -g3 -march=native -pipe" )
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -O0 -g3 -march=native -pipe" )
endif (_DEBUG_OPTIMIZATION_LEVEL_IS_SUPPORTED)
endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(QBT_ADDITONAL_FLAGS "-wd4290 -wd4275 -wd4251 /W4" CACHE STRING "Additional qBittorent compile flags")
string(APPEND CMAKE_C_FLAGS " ${QBT_ADDITONAL_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS " ${QBT_ADDITONAL_FLAGS}")
endif ()
# endif (NOT QBT_ADDITONAL_FLAGS)
endmacro(qbt_set_compiler_options)

View File

@@ -1,9 +1,11 @@
# Settings for compiling qBittorrent on Windows
list(APPEND CMAKE_LIBRARY_PATH "$ENV{LIB}")
# We want to link with static version of
# libtorrent
set(LibtorrentRasterbar_USE_STATIC_LIBS True)
set(LibtorrentRasterbar_CUSTOM_DEFINITIONS
set(LibtorrentRasterbar_CUSTOM_DEFINITIONS
-DBOOST_ALL_NO_LIB -DBOOST_ASIO_HASH_MAP_BUCKETS=1021
-DBOOST_ASIO_SEPARATE_COMPILATION
-DBOOST_EXCEPTION_DISABLE
@@ -17,8 +19,9 @@ add_definitions(-DUNICODE
-DWIN32
-D_WIN32
-DWIN32_LEAN_AND_MEAN
-DNTDDI_VERSION=0x05010000
-D_WIN32_WINNT=0x0501
-D_WIN32_IE=0x0500
-D_WIN32_IE=0x0501
-D_CRT_SECURE_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
)

18
configure vendored
View File

@@ -5461,12 +5461,12 @@ if test -n "$zlib_CFLAGS"; then
pkg_cv_zlib_CFLAGS="$zlib_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5
($PKG_CONFIG --exists --print-errors "zlib") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.5.2\""; } >&5
($PKG_CONFIG --exists --print-errors "zlib >= 1.2.5.2") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_zlib_CFLAGS=`$PKG_CONFIG --cflags "zlib" 2>/dev/null`
pkg_cv_zlib_CFLAGS=`$PKG_CONFIG --cflags "zlib >= 1.2.5.2" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -5478,12 +5478,12 @@ if test -n "$zlib_LIBS"; then
pkg_cv_zlib_LIBS="$zlib_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5
($PKG_CONFIG --exists --print-errors "zlib") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.5.2\""; } >&5
($PKG_CONFIG --exists --print-errors "zlib >= 1.2.5.2") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_zlib_LIBS=`$PKG_CONFIG --libs "zlib" 2>/dev/null`
pkg_cv_zlib_LIBS=`$PKG_CONFIG --libs "zlib >= 1.2.5.2" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -5504,14 +5504,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
zlib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib" 2>&1`
zlib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib >= 1.2.5.2" 2>&1`
else
zlib_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib" 2>&1`
zlib_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib >= 1.2.5.2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$zlib_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (zlib) were not met:
as_fn_error $? "Package requirements (zlib >= 1.2.5.2) were not met:
$zlib_PKG_ERRORS

View File

@@ -208,7 +208,7 @@ PKG_CHECK_MODULES(libtorrent,
LIBS="$libtorrent_LIBS $LIBS"])
PKG_CHECK_MODULES(zlib,
[zlib],
[zlib >= 1.2.5.2],
[CPPFLAGS="$zlib_CFLAGS $CPPFLAGS"
LIBS="$zlib_LIBS $LIBS"])

2
dist/mac/Info.plist vendored
View File

@@ -45,7 +45,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.3.11</string>
<string>3.3.13</string>
<key>CFBundleSignature</key>
<string>qBit</string>
<key>CFBundleExecutable</key>

View File

@@ -1,2 +1,3 @@
set(BU_CHMOD_BUNDLE_ITEMS ON)
include(BundleUtilities)
fixup_bundle("$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/qbittorrent.app" "" "")

View File

@@ -20,18 +20,20 @@ install(FILES ${MAN_FILES}
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
COMPONENT doc)
install(DIRECTORY menuicons/
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor
FILES_MATCHING PATTERN "*.png")
if (GUI)
install(DIRECTORY menuicons/
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor
FILES_MATCHING PATTERN "*.png")
install(FILES ${qBittorrent_SOURCE_DIR}/src/icons/qbittorrent.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps/
COMPONENT data)
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 ${qBittorrent_SOURCE_DIR}/src/icons/qbittorrent.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/
COMPONENT data)
install(FILES qBittorrent.appdata.xml
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/appdata/
COMPONENT data)
install(FILES qbittorrent.appdata.xml
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/appdata/
COMPONENT data)
endif()

View File

@@ -1,61 +0,0 @@
<?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 width="1200" height="675">
https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_01.png
</image>
</screenshot>
<screenshot>
<image width="1200" height="675">
https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_02.png
</image>
</screenshot>
<screenshot>
<image width="1200" height="675">
https://alexpl.fedorapeople.org/AppData/qbittorrent/screens/qbittorrent_03.png
</image>
</screenshot>
<screenshot>
<image width="1200" height="675">
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>
</component>

66
dist/unix/qbittorrent.appdata.xml vendored Normal file
View 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>

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_AFRIKAANS} "A previous installation wa
LangString inst_unist ${LANG_AFRIKAANS} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_AFRIKAANS} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_AFRIKAANS} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_ALBANIAN} "A previous installation was
LangString inst_unist ${LANG_ALBANIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_ALBANIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_ALBANIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_ARABIC} "A previous installation was d
LangString inst_unist ${LANG_ARABIC} "جاري ازالة النسخة السابقة من البرنامج"
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_ARABIC} "تشغيل البرنامج"
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_ARABIC} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_BASQUE} "A previous installation was d
LangString inst_unist ${LANG_BASQUE} "Aurreko bertsioa kentzen."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_BASQUE} "Abiarazi qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_BASQUE} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_BELARUSIAN} "A previous installation w
LangString inst_unist ${LANG_BELARUSIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_BELARUSIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_BELARUSIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_BOSNIAN} "A previous installation was
LangString inst_unist ${LANG_BOSNIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_BOSNIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_BOSNIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_BRETON} "A previous installation was d
LangString inst_unist ${LANG_BRETON} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_BRETON} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_BRETON} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_BULGARIAN} "A previous installation wa
LangString inst_unist ${LANG_BULGARIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_BULGARIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_BULGARIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_CATALAN} "A previous installation was
LangString inst_unist ${LANG_CATALAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_CATALAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_CATALAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_CROATIAN} "A previous installation was
LangString inst_unist ${LANG_CROATIAN} "Deinstaliraj prethodnu verziju."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_CROATIAN} "Pokreni qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_CROATIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_CZECH} "A previous installation was de
LangString inst_unist ${LANG_CZECH} "Odebírání předchozí verze."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_CZECH} "Spustit qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_CZECH} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_DANISH} "A previous installation was d
LangString inst_unist ${LANG_DANISH} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_DANISH} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_DANISH} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_DUTCH} "A previous installation was de
LangString inst_unist ${LANG_DUTCH} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_DUTCH} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_DUTCH} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_ENGLISH} "A previous installation was
LangString inst_unist ${LANG_ENGLISH} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_ESPERANTO} "A previous installation wa
LangString inst_unist ${LANG_ESPERANTO} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_ESPERANTO} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_ESPERANTO} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_ESTONIAN} "A previous installation was
LangString inst_unist ${LANG_ESTONIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_ESTONIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_ESTONIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_FARSI} "A previous installation was de
LangString inst_unist ${LANG_FARSI} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_FARSI} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_FARSI} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_FINNISH} "A previous installation was
LangString inst_unist ${LANG_FINNISH} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_FINNISH} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_FINNISH} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_FRENCH} "Une installation précédente
LangString inst_unist ${LANG_FRENCH} "Désinstallation de la version précédente."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_FRENCH} "Lancer qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_FRENCH} "Cet installateur ne fonctionne que dans les versions 64 bits de Windows."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_GALICIAN} "A previous installation was
LangString inst_unist ${LANG_GALICIAN} "Desinstalando a versión anterior."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_GALICIAN} "Iniciar qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_GALICIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_GERMAN} "Eine ältere Installation wur
LangString inst_unist ${LANG_GERMAN} "Vorherige Version wird deinstalliert."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_GERMAN} "Starte qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_GERMAN} "Diese Installation funktioniert nur mit einer 64-bit Version von Windows."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_GREEK} "A previous installation was de
LangString inst_unist ${LANG_GREEK} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_GREEK} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_GREEK} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_HEBREW} "A previous installation was d
LangString inst_unist ${LANG_HEBREW} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_HEBREW} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_HEBREW} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_HUNGARIAN} "A previous installation wa
LangString inst_unist ${LANG_HUNGARIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_HUNGARIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_HUNGARIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_ICELANDIC} "A previous installation wa
LangString inst_unist ${LANG_ICELANDIC} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_ICELANDIC} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_ICELANDIC} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_INDONESIAN} "A previous installation w
LangString inst_unist ${LANG_INDONESIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_INDONESIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_INDONESIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_IRISH} "A previous installation was de
LangString inst_unist ${LANG_IRISH} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_IRISH} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_IRISH} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_ITALIAN} "A previous installation was
LangString inst_unist ${LANG_ITALIAN} "Disinstallazione versione precedente."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_ITALIAN} "Esegui qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_ITALIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_JAPANESE} "A previous installation was
LangString inst_unist ${LANG_JAPANESE} "以前のバージョンをアンインストールしています。"
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_JAPANESE} "qBittorrent を起動する"
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_JAPANESE} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_KOREAN} "A previous installation was d
LangString inst_unist ${LANG_KOREAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_KOREAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_KOREAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_KURDISH} "A previous installation was
LangString inst_unist ${LANG_KURDISH} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_KURDISH} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_KURDISH} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_LATVIAN} "A previous installation was
LangString inst_unist ${LANG_LATVIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_LATVIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_LATVIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_LITHUANIAN} "A previous installation w
LangString inst_unist ${LANG_LITHUANIAN} "Šalinu ankstesnę versiją."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_LITHUANIAN} "Paleisti qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_LITHUANIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_LUXEMBOURGISH} "A previous installatio
LangString inst_unist ${LANG_LUXEMBOURGISH} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_LUXEMBOURGISH} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_LUXEMBOURGISH} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_MACEDONIAN} "A previous installation w
LangString inst_unist ${LANG_MACEDONIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_MACEDONIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_MACEDONIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_MALAY} "A previous installation was de
LangString inst_unist ${LANG_MALAY} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_MALAY} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_MALAY} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_MONGOLIAN} "A previous installation wa
LangString inst_unist ${LANG_MONGOLIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_MONGOLIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_MONGOLIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_NORWEGIAN} "A previous installation wa
LangString inst_unist ${LANG_NORWEGIAN} "Avinstallerer forrige versjon."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_NORWEGIAN} "Sett i gang qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_NORWEGIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_NORWEGIANNYNORSK} "A previous installa
LangString inst_unist ${LANG_NORWEGIANNYNORSK} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_NORWEGIANNYNORSK} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_NORWEGIANNYNORSK} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_POLISH} "A previous installation was d
LangString inst_unist ${LANG_POLISH} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_POLISH} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_POLISH} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_PORTUGUESE} "Uma antiga instalação f
LangString inst_unist ${LANG_PORTUGUESE} "A desinstalar versão anterior."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_PORTUGUESE} "Iniciar qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_PORTUGUESE} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_PORTUGUESEBR} "Uma instalação anteri
LangString inst_unist ${LANG_PORTUGUESEBR} "Desinstalando versão anterior."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_PORTUGUESEBR} "Executar qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_PORTUGUESEBR} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_ROMANIAN} "A previous installation was
LangString inst_unist ${LANG_ROMANIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_ROMANIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_ROMANIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_RUSSIAN} "Обнаружена пре
LangString inst_unist ${LANG_RUSSIAN} "Деинсталлируем старую версию."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_RUSSIAN} "Запустить qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_RUSSIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_SERBIAN} "A previous installation was
LangString inst_unist ${LANG_SERBIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_SERBIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_SERBIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_SERBIANLATIN} "A previous installation
LangString inst_unist ${LANG_SERBIANLATIN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_SERBIANLATIN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_SERBIANLATIN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -1,51 +1,53 @@
;Installer strings
;LangString inst_qbt_req ${LANG_ENGLISH} "qBittorrent (required)"
LangString inst_qbt_req ${LANG_SIMPCHINESE} "qBittorrent (required)"
LangString inst_qbt_req ${LANG_SIMPCHINESE} "qBittorrent (必要)"
;LangString inst_dekstop ${LANG_ENGLISH} "Create Desktop Shortcut"
LangString inst_dekstop ${LANG_SIMPCHINESE} "Create Desktop Shortcut"
LangString inst_dekstop ${LANG_SIMPCHINESE} "创建桌面快捷方式"
;LangString inst_startmenu ${LANG_ENGLISH} "Create Start Menu Shortcut"
LangString inst_startmenu ${LANG_SIMPCHINESE} "Create Start Menu Shortcut"
LangString inst_startmenu ${LANG_SIMPCHINESE} "创建开始菜单快捷方式"
;LangString inst_torrent ${LANG_ENGLISH} "Open .torrent files with qBittorrent"
LangString inst_torrent ${LANG_SIMPCHINESE} "Open .torrent files with qBittorrent"
LangString inst_torrent ${LANG_SIMPCHINESE} "用 qBittorrent 打开.torrent文件"
;LangString inst_magnet ${LANG_ENGLISH} "Open magnet links with qBittorrent"
LangString inst_magnet ${LANG_SIMPCHINESE} "Open magnet links with qBittorrent"
LangString inst_magnet ${LANG_SIMPCHINESE} " qBittorrent 打开磁力链接"
;LangString inst_firewall ${LANG_ENGLISH} "Add Windows Firewall rule"
LangString inst_firewall ${LANG_SIMPCHINESE} "Add Windows Firewall rule"
LangString inst_firewall ${LANG_SIMPCHINESE} "添加Windows防火墙规则"
;LangString inst_firewallinfo ${LANG_ENGLISH} "Adding Windows Firewall rule"
LangString inst_firewallinfo ${LANG_SIMPCHINESE} "Adding Windows Firewall rule"
LangString inst_firewallinfo ${LANG_SIMPCHINESE} "正在添加Windows防火墙规则"
;LangString inst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before installing."
LangString inst_warning ${LANG_SIMPCHINESE} "qBittorrent is running. Please close the application before installing."
LangString inst_warning ${LANG_SIMPCHINESE} "qBittorrent 正在运行。 安装前请关闭应用程序。"
;LangString inst_uninstall_question ${LANG_ENGLISH} "A previous installation was detected. It will be uninstalled without deleting user settings."
LangString inst_uninstall_question ${LANG_SIMPCHINESE} "A previous installation was detected. It will be uninstalled without deleting user settings."
LangString inst_uninstall_question ${LANG_SIMPCHINESE} "检测到以前的安装。 它将被卸载但不删除用户设置。"
;LangString inst_unist ${LANG_ENGLISH} "Uninstalling previous version."
LangString inst_unist ${LANG_SIMPCHINESE} "Uninstalling previous version."
LangString inst_unist ${LANG_SIMPCHINESE} "卸载以前的版本。"
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_SIMPCHINESE} "Launch qBittorrent."
LangString launch_qbt ${LANG_SIMPCHINESE} "启动 qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_SIMPCHINESE} "此安装程序只能在64位的Windows上工作。"
;------------------------------------
;Uninstaller strings
;LangString remove_files ${LANG_ENGLISH} "Remove files"
LangString remove_files ${LANG_SIMPCHINESE} "Remove files"
LangString remove_files ${LANG_SIMPCHINESE} "删除文件"
;LangString remove_shortcuts ${LANG_ENGLISH} "Remove shortcuts"
LangString remove_shortcuts ${LANG_SIMPCHINESE} "Remove shortcuts"
LangString remove_shortcuts ${LANG_SIMPCHINESE} "删除快捷方式"
;LangString remove_associations ${LANG_ENGLISH} "Remove file associations"
LangString remove_associations ${LANG_SIMPCHINESE} "Remove file associations"
LangString remove_associations ${LANG_SIMPCHINESE} "删除文件关联"
;LangString remove_registry ${LANG_ENGLISH} "Remove registry keys"
LangString remove_registry ${LANG_SIMPCHINESE} "Remove registry keys"
LangString remove_registry ${LANG_SIMPCHINESE} "删除注册表键"
;LangString remove_conf ${LANG_ENGLISH} "Remove configuration files"
LangString remove_conf ${LANG_SIMPCHINESE} "Remove configuration files"
LangString remove_conf ${LANG_SIMPCHINESE} "删除配置文件"
;LangString remove_firewall ${LANG_ENGLISH} "Remove Windows Firewall rule"
LangString remove_firewall ${LANG_SIMPCHINESE} "Remove Windows Firewall rule"
LangString remove_firewall ${LANG_SIMPCHINESE} "删除Windows防火墙规则"
;LangString remove_firewallinfo ${LANG_ENGLISH} "Removing Windows Firewall rule"
LangString remove_firewallinfo ${LANG_SIMPCHINESE} "Removing Windows Firewall rule"
LangString remove_firewallinfo ${LANG_SIMPCHINESE} "正在删除Windows防火墙规则"
;LangString remove_cache ${LANG_ENGLISH} "Remove torrents and cached data"
LangString remove_cache ${LANG_SIMPCHINESE} "Remove torrents and cached data"
LangString remove_cache ${LANG_SIMPCHINESE} "删除种子和缓存数据"
;LangString uninst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before uninstalling."
LangString uninst_warning ${LANG_SIMPCHINESE} "qBittorrent is running. Please close the application before uninstalling."
LangString uninst_warning ${LANG_SIMPCHINESE} "qBittorrent 正在运行。 卸载前请关闭程序。"
;LangString uninst_tor_warn ${LANG_ENGLISH} "Not removing .torrent association. It is associated with:"
LangString uninst_tor_warn ${LANG_SIMPCHINESE} "Not removing .torrent association. It is associated with:"
LangString uninst_tor_warn ${LANG_SIMPCHINESE} "不删除 .torrent 关联。 关联的是:"
;LangString uninst_mag_warn ${LANG_ENGLISH} "Not removing magnet association. It is associated with:"
LangString uninst_mag_warn ${LANG_SIMPCHINESE} "Not removing magnet association. It is associated with:"
LangString uninst_mag_warn ${LANG_SIMPCHINESE} "不删除磁力关联。 关联的是:"

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_SLOVAK} "A previous installation was d
LangString inst_unist ${LANG_SLOVAK} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_SLOVAK} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_SLOVAK} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_SLOVENIAN} "A previous installation wa
LangString inst_unist ${LANG_SLOVENIAN} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_SLOVENIAN} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_SLOVENIAN} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_SPANISH} "Se detectó una instalación
LangString inst_unist ${LANG_SPANISH} "Desinstalando la versión anterior."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_SPANISH} "Iniciar qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_SPANISH} "Este instalador solo funciona en versiones de 64-bit de Windows."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_SPANISHINTERNATIONAL} "Se detectó una
LangString inst_unist ${LANG_SPANISHINTERNATIONAL} "Desinstalando la versión anterior."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_SPANISHINTERNATIONAL} "Iniciar qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_SPANISHINTERNATIONAL} "Este instalador solo funciona en versiones de 64-bit de Windows."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_SWEDISH} "A previous installation was
LangString inst_unist ${LANG_SWEDISH} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_SWEDISH} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_SWEDISH} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_THAI} "A previous installation was det
LangString inst_unist ${LANG_THAI} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_THAI} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_THAI} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_TRADCHINESE} "A previous installation
LangString inst_unist ${LANG_TRADCHINESE} "正在移除先前版本"
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_TRADCHINESE} "啟動 qBittorrent"
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_TRADCHINESE} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_TURKISH} "Önceki bir kurulum algılan
LangString inst_unist ${LANG_TURKISH} "Önceki sürüm kaldırılıyor."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_TURKISH} "qBittorrent'i çalıştır."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_TURKISH} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -1,51 +1,53 @@
;Installer strings
;LangString inst_qbt_req ${LANG_ENGLISH} "qBittorrent (required)"
LangString inst_qbt_req ${LANG_UKRAINIAN} "qBittorrent (required)"
LangString inst_qbt_req ${LANG_UKRAINIAN} "qBittorrent (необхідний)"
;LangString inst_dekstop ${LANG_ENGLISH} "Create Desktop Shortcut"
LangString inst_dekstop ${LANG_UKRAINIAN} "Create Desktop Shortcut"
LangString inst_dekstop ${LANG_UKRAINIAN} "Створити ярлик на стільниці"
;LangString inst_startmenu ${LANG_ENGLISH} "Create Start Menu Shortcut"
LangString inst_startmenu ${LANG_UKRAINIAN} "Create Start Menu Shortcut"
LangString inst_startmenu ${LANG_UKRAINIAN} "Створити ярлик в меню Пуск"
;LangString inst_torrent ${LANG_ENGLISH} "Open .torrent files with qBittorrent"
LangString inst_torrent ${LANG_UKRAINIAN} "Open .torrent files with qBittorrent"
LangString inst_torrent ${LANG_UKRAINIAN} "Відкривати .torrent файли за допомогою qBittorrent"
;LangString inst_magnet ${LANG_ENGLISH} "Open magnet links with qBittorrent"
LangString inst_magnet ${LANG_UKRAINIAN} "Open magnet links with qBittorrent"
LangString inst_magnet ${LANG_UKRAINIAN} "Відкривати посилання magnet за допомогою qBittorrent"
;LangString inst_firewall ${LANG_ENGLISH} "Add Windows Firewall rule"
LangString inst_firewall ${LANG_UKRAINIAN} "Add Windows Firewall rule"
LangString inst_firewall ${LANG_UKRAINIAN} "Додати правило в Windows брандмауер"
;LangString inst_firewallinfo ${LANG_ENGLISH} "Adding Windows Firewall rule"
LangString inst_firewallinfo ${LANG_UKRAINIAN} "Adding Windows Firewall rule"
LangString inst_firewallinfo ${LANG_UKRAINIAN} "Додаємо правило до брандмауера"
;LangString inst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before installing."
LangString inst_warning ${LANG_UKRAINIAN} "qBittorrent is running. Please close the application before installing."
LangString inst_warning ${LANG_UKRAINIAN} "qBittorrent вже виконується. Будь ласка, закрийте застосунок перед запуском інсталятору."
;LangString inst_uninstall_question ${LANG_ENGLISH} "A previous installation was detected. It will be uninstalled without deleting user settings."
LangString inst_uninstall_question ${LANG_UKRAINIAN} "A previous installation was detected. It will be uninstalled without deleting user settings."
LangString inst_uninstall_question ${LANG_UKRAINIAN} "Виявлено попередню інсталяцію. Її буде видалено за виключенням користувацьких налаштувань."
;LangString inst_unist ${LANG_ENGLISH} "Uninstalling previous version."
LangString inst_unist ${LANG_UKRAINIAN} "Uninstalling previous version."
LangString inst_unist ${LANG_UKRAINIAN} "Видалення попередньої версії."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_UKRAINIAN} "Launch qBittorrent."
LangString launch_qbt ${LANG_UKRAINIAN} "Запустити qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_UKRAINIAN} "Ця програма установки працює тільки в 64-розрядних версіях Windows."
;------------------------------------
;Uninstaller strings
;LangString remove_files ${LANG_ENGLISH} "Remove files"
LangString remove_files ${LANG_UKRAINIAN} "Remove files"
LangString remove_files ${LANG_UKRAINIAN} "Видалити файли"
;LangString remove_shortcuts ${LANG_ENGLISH} "Remove shortcuts"
LangString remove_shortcuts ${LANG_UKRAINIAN} "Remove shortcuts"
LangString remove_shortcuts ${LANG_UKRAINIAN} "Видалити ярлики"
;LangString remove_associations ${LANG_ENGLISH} "Remove file associations"
LangString remove_associations ${LANG_UKRAINIAN} "Remove file associations"
LangString remove_associations ${LANG_UKRAINIAN} "Видалити файлові асоціації"
;LangString remove_registry ${LANG_ENGLISH} "Remove registry keys"
LangString remove_registry ${LANG_UKRAINIAN} "Remove registry keys"
LangString remove_registry ${LANG_UKRAINIAN} "Видалити ключі реєстру"
;LangString remove_conf ${LANG_ENGLISH} "Remove configuration files"
LangString remove_conf ${LANG_UKRAINIAN} "Remove configuration files"
LangString remove_conf ${LANG_UKRAINIAN} "Видалити користувацькі налаштування"
;LangString remove_firewall ${LANG_ENGLISH} "Remove Windows Firewall rule"
LangString remove_firewall ${LANG_UKRAINIAN} "Remove Windows Firewall rule"
LangString remove_firewall ${LANG_UKRAINIAN} "Видалити правило брандмауера Windows"
;LangString remove_firewallinfo ${LANG_ENGLISH} "Removing Windows Firewall rule"
LangString remove_firewallinfo ${LANG_UKRAINIAN} "Removing Windows Firewall rule"
LangString remove_firewallinfo ${LANG_UKRAINIAN} "Видаляємо правило брандмауера Windows"
;LangString remove_cache ${LANG_ENGLISH} "Remove torrents and cached data"
LangString remove_cache ${LANG_UKRAINIAN} "Remove torrents and cached data"
LangString remove_cache ${LANG_UKRAINIAN} "Видалити торренти та кешовані дані"
;LangString uninst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before uninstalling."
LangString uninst_warning ${LANG_UKRAINIAN} "qBittorrent is running. Please close the application before uninstalling."
LangString uninst_warning ${LANG_UKRAINIAN} "qBittorrent виконується. Будь ласка, закрийте застосунок перед деінсталляцією."
;LangString uninst_tor_warn ${LANG_ENGLISH} "Not removing .torrent association. It is associated with:"
LangString uninst_tor_warn ${LANG_UKRAINIAN} "Not removing .torrent association. It is associated with:"
LangString uninst_tor_warn ${LANG_UKRAINIAN} "Не видаляємо асоціацію .torrent файлів. Вони асоційовані з:"
;LangString uninst_mag_warn ${LANG_ENGLISH} "Not removing magnet association. It is associated with:"
LangString uninst_mag_warn ${LANG_UKRAINIAN} "Not removing magnet association. It is associated with:"
LangString uninst_mag_warn ${LANG_UKRAINIAN} "Не видаляємо асоціацію magnet-посилань. Вони асоційовані з:"

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_UZBEK} "A previous installation was de
LangString inst_unist ${LANG_UZBEK} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_UZBEK} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_UZBEK} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -22,6 +22,8 @@ LangString inst_uninstall_question ${LANG_WELSH} "A previous installation was de
LangString inst_unist ${LANG_WELSH} "Uninstalling previous version."
;LangString launch_qbt ${LANG_ENGLISH} "Launch qBittorrent."
LangString launch_qbt ${LANG_WELSH} "Launch qBittorrent."
;LangString inst_requires_64bit ${LANG_ENGLISH} "This installer works only in 64-bit Windows versions."
LangString inst_requires_64bit ${LANG_WELSH} "This installer works only in 64-bit Windows versions."
;------------------------------------

View File

@@ -1,14 +1,17 @@
Section "-hidden"
Var uninstallerPath
Section "-hidden"
;Search if qBittorrent is already installed.
FindFirst $0 $1 "$INSTDIR\uninst.exe"
FindFirst $0 $1 "$uninstallerPath\uninst.exe"
FindClose $0
StrCmp $1 "" done
;Run the uninstaller of the previous install.
DetailPrint $(inst_unist)
ExecWait '"$INSTDIR\uninst.exe" /S _?=$INSTDIR'
Delete "$INSTDIR\uninst.exe"
ExecWait '"$uninstallerPath\uninst.exe" /S _?=$uninstallerPath'
Delete "$uninstallerPath\uninst.exe"
RMDir "$uninstallerPath"
done:
@@ -18,14 +21,14 @@ SectionEnd
Section $(inst_qbt_req) ;"qBittorrent (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
;Create 'translations' directory
CreateDirectory $INSTDIR\translations
; Put file there
; Put file there
File "qbittorrent.exe"
File "qbittorrent.pdb"
File "qt.conf"
@@ -74,10 +77,10 @@ Section $(inst_qbt_req) ;"qBittorrent (required)"
File /oname=translations\qtbase_ru.qm "translations\qtbase_ru.qm"
File /oname=translations\qtbase_sk.qm "translations\qtbase_sk.qm"
File /oname=translations\qtbase_uk.qm "translations\qtbase_uk.qm"
; Write the installation path into the registry
; Write the installation path into the registry
WriteRegStr HKLM "Software\qBittorrent" "InstallLocation" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "DisplayName" "qBittorrent ${PROG_VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "UninstallString" '"$INSTDIR\uninst.exe"'
@@ -87,53 +90,53 @@ Section $(inst_qbt_req) ;"qBittorrent (required)"
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
WriteUninstaller "uninst.exe"
WriteUninstaller "uninst.exe"
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "EstimatedSize" "$0"
; qBittorrent ProgID
WriteRegStr HKLM "Software\Classes\qBittorrent" "" "qBittorrent Torrent File"
WriteRegStr HKLM "Software\Classes\qBittorrent" "FriendlyTypeName" "qBittorrent Torrent File"
WriteRegStr HKLM "Software\Classes\qBittorrent\shell" "" "open"
WriteRegStr HKLM "Software\Classes\qBittorrent\shell\open\command" "" '"$INSTDIR\qbittorrent.exe" "%1"'
WriteRegStr HKLM "Software\Classes\qBittorrent\DefaultIcon" "" '"$INSTDIR\qbittorrent.exe",1'
SectionEnd
; Optional section (can be disabled by the user)
Section /o $(inst_dekstop) ;"Create Desktop Shortcut"
CreateShortCut "$DESKTOP\qBittorrent.lnk" "$INSTDIR\qbittorrent.exe"
SectionEnd
Section $(inst_startmenu) ;"Create Start Menu Shortcut"
CreateDirectory "$SMPROGRAMS\qBittorrent"
CreateDirectory "$SMPROGRAMS\qBittorrent"
CreateShortCut "$SMPROGRAMS\qBittorrent\qBittorrent.lnk" "$INSTDIR\qbittorrent.exe"
CreateShortCut "$SMPROGRAMS\qBittorrent\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
Section $(inst_torrent) ;"Open .torrent files with qBittorrent"
ReadRegStr $0 HKLM "Software\Classes\.torrent" ""
StrCmp $0 "qBittorrent" clear_errors 0
;Check if empty string
StrCmp $0 "" clear_errors 0
;Write old value to OpenWithProgIds
WriteRegStr HKLM "Software\Classes\.torrent\OpenWithProgIds" $0 ""
clear_errors:
ClearErrors
WriteRegStr HKLM "Software\Classes\.torrent" "" "qBittorrent"
WriteRegStr HKLM "Software\Classes\.torrent" "Content Type" "application/x-bittorrent"
!insertmacro UAC_AsUser_Call Function inst_torrent_user ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR}
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
SectionEnd
@@ -141,13 +144,13 @@ SectionEnd
Function inst_torrent_user
ReadRegStr $0 HKCU "Software\Classes\.torrent" ""
StrCmp $0 "qBittorrent" clear_errors 0
;Check if empty string
StrCmp $0 "" clear_errors 0
;Write old value to OpenWithProgIds
WriteRegStr HKCU "Software\Classes\.torrent\OpenWithProgIds" $0 ""
clear_errors:
ClearErrors
@@ -164,7 +167,7 @@ Section $(inst_magnet) ;"Open magnet links with qBittorrent"
WriteRegStr HKLM "Software\Classes\magnet\DefaultIcon" "" '"$INSTDIR\qbittorrent.exe",1'
WriteRegStr HKLM "Software\Classes\magnet\shell" "" "open"
WriteRegStr HKLM "Software\Classes\magnet\shell\open\command" "" '"$INSTDIR\qbittorrent.exe" "%1"'
!insertmacro UAC_AsUser_Call Function inst_magnet_user ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR}
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
@@ -185,8 +188,8 @@ FunctionEnd
Section $(inst_firewall)
DetailPrint $(inst_firewallinfo)
nsisFirewallW::AddAuthorizedApplication "$INSTDIR\qbittorrent.exe" "qBittorrent"
nsisFirewallW::AddAuthorizedApplication "$INSTDIR\qbittorrent.exe" "qBittorrent"
SectionEnd
;--------------------------------
@@ -196,11 +199,21 @@ Function .onInit
!insertmacro Init "installer"
!insertmacro MUI_LANGDLL_DISPLAY
!ifdef APP64BIT
${IfNot} ${RunningX64}
MessageBox MB_OK|MB_ICONEXCLAMATION $(inst_requires_64bit)
Abort
${EndIf}
!endif
;Search if qBittorrent is already installed.
FindFirst $0 $1 "$INSTDIR\uninst.exe"
FindClose $0
StrCmp $1 "" done
;Copy old value to var so we can call the correct uninstaller
StrCpy $uninstallerPath $INSTDIR
;Inform the user
MessageBox MB_OKCANCEL|MB_ICONINFORMATION $(inst_uninstall_question) /SD IDOK IDOK done
Quit
@@ -228,3 +241,7 @@ Function PageFinishRun
!insertmacro UAC_AsUser_ExecShell "" "$INSTDIR\qbittorrent.exe" "" "" ""
FunctionEnd
Function .onInstSuccess
SetErrorLevel 0
FunctionEnd

View File

@@ -1,4 +1,5 @@
Unicode true
ManifestDPIAware true
;Compress the header too
!packhdr "$%TEMP%\exehead.tmp" 'upx.exe -9 --best --ultra-brute "$%TEMP%\exehead.tmp"'
@@ -7,9 +8,15 @@ SetCompressor /SOLID LZMA
SetCompressorDictSize 64
XPStyle on
;Uncomment when packaging 64bit qbittorrent
;!define APP64BIT
!include "MUI.nsh"
!include "UAC.nsh"
!include "FileFunc.nsh"
!ifdef APP64BIT
!include "x64.nsh"
!endif
;For the file association
!define SHCNE_ASSOCCHANGED 0x8000000
@@ -19,16 +26,26 @@ XPStyle on
!define CSIDL_APPDATA '0x1A' ;Application Data path
!define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
!define PROG_VERSION "3.3.11"
; Program specific
!define PROG_VERSION "3.3.13"
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
!define MUI_FINISHPAGE_RUN_TEXT $(launch_qbt)
; The name of the installer
Name "qBittorrent ${PROG_VERSION}"
!ifndef APP64BIT
; The name of the installer
Name "qBittorrent ${PROG_VERSION}"
; The file to write
OutFile "qbittorrent_${PROG_VERSION}_setup.exe"
; The file to write
OutFile "qbittorrent_${PROG_VERSION}_setup.exe"
!else
; The name of the installer
Name "qBittorrent ${PROG_VERSION} x64"
; The file to write
OutFile "qbittorrent_${PROG_VERSION}_x64_setup.exe"
!endif
;Installer Version Information
VIAddVersionKey "ProductName" "qBittorrent"
@@ -39,8 +56,15 @@ VIAddVersionKey "FileVersion" "${PROG_VERSION}"
VIProductVersion "${PROG_VERSION}.0"
; The default installation directory
InstallDir $PROGRAMFILES\qBittorrent
; The default installation directory. It changes depending if we install in the 64bit dir or not.
; A caveat of this is if a user has installed a 32bit version and then runs the 64bit installer
; (which in turn launches the 32bit uninstaller first) the value will still point to the 32bit location.
; The user has to manually uninstall the old version and THEN run the 64bit installer
!ifndef APP64BIT
InstallDir $PROGRAMFILES32\qBittorrent
!else
InstallDir $PROGRAMFILES64\qBittorrent
!endif
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)

View File

@@ -1,10 +1,10 @@
Section "un.$(remove_files)" ;"un.Remove files"
SectionIn RO
; Remove files and uninstaller
; Remove files and uninstaller
Delete "$INSTDIR\qbittorrent.exe"
Delete "$INSTDIR\qbittorrent.pdb"
Delete "$INSTDIR\qt.conf"
Delete "$INSTDIR\qt.conf"
Delete "$INSTDIR\translations\qt_ar.qm"
Delete "$INSTDIR\translations\qt_bg.qm"
Delete "$INSTDIR\translations\qt_ca.qm"
@@ -51,8 +51,8 @@
Delete "$INSTDIR\translations\qtbase_sk.qm"
Delete "$INSTDIR\translations\qtbase_uk.qm"
Delete "$INSTDIR\uninst.exe"
; Remove directories used
; Remove directories used
RMDir /r "$INSTDIR\translations"
RMDir "$INSTDIR"
SectionEnd
@@ -71,16 +71,16 @@ Section "un.$(remove_associations)" ;"un.Remove file associations"
DetailPrint "$(uninst_tor_warn) $0"
DeleteRegValue HKLM "Software\Classes\.torrent" ""
DeleteRegKey /ifempty HKLM "Software\Classes\.torrent"
torrent_end:
ReadRegStr $0 HKLM "Software\Classes\magnet\shell\open\command" ""
StrCmp $0 '"$INSTDIR\qbittorrent.exe" "%1"' 0 magnet_end
DetailPrint "$(uninst_mag_warn) $0"
DeleteRegKey HKLM "Software\Classes\magnet"
magnet_end:
!insertmacro UAC_AsUser_Call Function un.remove_associations_user ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR}
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
SectionEnd
@@ -90,23 +90,23 @@ Function un.remove_associations_user
DetailPrint "$(uninst_tor_warn) $0"
DeleteRegValue HKCU "Software\Classes\.torrent" ""
DeleteRegKey /ifempty HKCU "Software\Classes\.torrent"
torrent_end:
ReadRegStr $0 HKCU "Software\Classes\magnet\shell\open\command" ""
StrCmp $0 '"$INSTDIR\qbittorrent.exe" "%1"' 0 magnet_end
DetailPrint "$(uninst_mag_warn) $0"
DeleteRegKey HKCU "Software\Classes\magnet"
magnet_end:
FunctionEnd
Section "un.$(remove_registry)" ;"un.Remove registry keys"
SectionIn RO
Section "un.$(remove_registry)" ;"un.Remove registry keys"
SectionIn RO
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent"
DeleteRegKey HKLM "Software\qBittorrent"
DeleteRegKey HKLM "Software\Classes\qBittorrent"
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
SectionEnd
@@ -114,7 +114,7 @@ Section "un.$(remove_firewall)" ;
DetailPrint $(remove_firewallinfo)
nsisFirewallW::RemoveAuthorizedApplication "$INSTDIR\qbittorrent.exe"
SectionEnd
Section /o "un.$(remove_conf)" ;"un.Remove configuration files"
@@ -150,7 +150,7 @@ Function un.onInit
!insertmacro Init "uninstaller"
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd
Function un.check_instance
@@ -162,7 +162,11 @@ Function un.check_instance
done:
Abort
notfound:
FunctionEnd
Function un.onUninstSuccess
SetErrorLevel 0
FunctionEnd

View File

@@ -2,6 +2,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_STANDARD "11")
add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
include(MacroQbtCompilerSettings)
qbt_set_compiler_options()
include(MacroLinkQtComponents)
include(QbtTargetSources)
@@ -28,6 +31,7 @@ else (QT5)
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)

View File

@@ -38,6 +38,7 @@ endforeach()
set(QBT_APP_RESOURCES
../icons.qrc
../searchengine.qrc
"${_lang_qrc_dst}"
)
@@ -55,6 +56,7 @@ if (WIN32)
else (MINGW)
list (APPEND QBT_APP_SOURCES ../qbittorrent.rc)
endif (MINGW)
list(APPEND QBT_APP_SOURCES ../qbittorrent.exe.manifest)
endif (WIN32)
if (UNIX)
@@ -179,6 +181,6 @@ install(TARGETS ${QBT_TARGET_NAME}
BUNDLE DESTINATION .
COMPONENT runtime)
if (APPLE)
if (APPLE AND GUI)
install(SCRIPT ${OSX_RES_SRC_DIR}/bundle.cmake)
endif (APPLE)
endif (APPLE AND GUI)

View File

@@ -111,17 +111,20 @@ Application::Application(const QString &id, int &argc, char **argv)
QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
}
#endif
setApplicationName("qBittorrent");
initializeTranslation();
#ifndef DISABLE_GUI
#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);
#ifdef Q_OS_WIN
#endif
#if defined(Q_OS_WIN) && !defined(DISABLE_GUI)
connect(this, SIGNAL(commitDataRequest(QSessionManager &)), this, SLOT(shutdownCleanup(QSessionManager &)), Qt::DirectConnection);
#endif // Q_OS_WIN
#endif // DISABLE_GUI
#endif
connect(this, SIGNAL(messageReceived(const QString &)), SLOT(processMessage(const QString &)));
connect(this, SIGNAL(aboutToQuit()), SLOT(cleanup()));
@@ -129,7 +132,7 @@ Application::Application(const QString &id, int &argc, char **argv)
if (isFileLoggerEnabled())
m_fileLogger = new FileLogger(fileLoggerPath(), isFileLoggerBackup(), fileLoggerMaxSize(), isFileLoggerDeleteOld(), fileLoggerAge(), static_cast<FileLogger::FileLogAgeType>(fileLoggerAgeType()));
Logger::instance()->addMessage(tr("qBittorrent %1 started", "qBittorrent v3.2.0alpha started").arg(VERSION));
Logger::instance()->addMessage(tr("qBittorrent %1 started", "qBittorrent v3.2.0alpha started").arg(QBT_VERSION));
}
#ifndef DISABLE_GUI
@@ -441,6 +444,9 @@ int Application::exec(const QStringList &params)
m_paramsQueue.clear();
}
// Now UI is ready to process signals from Session
BitTorrent::Session::instance()->startUpTorrents();
return BaseApplication::exec();
}
@@ -512,7 +518,6 @@ void Application::initializeTranslation()
Preferences* const pref = Preferences::instance();
// Load translation
QString localeStr = pref->getLocale();
QLocale::setDefault(QLocale(localeStr));
if (
#ifdef QBT_USES_QT5

View File

@@ -40,6 +40,7 @@
#include <QPen>
#include <QPushButton>
#include <QSplashScreen>
#ifdef QBT_STATIC_QT
#include <QtPlugin>
#ifdef QBT_USES_QT5
@@ -120,15 +121,24 @@ struct QBtCommandLineParameters
}
};
#ifndef DISABLE_GUI
void showSplashScreen();
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
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
int main(int argc, char *argv[])
{
@@ -141,6 +151,11 @@ int main(int argc, char *argv[])
macMigratePlists();
#endif
#if !defined(DISABLE_GUI) && defined(Q_OS_UNIX)
setupDpi();
#endif
#ifndef DISABLE_GUI
migrateRSS();
#endif
@@ -193,7 +208,7 @@ int main(int argc, char *argv[])
}
// Set environment variable
if (!qputenv("QBITTORRENT", QByteArray(VERSION)))
if (!qputenv("QBITTORRENT", QBT_VERSION))
std::cerr << "Couldn't set environment variable...\n";
#ifndef DISABLE_GUI
@@ -259,7 +274,6 @@ int main(int argc, char *argv[])
&& isatty(fileno(stdout)))) return EXIT_FAILURE;
#endif
srand(time(0));
#ifdef DISABLE_GUI
if (params.shouldDaemonize) {
app.reset(); // Destroy current application
@@ -343,6 +357,17 @@ QBtCommandLineParameters parseCommandLine()
return result;
}
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
void reportToUser(const char* str)
{
const size_t strLen = strlen(str);
if (write(STDERR_FILENO, str, strLen) < static_cast<ssize_t>(strLen)) {
auto dummy = write(STDOUT_FILENO, str, strLen);
Q_UNUSED(dummy);
}
}
#endif
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
void sigNormalHandler(int signum)
{
@@ -350,9 +375,9 @@ void sigNormalHandler(int signum)
const char str1[] = "Catching signal: ";
const char *sigName = sysSigName[signum];
const char str2[] = "\nExiting cleanly\n";
write(STDERR_FILENO, str1, strlen(str1));
write(STDERR_FILENO, sigName, strlen(sigName));
write(STDERR_FILENO, str2, strlen(str2));
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
@@ -364,10 +389,10 @@ void sigAbnormalHandler(int signum)
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: " VERSION "\n";
write(STDERR_FILENO, str1, strlen(str1));
write(STDERR_FILENO, sigName, strlen(sigName));
write(STDERR_FILENO, str2, strlen(str2));
"qBittorrent version: " QBT_VERSION "\n";
reportToUser(str1);
reportToUser(sigName);
reportToUser(str2);
print_stacktrace(); // unsafe
#endif // !defined Q_OS_WIN && !defined Q_OS_HAIKU
#ifdef STACKTRACE_WIN
@@ -380,12 +405,12 @@ void sigAbnormalHandler(int signum)
}
#endif // defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
#ifndef DISABLE_GUI
#if !defined(DISABLE_GUI)
void showSplashScreen()
{
QPixmap splash_img(":/icons/skin/splash.png");
QPainter painter(&splash_img);
QString version = VERSION;
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);
@@ -394,11 +419,19 @@ void showSplashScreen()
QTimer::singleShot(1500, splash, SLOT(deleteLater()));
qApp->processEvents();
}
#endif
#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()
{
std::cout << qPrintable(qApp->applicationName()) << " " << VERSION << std::endl;
std::cout << qPrintable(qApp->applicationName()) << " " << QBT_VERSION << std::endl;
}
QString makeUsage(const QString &prg_name)

View File

@@ -9,16 +9,18 @@
#include <execinfo.h>
#include <cxxabi.h>
#include <vector>
/** 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");
// storage array for stack trace address data
void *addrlist[max_frames + 1];
std::vector<void *> addrlist(max_frames + 1);
// retrieve current stack addresses
int addrlen = backtrace(addrlist, sizeof(addrlist) / sizeof(void *));
int addrlen = backtrace(addrlist.data(), addrlist.size());
if (addrlen == 0) {
fprintf(out, " <empty, possibly corrupt>\n");
@@ -27,7 +29,7 @@ static inline void print_stacktrace(FILE *out = stderr, unsigned int max_frames
// resolve addresses into strings containing "filename(function+address)",
// this array must be free()-ed
char * *symbollist = backtrace_symbols(addrlist, addrlen);
char * *symbollist = backtrace_symbols(addrlist.data(), addrlen);
// allocate string which will be filled with the demangled function name
size_t funcnamesize = 256;

View File

@@ -60,7 +60,11 @@ public:
"</p></font>"
"<br/><hr><br/>"
"<p align=center><font size=4>"
"qBittorrent version: " VERSION "<br/>"
#if defined(__x86_64__) || defined(_M_X64)
"qBittorrent version: " QBT_VERSION " (64-bit)<br/>"
#else
"qBittorrent version: " QBT_VERSION " (32-bit)<br/>"
#endif
"Libtorrent version: %1<br/>"
"Qt version: " QT_VERSION_STR "<br/>"
"Boost version: %2<br/>"

View File

@@ -1,4 +1,4 @@
find_package(ZLIB REQUIRED)
find_package(ZLIB 1.2.5.2 REQUIRED)
set(QBT_BASE_HEADERS
bittorrent/cachestatus.h
@@ -44,6 +44,7 @@ rss/rssmanager.h
utils/fs.h
utils/gzip.h
utils/misc.h
utils/random.h
utils/string.h
filesystemwatcher.h
iconprovider.h
@@ -103,6 +104,7 @@ rss/rssmanager.cpp
utils/fs.cpp
utils/gzip.cpp
utils/misc.cpp
utils/random.cpp
utils/string.cpp
filesystemwatcher.cpp
iconprovider.cpp

View File

@@ -52,6 +52,7 @@ HEADERS += \
$$PWD/utils/fs.h \
$$PWD/utils/gzip.h \
$$PWD/utils/misc.h \
$$PWD/utils/random.h \
$$PWD/utils/string.h \
$$PWD/unicodestrings.h \
$$PWD/torrentfileguard.h \
@@ -107,6 +108,7 @@ SOURCES += \
$$PWD/utils/fs.cpp \
$$PWD/utils/gzip.cpp \
$$PWD/utils/misc.cpp \
$$PWD/utils/random.cpp \
$$PWD/utils/string.cpp \
$$PWD/torrentfileguard.cpp \
$$PWD/torrentfilter.cpp \

View File

@@ -34,7 +34,6 @@
#include <QDateTime>
#include <QDebug>
#include <QDir>
#include <QDirIterator>
#include <QHostAddress>
#include <QNetworkAddressEntry>
#include <QNetworkInterface>
@@ -76,6 +75,7 @@
#include "base/unicodestrings.h"
#include "base/utils/misc.h"
#include "base/utils/fs.h"
#include "base/utils/random.h"
#include "base/utils/string.h"
#include "cachestatus.h"
#include "magneturi.h"
@@ -90,7 +90,7 @@
static const char PEER_ID[] = "qB";
static const char RESUME_FOLDER[] = "BT_backup";
static const char USER_AGENT[] = "qBittorrent " VERSION;
static const char USER_AGENT[] = "qBittorrent/" QBT_VERSION_2;
namespace libt = libtorrent;
using namespace BitTorrent;
@@ -154,16 +154,6 @@ namespace
return expanded;
}
QStringList findAllFiles(const QString &dirPath)
{
QStringList files;
QDirIterator it(dirPath, QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext())
files << it.next();
return files;
}
template <typename T>
struct LowerLimited
{
@@ -301,7 +291,7 @@ Session::Session(QObject *parent)
;
#if LIBTORRENT_VERSION_NUM < 10100
libt::fingerprint fingerprint(PEER_ID, VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, VERSION_BUILD);
libt::fingerprint fingerprint(PEER_ID, QBT_VERSION_MAJOR, QBT_VERSION_MINOR, QBT_VERSION_BUGFIX, QBT_VERSION_BUILD);
std::string peerId = fingerprint.to_string();
const ushort port = this->port();
std::pair<int, int> ports(port, port);
@@ -331,7 +321,7 @@ Session::Session(QObject *parent)
dispatchAlerts(alertPtr.release());
});
#else
std::string peerId = libt::generate_fingerprint(PEER_ID, VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, VERSION_BUILD);
std::string peerId = libt::generate_fingerprint(PEER_ID, QBT_VERSION_MAJOR, QBT_VERSION_MINOR, QBT_VERSION_BUGFIX, QBT_VERSION_BUILD);
libt::settings_pack pack;
pack.set_int(libt::settings_pack::alert_mask, alertMask);
pack.set_str(libt::settings_pack::peer_fingerprint, peerId);
@@ -424,7 +414,6 @@ Session::Session(QObject *parent)
Net::PortForwarder::initInstance(m_nativeSession);
qDebug("* BitTorrent Session constructed");
startUpTorrents();
}
bool Session::isDHTEnabled() const
@@ -857,9 +846,6 @@ void Session::adjustLimits()
void Session::configure()
{
qDebug("Configuring session");
if (!m_deferredConfigureScheduled) return; // Obtaining the lock is expensive, let's check early
QWriteLocker locker(&m_lock);
if (!m_deferredConfigureScheduled) return; // something might have changed while we were getting the lock
#if LIBTORRENT_VERSION_NUM < 10100
libt::session_settings sessionSettings = m_nativeSession->settings();
configure(sessionSettings);
@@ -1391,7 +1377,14 @@ bool Session::deleteTorrent(const QString &hash, bool deleteLocalFiles)
// Remove it from session
if (deleteLocalFiles) {
m_savePathsToRemove[torrent->hash()] = torrent->rootPath(true);
if (torrent->savePath(true) == torrentTempPath(torrent->hash())) {
m_savePathsToRemove[torrent->hash()] = torrent->savePath(true);
}
else {
QString rootPath = torrent->rootPath(true);
if (!rootPath.isEmpty())
m_savePathsToRemove[torrent->hash()] = rootPath;
}
m_nativeSession->remove_torrent(torrent->nativeHandle(), libt::session::delete_files);
}
else {
@@ -1710,35 +1703,19 @@ bool Session::findIncompleteFiles(TorrentInfo &torrentInfo, QString &savePath) c
{
auto findInDir = [](const QString &dirPath, TorrentInfo &torrentInfo) -> bool
{
const QDir dir(dirPath);
bool found = false;
if (torrentInfo.filesCount() == 1) {
const QString filePath = dirPath + torrentInfo.filePath(0);
if (QFile(filePath).exists()) {
for (int i = 0; i < torrentInfo.filesCount(); ++i) {
const QString filePath = torrentInfo.filePath(i);
if (dir.exists(filePath)) {
found = true;
}
else if (QFile(filePath + QB_EXT).exists()) {
else if (dir.exists(filePath + QB_EXT)) {
found = true;
torrentInfo.renameFile(0, torrentInfo.filePath(0) + QB_EXT);
}
}
else {
QSet<QString> allFiles;
int dirPathSize = dirPath.size();
foreach (const QString &file, findAllFiles(dirPath + torrentInfo.name()))
allFiles << file.mid(dirPathSize);
for (int i = 0; i < torrentInfo.filesCount(); ++i) {
QString filePath = torrentInfo.filePath(i);
if (allFiles.contains(filePath)) {
found = true;
}
else {
filePath += QB_EXT;
if (allFiles.contains(filePath)) {
found = true;
torrentInfo.renameFile(i, filePath);
}
}
torrentInfo.renameFile(i, filePath + QB_EXT);
}
if ((i % 100) == 0)
qApp->processEvents();
}
return found;
@@ -2210,7 +2187,7 @@ void Session::setSaveResumeDataInterval(uint value)
int Session::port() const
{
static int randomPort = rand() % 64512 + 1024;
static int randomPort = Utils::Random::rand(1024, 65535);
if (useRandomPort())
return randomPort;
return m_port;
@@ -2966,12 +2943,10 @@ void Session::initResumeFolder()
void Session::configureDeferred()
{
if (m_deferredConfigureScheduled) return; // Obtaining the lock is expensive, let's check early
QWriteLocker locker(&m_lock);
if (m_deferredConfigureScheduled) return; // something might have changed while we were getting the lock
QMetaObject::invokeMethod(this, "configure", Qt::QueuedConnection);
m_deferredConfigureScheduled = true;
if (!m_deferredConfigureScheduled) {
QMetaObject::invokeMethod(this, "configure", Qt::QueuedConnection);
m_deferredConfigureScheduled = true;
}
}
// Enable IP Filtering
@@ -3363,17 +3338,16 @@ void Session::handleTorrentRemovedAlert(libt::torrent_removed_alert *p)
void Session::handleTorrentDeletedAlert(libt::torrent_deleted_alert *p)
{
m_savePathsToRemove.remove(p->info_hash);
const QString path = m_savePathsToRemove.take(p->info_hash);
if (path == torrentTempPath(p->info_hash))
Utils::Fs::smartRemoveEmptyFolderTree(path);
}
void Session::handleTorrentDeleteFailedAlert(libt::torrent_delete_failed_alert *p)
{
// libtorrent won't delete the directory if it contains files not listed in the torrent,
// so we remove the directory ourselves
if (m_savePathsToRemove.contains(p->info_hash)) {
QString path = m_savePathsToRemove.take(p->info_hash);
Utils::Fs::smartRemoveEmptyFolderTree(path);
}
Utils::Fs::smartRemoveEmptyFolderTree(m_savePathsToRemove.take(p->info_hash));
}
void Session::handleMetadataReceivedAlert(libt::metadata_received_alert *p)

View File

@@ -41,7 +41,6 @@
#endif
#include <QNetworkConfigurationManager>
#include <QPointer>
#include <QReadWriteLock>
#include <QStringList>
#include <QVector>
#include <QWaitCondition>
@@ -327,6 +326,7 @@ namespace BitTorrent
bool isTrackerFilteringEnabled() const;
void setTrackerFilteringEnabled(bool enabled);
void startUpTorrents();
TorrentHandle *findTorrent(const InfoHash &hash) const;
QHash<InfoHash, TorrentHandle *> torrents() const;
TorrentStatusReport torrentStatusReport() const;
@@ -457,7 +457,6 @@ namespace BitTorrent
void enableIPFilter();
void disableIPFilter();
void startUpTorrents();
bool addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri,
TorrentInfo torrentInfo = TorrentInfo(),
const QByteArray &fastresumeData = QByteArray());
@@ -610,8 +609,6 @@ namespace BitTorrent
QNetworkConfigurationManager m_networkManager;
mutable QReadWriteLock m_lock;
static Session *m_instance;
};
}

View File

@@ -103,7 +103,7 @@ void TorrentCreatorThread::run()
{
emit updateProgress(0);
QString creator_str("qBittorrent " VERSION);
QString creator_str("qBittorrent " QBT_VERSION);
try {
libt::file_storage fs;
// Adding files to the torrent

View File

@@ -153,42 +153,6 @@ TorrentState::operator int() const
// TorrentHandle
#define SAFE_CALL(func, ...) \
try { \
m_nativeHandle.func(__VA_ARGS__); \
} \
catch (std::exception &exc) { \
qDebug() << Q_FUNC_INFO << " throws exception: " << exc.what(); \
}
#define SAFE_CALL_BOOL(func, ...) \
try { \
m_nativeHandle.func(__VA_ARGS__); \
return true; \
} \
catch (std::exception &exc) { \
qDebug() << Q_FUNC_INFO << " throws exception: " << exc.what(); \
return false; \
}
#define SAFE_RETURN(type, func, val) \
type result = val; \
try { \
result = m_nativeHandle.func(); \
} \
catch (std::exception &exc) { \
qDebug() << Q_FUNC_INFO << " throws exception: " << exc.what(); \
} \
return result;
#define SAFE_GET(var, func, ...) \
try { \
var = m_nativeHandle.func(__VA_ARGS__); \
} \
catch (std::exception &exc) { \
qDebug() << Q_FUNC_INFO << " throws exception: " << exc.what(); \
}
const qreal TorrentHandle::USE_GLOBAL_RATIO = -2.;
const qreal TorrentHandle::NO_RATIO_LIMIT = -1.;
@@ -378,8 +342,8 @@ QList<TrackerEntry> TorrentHandle::trackers() const
{
QList<TrackerEntry> entries;
std::vector<libt::announce_entry> announces;
SAFE_GET(announces, trackers);
announces = m_nativeHandle.trackers();
foreach (const libt::announce_entry &tracker, announces)
entries << tracker;
@@ -417,21 +381,15 @@ void TorrentHandle::replaceTrackers(QList<TrackerEntry> trackers)
existingTrackers.removeOne(tracker);
}
try {
m_nativeHandle.replace_trackers(announces);
if (addedTrackers.isEmpty() && existingTrackers.isEmpty()) {
m_session->handleTorrentTrackersChanged(this);
}
else {
if (!existingTrackers.isEmpty())
m_session->handleTorrentTrackersRemoved(this, existingTrackers);
if (!addedTrackers.isEmpty())
m_session->handleTorrentTrackersAdded(this, addedTrackers);
}
m_nativeHandle.replace_trackers(announces);
if (addedTrackers.isEmpty() && existingTrackers.isEmpty()) {
m_session->handleTorrentTrackersChanged(this);
}
catch (std::exception &exc) {
qDebug("torrent_handle::replace_trackers() throws exception: %s", exc.what());
else {
if (!existingTrackers.isEmpty())
m_session->handleTorrentTrackersRemoved(this, existingTrackers);
if (!addedTrackers.isEmpty())
m_session->handleTorrentTrackersAdded(this, addedTrackers);
}
}
@@ -440,14 +398,14 @@ bool TorrentHandle::addTracker(const TrackerEntry &tracker)
if (trackers().contains(tracker))
return false;
SAFE_CALL_BOOL(add_tracker, tracker.nativeEntry());
m_nativeHandle.add_tracker(tracker.nativeEntry());
return true;
}
QList<QUrl> TorrentHandle::urlSeeds() const
{
QList<QUrl> urlSeeds;
std::set<std::string> seeds;
SAFE_GET(seeds, url_seeds);
std::set<std::string> seeds = m_nativeHandle.url_seeds();
foreach (const std::string &urlSeed, seeds)
urlSeeds.append(QUrl(urlSeed.c_str()));
@@ -484,7 +442,8 @@ bool TorrentHandle::addUrlSeed(const QUrl &urlSeed)
QList<QUrl> seeds = urlSeeds();
if (seeds.contains(urlSeed)) return false;
SAFE_CALL_BOOL(add_url_seed, Utils::String::toStdString(urlSeed.toString()));
m_nativeHandle.add_url_seed(Utils::String::toStdString(urlSeed.toString()));
return true;
}
bool TorrentHandle::removeUrlSeed(const QUrl &urlSeed)
@@ -492,7 +451,8 @@ bool TorrentHandle::removeUrlSeed(const QUrl &urlSeed)
QList<QUrl> seeds = urlSeeds();
if (!seeds.contains(urlSeed)) return false;
SAFE_CALL_BOOL(remove_url_seed, Utils::String::toStdString(urlSeed.toString()));
m_nativeHandle.remove_url_seed(Utils::String::toStdString(urlSeed.toString()));
return true;
}
bool TorrentHandle::connectPeer(const PeerAddress &peerAddress)
@@ -502,14 +462,15 @@ bool TorrentHandle::connectPeer(const PeerAddress &peerAddress)
if (ec) return false;
boost::asio::ip::tcp::endpoint ep(addr, peerAddress.port);
SAFE_CALL_BOOL(connect_peer, ep);
m_nativeHandle.connect_peer(ep);
return true;
}
bool TorrentHandle::needSaveResumeData() const
{
if (m_needSaveResumeData) return true;
SAFE_RETURN(bool, need_save_resume_data, false);
return m_nativeHandle.need_save_resume_data();
}
void TorrentHandle::saveResumeData(bool updateStatus)
@@ -517,7 +478,7 @@ void TorrentHandle::saveResumeData(bool updateStatus)
if (updateStatus) // to update queue_position, see discussion in PR #6154
this->updateStatus();
SAFE_CALL(save_resume_data);
m_nativeHandle.save_resume_data();
m_needSaveResumeData = false;
}
@@ -613,7 +574,7 @@ QStringList TorrentHandle::absoluteFilePathsUnwanted() const
QDir saveDir(savePath(true));
QStringList res;
std::vector<int> fp;
SAFE_GET(fp, file_priorities);
fp = m_nativeHandle.file_priorities();
int count = static_cast<int>(fp.size());
for (int i = 0; i < count; ++i) {
@@ -630,7 +591,7 @@ QStringList TorrentHandle::absoluteFilePathsUnwanted() const
QVector<int> TorrentHandle::filePriorities() const
{
std::vector<int> fp;
SAFE_GET(fp, file_priorities);
fp = m_nativeHandle.file_priorities();
return QVector<int>::fromStdVector(fp);
}
@@ -718,7 +679,9 @@ bool TorrentHandle::isErrored() const
bool TorrentHandle::isSeed() const
{
// Affected by bug http://code.rasterbar.com/libtorrent/ticket/402
//SAFE_RETURN(bool, is_seed, false);
//bool result;
//result = m_nativeHandle.is_seed());
//return result;
// May suffer from approximation problems
//return (progress() == 1.);
// This looks safe
@@ -742,7 +705,7 @@ bool TorrentHandle::hasFirstLastPiecePriority() const
// Get int first media file
std::vector<int> fp;
SAFE_GET(fp, file_priorities);
fp = m_nativeHandle.file_priorities();
TorrentInfo::PieceRange extremities;
bool found = false;
@@ -758,10 +721,8 @@ bool TorrentHandle::hasFirstLastPiecePriority() const
if (!found) return false; // No media file
int first = 0;
int last = 0;
SAFE_GET(first, piece_priority, extremities.first());
SAFE_GET(last, piece_priority, extremities.last());
int first = m_nativeHandle.piece_priority(extremities.first());
int last = m_nativeHandle.piece_priority(extremities.last());
return ((first == 7) && (last == 7));
}
@@ -840,8 +801,7 @@ bool TorrentHandle::hasError() const
bool TorrentHandle::hasFilteredPieces() const
{
std::vector<int> pp;
SAFE_GET(pp, piece_priorities);
std::vector<int> pp = m_nativeHandle.piece_priorities();
foreach (const int priority, pp)
if (priority == 0) return true;
@@ -914,7 +874,7 @@ QVector<qreal> TorrentHandle::filesProgress() const
{
std::vector<boost::int64_t> fp;
QVector<qreal> result;
SAFE_CALL(file_progress, fp, libt::torrent_handle::piece_granularity);
m_nativeHandle.file_progress(fp, libt::torrent_handle::piece_granularity);
int count = static_cast<int>(fp.size());
for (int i = 0; i < count; ++i) {
@@ -1007,12 +967,12 @@ int TorrentHandle::timeSinceActivity() const
int TorrentHandle::downloadLimit() const
{
SAFE_RETURN(int, download_limit, -1)
return m_nativeHandle.download_limit();
}
int TorrentHandle::uploadLimit() const
{
SAFE_RETURN(int, upload_limit, -1)
return m_nativeHandle.upload_limit();
}
bool TorrentHandle::superSeeding() const
@@ -1025,7 +985,7 @@ QList<PeerInfo> TorrentHandle::peers() const
QList<PeerInfo> peers;
std::vector<libt::peer_info> nativePeers;
SAFE_CALL(get_peer_info, nativePeers);
m_nativeHandle.get_peer_info(nativePeers);
foreach (const libt::peer_info &peer, nativePeers)
peers << PeerInfo(this, peer);
@@ -1048,7 +1008,7 @@ QBitArray TorrentHandle::downloadingPieces() const
QBitArray result(piecesCount());
std::vector<libt::partial_piece_info> queue;
SAFE_CALL(get_download_queue, queue);
m_nativeHandle.get_download_queue(queue);
std::vector<libt::partial_piece_info>::const_iterator it = queue.begin();
std::vector<libt::partial_piece_info>::const_iterator itend = queue.end();
@@ -1061,7 +1021,7 @@ QBitArray TorrentHandle::downloadingPieces() const
QVector<int> TorrentHandle::pieceAvailability() const
{
std::vector<int> avail;
SAFE_CALL(piece_availability, avail);
m_nativeHandle.piece_availability(avail);
return QVector<int>::fromStdVector(avail);
}
@@ -1206,12 +1166,12 @@ void TorrentHandle::move_impl(QString path)
void TorrentHandle::forceReannounce(int index)
{
SAFE_CALL(force_reannounce, 0, index);
m_nativeHandle.force_reannounce(0, index);
}
void TorrentHandle::forceDHTAnnounce()
{
SAFE_CALL(force_dht_announce);
m_nativeHandle.force_dht_announce();
}
void TorrentHandle::forceRecheck()
@@ -1223,13 +1183,13 @@ void TorrentHandle::forceRecheck()
resume();
}
SAFE_CALL(force_recheck);
m_nativeHandle.force_recheck();
}
void TorrentHandle::setSequentialDownload(bool b)
{
if (b != isSequentialDownload()) {
SAFE_CALL(set_sequential_download, b);
m_nativeHandle.set_sequential_download(b);
m_nativeStatus.sequential_download = b; // prevent return cached value
}
}
@@ -1243,10 +1203,8 @@ void TorrentHandle::setFirstLastPiecePriority(bool b)
{
if (!hasMetadata()) return;
std::vector<int> fp;
SAFE_GET(fp, file_priorities);
std::vector<int> pp;
SAFE_GET(pp, piece_priorities);
std::vector<int> fp = m_nativeHandle.file_priorities();
std::vector<int> pp = m_nativeHandle.piece_priorities();
// Download first and last pieces first for all media files in the torrent
int nbfiles = static_cast<int>(fp.size());
@@ -1270,7 +1228,7 @@ void TorrentHandle::setFirstLastPiecePriority(bool b)
}
}
SAFE_CALL(prioritize_pieces, pp);
m_nativeHandle.prioritize_pieces(pp);
}
void TorrentHandle::toggleFirstLastPiecePriority()
@@ -1282,28 +1240,18 @@ void TorrentHandle::pause()
{
if (isPaused()) return;
try {
m_nativeHandle.auto_managed(false);
m_nativeHandle.pause();
}
catch (std::exception &exc) {
qDebug() << Q_FUNC_INFO << " throws exception: " << exc.what();
}
m_nativeHandle.auto_managed(false);
m_nativeHandle.pause();
}
void TorrentHandle::resume(bool forced)
{
try {
if (hasError())
m_nativeHandle.clear_error();
m_hasMissingFiles = false;
m_nativeHandle.set_upload_mode(false);
m_nativeHandle.auto_managed(!forced);
m_nativeHandle.resume();
}
catch (std::exception &exc) {
qDebug() << Q_FUNC_INFO << " throws exception: " << exc.what();
}
if (hasError())
m_nativeHandle.clear_error();
m_hasMissingFiles = false;
m_nativeHandle.set_upload_mode(false);
m_nativeHandle.auto_managed(!forced);
m_nativeHandle.resume();
}
void TorrentHandle::moveStorage(const QString &newPath)
@@ -1317,28 +1265,24 @@ void TorrentHandle::moveStorage(const QString &newPath)
if (QDir(oldPath) == QDir(newPath)) return;
qDebug("move storage: %s to %s", qPrintable(oldPath), qPrintable(newPath));
try {
// Actually move the storage
m_nativeHandle.move_storage(newPath.toUtf8().constData());
m_oldPath = oldPath;
m_newPath = newPath;
}
catch (std::exception &exc) {
qDebug("torrent_handle::move_storage() throws exception: %s", exc.what());
}
// Actually move the storage
m_nativeHandle.move_storage(newPath.toUtf8().constData());
m_oldPath = oldPath;
m_newPath = newPath;
}
}
void TorrentHandle::setTrackerLogin(const QString &username, const QString &password)
{
SAFE_CALL(set_tracker_login, std::string(username.toLocal8Bit().constData()), std::string(password.toLocal8Bit().constData()));
m_nativeHandle.set_tracker_login(std::string(username.toLocal8Bit().constData())
, std::string(password.toLocal8Bit().constData()));
}
void TorrentHandle::renameFile(int index, const QString &name)
{
++m_renameCount;
qDebug() << Q_FUNC_INFO << index << name;
SAFE_CALL(rename_file, index, Utils::String::toStdString(Utils::Fs::toNativePath(name)));
m_nativeHandle.rename_file(index, Utils::String::toStdString(Utils::Fs::toNativePath(name)));
}
bool TorrentHandle::saveTorrentFile(const QString &path)
@@ -1359,8 +1303,7 @@ bool TorrentHandle::saveTorrentFile(const QString &path)
void TorrentHandle::setFilePriority(int index, int priority)
{
std::vector<int> priorities;
SAFE_GET(priorities, file_priorities);
std::vector<int> priorities = m_nativeHandle.file_priorities();
if ((priorities.size() > static_cast<quint64>(index)) && (priorities[index] != priority)) {
priorities[index] = priority;
@@ -1387,6 +1330,10 @@ void TorrentHandle::handleStorageMovedAlert(libtorrent::storage_moved_alert *p)
}
qDebug("Torrent is successfully moved from %s to %s", qPrintable(m_oldPath), qPrintable(m_newPath));
if (m_oldPath == m_session->torrentTempPath(hash())) {
qDebug() << "Removing torrent temp folder:" << m_oldPath;
Utils::Fs::smartRemoveEmptyFolderTree(m_oldPath);
}
updateStatus();
m_newPath.clear();
@@ -1805,10 +1752,7 @@ bool TorrentHandle::useTempPath() const
void TorrentHandle::updateStatus()
{
libt::torrent_status status;
SAFE_GET(status, status);
updateStatus(status);
updateStatus(m_nativeHandle.status());
}
void TorrentHandle::updateStatus(const libtorrent::torrent_status &nativeStatus)
@@ -1835,24 +1779,24 @@ void TorrentHandle::setRatioLimit(qreal limit)
void TorrentHandle::setUploadLimit(int limit)
{
SAFE_CALL(set_upload_limit, limit)
m_nativeHandle.set_upload_limit(limit);
}
void TorrentHandle::setDownloadLimit(int limit)
{
SAFE_CALL(set_download_limit, limit)
m_nativeHandle.set_download_limit(limit);
}
void TorrentHandle::setSuperSeeding(bool enable)
{
SAFE_CALL(super_seeding, enable)
m_nativeHandle.super_seeding(enable);
if (superSeeding() != enable)
updateStatus();
}
void TorrentHandle::flushCache()
{
SAFE_CALL(flush_cache)
m_nativeHandle.flush_cache();
}
QString TorrentHandle::toMagnetUri() const
@@ -1880,7 +1824,7 @@ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities)
}
qDebug() << Q_FUNC_INFO << "Changing files priorities...";
SAFE_CALL(prioritize_files, priorities.toStdVector());
m_nativeHandle.prioritize_files(priorities.toStdVector());
qDebug() << Q_FUNC_INFO << "Moving unwanted files to .unwanted folder and conversely...";
QString spath = savePath(true);

View File

@@ -246,6 +246,21 @@ QVector<int> TorrentInfo::fileIndicesForPiece(int pieceIndex) const
return res;
}
QVector<QByteArray> TorrentInfo::pieceHashes() const
{
if (!isValid())
return {};
const int count = piecesCount();
QVector<QByteArray> hashes;
hashes.reserve(count);
for (int i = 0; i < count; ++i)
hashes += { m_nativeInfo->hash_for_piece_ptr(i), libtorrent::sha1_hash::size };
return hashes;
}
TorrentInfo::PieceRange TorrentInfo::filePieces(const QString& file) const
{
if (!isValid()) // if we do not check here the debug message will be printed, which would be not correct

View File

@@ -91,6 +91,7 @@ namespace BitTorrent
QByteArray metadata() const;
QStringList filesForPiece(int pieceIndex) const;
QVector<int> fileIndicesForPiece(int pieceIndex) const;
QVector<QByteArray> pieceHashes() const;
using PieceRange = IndexRange<int>;
// returns pair of the first and the last pieces into which

View File

@@ -29,14 +29,17 @@
* Contact : chris@qbittorrent.org
*/
#include <QTcpSocket>
#include <QDebug>
#include "connection.h"
#include <QRegExp>
#include "types.h"
#ifndef QBT_USES_QT5
#include <QStringList>
#endif
#include <QTcpSocket>
#include "irequesthandler.h"
#include "requestparser.h"
#include "responsegenerator.h"
#include "irequesthandler.h"
#include "connection.h"
using namespace Http;
@@ -46,27 +49,33 @@ Connection::Connection(QTcpSocket *socket, IRequestHandler *requestHandler, QObj
, m_requestHandler(requestHandler)
{
m_socket->setParent(this);
m_idleTimer.start();
connect(m_socket, SIGNAL(readyRead()), SLOT(read()));
connect(m_socket, SIGNAL(disconnected()), SLOT(deleteLater()));
}
Connection::~Connection()
{
m_socket->close();
}
void Connection::read()
{
m_receivedData.append(m_socket->readAll());
m_idleTimer.restart();
m_receivedData.append(m_socket->readAll());
Request request;
RequestParser::ErrorCode err = RequestParser::parse(m_receivedData, request);
RequestParser::ErrorCode err = RequestParser::parse(m_receivedData, request); // TODO: transform request headers to lowercase
switch (err) {
case RequestParser::IncompleteRequest:
// Partial request waiting for the rest
break;
case RequestParser::BadRequest:
sendResponse(Response(400, "Bad Request"));
m_receivedData.clear();
break;
case RequestParser::NoError:
Environment env;
env.clientAddress = m_socket->peerAddress();
@@ -74,25 +83,69 @@ void Connection::read()
if (acceptsGzipEncoding(request.headers["accept-encoding"]))
response.headers[HEADER_CONTENT_ENCODING] = "gzip";
sendResponse(response);
m_receivedData.clear();
break;
}
}
void Connection::sendResponse(const Response &response)
{
m_socket->write(ResponseGenerator::generate(response));
m_socket->disconnectFromHost();
m_socket->write(toByteArray(response));
m_socket->close(); // TODO: remove when HTTP pipelining is supported
}
bool Connection::acceptsGzipEncoding(const QString &encoding)
bool Connection::hasExpired(const qint64 timeout) const
{
QRegExp rx("(gzip)(;q=([^,]+))?");
if (rx.indexIn(encoding) >= 0) {
if (rx.cap(2).size() > 0)
// check if quality factor > 0
return (rx.cap(3).toDouble() > 0);
// if quality factor is not specified, then it's 1
return m_idleTimer.hasExpired(timeout);
}
bool Connection::isClosed() const
{
return (m_socket->state() == QAbstractSocket::UnconnectedState);
}
bool Connection::acceptsGzipEncoding(QString codings)
{
// [rfc7231] 5.3.4. Accept-Encoding
const auto isCodingAvailable = [](const QStringList &list, const QString &encoding) -> bool
{
for (const QString &str: list) {
if (!str.startsWith(encoding))
continue;
// without quality values
if (str == encoding)
return true;
// [rfc7231] 5.3.1. Quality Values
#ifdef QBT_USES_QT5
const QStringRef substr = str.midRef(encoding.size() + 3); // ex. skip over "gzip;q="
#else
const QString substr = str.mid(encoding.size() + 3); // ex. skip over "gzip;q="
#endif
bool ok = false;
const double qvalue = substr.toDouble(&ok);
if (!ok || (qvalue <= 0.0))
return false;
return true;
}
return false;
};
const QStringList list = codings.remove(' ').remove('\t').split(',', QString::SkipEmptyParts);
if (list.isEmpty())
return false;
const bool canGzip = isCodingAvailable(list, QLatin1String("gzip"));
if (canGzip)
return true;
}
const bool canAny = isCodingAvailable(list, QLatin1String("*"));
if (canAny)
return true;
return false;
}

View File

@@ -33,12 +33,12 @@
#ifndef HTTP_CONNECTION_H
#define HTTP_CONNECTION_H
#include <QElapsedTimer>
#include <QObject>
#include "types.h"
QT_BEGIN_NAMESPACE
class QTcpSocket;
QT_END_NAMESPACE
namespace Http
{
@@ -53,16 +53,20 @@ namespace Http
Connection(QTcpSocket *socket, IRequestHandler *requestHandler, QObject *parent = 0);
~Connection();
bool hasExpired(qint64 timeout) const;
bool isClosed() const;
private slots:
void read();
private:
static bool acceptsGzipEncoding(const QString &encoding);
static bool acceptsGzipEncoding(QString codings);
void sendResponse(const Response &response);
QTcpSocket *m_socket;
IRequestHandler *m_requestHandler;
QByteArray m_receivedData;
QElapsedTimer m_idleTimer;
};
}

View File

@@ -198,14 +198,14 @@ QList<QByteArray> RequestParser::splitMultipartData(const QByteArray& data, cons
start = end + sepLength; // skip first boundary
while ((end = data.indexOf(sep, start)) >= 0) {
ret << data.mid(start, end - start);
ret << data.mid(start, end - EOL.length() - start);
start = end + sepLength;
}
// last or single part
sep = boundary + "--" + EOL;
if ((end = data.indexOf(sep, start)) >= 0)
ret << data.mid(start, end - start);
ret << data.mid(start, end - EOL.length() - start);
}
return ret;

View File

@@ -29,39 +29,82 @@
* Contact : chris@qbittorrent.org
*/
#include "base/utils/gzip.h"
#include "responsegenerator.h"
using namespace Http;
#include <QDateTime>
#ifndef QBT_USES_QT5
#include <QLocale>
#endif
QByteArray ResponseGenerator::generate(Response response)
#include "base/utils/gzip.h"
QByteArray Http::toByteArray(Response response)
{
if (response.headers[HEADER_CONTENT_ENCODING] == "gzip") {
// A gzip seems to have 23 bytes overhead.
// Also "Content-Encoding: gzip\r\n" is 26 bytes long
// So we only benefit from gzip if the message is bigger than 23+26 = 49
// If the message is smaller than 49 bytes we actually send MORE data if we gzip
QByteArray dest_buf;
if ((response.content.size() > 49) && (Utils::Gzip::compress(response.content, dest_buf)))
response.content = dest_buf;
else
response.headers.remove(HEADER_CONTENT_ENCODING);
}
compressContent(response);
if (response.content.length() > 0)
response.headers[HEADER_CONTENT_LENGTH] = QString::number(response.content.length());
response.headers[HEADER_CONTENT_LENGTH] = QString::number(response.content.length());
response.headers[HEADER_DATE] = httpDate();
QString ret(QLatin1String("HTTP/1.1 %1 %2\r\n%3\r\n"));
QByteArray buf;
buf.reserve(10 * 1024);
QString header;
foreach (const QString& key, response.headers.keys())
header += QString("%1: %2\r\n").arg(key).arg(response.headers[key]);
// Status Line
buf += QString("HTTP/%1 %2 %3")
.arg("1.1", // TODO: depends on request
QString::number(response.status.code),
response.status.text)
.toLatin1()
.append(CRLF);
ret = ret.arg(response.status.code).arg(response.status.text).arg(header);
// Header Fields
for (auto i = response.headers.constBegin(); i != response.headers.constEnd(); ++i)
buf += QString("%1: %2").arg(i.key(), i.value()).toLatin1().append(CRLF);
// qDebug() << Q_FUNC_INFO;
// qDebug() << "HTTP Response header:";
// qDebug() << ret;
// the first empty line
buf += CRLF;
return ret.toUtf8() + response.content;
// message body // TODO: support HEAD request
buf += response.content;
return buf;
}
QString Http::httpDate()
{
// [RFC 7231] 7.1.1.1. Date/Time Formats
// example: "Sun, 06 Nov 1994 08:49:37 GMT"
return QLocale::c().toString(QDateTime::currentDateTimeUtc(), QLatin1String("ddd, dd MMM yyyy HH:mm:ss"))
.append(QLatin1String(" GMT"));
}
void Http::compressContent(Response &response)
{
if (response.headers.value(HEADER_CONTENT_ENCODING) != QLatin1String("gzip"))
return;
response.headers.remove(HEADER_CONTENT_ENCODING);
// for very small files, compressing them only wastes cpu cycles
const int contentSize = response.content.size();
if (contentSize <= 1024) // 1 kb
return;
// filter out known hard-to-compress types
const QString contentType = response.headers[HEADER_CONTENT_TYPE];
if ((contentType == CONTENT_TYPE_GIF) || (contentType == CONTENT_TYPE_PNG))
return;
// try compressing
bool ok = false;
const QByteArray compressedData = Utils::Gzip::compress(response.content, 6, &ok);
if (!ok)
return;
// "Content-Encoding: gzip\r\n" is 24 bytes long
if ((compressedData.size() + 24) >= contentSize)
return;
response.content = compressedData;
response.headers[HEADER_CONTENT_ENCODING] = QLatin1String("gzip");
}

View File

@@ -37,11 +37,9 @@
namespace Http
{
class ResponseGenerator
{
public:
static QByteArray generate(Response response);
};
QByteArray toByteArray(Response response);
QString httpDate();
void compressContent(Response &response);
}
#endif // HTTP_RESPONSEGENERATOR_H

View File

@@ -28,14 +28,24 @@
* exception statement from your version.
*/
#include "server.h"
#include <QMutableListIterator>
#include <QNetworkProxy>
#include <QStringList>
#include <QTimer>
#ifndef QT_NO_OPENSSL
#include <QSslSocket>
#else
#include <QTcpSocket>
#endif
#include <QNetworkProxy>
#include "connection.h"
#include "server.h"
static const int KEEP_ALIVE_DURATION = 7; // seconds
static const int CONNECTIONS_LIMIT = 500;
static const int CONNECTIONS_SCAN_INTERVAL = 2; // seconds
using namespace Http;
@@ -50,34 +60,24 @@ Server::Server(IRequestHandler *requestHandler, QObject *parent)
#ifndef QT_NO_OPENSSL
QSslSocket::setDefaultCiphers(safeCipherList());
#endif
QTimer *dropConnectionTimer = new QTimer(this);
connect(dropConnectionTimer, SIGNAL(timeout()), SLOT(dropTimedOutConnection()));
dropConnectionTimer->start(CONNECTIONS_SCAN_INTERVAL * 1000);
}
Server::~Server()
{
}
#ifndef QT_NO_OPENSSL
void Server::enableHttps(const QList<QSslCertificate> &certificates, const QSslKey &key)
{
m_certificates = certificates;
m_key = key;
m_https = true;
}
void Server::disableHttps()
{
m_https = false;
m_certificates.clear();
m_key.clear();
}
#endif
#ifdef QBT_USES_QT5
void Server::incomingConnection(qintptr socketDescriptor)
#else
void Server::incomingConnection(int socketDescriptor)
#endif
{
if (m_connections.size() >= CONNECTIONS_LIMIT) return;
QTcpSocket *serverSocket;
#ifndef QT_NO_OPENSSL
if (m_https)
@@ -86,28 +86,79 @@ void Server::incomingConnection(int socketDescriptor)
#endif
serverSocket = new QTcpSocket(this);
if (serverSocket->setSocketDescriptor(socketDescriptor)) {
#ifndef QT_NO_OPENSSL
if (m_https) {
static_cast<QSslSocket *>(serverSocket)->setProtocol(QSsl::SecureProtocols);
static_cast<QSslSocket *>(serverSocket)->setPrivateKey(m_key);
#ifdef QBT_USES_QT5
static_cast<QSslSocket *>(serverSocket)->setLocalCertificateChain(m_certificates);
#else
static_cast<QSslSocket *>(serverSocket)->setLocalCertificate(m_certificates.first());
#endif
static_cast<QSslSocket *>(serverSocket)->setPeerVerifyMode(QSslSocket::VerifyNone);
static_cast<QSslSocket *>(serverSocket)->startServerEncryption();
}
#endif
new Connection(serverSocket, m_requestHandler, this);
if (!serverSocket->setSocketDescriptor(socketDescriptor)) {
delete serverSocket;
return;
}
else {
serverSocket->deleteLater();
#ifndef QT_NO_OPENSSL
if (m_https) {
static_cast<QSslSocket *>(serverSocket)->setProtocol(QSsl::SecureProtocols);
static_cast<QSslSocket *>(serverSocket)->setPrivateKey(m_key);
#ifdef QBT_USES_QT5
static_cast<QSslSocket *>(serverSocket)->setLocalCertificateChain(m_certificates);
#else
static_cast<QSslSocket *>(serverSocket)->setLocalCertificate(m_certificates.first());
#endif
static_cast<QSslSocket *>(serverSocket)->setPeerVerifyMode(QSslSocket::VerifyNone);
static_cast<QSslSocket *>(serverSocket)->startServerEncryption();
}
#endif
Connection *c = new Connection(serverSocket, m_requestHandler, this);
m_connections.append(c);
}
void Server::dropTimedOutConnection()
{
QMutableListIterator<Connection *> i(m_connections);
while (i.hasNext()) {
auto connection = i.next();
if (connection->isClosed() || connection->hasExpired(KEEP_ALIVE_DURATION)) {
delete connection;
i.remove();
}
}
}
#ifndef QT_NO_OPENSSL
bool Server::setupHttps(const QByteArray &certificates, const QByteArray &key)
{
QSslKey sslKey(key, QSsl::Rsa);
if (sslKey.isNull())
#ifdef QBT_USES_QT5
sslKey = QSslKey(key, QSsl::Ec);
#else
{
disableHttps();
return false;
}
#endif
const QList<QSslCertificate> certs = QSslCertificate::fromData(certificates);
const bool areCertsValid = !certs.empty() && std::all_of(certs.begin(), certs.end(), [](const QSslCertificate &c) { return !c.isNull(); });
if (!sslKey.isNull() && areCertsValid)
{
m_key = sslKey;
m_certificates = certs;
m_https = true;
return true;
}
else
{
disableHttps();
return false;
}
}
void Server::disableHttps()
{
m_https = false;
m_certificates.clear();
m_key.clear();
}
QList<QSslCipher> Server::safeCipherList() const
{
const QStringList badCiphers = {"idea", "rc4"};

View File

@@ -34,6 +34,7 @@
#define HTTP_SERVER_H
#include <QTcpServer>
#ifndef QT_NO_OPENSSL
#include <QSslCertificate>
#include <QSslCipher>
@@ -55,19 +56,23 @@ namespace Http
~Server();
#ifndef QT_NO_OPENSSL
void enableHttps(const QList<QSslCertificate> &certificates, const QSslKey &key);
bool setupHttps(const QByteArray &certificates, const QByteArray &key);
void disableHttps();
#endif
private:
IRequestHandler *m_requestHandler;
private slots:
void dropTimedOutConnection();
private:
#ifdef QBT_USES_QT5
void incomingConnection(qintptr socketDescriptor);
#else
void incomingConnection(int socketDescriptor);
#endif
IRequestHandler *m_requestHandler;
QList<Connection *> m_connections; // for tracking persistence connections
#ifndef QT_NO_OPENSSL
QList<QSslCipher> safeCipherList() const;

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