1
mirror of https://github.com/qbittorrent/qBittorrent synced 2025-10-09 18:32:15 +02:00

Compare commits

...

186 Commits

Author SHA1 Message Date
sledgehammer999
d1ebbcb35d Bump to 4.1.2 2018-08-12 21:16:29 +03:00
sledgehammer999
2743d998a8 Update Changelog 2018-08-12 21:13:12 +03:00
sledgehammer999
dbbfbaff9f Bump Web API version 2018-08-12 21:10:28 +03:00
sledgehammer999
0be8439cf6 Sync translations from Transifex and run lupdate 2018-08-12 21:10:28 +03:00
Chocobo1
66982c5524 Fix lupdate errors
I suspect lupdate isn't smart enough to figure out what tr() is suppose
to do, so just make it a static function in class.
The error was: tr() cannot be called without context
2018-08-12 20:59:52 +03:00
Chocobo1
85af8547f7 Generate i18n .ts files in the correct directory
Fixup 5b7c089dd2.
Closes #9313.
2018-08-12 20:59:52 +03:00
thalieht
e26977ab2c Add hotkey for toggling focus between the search LineEdits 2018-08-12 16:50:13 +03:00
thalieht
ec1cc783a6 Limit the scope of find torrents hotkey in MainWindow
To TransferListWidget because it will interfere with the SearchWidget's focus hotkey
2018-08-12 16:50:13 +03:00
thalieht
03b00ec045 Add a name filter for search results
Closes #8226
2018-08-12 16:50:13 +03:00
Lukas Greib
5e90156e9e Inhibit sleep regardless of activity
"Active torrents" is a somewhat unintuitive concept as a basis for
preventing sleep, as torrents can become active or inactive on the
network at any time. This brings some predictability to the inhibit
sleep option, and will inhibit sleep as long as there are unpaused
downloads or uploads, regardless of network activity.

Closes #1696, #4592, #4655, #7019, #7159, #7452
2018-08-12 16:50:13 +03:00
thalieht
052206efa1 Add option for regexps in the transferlist search filter's context menu 2018-08-12 16:50:13 +03:00
sledgehammer999
305d73180b Update Changelog 2018-08-12 11:51:43 +03:00
Couchy
80000bf0fd Avoid allocating large memory when loading a .torrent file
`QIODevice::read(qint64 maxSize)` will allocate full `maxSize` of memory no matter
what the real file size was, this caused users to experience out-of-memory
exception on 32-bit qbt.
Also handle the OOM execption if it still fails.

Closes #9064, #9075, #9130, #9239, #9246, #9279.
2018-08-12 11:08:06 +03:00
sledgehammer999
06ebe756e8 Notify users on 1st time close/minimize to tray 2018-08-12 11:08:06 +03:00
sledgehammer999
5fa3d9f19c Revert "Set "close to tray" to false as default"
This reverts commit dc9ec0e408.
2018-08-12 11:08:06 +03:00
Chocobo1
5b4c6d3665 Fix I/O error after fetching magnet metadata
It is caused by an extra path seperator, so removing it fixes it.
Fixup 9612a75faa.
2018-08-12 11:08:06 +03:00
sledgehammer999
77bd0f17d1 Update AppVeyor config 2018-08-12 11:08:06 +03:00
Vladimir Golovnev (Glassez)
03a702cfbd Never save resume data for already paused torrents 2018-08-12 11:08:06 +03:00
Vladimir Golovnev (Glassez)
a932cd2ec1 Reorder resume data saving conditionals
Having conditionals which can break saving of torrent resume data
in order from more likely to less likely is more effective.
2018-08-12 11:08:06 +03:00
Chocobo1
8e5743380a Make ProgramUpdater upgrade to 64-bit qbt when running on 64-bit Windows 2018-08-12 11:08:06 +03:00
Chocobo1
8001eb0368 Avoid regenerating .qm files unnecessarily
Translations included at top level is to avoid regenerating the .qm files every
time when src.pro is processed.
Partially revert 5b7c089dd2.
2018-08-12 11:08:06 +03:00
Chocobo1
f214dc88fc Put temporary files in qbt own temp folder 2018-08-12 11:08:06 +03:00
Chocobo1
5cff5ab135 Refactor GuiIconProvider::generateDifferentSizes() 2018-08-12 11:08:06 +03:00
Chocobo1
82ba154b64 Add const to function signature 2018-08-12 11:08:06 +03:00
thalieht
4ea44bbd2b Set "close to tray" to false as default 2018-08-12 11:08:06 +03:00
Chocobo1
a5e68a8725 Avoid potentially setting the wrong piece priorities
Updating file priorities is an async operation in libtorrent, when we
just updated it and immediately query it, we might get the
old/wrong values, so we rely on `updatedFilePrio` in this case.
2018-08-12 11:08:06 +03:00
Chocobo1
70291014d1 Refactor code
Make the code slightly easier to read.
2018-08-12 11:08:06 +03:00
Chocobo1
1aabcfc30c Add const to function parameters 2018-08-12 11:08:06 +03:00
Thomas Piccirello
aba80e2b1c Send all rechecks in one request 2018-08-12 11:08:06 +03:00
Thomas Piccirello
be683fbcd3 Add WebUI Force Reannounce option 2018-08-12 11:08:06 +03:00
Chocobo1
2bcf09cfa5 Remove static keyword overuse 2018-08-12 11:08:06 +03:00
Chocobo1
697325af63 Move member variable initialization
Move the initialization from constructor body to member initializer
list.
Remove superfluous initializer.
2018-08-12 11:08:06 +03:00
Chocobo1
c21bd77be5 Remove unnecessary dynamic allocation
Also remove unneeded `if ()` conditional.
2018-08-12 11:08:06 +03:00
Chocobo1
d5430adaaa Avoid binding constant reference to returned object
In such cases, it makes no sense doing so.
2018-08-12 11:08:06 +03:00
Chocobo1
9e99a0d3f5 Replace single-character string with character literal
Also remove unnecessary dynamic allocation.
2018-08-12 11:08:06 +03:00
sledgehammer999
d088ab6f43 Remove trailing dot from headings 2018-08-12 11:08:06 +03:00
sledgehammer999
820d510c12 Add a TOC in the coding guidelines 2018-08-12 11:08:06 +03:00
Chocobo1
676847fcd0 Add options in AddNewTorrentDialog
The new checkboxes are: "Download in sequential order", "Download first
and last pieces first".
2018-08-12 11:08:06 +03:00
Chocobo1
0204630ee6 Revise dialog messages
Using critical dialog is a bit too strong as qbt didn't actually run
into something that fails, so downgrade to warning dialog.
2018-08-12 11:08:06 +03:00
Chocobo1
b515c7eda4 Fix typo 2018-08-12 11:08:06 +03:00
Chocobo1
73fcecac76 Simplify code
This avoids "deferencing null pointer" warning from static analyzers.
2018-08-12 11:08:06 +03:00
Chocobo1
a7b82ebcb5 Cache more preference values
These values from Preference class are frequently used.
Also group related variables together.
2018-08-12 11:08:06 +03:00
Eugene Shalygin
f8598b010d Use proper include files in the QtSingleApplication find module.
Look for qtsinglecoreapplication.h when Qt5Widgets module was not found,
and qtsingleapplication.h otherwise. Fixes #9196.

This also removes Qt4 support from the QtSingleApplication find module.
2018-08-12 11:08:06 +03:00
Vladimir Golovnev (Glassez)
93779bcc4b Download favicon using appropriate protocol
Some trackers use UDP protocol but we can't download its favicon
using UDP. Just try to download it using HTTP.
2018-08-12 11:08:06 +03:00
Vladimir Golovnev (Glassez)
938f5b9dd9 Apply proxy settings on DownloadManager creation 2018-08-12 11:08:06 +03:00
Vladimir Golovnev (Glassez)
3b4d9f49d5 Improve torrent initialization
Don't post "torrent resumed" event when torrent starts in "resumed"
state.
Fix confusing names. Now "resumed torrent" means "unpaused torrent"
only. When we load previously added torrent it is called "restored
torrent".
2018-08-12 11:08:06 +03:00
Vladimir Golovnev (Glassez)
171c93af50 Save resume data on torrent change events
Closes #9174.
2018-08-12 11:08:06 +03:00
sledgehammer999
6f81e40106 Revert email address changes in copyright notices 2018-08-12 11:08:06 +03:00
tjjh89017
e19b5cb2ce Add async io threads option to AdvancedSettings 2018-08-12 11:08:06 +03:00
Chocobo1
2c69faca58 Allow save resume interval to be disabled
Also raise the allowable upper limit
2018-08-12 11:08:06 +03:00
Chocobo1
9272151d0a Prolong resume data save interval 2018-08-12 11:08:06 +03:00
Chocobo1
d45ebf5a43 Remove unnecessary resources inclusion 2018-08-12 11:08:06 +03:00
thalieht
8074be7644 Delete several unused #include 2018-08-12 11:08:06 +03:00
thalieht
c99ac99a99 Fix coding style 2018-08-12 11:08:06 +03:00
thalieht
976e2450ec Convert the names used in ui and c++ files from snake_case to camelCase 2018-08-12 11:08:06 +03:00
Chocobo1
7e4db8fafd Fix python version detection
Closes #9146.
2018-08-12 11:08:06 +03:00
Chocobo1
115a409d92 Clear python cache conditionally
Clear the cache artifacts on plugin install and plugin uninstall events.
2018-08-12 11:08:06 +03:00
Chocobo1
c203ab3d16 Refactor function
In SearchPluginManager::updateNova(), omit removing __pycache__ folder and pyc
files, those files will be recreated anyway.
Add const to variables
2018-08-12 11:08:06 +03:00
Chocobo1
5dff96496d Rename function 2018-08-12 11:08:06 +03:00
Chocobo1
f813935011 Cache SearchPluginManager::engineLocation() result
Also the folder is only created on first usage.
2018-08-12 11:08:06 +03:00
Chocobo1
2be719449f Replace less-efficient QProcess::setEnvironment
Also small refactor
2018-08-12 11:08:06 +03:00
Chocobo1
2094c870d5 Simplify function 2018-08-12 11:08:06 +03:00
Chocobo1
4fe93ae8b8 Add checkbox for recursive download dialog
Also group similar options together.
2018-08-12 11:08:06 +03:00
Chocobo1
fff1103cf4 Work around crash when procesing recursive download
The messagebox is modal and exec() it makes it generates a new local
event loop, however the new local event loop will continue to process
libtorrent events (in Session::readAlerts()), at the time exec()
returns, the original libt::alert pointers are lost and resume
processing alerts will cause the crash.
One solution is to make the messagebox use show() and avoid exec().

Closes #9086.
2018-08-12 11:08:06 +03:00
Vladimir Golovnev (Glassez)
8cede43a45 Make TorrentInfo loading behavior uniform 2018-08-12 11:08:06 +03:00
Vladimir Golovnev (Glassez)
9b1fa3a5af Use new DownloadManager interface 2018-08-12 11:08:06 +03:00
Vladimir Golovnev (Glassez)
409e73c074 Implement "Sequential downloading" feature
Closes #6835.
2018-08-12 11:08:06 +03:00
Vladimir Golovnev (Glassez)
c893729d62 Implement DownloadRequest helper 2018-08-12 11:08:06 +03:00
Chocobo1
945466968c Reduce queries to python version
Instead of doing at least 2 queries for python infos, now requires only
1 query (in ideal condition), and the result is cached.
2018-08-12 11:08:06 +03:00
Chocobo1
54f080b755 Move related functions to Utils::Python 2018-08-12 11:08:06 +03:00
Goshik
bfad14d552 Create non-existing path in setLocationAction()
When using qbittorrent-nox it is not always possible to manually create
the target path for torrent moving. This commit allows automatic path
creation. It also allows to display error messages in the
'Set location' window.
2018-08-12 11:08:06 +03:00
Chocobo1
2972e1596d Move optimization flags
Those flags aren't strictly required when compiling but they are
recommended to be on.
2018-08-12 11:08:06 +03:00
Chocobo1
987d2aae88 Turn on Control Flow Guard for MSVC builds
The performance impact should be negligible according to the
documentation on msdn.
Closes #9101.
2018-08-12 11:08:06 +03:00
hannsen
4707d34fad Properly normalize version string before parsing it
This allows python scripts to be formatted in PEP 8 style.
2018-08-12 11:08:06 +03:00
Chocobo1
2ffc09d097 Move qm_gen.pri 2018-08-12 11:08:06 +03:00
Chocobo1
afa8d6bb8f Move .desktop file 2018-08-12 11:08:06 +03:00
Chocobo1
a37ead98e8 Move .ico files into icons dir 2018-08-12 11:08:06 +03:00
Chocobo1
c73cd8d618 Move .qrc files into its own directory 2018-08-12 11:08:06 +03:00
thalieht
800a3aa61e Change file names and classes names to match them 2018-08-12 11:08:06 +03:00
Thomas Piccirello
ebd815be75 Add WebUI support for Mac ⌘ (Command) key
The Command key will now be recognized for WebUI Table multi-selection, as Ctrl is.
2018-08-12 11:08:06 +03:00
Thomas Piccirello
ef669acf89 Implement key functions in Class and refactor 2018-08-12 11:08:06 +03:00
thalieht
ac6426eab1 Fix coding style 2018-08-12 11:08:06 +03:00
Chocobo1
b107b745f2 Revise usage of BOOST_NO_CXX11_RVALUE_REFERENCES
Now the flag will be present when building with boost version <= 1.59.
Closes #8990.
2018-08-12 11:08:06 +03:00
Goshik
3d851a448f Show current save path in 'Set location' window
The feature is useful when the user needs to move their torrent to a
sub or parent folder. If more than one torrent is chosen, the path
of the first selected torrent is used. The window was made wider to
allow more convenient editing of long paths.
2018-08-12 11:08:06 +03:00
Chocobo1
ce133f01aa Replace deprecated function on macOS
Closes #8993.
2018-08-12 11:08:06 +03:00
Chocobo1
492d378537 Disable certain mouse wheel events in Options dialog
The mouse wheel events for QComboBox & QSpinBox widgets in Options
dialog are filtered out.
2018-08-12 11:08:06 +03:00
Chocobo1
7ece484423 Remove duplicate private sections in class
And group related methods & variables together.
2018-08-12 11:08:06 +03:00
Chocobo1
be5ad63e21 Replace post-increment with pre-increment
And post-decrement with pre-decrement.
2018-08-12 11:08:06 +03:00
Eugene Shalygin
bdac8f8db8 Fix option name in winconf-xxx.cmake
The mistake was made by commit 7712d0ada0
2018-08-12 11:08:06 +03:00
Eugene Shalygin
bb893e70c5 Refactor CMake build scripts
1. Use FeatureSummary module to show configuration results.

2. Invert option()/find_package() relationship: instead of
calling find_package(... REQUIRED) when option is set, rely on optional
find package call and PackageName_FOUND variable.

3. Refactor handling options that result in simple preprocessor defines
(actually copy the snippet from libtorrent) so that everything is done
in a single function call.

4. Populate target properties in order to get rid of
include_directories() calls.
2018-08-12 11:08:06 +03:00
Chocobo1
57ec9db532 Fix WebUI cache behavior for css files
The style.css in public & private folders share the same URI, this
confuses the browser cache, so rename one of them.
2018-08-12 11:08:06 +03:00
Chocobo1
0287481001 Send Cache-Control header in WebUI responses
Tune the caching time to be shorter, in case there is a program
update.
Change the cacheability to private, as WebUI resources are not intended
to be cached at proxy.
For uncacheable responses, send out "no-store" explicitly to halt
browser caching.
2018-08-12 11:08:06 +03:00
Chocobo1
0167496ecb Add changelog link in program updater
Closes #8997.
2018-08-12 11:08:06 +03:00
Thomas Piccirello
d86cf193a0 Rename variables for clarity 2018-08-12 11:08:06 +03:00
Thomas Piccirello
246cad1108 Add form-action to CSP
This option restricts all form submissions to the WebUI's origin.
qBittorrent only ever submits forms to the origin, so this is intended as a security measure.
2018-08-12 11:08:06 +03:00
Thomas Piccirello
23bf86a8a8 Add upgrade-insecure-requests to CSP when HTTPS is enabled
This option automatically upgrades all http connections to https.
It ensures http urls cannot be accessed when in https mode, and is intended as a security measure.
2018-08-12 11:08:06 +03:00
thalieht
6ce4c885b9 Fix coding style 2018-08-12 11:08:06 +03:00
Chocobo1
faf84e483a Reset WebUI ban counter on login success 2018-08-12 11:08:06 +03:00
Chocobo1
576004c840 Add logging messages in WebUI login action 2018-08-12 11:08:06 +03:00
Chocobo1
c93b05c293 Replace QRegExp with QRegularExpression
Revise `static` keyword usage, static is added to frequently used
instances.
2018-08-12 11:08:06 +03:00
Chocobo1
55c3813fac Cleanup header include order
Add missing header.
Cleanup license.
2018-08-12 11:08:06 +03:00
Chocobo1
725c6857be Improve WebUI security measures
CSP was erroneously disabled in bad4d94f77
when clickjacking protection is off, now it is back.
Also added CSP 'frame-ancestors' directive when clickjacking
protection is enabled.
2018-08-12 11:08:06 +03:00
Chocobo1
86767c9ab4 Refactor function 2018-08-12 11:08:06 +03:00
Chocobo1
46aa631d2b Improve DownloadFromURL behavior
URL should be considered case sensitive.
2018-08-12 11:08:06 +03:00
Chocobo1
7c61a937c9 Move DownloadFromURLDialog to its own file
Simplify code, no functionality changes.
Remove debug messages.
Capitalize dialog name.
Capitalize class name.
Update license text.
2018-08-12 11:08:06 +03:00
Chocobo1
b8d65dcc45 Add missing header include 2018-08-12 11:08:06 +03:00
Vladimir Golovnev (Glassez)
b9ab83eaf2 Don't use RSS feed URLs as base for file names
RSS feed URLs can be too long and exceed max path limit.
Add RSS feed UIDs and use UIDs as base for file names instead of URLs.
Closes #8399.
2018-08-12 11:08:06 +03:00
Chocobo1
8b7b563992 Add constexpr to IndexInterval class
Add const to IndexRange private members.
Remove redundant inline specifier.
Add missing parentheses.
2018-08-12 11:08:06 +03:00
Chocobo1
b813a878d7 Add constexpr to TriStateBool class 2018-08-12 11:08:06 +03:00
Chocobo1
54e486c389 Improve Utils::Version class
Add operator>=() and operator<=().
More methods are suitable to be constexpr.
Remove redundant boundary checking.
2018-08-12 11:08:06 +03:00
Chocobo1
12d0a3acc1 Add option to control CSRF protection
Some users are using WebUI with simple port-forwarding from their router,
providing an option to control the protection will save them from setting up an
non-trival web proxy.
Closes #7274.
2018-08-12 11:08:06 +03:00
Chocobo1
6ad2a13386 Add option to control WebUI clickjacking protection
Some users actually want embedding WebUI into their custom build iframe.
Closes #7370.
2018-08-12 11:08:06 +03:00
Chocobo1
2a9c401db9 Update Options dialog layout in WebUI 2018-08-12 11:08:06 +03:00
sledgehammer999
ea5a29018f Bump to 4.1.1 2018-05-27 21:35:07 +03:00
sledgehammer999
c8d0a715e8 Update Changelog 2018-05-27 21:30:13 +03:00
sledgehammer999
2cfc6514ab Sync translations from Transifex and run lupdate 2018-05-27 21:03:53 +03:00
sledgehammer999
1d78bc7206 Bump Web API version 2018-05-27 21:03:53 +03:00
Chocobo1
e5577e43f8 Replace raster qbt logo with vector version
Add helper function for svg icons.
2018-05-27 18:31:51 +03:00
Chocobo1
17c0463906 Fix GUI scaling factor on macOS
macOS seems have an unique way to handle widget size, that is, it doesn't require
application to resize widgets manually, Qt will handle the resize job
automatically.

Closes #8841.
2018-05-27 18:31:51 +03:00
Chocobo1
4168772904 Use 32px icons for favicon
One less resource to manage and 16px size can be downsampled from 32px
on-the-fly anyway.
2018-05-27 18:31:51 +03:00
sledgehammer999
44f2186749 Fix compilation without D-Bus support
Closes #8977
2018-05-27 18:31:51 +03:00
Chocobo1
0c918bcc3a Initialize variables properly
The warnings are emitted when compiling on msys2, mingw

The warning was:
gui/torrentcontentmodel.cpp:135:33: warning: missing initializer for
member '_SHFILEINFOW::iIcon' [-Wmissing-field-initializers]

..\..\qBittorrent\src\app\stacktrace_win.h:141:30: warning: missing
initializer for member '_IMAGEHLP_LINE64::Key'
[-Wmissing-field-initializers]
2018-05-27 18:31:51 +03:00
sledgehammer999
0a8925dc75 Suppress multiple I/O errors for the same torrent
When a file error happens libtorrent spews a ton of `file_error_alert`
which result in log floods and notification balloon floods. The later
might render the program inaccessible because the constant
notifications prevent the user from interacting with the tray icon.

Closes #8934
2018-05-27 18:31:51 +03:00
airium
a446597597 Update strace_win to stacktrace in conf.pri.windows
It is advised to update the stack trace statement since #8701, otherwise people may forget to change it, which results in that no pdb file is generated for Windows distribution package.
2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
54354a2732 Add missing 'return' statement 2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
d94b8f08ab Use RSS feed update time as a fallback
Some sites omit publication date in its RSS feed articles
that prevents "Ignore Subsequent Matches" to work properly.
Closes #8959.
2018-05-27 18:31:51 +03:00
Chocobo1
0d8189efeb Relax behavior of "Download first and last piece first"
Now it applies the setting to all files in torrent, no matter whether
the file is previewable or not.

Torrent client shouldn't be smart by deciding which file this
option will be applied to, i.e. it should just follow the user's decision.
2018-05-27 18:31:51 +03:00
Chocobo1
00c886e426 Refactor code
Add const to variables.
Add Logger message.
Simplify code logic.
2018-05-27 18:31:51 +03:00
Chocobo1
551fc35439 Simplify the saving & loading of a setting
Remove excessive usage of constexpr.
2018-05-27 18:31:51 +03:00
Chocobo1
9ff17c8d9d Make use of QStringLiteral
Only changed instances that are initialized at program start.
2018-05-27 18:31:51 +03:00
Chocobo1
ec37732e99 Use smaller type 2018-05-27 18:31:51 +03:00
adem
8a414f32a8 Update Windows icons 2018-05-27 18:31:51 +03:00
sledgehammer999
bac06acb49 Fix Stats dialog size
Partially reverts e31ec20ec4.
Closes #8870.
2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
ae1e3c2a81 Rename torrent if content was initially renamed
Closes #8910.
2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
67940eb0f9 Place "Use Smart Episode Filter" more correctly 2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
007aa8480e Make "Ignoring days" to behave like other filters
This prevents confusing in GUI when it shows matched RSS
articles which be really ignored by the rule.
2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
dedec10c58 Improve code of RSS auto-downloading rule
Closes #8933.
2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
75219e21be Add last used save path to the front of history 2018-05-27 18:31:51 +03:00
Evgeny Lensky
10f5964f8e Fix open destination folder with Nautilus > 3.28
Closes #8923.
2018-05-27 18:31:51 +03:00
Chocobo1
a4a64d51c0 Improve "Run External Program" behavior
This follows utorrent behavior: they don't append backslash character at
the end of path variables.
Closes #8836.
2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
1014313d88 Rename RSS properties to follow other names 2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
e486bb4c29 Properly set RSS settings via API
Closes #8925.
2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
5c3d9ffb46 Properly fill UploadedFile::filename field
Closes #8928.
2018-05-27 18:31:51 +03:00
Chocobo1
2e474fd8db Detect endianness at compile time 2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
b2b110ae1f Add option to remember last used save path
Replace in "Add new torrent" dialog confusing "Set as default save path" option
with "Remember last used save path" option that affects only selected value in
"Save path" combo box.
Closes #7323.
2018-05-27 18:31:51 +03:00
Chocobo1
68a34e0738 Refactor code
Add const to variables.
No functionality change.
2018-05-27 18:31:51 +03:00
Chocobo1
38fa575958 Apply locale changes immediately in WebUI 2018-05-27 18:31:51 +03:00
Chocobo1
6cfeefe054 Rename variables
Variable name should not start with underscore as C++ standard stated it
is reserved.
2018-05-27 18:31:51 +03:00
Chocobo1
8007971a53 Fix i18n in WebUI
Closes #8844.
2018-05-27 18:31:51 +03:00
Chocobo1
d66bd30fae Make strings translatable
Closes #8866.
2018-05-27 18:31:51 +03:00
sledgehammer999
3fa59b1b12 Don't migrate torrents that have newer fastresumes 2018-05-27 18:31:51 +03:00
sledgehammer999
20e7aff393 Delete non-commited fastresume files
Old v3.3.x format had a number at the end indicating the queue position.
The naming scheme was '<infohash>.fastresume.<queueposition>'.
However, QSaveFile, which uses QTemporaryFile internally, might leave
non-commited files behind eg after a crash. These files have the
naming scheme '<infohash>.fastresume.XXXXXX' where each X is a random
character. We try to detect the latter and remove it without "migrating"
the fastresume to the new saving system.
2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
4b7ce87f57 Fix params handling for some legacy API methods
Closes #8880.
2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
2075533468 Improve legacy API params handling 2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
a4ad5c8d11 Fix invalid API calls in WebUI
Closes #8899.
2018-05-27 18:31:51 +03:00
sledgehammer999
35f2f56757 Fix deletion of old logs 2018-05-27 18:31:51 +03:00
Marcel Petersen
e6f4aa6a2f Filter torrent info endpoint by hashes
Added hashes parameter to info action.
Allows filtering seralized torrents by passing it into the TorrentFilter.
2018-05-27 18:31:51 +03:00
sledgehammer999
92fc62bb0d Show rechecking progress
When having big torrents, the rechecking might take a while to
complete. Users need some sort of feedback that progress is being made.
Also, I changed the float to qreal since that's the return type.
2018-05-27 18:31:51 +03:00
sledgehammer999
44b57a59f5 Log successful torrent move 2018-05-27 18:31:51 +03:00
sledgehammer999
97b8e02bf5 Add 'Moving' state for torrents being relocated/moved
This is another indication to the user that something is happening
behind the scenes.
Uses the same icon/color as "Checking" status.
Torrents in the `Moving` state are considered as "Active". This should
prevent accidental program exit from the user and inhibit system sleep.
2018-05-27 18:31:51 +03:00
Chocobo1
5df42420cb Retry saving settings when operation failed 2018-05-27 18:31:51 +03:00
Chocobo1
0ede11a1b7 Make settings file recovery more robust
We should not blindly remove the leftover settings file, as the following write()
operation could fail and the user would lost all settings.
We should try renaming it instead.
2018-05-27 18:31:51 +03:00
Chocobo1
7d9c282db9 Refactor SettingsStorage class
Make use of (i.e. returning) QFile::rename operation status
Make log message more verbose
Add const
Remove empty lines
Inline typedef
2018-05-27 18:31:51 +03:00
Chocobo1
bc0e0813a4 Enable more compiler warnings on linux 2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
f3aebb3001 Fix compilation with MinGW 2018-05-27 18:31:51 +03:00
thalieht
800f966df9 Use qt5 syntax for a few remaining SLOT() 2018-05-27 18:31:51 +03:00
thalieht
e33df4dd8c Clarify guidelines and fix some typos 2018-05-27 18:31:51 +03:00
thalieht
96d9d810fd Fix coding style 2018-05-27 18:31:51 +03:00
thalieht
8707a1bc86 Move some connect() from propertieswidget to their corresponding widget 2018-05-27 18:31:51 +03:00
thalieht
0c988a5fd4 Use qt5 connect() syntax 2018-05-27 18:31:51 +03:00
Chocobo1
b396ca771d Fix displayed tracker messages
Before this change, we were displaying debug messages constructed by
libtorrent, now we show messages returned by trackers.

Closes #8739.
2018-05-27 18:31:51 +03:00
Chocobo1
a37dfcf961 Refactor functions
Add const to variables
Remove debug messages
2018-05-27 18:31:51 +03:00
Chocobo1
31989740cd Comment out Werror flag in cmake script
Werror flag should be only enabled on developer's machine, not for
users using the product.
Also fix formatting.
2018-05-27 18:31:51 +03:00
Chocobo1
501191289b Print warning about cmake support status 2018-05-27 18:31:51 +03:00
Chocobo1
8971e92d78 Remove debug messages 2018-05-27 18:31:51 +03:00
Chocobo1
0c96e79d0d Refactor code
Remove forward declarations of Qt types.
Fix header include order.
2018-05-27 18:31:51 +03:00
Nick Korotysh
0704c0f5e6 Add missing "override" 2018-05-27 18:31:51 +03:00
thalieht
9cb190ebe7 Replace the zeroing of pointers with nullptr 2018-05-27 18:31:51 +03:00
Vladimir Golovnev (Glassez)
667f84995c Fix wrong API method names
Closes #8828.
2018-05-27 18:31:51 +03:00
Chocobo1
7a93fae6e4 Fix compile warnings on gcc 8
The warning was:
warning: catching polymorphic type ‘class std::exception’ by value
[-Wcatch-value=]
2018-05-27 18:31:51 +03:00
Chocobo1
0d6deca15c Revert commit
Apparently the translations were working in previous state, but affected by
lupdate issue:
https://github.com/qbittorrent/qBittorrent/issues/8220#issuecomment-385712673

The reverts commit fb698896c9.
Closes #8831.
2018-05-27 18:31:51 +03:00
Chocobo1
f54d7d46f2 Really fix translation in fspathedit
QT_TRANSLATE_NOOP3 is a macro, so we cannot use a runtime string for the context
argument.
Fix up 1d778676cd.
2018-05-27 18:31:51 +03:00
Chocobo1
8cf00ba5e1 Fix translation strings not found
The translation context doesn't exist, so the translations were not found, fixed
now.
Closes #8829.
2018-05-27 18:31:51 +03:00
Chocobo1
ecc9c6bbd9 Work around false-positive warning from lupdate
In short, lupdate will get confused when seeing `template <class T>`,
see: QTBUG-55478
2018-05-27 18:31:51 +03:00
Chocobo1
e11199f988 Fix usage of Q_DECLARE_TR_FUNCTIONS()
The context parameter shouldn't be enclosed in double quotes.
2018-05-27 18:31:51 +03:00
sledgehammer999
e9ed621178 Bump to 4.1.0 2018-05-05 00:55:42 +03:00
390 changed files with 171514 additions and 107870 deletions

View File

@@ -45,8 +45,7 @@ before_build:
- CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
- SET PATH=%PATH%;c:\qbt\qt5_32\bin;%CACHE_DIR%\jom;
# setup project
- COPY /Y "%CACHE_DIR%\winconf.pri" "%REPO_DIR%"
- COPY /Y "%CACHE_DIR%\winconf-msvc.pri" "%REPO_DIR%"
- COPY /Y "%CACHE_DIR%\conf.pri" "%REPO_DIR%"
# workarounds
- MKLINK /J "c:\qbt\base" "%CACHE_DIR%\base"

View File

@@ -166,7 +166,10 @@ script:
if [ "$build_system" = "cmake" ]; then
mkdir build
cd build
cmake -DGUI=${gui} -DCMAKE_INSTALL_PREFIX="$qbt_path" "$MY_CMAKE_OPENSSL_HINT" \
if [ "$gui" = "false" ]; then
DISABLE_GUI_OPTION="-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=ON"
fi
cmake $DISABLE_GUI_OPTION -DCMAKE_INSTALL_PREFIX="$qbt_path" "$MY_CMAKE_OPENSSL_HINT" \
-G "Ninja" -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE ..
BUILD_TOOL="ninja"
fi

View File

@@ -12,7 +12,7 @@ mode = developer
[qbittorrent.qbittorrentdesktop_master]
source_file = src/icons/qBittorrent.desktop
source_file = dist/unix/qbittorrent.desktop
source_lang = en
type = DESKTOP
minimum_perc = 23

View File

@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.5)
cmake_policy(VERSION 3.5)
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
message(WARNING "No official support for cmake build system. If it is broken, please submit patches!")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
include(FunctionReadVersion)
@@ -25,32 +26,29 @@ add_definitions(-DQBT_VERSION_BUILD=${VER_BUILD})
add_definitions(-DQBT_VERSION="v${PROJECT_VERSION}")
add_definitions(-DQBT_VERSION_2="${PROJECT_VERSION}")
if (UNIX AND NOT APPLE)
include(GNUInstallDirs)
endif (UNIX AND NOT APPLE)
include(GNUInstallDirs)
include(FeatureSummary)
# version requirements
set(requiredBoostVersion 1.35)
set(requiredQtVersion 5.5.1)
if(WIN32)
include(winconf)
endif(WIN32)
# we need options here, because they are used not only in "src" subdir, but in the "dist" dir too
include(CMakeDependentOption)
option(SYSTEM_QTSINGLEAPPLICATION
"Use the system qtsingleapplication library or shipped one otherwise")
option(GUI "Allows to disable GUI for headless running. Disables QtDBus and the GeoIP Database" ON)
option(WEBUI "Allows to disable the WebUI." ON)
option(STACKTRACE "Enable stacktrace feature" ON)
if (UNIX)
cmake_dependent_option(SYSTEMD "Install the systemd service file (headless only)" OFF
"NOT GUI" OFF)
cmake_dependent_option(DBUS "Enable use of QtDBus (GUI only)" ON "GUI" OFF)
endif(UNIX)
# we need options here, at the top level, because they are used not only in "src" subdir, but in the "dist" dir too
include(CompileFeature)
optional_compile_definitions(COUNTRIES_RESOLUTION FEATURE DESCRIPTION "Enable resolving peers IP addresses to countries"
DEFAULT ON DISABLED DISABLE_COUNTRIES_RESOLUTION)
optional_compile_definitions(STACKTRACE FEATURE DESCRIPTION "Enable stacktraces"
DEFAULT ON ENABLED STACKTRACE)
optional_compile_definitions(WEBUI FEATURE DESCRIPTION "Enables built-in HTTP server for headless use"
DEFAULT ON DISABLED DISABLE_WEBUI)
add_subdirectory(src)
add_subdirectory(dist)
feature_summary(DESCRIPTION "\nConfiguration results:" WHAT ALL)

View File

@@ -6,6 +6,31 @@ For programming languages other than C++ (e.g. JavaScript) used in this reposito
**Note 2:** You can use the `uncrustify` program/tool to clean up any source file. Use it with the `uncrustify.cfg` configuration file found in the root folder.
**Note 3:** There is also a style for QtCreator but it doesn't cover all cases. In QtCreator `Tools->Options...->C++->Code Style->Import...` and choose the `codingStyleQtCreator.xml` file found in the root folder.
### Table Of Contents
* [1. New lines &amp; curly braces](#1-new-lines--curly-braces)
* [a. Function blocks, class/struct definitions, namespaces](#a-function-blocks-classstruct-definitions-namespaces)
* [b. Other code blocks](#b-other-code-blocks)
* [c. Blocks in switch's case labels](#c-blocks-in-switchs-case-labels)
* [d. If-else statements](#d-if-else-statements)
* [e. Single statement if blocks](#e-single-statement-if-blocks)
* [f. Acceptable conditions to omit braces](#f-acceptable-conditions-to-omit-braces)
* [g. Brace enclosed initializers](#g-brace-enclosed-initializers)
* [2. Indentation](#2-indentation)
* [3. File encoding and line endings](#3-file-encoding-and-line-endings)
* [4. Initialization lists](#4-initialization-lists)
* [5. Enums](#5-enums)
* [6. Names](#6-names)
* [a. Type names and namespaces](#a-type-names-and-namespaces)
* [b. Variable names](#b-variable-names)
* [c. Private member variable names](#c-private-member-variable-names)
* [7. Header inclusion order](#7-header-inclusion-order)
* [8. Include guard](#8-include-guard)
* [9. Misc](#9-misc)
* [10. Git commit message](#10-git-commit-message)
* [11. Not covered above](#11-not-covered-above)
---
### 1. New lines & curly braces ###
#### a. Function blocks, class/struct definitions, namespaces ####
@@ -165,11 +190,11 @@ QVariantMap map {{"key1", 5}, {"key2", 10}};
### 2. Indentation ###
4 spaces.
### 3. File encoding and line endings. ###
### 3. File encoding and line endings ###
UTF-8 and Unix-like line ending (LF). Unless some platform specific files need other encodings/line endings.
### 4. Initialization lists. ###
### 4. 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)
@@ -182,7 +207,7 @@ myClass::myClass(int a, int b, int c, int d)
}
```
### 5. Enums. ###
### 5. Enums ###
Enums should be vertical. This will allow for more easily readable diffs. The members should be indented.
```c++
enum Days
@@ -197,7 +222,7 @@ enum Days
};
```
### 6. Names. ###
### 6. Names ###
All names should be camelCased.
#### a. Type names and namespaces ####
@@ -231,7 +256,7 @@ class MyClass
}
```
### 7. Header inclusion order. ###
### 7. Header inclusion order ###
The headers should be placed in the following group order:
1. Module header (in .cpp)
2. C++ Standard Library headers
@@ -239,11 +264,11 @@ The headers should be placed in the following group order:
4. Boost library headers
5. Libtorrent headers
6. Qt headers
7. qBittorrent own headers, starting from *base* headers.
7. qBittorrent's own headers, starting from the *base* headers.
The headers should be ordered alphabetically within each group.
If there are conditionals for the same header group, then put them at the bottom of the respective group.
If there are conditionals for the different header groups, then put them above of the "qBittorrent own headers" group.
If there are conditionals that contain headers from several different header groups, then put them above the "qBittorrent's own headers" group.
One exception is the header containing the library version (for example, QtGlobal), this particular header isn't constrained by the aforementioned order.
@@ -285,19 +310,19 @@ Example:
#include <QFont>
#endif
// conditional for the different header groups
// conditional that contains headers from several different header groups
#if LIBTORRENT_VERSION_NUM >= 10100
#include <memory>
#include <QElapsedTimer>
#endif
// qBittorrent own headers
// qBittorrent's own headers
#include "base/bittorrent/infohash.h"
#include "anothermodule.h"
#include "ui_examplewidget.h"
```
### 8. Include guard. ###
### 8. Include guard ###
`#pragma once` should be used instead of "include guard" in new code:
```c++
// examplewidget.h
@@ -313,7 +338,7 @@ class ExampleWidget : public QWidget
```
### 9. Misc. ###
### 9. Misc ###
* Line breaks for long lines with operation:

View File

@@ -1,3 +1,86 @@
* Sun Aug 12 2018 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.1.2
- FEATURE: New options for "inhibit sleep" (Lukas Greib)
- FEATURE: Add option for regexps in the transferlist search filter's context menu (thalieht)
- FEATURE: Add async io threads option to AdvancedSettings (tjjh89017)
- FEATURE: Allow save resume interval to be disabled (Chocobo1)
- FEATURE: Add checkbox for recursive download dialog (Chocobo1)
- FEATURE: Add changelog link in program updater (Chocobo1)
- BUGFIX: Avoid allocating large memory when loading a .torrent file (Couchy)
- BUGFIX: Notify users on 1st time close/minimize to tray (sledgehammer999)
- BUGFIX: Fix I/O error after fetching magnet metadata (Chocobo1)
- BUGFIX: Never save resume data for already paused torrents (glassez)
- BUGFIX: Make ProgramUpdater upgrade to 64-bit qbt when running on 64-bit Windows (Chocobo1)
- BUGFIX: Put temporary files in qbt own temp folder (Chocobo1)
- BUGFIX: Avoid potentially setting the wrong piece priorities (Chocobo1)
- BUGFIX: Various code refactorings/improvements (Chocobo1, thalieht, glassez)
- BUGFIX: Add options "Download in sequential order" and "Download first and last pieces first" in AddNewTorrentDialog (Chocobo1)
- BUGFIX: Download favicon using appropriate protocol (glassez)
- BUGFIX: Apply proxy settings on DownloadManager creation (glassez)
- BUGFIX: Improve torrent initialization (glassez)
- BUGFIX: Save resume data on torrent change events (glassez)
- BUGFIX: Increase default resume data save interval (Chocobo1)
- BUGFIX: Work around crash when procesing recursive download. Closes #9086 (Chocobo1)
- BUGFIX: Reduce queries to python version (Chocobo1)
- BUGFIX: Disable certain mouse wheel events in Options dialog (Chocobo1)
- WEBUI: Send all rechecks in one request (Thomas Piccirello)
- WEBUI: Add WebUI Force Reannounce option (Thomas Piccirello)
- WEBUI: Create non-existing path in setLocationAction() (Goshik)
- WEBUI: Add WebUI support for Mac ⌘ (Command) key (Thomas Piccirello)
- WEBUI: Show current save path in 'Set location' window (Goshik)
- WEBUI: Fix WebUI cache behavior for css files (Chocobo1)
- WEBUI: Send Cache-Control header in WebUI responses (Chocobo1)
- WEBUI: Add form-action to CSP (Thomas Piccirello)
- WEBUI: Add upgrade-insecure-requests to CSP when HTTPS is enabled (Thomas Piccirello)
- WEBUI: Reset WebUI ban counter on login success (Chocobo1)
- WEBUI: Add logging messages in WebUI login action (Chocobo1)
- WEBUI: Add option to control CSRF protection (Chocobo1)
- WEBUI: Add option to control WebUI clickjacking protection (Chocobo1)
- RSS: Implement "Sequential downloading" feature. Closes #6835 (glassez)
- RSS: Don't use RSS feed URLs as base for file names. Closes #8399 (glassez)
- SEARCH: Add a name filter for search results (thalieht)
- SEARCH: Fix python version detection (Chocobo1)
- SEARCH: Clear python cache conditionally (Chocobo1)
- SEARCH: Properly normalize version string before parsing it (hannsen)
- WINDOWS: Turn on Control Flow Guard for MSVC builds (Chocobo1)
- MACOS: Replace deprecated function IOPMAssertionCreate() on macOS (Chocobo1)
- OTHER: Fix CMake build with QtSingleApplication. Fixes #9196 (Eugene Shalygin)
* Sun May 27 2018 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.1.1
- FEATURE: Add 'Moving' state for torrents being relocated/moved (sledgehammer999)
- FEATURE: Show rechecking progress (sledgehammer999)
- FEATURE: Add option to remember last used save path (glassez)
- FEATURE: Torrent name is also renamed if the content was renamed in the "Add New Torrent" dialog (glassez)
- FEATURE: Relax behavior of "Download first and last piece first". It applies to all files and not only to the previewable. (Chocobo1)
- BUGFIX: Fix issues with translatable strings (Chocobo1)
- BUGFIX: Fix displayed tracker messages (Chocobo1)
- BUGFIX: Make settings file recovery more robust (Chocobo1)
- BUGFIX: Retry saving settings when operation failed (Chocobo1)
- BUGFIX: Log successful torrent move (sledgehammer999)
- BUGFIX: Fix deletion of old logs (sledgehammer999)
- BUGFIX: Delete non-commited fastresume files (sledgehammer999)
- BUGFIX: Don't migrate torrents that have newer fastresumes (sledgehammer999)
- BUGFIX: Fix adding multiple torrents at once from WebUI (glassez)
- BUGFIX: Improve "Run External Program" behavior. On Windows, a backslash isn't appended to paths from path variables (Chocobo1)
- BUGFIX: Suppress multiple I/O errors for the same torrent (sledgehammer999)
- BUGFIX: Replace raster qbt logo with vector version (Chocobo1)
- WEBUI: Fix wrong API method names (glassez)
- WEBUI: Filter torrent info endpoint by hashes (Marcel Petersen)
- WEBUI: Fix invalid API calls in WebUI (glassez)
- WEBUI: Improve legacy API params handling (glassez)
- WEBUI: Fix params handling for some legacy API methods (glassez)
- WEBUI: Apply locale changes immediately in WebUI (Chocobo1)
- WEBUI: Use 32px icons for favicon (Chocobo1)
- WEBUI/RSS: Properly set RSS settings via API (glassez)
- RSS: Fix auto-downloading rule when Smart filter with regular Episode filter are used (glassez)
- RSS: Make "Ignoring days" to behave like other filters (glassez)
- RSS: Place "Use Smart Episode Filter" more correctly (glassez)
- RSS: Use RSS feed update time as a fallback (glassez)
- COSMETIC: Fix Stats dialog size (sledgehammer999)
- MACOS: Fix GUI scaling factor on macOS (Chocobo1)
- WINDOWS: Update icons (adem4ik)
- LINUX: Fix open destination folder with Nautilus > 3.28 (Evgeny Lensky)
- OTHER: Code improvements and refactoring (thalieht, Nick Korotysh, Chocobo1)
* Sat May 05 2018 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.1.0
- FEATURE: Add "Coalesce reads & writes" checkbox in advanced options (Chocobo1)
- FEATURE: Smart Filter for RSS (Stephen Dawkins)

View File

@@ -0,0 +1,22 @@
# Helper function for coupling add_feature_info(), option(), and add_definitions()
function(optional_compile_definitions _name)
set(options FEATURE)
set(oneValueArgs DESCRIPTION DEFAULT)
set(multiValueArgs ENABLED DISABLED)
cmake_parse_arguments(OCD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
option(${_name} "${OCD_DESCRIPTION}" ${OCD_DEFAULT})
if (${${_name}})
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY COMPILE_DEFINITIONS ${OCD_ENABLED})
else()
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY COMPILE_DEFINITIONS ${OCD_DISABLED})
endif()
if(${OCD_FEATURE})
add_feature_info(${_name} ${_name} "${OCD_DESCRIPTION}")
endif()
endfunction()
macro(feature_option _name _description _default)
option(${_name} "${_description}" ${_default})
add_feature_info(${_name} ${_name} "${_description}")
endmacro()

View File

@@ -99,6 +99,7 @@ list(FIND LibtorrentRasterbar_DEFINITIONS -DTORRENT_USE_OPENSSL LibtorrentRaster
if(LibtorrentRasterbar_ENCRYPTION_INDEX GREATER -1)
find_package(OpenSSL REQUIRED)
set(LibtorrentRasterbar_LIBRARIES ${LibtorrentRasterbar_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
list(APPEND LibtorrentRasterbar_INCLUDE_DIRS "${OPENSSL_INCLUDE_DIR}")
set(LibtorrentRasterbar_OPENSSL_ENABLED ON)
endif()
@@ -113,10 +114,10 @@ mark_as_advanced(LibtorrentRasterbar_INCLUDE_DIR LibtorrentRasterbar_LIBRARY
LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES
LibtorrentRasterbar_ENCRYPTION_INDEX)
if (LibtorrentRasterbar_FOUND AND NOT TARGET LibtorrentRasterbar::LibTorrent)
add_library(LibtorrentRasterbar::LibTorrent UNKNOWN IMPORTED)
if (LibtorrentRasterbar_FOUND AND NOT TARGET LibtorrentRasterbar::torrent-rasterbar)
add_library(LibtorrentRasterbar::torrent-rasterbar UNKNOWN IMPORTED)
set_target_properties(LibtorrentRasterbar::LibTorrent PROPERTIES
set_target_properties(LibtorrentRasterbar::torrent-rasterbar PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${LibtorrentRasterbar_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LibtorrentRasterbar_INCLUDE_DIRS}"

View File

@@ -1,94 +1,79 @@
# - Try to find the QtSingleApplication includes and library
# which defines
#
# QTSINGLEAPPLICATION_FOUND - system has QtSingleApplication
# QTSINGLEAPPLICATION_INCLUDE_DIR - where to find header QtSingleApplication
# QTSINGLEAPPLICATION_LIBRARIES - the libraries to link against to use QtSingleApplication
# QTSINGLEAPPLICATION_LIBRARY - where to find the QtSingleApplication library (not for general use)
# QtSingleApplication_FOUND - system has QtSingleApplication
# QtSingleApplication_INCLUDE_DIR - where to find header QtSingleApplication
# QtSingleApplication_LIBRARIES - the libraries to link against to use QtSingleApplication
# QtSingleApplication_LIBRARY - where to find the QtSingleApplication library (not for general use)
# copyright (c) 2013 TI_Eugene ti.eugene@gmail.com
#
# Redistribution and use is allowed according to the terms of the FreeBSD license.
SET(QTSINGLEAPPLICATION_FOUND FALSE)
SET(QtSingleApplication_FOUND FALSE)
IF(QT4_FOUND)
message(STATUS "Looking for Qt4 single application library")
FIND_PATH(QTSINGLEAPPLICATION_INCLUDE_DIR QtSingleApplication
# standard locations
/usr/include
/usr/include/QtSolutions
# qt4 location except mac's frameworks
"${QT_INCLUDE_DIR}/QtSolutions"
# mac's frameworks
${FRAMEWORK_INCLUDE_DIR}/QtSolutions
)
if (Qt5Widgets_FOUND)
set(_includeFileName qtsingleapplication.h)
else()
set(_includeFileName qtsinglecoreapplication.h)
endif()
SET(QTSINGLEAPPLICATION_NAMES ${QTSINGLEAPPLICATION_NAMES}
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
FIND_LIBRARY(QTSINGLEAPPLICATION_LIBRARY
NAMES ${QTSINGLEAPPLICATION_NAMES}
PATHS ${QT_LIBRARY_DIR}
)
ELSEIF(Qt5Core_FOUND)
message(STATUS "Looking for Qt5 single application library")
FOREACH(TOP_INCLUDE_PATH in ${Qt5Core_INCLUDE_DIRS} ${FRAMEWORK_INCLUDE_DIR})
FIND_PATH(QTSINGLEAPPLICATION_INCLUDE_DIR QtSingleApplication ${TOP_INCLUDE_PATH}/QtSolutions)
FOREACH(TOP_INCLUDE_PATH in ${Qt5Core_INCLUDE_DIRS} ${FRAMEWORK_INCLUDE_DIR})
FIND_PATH(QtSingleApplication_INCLUDE_DIR ${_includeFileName} ${TOP_INCLUDE_PATH}/QtSolutions)
IF(QTSINGLEAPPLICATION_INCLUDE_DIR)
BREAK()
ENDIF()
ENDFOREACH()
IF(QtSingleApplication_INCLUDE_DIR)
BREAK()
ENDIF()
ENDFOREACH()
SET(QTSINGLEAPPLICATION_NAMES ${QTSINGLEAPPLICATION_NAMES}
Qt5Solutions_SingleApplication-2.6 libQt5Solutions_SingleApplication-2.6
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
GET_TARGET_PROPERTY(_QT5_CORELIBRARY Qt5::Core LOCATION)
GET_FILENAME_COMPONENT(_QT5_CORELIBRARYPATH ${_QT5_CORELIBRARY} PATH)
SET(QtSingleApplication_NAMES ${QtSingleApplication_NAMES}
Qt5Solutions_SingleApplication-2.6 libQt5Solutions_SingleApplication-2.6
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
GET_TARGET_PROPERTY(_QT5_CORELIBRARY Qt5::Core LOCATION)
GET_FILENAME_COMPONENT(_QT5_CORELIBRARYPATH ${_QT5_CORELIBRARY} PATH)
FIND_LIBRARY(QTSINGLEAPPLICATION_LIBRARY
NAMES ${QTSINGLEAPPLICATION_NAMES}
PATHS ${_QT5_CORELIBRARYPATH}
)
ENDIF()
FIND_LIBRARY(QtSingleApplication_LIBRARY
NAMES ${QtSingleApplication_NAMES}
PATHS ${_QT5_CORELIBRARYPATH}
)
IF (QTSINGLEAPPLICATION_LIBRARY AND QTSINGLEAPPLICATION_INCLUDE_DIR)
IF (QtSingleApplication_LIBRARY AND QtSingleApplication_INCLUDE_DIR)
SET(QTSINGLEAPPLICATION_LIBRARIES ${QTSINGLEAPPLICATION_LIBRARY})
SET(QTSINGLEAPPLICATION_FOUND TRUE)
SET(QtSingleApplication_LIBRARIES ${QtSingleApplication_LIBRARY})
SET(QtSingleApplication_FOUND TRUE)
IF (CYGWIN)
IF(BUILD_SHARED_LIBS)
# No need to define QTSINGLEAPPLICATION_USE_DLL here, because it's default for Cygwin.
# No need to define QtSingleApplication_USE_DLL here, because it's default for Cygwin.
ELSE(BUILD_SHARED_LIBS)
SET (QTSINGLEAPPLICATION_DEFINITIONS -DQTSINGLEAPPLICATION_STATIC)
SET (QtSingleApplication_DEFINITIONS -DQTSINGLEAPPLICATION_STATIC)
ENDIF(BUILD_SHARED_LIBS)
ENDIF (CYGWIN)
ENDIF (QTSINGLEAPPLICATION_LIBRARY AND QTSINGLEAPPLICATION_INCLUDE_DIR)
ENDIF (QtSingleApplication_LIBRARY AND QtSingleApplication_INCLUDE_DIR)
IF (QTSINGLEAPPLICATION_FOUND)
IF (NOT QtSingleApplication_FIND_QUIETLY)
MESSAGE(STATUS "Found QtSingleApplication: ${QTSINGLEAPPLICATION_LIBRARY}")
MESSAGE(STATUS " includes: ${QTSINGLEAPPLICATION_INCLUDE_DIR}")
ENDIF (NOT QtSingleApplication_FIND_QUIETLY)
ELSE (QTSINGLEAPPLICATION_FOUND)
IF (QtSingleApplication_FOUND)
IF (NOT QtSingleApplication_FIND_QUIETLY)
MESSAGE(STATUS "Found QtSingleApplication: ${QtSingleApplication_LIBRARY}")
MESSAGE(STATUS " includes: ${QtSingleApplication_INCLUDE_DIR}")
ENDIF (NOT QtSingleApplication_FIND_QUIETLY)
if(NOT TARGET QtSingleApplication::QtSingleApplication)
add_library(QtSingleApplication::QtSingleApplication UNKNOWN IMPORTED)
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${QtSingleApplication_INCLUDE_DIR}"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${QtSingleApplication_INCLUDE_DIR}"
)
if(EXISTS "${QtSingleApplication_LIBRARY}")
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${QtSingleApplication_LIBRARY}")
endif()
endif(NOT TARGET QtSingleApplication::QtSingleApplication)
ELSE (QtSingleApplication_FOUND)
IF (QtSingleApplication_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find QtSingleApplication library")
ENDIF (QtSingleApplication_FIND_REQUIRED)
ENDIF (QTSINGLEAPPLICATION_FOUND)
ENDIF (QtSingleApplication_FOUND)
MARK_AS_ADVANCED(QTSINGLEAPPLICATION_INCLUDE_DIR QTSINGLEAPPLICATION_LIBRARY)
if(NOT TARGET QtSingleApplication::QtSingleApplication)
add_library(QtSingleApplication::QtSingleApplication UNKNOWN IMPORTED)
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${QTSINGLEAPPLICATION_INCLUDE_DIR}"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${QTSINGLEAPPLICATION_INCLUDE_DIR}"
)
if(EXISTS "${QTSINGLEAPPLICATION_LIBRARY}")
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${QTSINGLEAPPLICATION_LIBRARY}")
endif()
endif(NOT TARGET QtSingleApplication::QtSingleApplication)
MARK_AS_ADVANCED(QtSingleApplication_INCLUDE_DIR QtSingleApplication_LIBRARY)

View File

@@ -11,18 +11,17 @@ macro(qbt_set_compiler_options)
#-Wshadow -Wconversion ?
set(_GCC_COMMON_C_AND_CXX_FLAGS "-Wall -Wextra"
"-Wfloat-equal -Wcast-qual -Wcast-align"
"-Wsign-conversion -Winvalid-pch -Werror=return-type -Wno-long-long"
# -fstack-protector-all
"-Werror -Wno-error=deprecated-declarations"
"-Wsign-conversion -Winvalid-pch -Wno-long-long"
#"-fstack-protector-all"
#"-Werror -Wno-error=deprecated-declarations"
)
set (_GCC_COMMON_CXX_FLAGS "-fexceptions -frtti"
set(_GCC_COMMON_CXX_FLAGS "-fexceptions -frtti"
"-Woverloaded-virtual -Wold-style-cast"
"-Wnon-virtual-dtor -Wfloat-equal -Wcast-qual -Wcast-align"
"-Werror=overloaded-virtual"
# "-Weffc++"
"-Werror -Wno-error=cpp"
#"-Weffc++"
#"-Werror -Wno-error=cpp"
# we should modify code to make these ones obsolete
"-Wno-error=sign-conversion -Wno-error=float-equal"
#"-Wno-error=sign-conversion -Wno-error=float-equal"
)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)

View File

@@ -1,16 +1,17 @@
# a helper function which appends source to the main qBt target
# sources file names are relative to the the ${qBittorrent_SOURCE_DIR}
# a helper function which appends source to the target
# sources file names are relative to the the target source dir
function (qbt_target_sources)
set (_sources_rel "")
foreach (_source IN ITEMS ${ARGN})
if (IS_ABSOLUTE "${_source}")
set(source_abs "${_source}")
function (qbt_target_sources _target _scope)
get_target_property(targetSourceDir ${_target} SOURCE_DIR)
set(sourcesRelative "")
foreach(source IN ITEMS ${ARGN})
if(IS_ABSOLUTE "${source}")
set(sourceAbsolutePath "${source}")
else()
get_filename_component(_source_abs "${_source}" ABSOLUTE)
get_filename_component(sourceAbsolutePath "${source}" ABSOLUTE)
endif()
file (RELATIVE_PATH _source_rel "${qbt_executable_SOURCE_DIR}" "${_source_abs}")
list (APPEND _sources_rel "${_source_rel}")
file(RELATIVE_PATH sourceRelativePath "${targetSourceDir}" "${sourceAbsolutePath}")
list(APPEND sourcesRelative "${sourceRelativePath}")
endforeach()
target_sources (qBittorrent PRIVATE "${_sources_rel}")
endfunction (qbt_target_sources)
target_sources(${_target} ${_scope} "${sourcesRelative}")
endfunction(qbt_target_sources)

View File

@@ -1,9 +1,9 @@
if (STACKTRACE_WIN)
if (STACKTRACE)
if ("${WINXXBITS}" NOT STREQUAL "Win64")
add_compile_options(-fno-omit-frame-pointer)
endif ("${WINXXBITS}" NOT STREQUAL "Win64")
link_libraries(libdbghelp -Wl,--export-all-symbols)
endif (STACKTRACE_WIN)
endif (STACKTRACE)
if (("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") OR ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo"))
link_libraries(-Wl,--dynamicbase)

View File

@@ -1,4 +1,4 @@
if (STACKTRACE_WIN)
if (STACKTRACE)
if ("${WINXXBITS}" STREQUAL "Win64")
add_compile_options(-Zi)
else ("${WINXXBITS}" STREQUAL "Win64")
@@ -6,7 +6,7 @@ if (STACKTRACE_WIN)
add_compile_options(-Oy-)
endif ("${WINXXBITS}" STREQUAL "Win64")
link_libraries(dbghelp.lib)
endif (STACKTRACE_WIN)
endif (STACKTRACE)
# Enable Wide characters
add_definitions(-DTORRENT_USE_WPATH)

View File

@@ -50,6 +50,8 @@ DEFINES += BOOST_USE_WINAPI_VERSION=0x0501
#DEFINES += BOOST_ASIO_SEPARATE_COMPILATION
# Enable if building against libtorrent 1.0.x (RC_1_0) (dynamic linking)
#DEFINES += BOOST_ASIO_DYN_LINK
# Enable if encountered build error with boost version <= 1.59
#DEFINES += BOOST_NO_CXX11_RVALUE_REFERENCES
# Enable if building against libtorrent 1.1.x (RC_1_1)
# built with this flag defined
@@ -58,4 +60,10 @@ DEFINES += BOOST_USE_WINAPI_VERSION=0x0501
#DEFINES += TORRENT_LINKING_SHARED
# Enable stack trace support
CONFIG += strace_win
CONFIG += stacktrace
win32-msvc* {
QMAKE_CXXFLAGS += "/guard:cf"
QMAKE_LFLAGS += "/guard:cf"
QMAKE_LFLAGS_RELEASE += "/OPT:REF /OPT:ICF"
}

58
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for qbittorrent v4.1.0alpha.
# Generated by GNU Autoconf 2.69 for qbittorrent v4.1.2.
#
# Report bugs to <bugs.qbittorrent.org>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='qbittorrent'
PACKAGE_TARNAME='qbittorrent'
PACKAGE_VERSION='v4.1.0alpha'
PACKAGE_STRING='qbittorrent v4.1.0alpha'
PACKAGE_VERSION='v4.1.2'
PACKAGE_STRING='qbittorrent v4.1.2'
PACKAGE_BUGREPORT='bugs.qbittorrent.org'
PACKAGE_URL='https://www.qbittorrent.org/'
@@ -1297,7 +1297,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures qbittorrent v4.1.0alpha to adapt to many kinds of systems.
\`configure' configures qbittorrent v4.1.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1368,7 +1368,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of qbittorrent v4.1.0alpha:";;
short | recursive ) echo "Configuration of qbittorrent v4.1.2:";;
esac
cat <<\_ACEOF
@@ -1503,7 +1503,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
qbittorrent configure v4.1.0alpha
qbittorrent configure v4.1.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1642,7 +1642,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by qbittorrent $as_me v4.1.0alpha, which was
It was created by qbittorrent $as_me v4.1.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3820,7 +3820,7 @@ fi
# Define the identity of the package.
PACKAGE='qbittorrent'
VERSION='v4.1.0alpha'
VERSION='v4.1.2'
cat >>confdefs.h <<_ACEOF
@@ -5014,6 +5014,40 @@ fi
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
# add workaround for problematic boost version
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# taken from ax_boost_base.m4
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <boost/version.hpp>
int
main ()
{
(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < (106000))]));
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
else
QBT_ADD_DEFINES="$QBT_ADD_DEFINES BOOST_NO_CXX11_RVALUE_REFERENCES"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# Check whether --with-boost-system was given.
@@ -6140,7 +6174,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by qbittorrent $as_me v4.1.0alpha, which was
This file was extended by qbittorrent $as_me v4.1.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6198,7 +6232,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
qbittorrent config.status v4.1.0alpha
qbittorrent config.status v4.1.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -7455,7 +7489,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by qbittorrent $as_me v4.1.0alpha, which was
This file was extended by qbittorrent $as_me v4.1.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -7513,7 +7547,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
qbittorrent config.status v4.1.0alpha
qbittorrent config.status v4.1.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@@ -1,4 +1,4 @@
AC_INIT([qbittorrent], [v4.1.0alpha], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
AC_INIT([qbittorrent], [v4.1.2], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
@@ -168,6 +168,17 @@ AX_BOOST_BASE([1.35],
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
# add workaround for problematic boost version
AC_LANG_PUSH(C++)
# taken from ax_boost_base.m4
m4_define([DETECT_BOOST_VERSION_PROGRAM],
[AC_LANG_PROGRAM([[#include <boost/version.hpp>]],
[[(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($1))]));]])])
AC_COMPILE_IFELSE([DETECT_BOOST_VERSION_PROGRAM(106000)], [],
[QBT_ADD_DEFINES="$QBT_ADD_DEFINES BOOST_NO_CXX11_RVALUE_REFERENCES"])
AC_LANG_POP([C++])
AX_BOOST_SYSTEM()
AC_MSG_NOTICE([Boost.System LIB: "$BOOST_SYSTEM_LIB"])
LIBS="$BOOST_SYSTEM_LIB $LIBS"

2
dist/CMakeLists.txt vendored
View File

@@ -1,3 +1,5 @@
find_package(Qt5Widgets ${requiredQtVersion}) # to conditionally install desktop-related files
if (APPLE)
add_subdirectory(mac)
else (APPLE)

2
dist/mac/Info.plist vendored
View File

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

View File

@@ -1,31 +1,37 @@
if (SYSTEMD)
find_package(Systemd)
if (SYSTEMD_FOUND)
if (NOT Qt5Widgets_FOUND)
feature_option(SYSTEMD "Install systemd service file (headless only)" OFF)
if (SYSTEMD)
if (NOT Systemd_SERVICES_INSTALL_DIR)
find_package(Systemd)
if (NOT Systemd_FOUND)
message(FATAL_ERROR "Could not locate systemd services install dir."
" Either pass -DSystemd_SERVICES_INSTALL_DIR=/path/to/systemd/services option or install systemd pkg-config")
endif(NOT Systemd_FOUND)
endif(NOT Systemd_SERVICES_INSTALL_DIR)
set(EXPAND_BINDIR ${CMAKE_INSTALL_FULL_BINDIR})
configure_file(systemd/qbittorrent-nox@.service.in ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service
DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR}
DESTINATION ${Systemd_SERVICES_INSTALL_DIR}
COMPONENT data)
endif(SYSTEMD_FOUND)
endif(SYSTEMD)
endif(SYSTEMD)
endif()
if (GUI)
if (Qt5Widgets_FOUND)
list(APPEND MAN_FILES ${qBittorrent_SOURCE_DIR}/doc/qbittorrent.1)
else (GUI)
else (Qt5Widgets_FOUND)
list(APPEND MAN_FILES ${qBittorrent_SOURCE_DIR}/doc/qbittorrent-nox.1)
endif (GUI)
endif (Qt5Widgets_FOUND)
install(FILES ${MAN_FILES}
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
COMPONENT doc)
if (GUI)
if (Qt5Widgets_FOUND)
install(DIRECTORY menuicons/
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor
FILES_MATCHING PATTERN "*.png")
install(FILES ${qBittorrent_SOURCE_DIR}/src/icons/qbittorrent.desktop
install(FILES qbittorrent.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/
COMPONENT data)

View File

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

View File

@@ -3,7 +3,6 @@ TEMPLATE = subdirs
SUBDIRS += src
include(version.pri)
include(qm_gen.pri)
# Make target to create release tarball. Use 'make tarball'
tarball.commands += rm -fR ../$${PROJECT_NAME}-$${PROJECT_VERSION}/ &&
@@ -18,6 +17,10 @@ tarball.commands += rm -fR $${PROJECT_NAME}-$${PROJECT_VERSION}
QMAKE_EXTRA_TARGETS += tarball
# Translations included here (at top level) is to avoid regenerating the .qm files
# every time when src.pro is processed
include(src/lang/lang.pri)
# For Qt Creator beautifier
DISTFILES += \
uncrustify.cfg

View File

@@ -1,21 +0,0 @@
TS_IN = $$fromfile(src/src.pro,TRANSLATIONS)
TS_IN_NOEXT = $$replace(TS_IN,".ts","")
isEmpty(QMAKE_LRELEASE) {
win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe
else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
unix {
equals(QT_MAJOR_VERSION, 5) {
!exists($$QMAKE_LRELEASE) { QMAKE_LRELEASE = lrelease-qt5 }
}
} else {
!exists($$QMAKE_LRELEASE) { QMAKE_LRELEASE = lrelease }
}
}
message("Building translations")
for(L,TS_IN_NOEXT) {
message("Processing $${L}")
system("$$QMAKE_LRELEASE -silent src/$${L}.ts -qm src/$${L}.qm")
!exists("src/$${L}.qm"):error("Building translations failed, cannot continue")
}

View File

@@ -1,40 +1,45 @@
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)
find_package(Boost ${requiredBoostVersion} REQUIRED)
find_package(LibtorrentRasterbar REQUIRED)
# Qt
list(APPEND QBT_QT_COMPONENTS Core Network Xml)
if (GUI)
list (APPEND QBT_QT_COMPONENTS Gui Svg Widgets)
if (WIN32)
list (APPEND QBT_QT_COMPONENTS WinExtras)
endif(WIN32)
if (APPLE)
list (APPEND QBT_GUI_OPTIONAL_LINK_LIBRARIES objc)
list (APPEND QBT_QT_COMPONENTS MacExtras)
endif (APPLE)
endif (GUI)
if (DBUS)
list (APPEND QBT_QT_COMPONENTS DBus)
endif (DBUS)
find_package(Qt5 5.5.1 COMPONENTS ${QBT_QT_COMPONENTS} REQUIRED)
if (Boost_VERSION VERSION_LESS 106000)
add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
endif()
if (GUI AND APPLE)
# Fix MOC inability to detect macOS. This seems to only affect cmake.
# Relevant issue: https://bugreports.qt.io/browse/QTBUG-58325
set(CMAKE_AUTOMOC_MOC_OPTIONS ${CMAKE_AUTOMOC_MOC_OPTIONS} -DQ_OS_MAC)
endif ()
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml)
find_package(Qt5Widgets ${requiredQtVersion})
if (Qt5Widgets_FOUND)
find_package(Qt5DBus ${requiredQtVersion})
else()
add_definitions(-DDISABLE_GUI)
endif()
set_package_properties(Qt5Widgets PROPERTIES
DESCRIPTION "Set of components for creating classic desktop-style UIs for the Qt5 framework"
PURPOSE "Enables qBittorrent GUI. Unneeded for headless configuration."
TYPE OPTIONAL
)
set_package_properties(Qt5DBus PROPERTIES
DESCRIPTION "Qt5 module for inter-process communication over the D-Bus protocol"
PURPOSE "Enables communication with other system components (e.g. notification service) via D-Bus. "
TYPE RECOMMENDED
)
set(CMAKE_AUTOMOC True)
list(APPEND CMAKE_AUTORCC_OPTIONS -compress 9 -threshold 5)
if (APPLE)
# Workaround CMake bug (autogen does not pass required parameters to moc)
# Relevant issue: https://gitlab.kitware.com/cmake/cmake/issues/18041
list(APPEND CMAKE_AUTOMOC_MOC_OPTIONS -DQ_OS_MAC -DQ_OS_DARWIN)
endif ()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
@@ -43,56 +48,34 @@ add_definitions(-DQT_NO_CAST_TO_ASCII)
# Efficient construction for QString & QByteArray (Qt >= 4.8)
add_definitions(-DQT_USE_QSTRINGBUILDER)
if (NOT GUI)
add_definitions(-DDISABLE_GUI -DDISABLE_COUNTRIES_RESOLUTION)
endif (NOT GUI)
if (NOT WEBUI)
add_definitions(-DDISABLE_WEBUI)
endif (NOT WEBUI)
if (STACKTRACE)
add_definitions(-DSTACKTRACE)
endif(STACKTRACE)
# nogui {
# TARGET = qbittorrent-nox
# } else {
# CONFIG(static) {
# DEFINES += QBT_STATIC_QT
# QTPLUGIN += qico
# }
# TARGET = qbittorrent
# }
if (UNIX AND NOT APPLE)
add_compile_options(-Wformat -Wformat-security)
endif ()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_BUILD_TYPE MATCHES "Debug")
message(STATUS "Project is built in DEBUG mode.")
else (CMAKE_BUILD_TYPE STREQUAL "Debug")
else()
message(STATUS "Project is built in RELEASE mode.")
message(STATUS "Disabling debug output.")
add_definitions(-DQT_NO_DEBUG_OUTPUT)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(QBT_USE_GUI ${GUI})
set(QBT_USE_WEBUI ${WEBUI})
endif()
configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h)
if (SYSTEM_QTSINGLEAPPLICATION)
find_package(QtSingleApplication REQUIRED)
else (SYSTEM_QTSINGLEAPPLICATION)
find_package(QtSingleApplication)
set_package_properties(QtSingleApplication PROPERTIES
URL "https://code.qt.io/cgit/qt-solutions/qt-solutions.git/"
DESCRIPTION "Qt library to start applications only once per user"
TYPE RECOMMENDED
PURPOSE "Use the system qtsingleapplication library or shipped one otherwise"
)
if (NOT QtSingleApplication_FOUND)
add_subdirectory(app/qtsingleapplication)
endif (SYSTEM_QTSINGLEAPPLICATION)
endif ()
add_subdirectory(app)
add_subdirectory(base)
if (GUI)
if (Qt5Widgets_FOUND)
add_subdirectory(gui)
endif (GUI)
endif ()
if (WEBUI)
add_subdirectory(webui)

View File

@@ -1,19 +1,27 @@
project(qbt_executable)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(QBT_APP_HEADERS
add_executable(qBittorrent
application.h
cmdoptions.h
filelogger.h
)
set(QBT_APP_SOURCES
upgrade.h
application.cpp
cmdoptions.cpp
filelogger.cpp
main.cpp
)
target_include_directories(qBittorrent PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(qBittorrent
PRIVATE
qbt_base
)
set_target_properties(qBittorrent
PROPERTIES
AUTOUIC True
AUTORCC True
MACOSX_BUNDLE True
)
# translations
file(GLOB QBT_TS_FILES ../lang/*.ts)
get_filename_component(QBT_QM_FILES_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/../lang" ABSOLUTE)
@@ -22,9 +30,9 @@ set_source_files_properties(${QBT_TS_FILES} PROPERTIES OUTPUT_LOCATION "${QBT_QM
find_package(Qt5 COMPONENTS LinguistTools REQUIRED)
qt5_add_translation(QBT_QM_FILES ${QBT_TS_FILES})
get_filename_component(_lang_qrc_src "${CMAKE_CURRENT_SOURCE_DIR}/../lang.qrc" ABSOLUTE)
get_filename_component(_lang_qrc_dst "${CMAKE_CURRENT_BINARY_DIR}/../lang.qrc" ABSOLUTE)
get_filename_component(_lang_qrc_dst_dir "${CMAKE_CURRENT_BINARY_DIR}/../" ABSOLUTE)
get_filename_component(_lang_qrc_src "${CMAKE_CURRENT_SOURCE_DIR}/../lang/lang.qrc" ABSOLUTE)
get_filename_component(_lang_qrc_dst "${CMAKE_CURRENT_BINARY_DIR}/../lang/lang.qrc" ABSOLUTE)
get_filename_component(_lang_qrc_dst_dir "${CMAKE_CURRENT_BINARY_DIR}/../lang" ABSOLUTE)
message(STATUS "copying ${_lang_qrc_src} -> ${_lang_qrc_dst}")
file(COPY ${_lang_qrc_src} DESTINATION ${_lang_qrc_dst_dir})
@@ -35,8 +43,8 @@ foreach(qm_file ${QBT_QM_FILES})
endforeach()
set(QBT_APP_RESOURCES
../icons.qrc
../searchengine.qrc
../icons/icons.qrc
../searchengine/searchengine.qrc
"${_lang_qrc_dst}"
)
@@ -46,51 +54,41 @@ qt5_add_resources(QBT_APP_RESOURCE_SOURCE ${QBT_APP_RESOURCES})
if (WIN32)
if (MINGW)
list (APPEND QBT_APP_SOURCES ../qbittorrent_mingw.rc)
target_sources(qBittorrent PRIVATE ../qbittorrent_mingw.rc)
else (MINGW)
list (APPEND QBT_APP_SOURCES ../qbittorrent.rc)
target_sources(qBittorrent PRIVATE ../qbittorrent.rc)
endif (MINGW)
list(APPEND QBT_APP_SOURCES ../qbittorrent.exe.manifest)
target_sources(qBittorrent PRIVATE ../qbittorrent.exe.manifest)
endif (WIN32)
if (STACKTRACE)
if (UNIX)
list(APPEND QBT_APP_HEADERS stacktrace.h)
target_sources(qBittorrent PRIVATE stacktrace.h)
else (UNIX)
list(APPEND QBT_APP_HEADERS stacktrace_win.h)
if (GUI)
list(APPEND QBT_APP_HEADERS stacktrace_win_dlg.h)
endif (GUI)
target_sources(qBittorrent PRIVATE stacktrace_win.h)
if (Qt5Widgets_FOUND)
target_sources(qBittorrent PRIVATE stacktracedialog.h)
endif (Qt5Widgets_FOUND)
endif (UNIX)
endif (STACKTRACE)
# usesystemqtsingleapplication {
# nogui {
# CONFIG += qtsinglecoreapplication
# } else {
# CONFIG += qtsingleapplication
# }
# } else {
# nogui {
# include(qtsingleapplication/qtsinglecoreapplication.pri)
# } else {
# include(qtsingleapplication/qtsingleapplication.pri)
# }
# }
# upgrade code
list(APPEND QBT_APP_HEADERS upgrade.h)
list(APPEND QBT_TARGET_LIBRARIES qbt_base)
if (GUI)
list(APPEND QBT_TARGET_LIBRARIES qbt_searchengine qbt_gui)
include_directories(../gui
${CMAKE_CURRENT_BINARY_DIR}/../gui
if (Qt5Widgets_FOUND)
target_link_libraries(qBittorrent PRIVATE qbt_searchengine qbt_gui)
set_target_properties(qBittorrent
PROPERTIES
OUTPUT_NAME qbittorrent
WIN32_EXECUTABLE True
)
endif (GUI)
else(Qt5Widgets_FOUND)
set_target_properties(qBittorrent
PROPERTIES
OUTPUT_NAME qbittorrent-nox
)
endif (Qt5Widgets_FOUND)
if (WEBUI)
list(APPEND QBT_TARGET_LIBRARIES qbt_webui)
target_link_libraries(qBittorrent PRIVATE qbt_webui)
endif (WEBUI)
# we have to include resources into the bundle
@@ -142,30 +140,11 @@ if (APPLE)
PROPERTIES MACOSX_PACKAGE_LOCATION translations)
endif (APPLE)
add_executable(qBittorrent ${QBT_APP_HEADERS} ${QBT_APP_SOURCES} ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
if (GUI)
set_target_properties(qBittorrent
PROPERTIES
OUTPUT_NAME qbittorrent
WIN32_EXECUTABLE True
)
else (GUI)
set_target_properties(qBittorrent
PROPERTIES
OUTPUT_NAME qbittorrent-nox
)
endif (GUI)
set_target_properties(qBittorrent
PROPERTIES
AUTOUIC True
AUTORCC True
MACOSX_BUNDLE True
)
target_sources(qBittorrent PRIVATE ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
get_target_property(QBT_EXECUTABLE_NAME qBittorrent OUTPUT_NAME)
target_link_libraries(qBittorrent ${QBT_TARGET_LIBRARIES} QtSingleApplication::QtSingleApplication)
target_link_libraries(qBittorrent PRIVATE ${QBT_TARGET_LIBRARIES} QtSingleApplication::QtSingleApplication)
if (APPLE)
set(qbt_BUNDLE_NAME ${QBT_EXECUTABLE_NAME})
@@ -186,6 +165,7 @@ install(TARGETS qBittorrent
BUNDLE DESTINATION .
COMPONENT runtime)
if (GUI AND APPLE)
if (Qt5Widgets_FOUND AND APPLE)
find_package(Qt5Svg REQUIRED)
include(bundle)
endif (GUI AND APPLE)
endif (Qt5Widgets_FOUND AND APPLE)

View File

@@ -32,8 +32,8 @@ stacktrace {
else {
HEADERS += $$PWD/stacktrace_win.h
!nogui {
HEADERS += $$PWD/stacktrace_win_dlg.h
FORMS += $$PWD/stacktrace_win_dlg.ui
HEADERS += $$PWD/stacktracedialog.h
FORMS += $$PWD/stacktracedialog.ui
}
}
}

View File

@@ -31,18 +31,34 @@
#include <algorithm>
#ifdef Q_OS_WIN
#include <memory>
#endif
#include <QAtomicInt>
#include <QDebug>
#include <QFileInfo>
#include <QLibraryInfo>
#include <QLocale>
#include <QProcess>
#include <QSysInfo>
#ifdef Q_OS_WIN
#include <memory>
#include <Shellapi.h>
#endif
#ifndef DISABLE_GUI
#ifdef Q_OS_WIN
#include <QSessionManager>
#include <QSharedMemory>
#endif // Q_OS_WIN
#ifdef Q_OS_MAC
#include <QFileOpenEvent>
#endif // Q_OS_MAC
#include "addnewtorrentdialog.h"
#include "gui/guiiconprovider.h"
#include "mainwindow.h"
#include "shutdownconfirmdialog.h"
#else // DISABLE_GUI
#include <cstdio>
#endif // DISABLE_GUI
#include "base/bittorrent/session.h"
#include "base/bittorrent/torrenthandle.h"
#include "base/iconprovider.h"
@@ -62,28 +78,6 @@
#include "base/utils/string.h"
#include "filelogger.h"
#ifndef DISABLE_GUI
#ifdef Q_OS_WIN
#include <QSessionManager>
#include <QSharedMemory>
#endif // Q_OS_WIN
#ifdef Q_OS_MAC
#include <QFileOpenEvent>
#include <QFont>
#include <QUrl>
#endif // Q_OS_MAC
#include "addnewtorrentdialog.h"
#include "gui/guiiconprovider.h"
#include "mainwindow.h"
#include "shutdownconfirmdlg.h"
#else // DISABLE_GUI
#include <cstdio>
#endif // DISABLE_GUI
#ifdef Q_OS_WIN
#include <Shellapi.h>
#endif
#ifndef DISABLE_WEBUI
#include "webui/webui.h"
#endif
@@ -93,7 +87,7 @@ namespace
#define SETTINGS_KEY(name) "Application/" name
// FileLogger properties keys
#define FILELOGGER_SETTINGS_KEY(name) SETTINGS_KEY("FileLogger/") name
#define FILELOGGER_SETTINGS_KEY(name) QStringLiteral(SETTINGS_KEY("FileLogger/") name)
const QString KEY_FILELOGGER_ENABLED = FILELOGGER_SETTINGS_KEY("Enabled");
const QString KEY_FILELOGGER_PATH = FILELOGGER_SETTINGS_KEY("Path");
const QString KEY_FILELOGGER_BACKUP = FILELOGGER_SETTINGS_KEY("Backup");
@@ -102,13 +96,13 @@ namespace
const QString KEY_FILELOGGER_AGE = FILELOGGER_SETTINGS_KEY("Age");
const QString KEY_FILELOGGER_AGETYPE = FILELOGGER_SETTINGS_KEY("AgeType");
//just a shortcut
// just a shortcut
inline SettingsStorage *settings() { return SettingsStorage::instance(); }
const QString LOG_FOLDER("logs");
const char PARAMS_SEPARATOR[] = "|";
const QString LOG_FOLDER = QStringLiteral("logs");
const QChar PARAMS_SEPARATOR = '|';
const QString DEFAULT_PORTABLE_MODE_PROFILE_DIR = QLatin1String("profile");
const QString DEFAULT_PORTABLE_MODE_PROFILE_DIR = QStringLiteral("profile");
const int MIN_FILELOG_SIZE = 1024; // 1KiB
const int MAX_FILELOG_SIZE = 1000 * 1024 * 1024; // 1000MiB
@@ -151,11 +145,11 @@ Application::Application(const QString &id, int &argc, char **argv)
#endif
#if defined(Q_OS_WIN) && !defined(DISABLE_GUI)
connect(this, SIGNAL(commitDataRequest(QSessionManager &)), this, SLOT(shutdownCleanup(QSessionManager &)), Qt::DirectConnection);
connect(this, &QGuiApplication::commitDataRequest, this, &Application::shutdownCleanup, Qt::DirectConnection);
#endif
connect(this, SIGNAL(messageReceived(const QString &)), SLOT(processMessage(const QString &)));
connect(this, SIGNAL(aboutToQuit()), SLOT(cleanup()));
connect(this, &Application::messageReceived, this, &Application::processMessage);
connect(this, &QCoreApplication::aboutToQuit, this, &Application::cleanup);
if (isFileLoggerEnabled())
m_fileLogger = new FileLogger(fileLoggerPath(), isFileLoggerBackup(), fileLoggerMaxSize(), isFileLoggerDeleteOld(), fileLoggerAge(), static_cast<FileLogger::FileLogAgeType>(fileLoggerAgeType()));
@@ -261,17 +255,17 @@ void Application::setFileLoggerAge(const int value)
int Application::fileLoggerAgeType() const
{
int val = settings()->loadValue(KEY_FILELOGGER_AGETYPE, 1).toInt();
return (val < 0 || val > 2) ? 1 : val;
return ((val < 0) || (val > 2)) ? 1 : val;
}
void Application::setFileLoggerAgeType(const int value)
{
settings()->storeValue(KEY_FILELOGGER_AGETYPE, (value < 0 || value > 2) ? 1 : value);
settings()->storeValue(KEY_FILELOGGER_AGETYPE, ((value < 0) || (value > 2)) ? 1 : value);
}
void Application::processMessage(const QString &message)
{
QStringList params = message.split(QLatin1String(PARAMS_SEPARATOR), QString::SkipEmptyParts);
QStringList params = message.split(PARAMS_SEPARATOR, QString::SkipEmptyParts);
// If Application is not running (i.e., other
// components are not ready) store params
if (m_running)
@@ -290,9 +284,21 @@ void Application::runExternalProgram(const BitTorrent::TorrentHandle *torrent) c
std::sort(tags.begin(), tags.end(), Utils::String::naturalLessThan<Qt::CaseInsensitive>);
program.replace("%G", tags.join(','));
#if defined(Q_OS_WIN)
const auto chopPathSep = [](const QString &str) -> QString
{
if (str.endsWith('\\'))
return str.mid(0, (str.length() -1));
return str;
};
program.replace("%F", chopPathSep(Utils::Fs::toNativePath(torrent->contentPath())));
program.replace("%R", chopPathSep(Utils::Fs::toNativePath(torrent->rootPath())));
program.replace("%D", chopPathSep(Utils::Fs::toNativePath(torrent->savePath())));
#else
program.replace("%F", Utils::Fs::toNativePath(torrent->contentPath()));
program.replace("%R", Utils::Fs::toNativePath(torrent->rootPath()));
program.replace("%D", Utils::Fs::toNativePath(torrent->savePath()));
#endif
program.replace("%C", QString::number(torrent->filesCount()));
program.replace("%Z", QString::number(torrent->totalSize()));
program.replace("%T", torrent->currentTracker());
@@ -301,9 +307,7 @@ void Application::runExternalProgram(const BitTorrent::TorrentHandle *torrent) c
Logger *logger = Logger::instance();
logger->addMessage(tr("Torrent: %1, running external program, command: %2").arg(torrent->name(), program));
#if defined(Q_OS_UNIX)
QProcess::startDetached(QLatin1String("/bin/sh"), {QLatin1String("-c"), program});
#else
#if defined(Q_OS_WIN)
std::unique_ptr<wchar_t[]> programWchar(new wchar_t[program.length() + 1] {});
program.toWCharArray(programWchar.get());
@@ -320,18 +324,20 @@ void Application::runExternalProgram(const BitTorrent::TorrentHandle *torrent) c
QProcess::startDetached(QString::fromWCharArray(args[0]), argList);
::LocalFree(args);
#else
QProcess::startDetached(QLatin1String("/bin/sh"), {QLatin1String("-c"), program});
#endif
}
void Application::sendNotificationEmail(const BitTorrent::TorrentHandle *torrent)
{
// Prepare mail content
const QString content = tr("Torrent name: %1").arg(torrent->name()) + "\n"
+ tr("Torrent size: %1").arg(Utils::Misc::friendlyUnit(torrent->wantedSize())) + "\n"
const QString content = tr("Torrent name: %1").arg(torrent->name()) + '\n'
+ tr("Torrent size: %1").arg(Utils::Misc::friendlyUnit(torrent->wantedSize())) + '\n'
+ tr("Save path: %1").arg(torrent->savePath()) + "\n\n"
+ tr("The torrent was downloaded in %1.", "The torrent was downloaded in 1 hour and 20 seconds")
.arg(Utils::Misc::userFriendlyDuration(torrent->activeTime())) + "\n\n\n"
+ tr("Thank you for using qBittorrent.") + "\n";
+ tr("Thank you for using qBittorrent.") + '\n';
// Send the notification email
const Preferences *pref = Preferences::instance();
@@ -382,7 +388,7 @@ void Application::allTorrentsFinished()
// do nothing & skip confirm
}
else {
if (!ShutdownConfirmDlg::askForConfirmation(m_window, action)) return;
if (!ShutdownConfirmDialog::askForConfirmation(m_window, action)) return;
}
#endif // DISABLE_GUI
@@ -403,7 +409,7 @@ void Application::allTorrentsFinished()
bool Application::sendParams(const QStringList &params)
{
return sendMessage(params.join(QLatin1String(PARAMS_SEPARATOR)));
return sendMessage(params.join(PARAMS_SEPARATOR));
}
// As program parameters, we can get paths or urls.
@@ -489,8 +495,8 @@ int Application::exec(const QStringList &params)
#endif
BitTorrent::Session::initInstance();
connect(BitTorrent::Session::instance(), SIGNAL(torrentFinished(BitTorrent::TorrentHandle *const)), SLOT(torrentFinished(BitTorrent::TorrentHandle *const)));
connect(BitTorrent::Session::instance(), SIGNAL(allTorrentsFinished()), SLOT(allTorrentsFinished()), Qt::QueuedConnection);
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentFinished, this, &Application::torrentFinished);
connect(BitTorrent::Session::instance(), &BitTorrent::Session::allTorrentsFinished, this, &Application::allTorrentsFinished, Qt::QueuedConnection);
#ifndef DISABLE_COUNTRIES_RESOLUTION
Net::GeoIPManager::initInstance();
@@ -511,7 +517,7 @@ int Application::exec(const QStringList &params)
#ifdef DISABLE_GUI
#ifndef DISABLE_WEBUI
Preferences* const pref = Preferences::instance();
Preferences *const pref = Preferences::instance();
// Display some information to the user
const QString mesg = QString("\n******** %1 ********\n").arg(tr("Information"))
+ tr("To control qBittorrent, access the Web UI at %1")
@@ -607,7 +613,7 @@ bool Application::notify(QObject *receiver, QEvent *event)
void Application::initializeTranslation()
{
Preferences* const pref = Preferences::instance();
Preferences *const pref = Preferences::instance();
// Load translation
QString localeStr = pref->getLocale();
@@ -660,7 +666,7 @@ void Application::shutdownCleanup(QSessionManager &manager)
// According to the qt docs we shouldn't call quit() inside a slot.
// aboutToQuit() is never emitted if the user hits "Cancel" in
// the above dialog.
QTimer::singleShot(0, qApp, SLOT(quit()));
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
#endif
@@ -673,7 +679,7 @@ void Application::cleanup()
#ifndef DISABLE_GUI
if (m_window) {
// Hide the window and not leave it on screen as
// Hide the window and don't leave it on screen as
// unresponsive. Also for Windows take the WinId
// after it's hidden, because hide() may cause a
// WinId change.

View File

@@ -40,15 +40,13 @@ typedef QtSingleApplication BaseApplication;
class MainWindow;
#ifdef Q_OS_WIN
QT_BEGIN_NAMESPACE
class QSessionManager;
QT_END_NAMESPACE
#endif // Q_OS_WIN
#else
#include "qtsinglecoreapplication.h"
typedef QtSingleCoreApplication BaseApplication;
#endif
#endif // DISABLE_GUI
#include "base/utils/misc.h"
#include "cmdoptions.h"
@@ -110,9 +108,9 @@ public:
protected:
#ifndef DISABLE_GUI
#ifdef Q_OS_MAC
bool event(QEvent *);
bool event(QEvent *) override;
#endif
bool notify(QObject* receiver, QEvent* event) override;
bool notify(QObject *receiver, QEvent *event) override;
#endif
private slots:

View File

@@ -2,7 +2,7 @@
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2016 Eugene Shalygin <eugene.shalygin@gmail.com>
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2006 Christophe Dumez
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -26,8 +26,6 @@
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/
#include "cmdoptions.h"
@@ -100,7 +98,7 @@ namespace
};
// Boolean option.
class BoolOption: protected Option
class BoolOption : protected Option
{
public:
constexpr BoolOption(const char *name, char shortcut = 0)
@@ -118,7 +116,7 @@ namespace
{
QString val = env.value(envVarName());
// we accept "1" and "true" (upper or lower cased) as boolean 'true' values
return (val == QLatin1String("1") || val.toUpper() == QLatin1String("TRUE"));
return ((val == QLatin1String("1")) || (val.toUpper() == QLatin1String("TRUE")));
}
QString usage() const
@@ -137,7 +135,7 @@ namespace
}
// Option with string value. May not have a shortcut
struct StringOption: protected Option
struct StringOption : protected Option
{
public:
constexpr StringOption(const char *name)
@@ -184,7 +182,7 @@ namespace
}
// Option with integer value. May not have a shortcut
class IntOption: protected StringOption
class IntOption : protected StringOption
{
public:
constexpr IntOption(const char *name)
@@ -230,7 +228,7 @@ namespace
// Option that is explicitly set to true or false, and whose value is undefined when unspecified.
// May not have a shortcut.
class TriStateBoolOption: protected Option
class TriStateBoolOption : protected Option
{
public:
constexpr TriStateBoolOption(const char *name, bool defaultValue)
@@ -260,10 +258,10 @@ namespace
else if (parts.size() == 2) {
QString val = parts[1];
if (val.toUpper() == QLatin1String("TRUE") || val == QLatin1String("1")) {
if ((val.toUpper() == QLatin1String("TRUE")) || (val == QLatin1String("1"))) {
return TriStateBool::True;
}
else if (val.toUpper() == QLatin1String("FALSE") || val == QLatin1String("0")) {
else if ((val.toUpper() == QLatin1String("FALSE")) || (val == QLatin1String("0"))) {
return TriStateBool::False;
}
}
@@ -285,10 +283,10 @@ namespace
else if (val == QLatin1String("-1")) {
return TriStateBool::Undefined;
}
else if (val.toUpper() == QLatin1String("TRUE") || val == QLatin1String("1")) {
else if ((val.toUpper() == QLatin1String("TRUE")) || (val == QLatin1String("1"))) {
return TriStateBool::True;
}
else if (val.toUpper() == QLatin1String("FALSE") || val == QLatin1String("0")) {
else if ((val.toUpper() == QLatin1String("FALSE")) || (val == QLatin1String("0"))) {
return TriStateBool::False;
}
else {
@@ -360,7 +358,7 @@ QStringList QBtCommandLineParameters::paramList() const
// the user has specified. Here we place special strings that are
// almost certainly not going to collide with a file path or URL
// specified by the user, and placing them at the beginning of the
// string listr so that they will be processed before the list of
// string list so that they will be processed before the list of
// torrent paths or URLs.
if (!savePath.isEmpty())
@@ -404,9 +402,9 @@ QBtCommandLineParameters parseCommandLine(const QStringList &args)
const QString &arg = args[i];
if ((arg.startsWith("--") && !arg.endsWith(".torrent"))
|| (arg.startsWith("-") && (arg.size() == 2))) {
|| (arg.startsWith('-') && (arg.size() == 2))) {
// Parse known parameters
if ((arg == SHOW_HELP_OPTION)) {
if (arg == SHOW_HELP_OPTION) {
result.showHelp = true;
}
#ifndef Q_OS_WIN
@@ -501,7 +499,7 @@ QString wrapText(const QString &text, int initialIndentation = USAGE_TEXT_COLUMN
foreach (const QString &word, words.mid(1)) {
if (lines.last().length() + word.length() + 1 < currentLineMaxLength) {
lines.last().append(" " + word);
lines.last().append(' ' + word);
}
else {
lines.append(QString(initialIndentation, ' ') + word);
@@ -509,7 +507,7 @@ QString wrapText(const QString &text, int initialIndentation = USAGE_TEXT_COLUMN
}
}
return lines.join("\n");
return lines.join('\n');
}
QString makeUsage(const QString &prgName)

View File

@@ -2,7 +2,7 @@
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2016 Eugene Shalygin <eugene.shalygin@gmail.com>
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2006 Christophe Dumez
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -26,8 +26,6 @@
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/
#ifndef APP_OPTIONS_H
@@ -62,11 +60,11 @@ struct QBtCommandLineParameters
QStringList paramList() const;
};
class CommandLineParameterError: public std::runtime_error
class CommandLineParameterError : public std::runtime_error
{
public:
CommandLineParameterError(const QString &messageForUser);
const QString& messageForUser() const;
const QString &messageForUser() const;
private:
const QString m_messageForUser;

View File

@@ -26,11 +26,13 @@
* exception statement from your version.
*/
#include "filelogger.h"
#include <QDateTime>
#include <QDir>
#include <QFile>
#include <QTextStream>
#include "filelogger.h"
#include "base/logger.h"
#include "base/utils/fs.h"
@@ -41,17 +43,17 @@ FileLogger::FileLogger(const QString &path, const bool backup, const int maxSize
{
m_flusher.setInterval(0);
m_flusher.setSingleShot(true);
connect(&m_flusher, SIGNAL(timeout()), SLOT(flushLog()));
connect(&m_flusher, &QTimer::timeout, this, &FileLogger::flushLog);
changePath(path);
if (deleteOld)
this->deleteOld(age, ageType);
const Logger* const logger = Logger::instance();
foreach (const Log::Msg& msg, logger->getMessages())
const Logger *const logger = Logger::instance();
foreach (const Log::Msg &msg, logger->getMessages())
addLogMessage(msg);
connect(logger, SIGNAL(newLogMessage(const Log::Msg &)), SLOT(addLogMessage(const Log::Msg &)));
connect(logger, &Logger::newLogMessage, this, &FileLogger::addLogMessage);
}
FileLogger::~FileLogger()
@@ -61,7 +63,7 @@ FileLogger::~FileLogger()
delete m_logFile;
}
void FileLogger::changePath(const QString& newPath)
void FileLogger::changePath(const QString &newPath)
{
QString tmpPath = Utils::Fs::fromNativePath(newPath);
QDir dir(tmpPath);
@@ -83,21 +85,21 @@ void FileLogger::changePath(const QString& newPath)
void FileLogger::deleteOld(const int age, const FileLogAgeType ageType)
{
QDateTime date = QDateTime::currentDateTime();
QDir dir(m_path);
switch (ageType) {
case DAYS:
date = date.addDays(age);
break;
case MONTHS:
date = date.addMonths(age);
break;
default:
date = date.addYears(age);
}
QDir dir(Utils::Fs::branchPath(m_path));
foreach (const QFileInfo file, dir.entryInfoList(QStringList("qbittorrent.log.bak*"), QDir::Files | QDir::Writable, QDir::Time | QDir::Reversed)) {
if (file.lastModified() < date)
QDateTime modificationDate = file.lastModified();
switch (ageType) {
case DAYS:
modificationDate = modificationDate.addDays(age);
break;
case MONTHS:
modificationDate = modificationDate.addMonths(age);
break;
default:
modificationDate = modificationDate.addYears(age);
}
if (modificationDate > date)
break;
Utils::Fs::forceRemove(file.absoluteFilePath());
}

View File

@@ -76,4 +76,3 @@ private:
};
#endif // FILELOGGER_H

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