Compare commits

...

269 Commits

Author SHA1 Message Date
sledgehammer999
d2f3d1ec2c Bump to 4.0.4 2018-02-16 00:46:34 +02:00
sledgehammer999
bc6e3ae40d Sync translations from Transifex and run lupdate. 2018-02-09 21:14:58 +02:00
sledgehammer999
b02e239f7c Set default file log size to 65 KiB and delete backup logs older than 1 month. 2018-02-09 20:50:43 +02:00
Luís Pereira
397cd4bf60 Don't set application name twice
It's an artifact introduced by commit b3c73b7868.
2018-02-09 20:50:43 +02:00
Thomas Piccirello
409f972ad3 Add missing units 2018-02-09 20:50:42 +02:00
Thomas Piccirello
267961ffca Right-align stat values 2018-02-09 20:50:41 +02:00
Thomas Piccirello
dff753c452 Remove invalid subnets directly from list 2018-02-09 20:50:41 +02:00
Thomas Piccirello
ce3bafd30d Perform ip string validation inside setWebUiAuthSubnetWhitelist 2018-02-09 20:50:40 +02:00
Thomas Piccirello
e5538d9f25 Separate subnet whitelist options into two lines 2018-02-09 20:50:39 +02:00
Tom Piccirello
7a8a32b1c3 Remove default case, fix #8302 2018-02-09 20:50:39 +02:00
Vladimir Golovnev (Glassez)
cac5e0391b Remove legacy and corrupted RSS settings 2018-02-09 20:50:38 +02:00
Vladimir Golovnev (Glassez)
726790fa93 Require '#pragma once' in new code 2018-02-09 20:50:37 +02:00
Thomas Piccirello
c9c7a5be53 Add default case 2018-02-09 20:50:36 +02:00
sledgehammer999
1495513cfc Revert "Remove examples from gpl.html. Closes #7749."
The GPL folks are a bit overzealous. See https://www.gnu.org/licenses/gpl-faq.html#GPLOmitPreamble

This reverts commit 5cf4f00824.
2018-02-09 20:50:36 +02:00
sledgehammer999
085afaac14 Sync translations from Transifex and run lupdate. 2018-02-09 20:50:34 +02:00
Thomas Piccirello
d58a54c758 Use switch statement 2018-02-09 20:50:33 +02:00
Thomas Piccirello
78d9bcb6a1 Match webui statuses to gui, closes #7516 2018-02-09 20:50:33 +02:00
Tom Piccirello
1a43cd329d Only add search separators as needed 2018-02-09 20:50:32 +02:00
Jesse Bryan
2fe687eeca transferlist: added a force reannounce option. closes #6448. 2018-02-09 20:50:31 +02:00
Chocobo1
107bd8a54f Torrent creator: raise maximum piece size to 32 MiB 2018-02-09 20:50:31 +02:00
Chocobo1
865df3fcf1 Fix translation context.
Partially addresses #8220.

Also sort include headers
2018-02-09 20:50:30 +02:00
sledgehammer999
cbf9c52462 Update copyright year. 2018-02-09 20:50:29 +02:00
Chocobo1
171e25e962 Fix translation context. Closes #8211. 2018-02-09 20:50:11 +02:00
sledgehammer999
239d14fd10 Update configure version info. 2018-01-03 23:29:59 +02:00
sledgehammer999
0b7a175156 Update libtorrent bottle for Travis. 2018-01-03 23:28:24 +02:00
Chocobo1
b37dbb60b5 Sort filename lists in .pri files 2018-01-03 23:28:18 +02:00
sledgehammer999
d5acd1f210 configure: Parse all compiler related flags together. 2018-01-03 03:18:15 +02:00
sledgehammer999
65eda4a68e Fix splitting of compiler flags in configure.
Autoconf removes a set of [] during script translation, resulting in a wrong sed command.
2018-01-03 03:18:14 +02:00
sledgehammer999
7209881025 Fix constant status of '[F] Downloading'. Closes #7628. 2018-01-03 03:18:13 +02:00
Chocobo1
a5d0a4b619 Fix column size too narrow on resize
Instead of giving a value, just resize to the content size
2018-01-03 03:18:13 +02:00
Chocobo1
79276a8786 Resize dialog size on high DPI monitors 2018-01-03 03:18:12 +02:00
Chocobo1
fa2b645a64 Fix gui issues on high DPI monitor
Fix LineEdit widget size issues
Up-scale the icons on statusbar
Up-scale the icons in options dialog. Closes #7729.
Fix small icons in cookie manager
Fix progress bar height
Fix small icons in confirm delete dialog
Fix small icons in options dialog
Fix small images in about dialog
2018-01-03 03:18:11 +02:00
Chocobo1
4d5d6df734 Tweak spacing 2018-01-03 03:18:10 +02:00
Chocobo1
2c39b69c18 Cleanup
Use Qt5 connect syntax
Reorder include headers
2018-01-03 03:18:10 +02:00
Chocobo1
13c0077e95 Revert "Run external program" function
This revert df95efe33e partially
2018-01-03 03:18:09 +02:00
Vladimir Golovnev (Glassez)
9299e3f371 Don't process new/updated RSS rules when disabled 2018-01-03 03:18:08 +02:00
Thomas Piccirello
b9ddc6ee86 Use https for www.qbittorrent.org 2018-01-03 03:18:07 +02:00
Thomas Piccirello
276856a614 Add Time Active column 2018-01-03 03:18:07 +02:00
Thomas Piccirello
fbd6a8a0da Add Tags columns 2018-01-03 03:18:06 +02:00
Thomas Piccirello
6fc18b4af6 Reposition Total Size column to match gui 2018-01-03 03:18:05 +02:00
Thomas Piccirello
44d633fb68 Make value formatting consistent with GUI 2017-12-24 03:01:17 +02:00
Thomas Piccirello
eb4bf6cc68 Add "Remaining" and "Availability" columns to webui Content tab 2017-12-24 03:01:15 +02:00
jan.karberg
6db6c850eb search only when category is supported by plugin Closes #8053 2017-12-24 03:01:14 +02:00
thalieht
02ae1e3734 Make peer information flags in peerlist more readable 2017-12-24 03:01:13 +02:00
sledgehammer999
eb887139fd Fix application of speed limits on LAN and μTP connections. Closes #7745. 2017-12-24 03:01:12 +02:00
sledgehammer999
84805f7fb8 Fix natural sorting when the common part of 2 strings ends partially in a number which continues in the uncommon part.
Closes #8080 #6732.
2017-12-24 03:01:11 +02:00
sledgehammer999
2719131ed2 Simplify sorting code. 2017-12-24 03:01:10 +02:00
sledgehammer999
52401bd2b0 Fix sorting of country flags column in Peers tab. 2017-12-24 03:01:09 +02:00
Vladimir Golovnev (Glassez)
4834703bc4 Fix RSS rule updated when deleting
Closes #8094
2017-12-24 03:01:08 +02:00
Chocobo1
3ed73244b1 Use standard folder icon for open file behavior on Windows. Closes #7880. 2017-12-24 03:01:07 +02:00
vit9696
97cd430125 Fix cmd+w not closing the main window on macOS 2017-12-24 03:01:06 +02:00
vit9696
d202b85d51 Fix Finder reveal in preview and torrent contents 2017-12-24 03:01:05 +02:00
vit9696
c51b79e9fc Put macOS specific functions to MacUtils namespace 2017-12-24 03:01:04 +02:00
vit9696
4449018207 Fix torrent file selection in Finder on mac 2017-12-24 03:01:03 +02:00
Chocobo1
ced8e41473 Add source field in Torrent creator. Closes #7965.
This field is often used for cross-seeding between (private) trackers.
2017-12-24 03:01:02 +02:00
Chocobo1
2c66ed6708 Add struct TorrentCreatorParams for passing parameters
Filter out continuous newlines in Trackers field
Avoid adding empty url seed entries

Cleanup:
  Replace boost::bind
  Add const
  Use nullptr
  Use QString::SkipEmptyParts
  Rename variables
  Throw proper exception type
2017-12-24 03:01:01 +02:00
Chocobo1
c7d3d6ac90 WebUI: Only prepend scheme when it is not present. Closes #8057. 2017-12-24 03:00:55 +02:00
sledgehammer999
13210b3e9f Bump to 4.0.3 2017-12-17 23:31:59 +02:00
sledgehammer999
6e622fc23b Sync translations from Transifex and run lupdate. 2017-12-17 23:19:17 +02:00
Vladimir Golovnev (Glassez)
ae35111b59 Fix WebUI is not reachable via IPv6 2017-12-17 23:07:59 +02:00
Chocobo1
e1c3d419a7 Disable the "?" help button in all dialogs on Windows. Closes #7365. 2017-12-17 23:07:58 +02:00
Chocobo1
7396b8adba Partial revert eac8838dc2. Fixes #7952.
mapFromSource() didn't work as expected, when used in lessThan(), it sometimes
returns an invalid QModelIndex.
A crash is observed when filtering source model via filterAcceptsRow() in #7952,
the crash is due to endless recursive of filterAcceptsRow() & lessThan() calling
each other and mapFromSource() is the culprit of it.
2017-12-17 23:07:57 +02:00
Chocobo1
c09001545d Allow to drag-n-drop URLs into mainwindow to initiate download
Fix issue: https://github.com/qbittorrent/qBittorrent/issues/7785#issuecomment-347092418
Minor refactor
2017-12-17 23:07:55 +02:00
Chocobo1
f8d4315f7e [WebUI] Use POST for logout command
This is to avoid browser being smart to prefetch the link then logging
out the user.
2017-12-17 23:07:54 +02:00
Chocobo1
1fa2957d27 [WebUI] Add check to avoid type error after logout 2017-12-17 23:07:53 +02:00
Chocobo1
ade50d2b53 Fix missing qbt logo on login page in webUI. Closes #7953. 2017-12-17 23:07:52 +02:00
sledgehammer999
0fa1d35b87 Add height padding to the transfer list icons. Closes #7951. 2017-12-17 23:07:29 +02:00
sledgehammer999
6486fc5f4d Bump to 4.0.2 2017-12-01 01:59:53 +02:00
sledgehammer999
1e059ab1a2 Sync translations from Transifex and run lupdate. 2017-12-01 01:44:49 +02:00
Mike Tzou
15b137211b [GUI] Implement stable sort (#7703)
* NaturalCompare now returns compare result instead of "less than" result
* Change to stable sort in GUI components
* Add Utils::String::naturalLessThan() helper function
* Use Qt::CaseSensitivity type
2017-12-01 01:39:16 +02:00
thalieht
6f8f1d7bad Coding style for many files 2017-12-01 01:39:15 +02:00
sledgehammer999
a31f0c0a3d Stop logging IP filter parsing errors after a while.
When a lot of errors happen the resulting log lines introduce
a huge slowdown of the GUI, due to writing each log line to disk.

Closes #7755.
2017-12-01 01:39:08 +02:00
Evgeny Lensky
f977d1293a Fix i386 build (configure)
Fix building on i686 fails with wrong multilib library path #7845

and rebregenerate ./configure
2017-11-27 19:16:03 +02:00
sledgehammer999
1399be50cb Fix crash on some systems when creating address object for 255.255.255.255
Closes #7735.
2017-11-27 19:14:41 +02:00
Vladimir Golovnev (Glassez)
52dcf32cc8 Implement Import/Export RSS rules in JSON format 2017-11-27 19:14:40 +02:00
Vladimir Golovnev (Glassez)
52b2b807ab Implement Import/Export RSS rules in legacy format 2017-11-27 19:14:38 +02:00
sledgehammer999
5cf4f00824 Remove examples from gpl.html. Closes #7749. 2017-11-27 19:14:37 +02:00
TheNicker
faa6fad025 Fixed blurry text under Windows by setting DPI awareness to default 2017-11-27 19:14:36 +02:00
Vladimir Golovnev (Glassez)
9f94bbce3a Fix RSS Parser
Closes #7751
Closes #7763
Closes #7768
Closes #7786
2017-11-27 19:14:35 +02:00
Chocobo1
5c49b2486c Change MixedModeAlgorithm default to TCP. Closes #7779.
MixedModeAlgorithm::Proportional will throttle TCP connections when utp
is in use and users is expecting maximum speed no matter what, so now
disable the throttling.
2017-11-27 19:14:34 +02:00
thoradia
4f6e7f97c6 Fix missing include in rss_feed.cpp
Fixes #7805.
2017-11-27 19:14:33 +02:00
sledgehammer999
7751c5b75c Merge pull request #7835 from heirecka/v4_0_x
Fix build with --disable-webui
2017-11-23 01:50:21 +02:00
Heiko Becker
a1a9f3317b Fix build with --disable-webui
"app/application.cpp:108:7: error: class 'Application' does not have
any field named 'm_webui'"
2017-11-22 21:30:08 +01:00
sledgehammer999
fb20f59a96 Bump to 4.0.1 2017-11-22 01:18:04 +02:00
sledgehammer999
a15e3407b0 Bump API_VERSION to 16. 2017-11-22 01:14:58 +02:00
sledgehammer999
e267c2d37a Sync translations from Transifex and run lupdate. 2017-11-22 01:05:19 +02:00
sledgehammer999
ae32edeb26 Correctly check if torrent passed during application start already exists. 2017-11-22 01:05:18 +02:00
Chocobo1
34d38ef466 Fix crash when aborting a torrent creation process. Closes #7783.
The wait time wasn't long enough causing the thread to
terminate prematurely.
Also, to avoid crashing qbt entirely when creating a torrent for a very
big file, I decided to wait indefinitely here.
2017-11-22 01:05:17 +02:00
Chocobo1
120ee6b836 Wrap function into anonymous namespace 2017-11-22 01:05:15 +02:00
Chocobo1
7d25b6fce2 Avoid double delete on close 2017-11-22 01:05:14 +02:00
Chocobo1
068eff9e9f Use Qt5 connect syntax 2017-11-22 01:05:13 +02:00
Chocobo1
31a55f79f1 Remove superfluous QString::fromUtf8() 2017-11-22 01:03:41 +02:00
Chocobo1
bac032e01c Allow drag-n-drop magnet links to mainwindow. Closes #7742. 2017-11-22 01:03:40 +02:00
sledgehammer999
b809941f02 Fix english typo. 2017-11-22 01:03:39 +02:00
Chocobo1
77c3758090 [WebUI] Fix logo missing in login page 2017-11-22 01:03:37 +02:00
luigino
5758817189 qtsingleapplication should always be built statically to avoid dependency problems 2017-11-20 22:48:56 +02:00
Thomas Piccirello
acc9f08a05 Remove duplicate header 2017-11-20 22:48:55 +02:00
Thomas Piccirello
f3b7f17a7c Enable preferences Apply button when ip banlist is modified 2017-11-20 22:48:54 +02:00
Thomas Piccirello
dfc3f047e2 Add ip subnet whitelist for bypassing webui auth 2017-11-20 22:48:53 +02:00
sledgehammer999
223ab7de84 Fix crash on opening torrent/magnet (uninitialized pointer). Closes #7739 #7723. 2017-11-20 22:48:52 +02:00
sledgehammer999
d2a4027347 Improve the github issue template. 2017-11-20 22:48:37 +02:00
sledgehammer999
4594895082 Bump to 4.0.0 2017-11-20 02:43:03 +02:00
sledgehammer999
e457223fcd Update Changelog. 2017-11-20 02:31:42 +02:00
sledgehammer999
8fc25c4524 Sync translations from Transifex and run lupdate. 2017-11-20 02:24:02 +02:00
sledgehammer999
410e133592 Use new logo in the file icon. 2017-11-20 02:10:03 +02:00
sledgehammer999
e114bc7ef6 Use new logo in the splash screen. 2017-11-20 02:10:02 +02:00
sledgehammer999
6ac57cb24c Remove unused image. 2017-11-20 02:10:01 +02:00
sledgehammer999
2b7893adc8 Use the SVG for the tray icon. 2017-11-20 02:10:00 +02:00
sledgehammer999
84b8832d57 Change qbittorrent logo. Issue #6467. 2017-11-20 02:09:59 +02:00
Vladimir Golovnev (Glassez)
0e738b534c Fix WebUI error handling 2017-11-20 02:09:58 +02:00
Chocobo1
96ce8690b6 Simplify AX_BOOST_BASE usage
Regenerate configure
2017-11-20 02:09:57 +02:00
Chocobo1
a23698940c Sync m4 macros with upstream 2017-11-20 02:09:56 +02:00
Chocobo1
50bb733293 [WebAPI] Improve error messages
Also refactor to use class methods
2017-11-20 02:09:55 +02:00
Vladimir Golovnev (Glassez)
6420157b55 Improve RSS events logging
Fix RSS log messages was untranslatable.
Add more logging.
2017-11-20 02:09:54 +02:00
Eugene Shalygin
86bdfbf88c Add option to tune download history list length. Closes #4043. 2017-11-20 02:09:53 +02:00
Eugene Shalygin
81e8f79164 Add maxVisibleItems combo box property to FileSystemPathComboEdit. 2017-11-20 02:09:52 +02:00
Chocobo1
64a0ad33c1 Include/print caught signal in stackdump 2017-11-20 02:09:51 +02:00
Nikolay Korotysh
3cd0ffecaf dropped unneeded executable flag from several files 2017-11-20 02:09:50 +02:00
sledgehammer999
a2ddabaedb Bump API_VERSION to 16. 2017-11-20 02:09:49 +02:00
sledgehammer999
1fec1978aa Update Changelog. 2017-11-20 02:09:48 +02:00
Chocobo1
8de67fd745 Refactor
Add const
Use Qt5 connect syntax
2017-11-20 02:09:47 +02:00
Chocobo1
3b51582416 Explicitly set UPnP state on start-up. Closes #7338.
libtorrent 1.1 enables upnp by default.
2017-11-20 02:09:46 +02:00
sledgehammer999
ffa2fdce9d Change default settings for tracker/tier announces to mimick ìTorrent behavior. 2017-11-20 02:09:45 +02:00
sledgehammer999
588f1c7592 Allow to specify if announcing to all tiers is desired. 2017-11-20 02:09:44 +02:00
Chocobo1
ab1ece2460 Open links in browser. Closes #7651. 2017-11-20 02:09:43 +02:00
sledgehammer999
7a935d8a87 Add Turkish translator in about page. 2017-11-20 02:09:42 +02:00
Chocobo1
3926eba585 Allow SMTP sender to be set. Closes #7575. 2017-11-20 02:09:41 +02:00
Chocobo1
74bf420610 Disable processing events when adding torrents. Closes #7436.
webUI connection timeout & deletion might occur while
doing processEvents() and will result in use-after-free segfault.
2017-11-20 02:09:39 +02:00
Chocobo1
324f18a0b2 [WebUI] Improve log messages 2017-11-20 02:09:38 +02:00
sledgehammer999
c134e391e6 Run lupdate again. 2017-11-20 02:09:37 +02:00
sledgehammer999
24504951b0 Mention more translators in the about page after their request. 2017-11-20 02:09:35 +02:00
sledgehammer999
f7f02ab16a String fixes and optimizations mentioned by translators on Transifex. 2017-11-20 02:09:29 +02:00
sledgehammer999
fe810fcd37 Revert "Update Transifex config file."
This reverts commit e872719ef1.
2017-10-24 01:31:06 +03:00
sledgehammer999
17167e79d2 Sync translations from Transifex and run lupdate. 2017-10-24 01:31:04 +03:00
Chocobo1
7bd86048a8 WebAPI refactor: utilize parseBool() function
Coding style cleanup
Rename variable
Return const reference
Add const
2017-10-24 01:30:37 +03:00
Chocobo1
d399f024a7 Reinitialize webUI server when "IP address" setting changed
An app restart won't be necessary from now on.
2017-10-24 01:30:36 +03:00
sledgehammer999
21f06abef8 Fix row height/width in webui for country flags.
Patch by Chocobo1.
2017-10-24 01:07:57 +03:00
sledgehammer999
fbe0e96fd5 Use svg icons for the country flags.
Closes #6223.
2017-10-24 01:07:55 +03:00
Matthew Fioravante
94e00dd38d Add WebUi\Address config option 2017-10-24 01:07:54 +03:00
Chocobo1
c3f5432877 [WebUI]: Print error messages upon receiving invalid header fields 2017-10-24 01:07:53 +03:00
dzmat
4dcc187a72 speedwidget class: excess QtConcurent usage removal 2017-10-24 01:07:51 +03:00
scootergrisen
97c99dfaaf Add me for danish 2017-10-24 01:07:50 +03:00
sledgehammer999
da83041a3f Generate pngs using svgexport and optimize using PNGGauntlet. 2017-10-24 01:07:49 +03:00
sledgehammer999
d40a4f14dd Optimize and prettify the svg source using svgo. 2017-10-24 01:07:48 +03:00
LordNyriox
de7b0278f4 Invert Framing for Torrent Status Icons
Also recolor the icons to match the text-color used for the torrent-status as well. 
Optimized using SVGOMG [<https://jakearchibald.github.io/svgomg/>].
2017-10-24 01:07:47 +03:00
Chocobo1
17f5e10ffc Convert tab into whitespaces 2017-10-24 01:07:45 +03:00
Chocobo1
a0dbb6c97c WebUI: add optional parameters for /command/download & /command/upload
Specifically:
torrent name: string
download limit, upload limit: number in bytes, default: -1 (unlimited)
sequential download, first last piece prio: boolean true/false, default: false
2017-10-24 01:07:44 +03:00
Chocobo1
4d330a6110 Add uploadLimit, downloadLimit fields to AddTorrentData & AddTorrentParams 2017-10-24 01:07:43 +03:00
Chocobo1
9fc2bf6353 Add file-to-piece-index mappings in /query/propertiesFiles command
Also do the following cleanups:
  Use string constant QB_EXT
  Remove redundant variable
  Add const
2017-10-24 01:07:42 +03:00
sledgehammer999
f9c7121847 Sync translations from Transifex and run lupdate. 2017-10-24 01:07:31 +03:00
Eugene Shalygin
d3a0ac3b6e Make BitTorrent::TorrentState strongly-typed enum
This is needed to forward declare this type and pass it by value.

Conversion from/to QVariant are hanled via Q_DECLARE_METATYPE, while
TorrentState::toString() function was used in webui only and as such is
moved there.
2017-10-24 00:57:58 +03:00
Tim Delaney
a6c99844de Follow project coding style. Issue #2192.
--HG--
branch : magao-dev
2017-10-24 00:57:57 +03:00
Chocobo1
d51a957247 Die gracefully when failed to initialize web server with qbt-nox 2017-10-24 00:57:56 +03:00
Matthew Fioravante
a0c16cd461 Report TCPServer errorString() if webui fails to listen to port 2017-10-24 00:57:55 +03:00
Chocobo1
8fe11dff91 Fix delete key has no effect due to "Ambiguous shortcut overload"
We want to show the accelerator key in the menu but without hitting
the ambiguous overload error.
Fixup of 1378245a63
2017-10-24 00:57:54 +03:00
Eugene Shalygin
efcdcf5898 Update uncrustify config 2017-10-24 00:57:52 +03:00
sledgehammer999
da543cdae2 Optimize SVGs.
Used svgo with commands --pretty --indent=2 --multipass.
2017-10-24 00:55:41 +03:00
sledgehammer999
0374742e57 Optimize PNGs.
Using PNGGauntlet.
2017-10-24 00:55:39 +03:00
sledgehammer999
408052d1ec Remove unused image. Possibly leftover from dropping Qt4. 2017-10-24 00:55:38 +03:00
sledgehammer999
b0ebbc3596 Drop OS/2 support. 2017-10-24 00:55:37 +03:00
sledgehammer999
e45e1166b2 Show new paths in native form. 2017-10-24 00:55:35 +03:00
thalieht
de64d5c3bc Save ratio limits as int instead of string 2017-10-24 00:55:34 +03:00
thalieht
07130c4b26 Coding style, use nullptr and other minor things 2017-10-24 00:55:33 +03:00
thalieht
8482464ad0 Properly pre-select the selected torrent's current ratio limiting options in UpDownRatioDlg dialogs. Fixes #7352 2017-10-24 00:55:32 +03:00
Eugene Shalygin
d7ce6e39d4 cmake: do not use Qt5Widgets when locating QtSingleApplication. Closes #7551.
This fixes cmake builds with GUI disabled and system
QtSingleApplication. We rely on Qt5::Core instead of Qt5::Widgets.
2017-10-24 00:55:30 +03:00
Chocobo1
97acbd5259 Set QTextOption::NoWrap property in "Download from URLs" dialog
This makes it easier to put each magnet link on its own line
2017-10-24 00:55:29 +03:00
Nick Korotysh
60937a1871 show delete accelerator key in menu. closes #7508 2017-10-24 00:55:28 +03:00
Nick Korotysh
ed43bc377d allow search plugins sorting. closes #7526 2017-10-24 00:55:27 +03:00
Vladimir Golovnev (Glassez)
8d11929815 Reformat Windows build configuration files 2017-10-24 00:55:26 +03:00
dzmat
0e6f8c15c5 transferlistwidget class members names clarification 2017-10-24 00:55:24 +03:00
Chocobo1
8107201a5b Fix "Time active" field in transfer list
The "Time active" field was broken, displaying nothing when in
downloading state.
Also change type to int to match the return
types of TorrentHandle::activeTime() & TorrentHandle::seedingTime()
2017-10-24 00:55:23 +03:00
Vladimir Golovnev (Glassez)
395ea4d1d0 Implement TorrentCategoryDialog class 2017-10-24 00:55:22 +03:00
Vladimir Golovnev (Glassez)
7bf317929b Use Qt5 connect() style in CategoryFilterWidget 2017-10-24 00:55:21 +03:00
Chocobo1
3cacf876c9 Show torrent name in "add new torrent" dialog on merging trackers 2017-10-24 00:55:20 +03:00
silver
d6247dd4ec Center Options dialog when showed 2017-10-24 00:53:10 +03:00
silver
4f0c49f1c4 Persist size and treeview header state in preview dialog
- renamed variable m_headerState
 - renamed PreviewSelect class to PreviewSelectDialog
 - renamed previewselect files to previewselectdialog
2017-10-24 00:53:09 +03:00
silver
30455e8b01 Follow project coding style. Issue #2192. 2017-10-24 00:53:08 +03:00
silver
60adb94463 Options dialog save windows state in destructor 2017-10-24 00:53:07 +03:00
Chocobo1
a02fd5b588 Fix last activity calculation. Closes #7461
`time_since_upload` & `time_since_download` can be -1, so filter them out
2017-10-24 00:53:06 +03:00
sledgehammer999
39ce080318 Don't use margins in FileSystemPathEdit widgets.
Introduced in 30081e0.
2017-10-24 00:53:04 +03:00
Chocobo1
f53abd2f07 Update qtsingleapplication
To upstream version a8dda66d7738cde9042b87db27993f710ae3eeeb
2017-10-24 00:53:03 +03:00
Thomas Piccirello
5b0ae0271b Reposition "Priority" menu option in WebUI to match gui (closes #7072) 2017-10-24 00:53:02 +03:00
sledgehammer999
ec2efd8c62 Better reporting of success/failure of torrent and file deletion. 2017-10-24 00:53:01 +03:00
Chocobo1
146daea513 Replace dialog ok-cancel buttons with QDialogButtonBox
This PR will make button order follow the platform default.
For example: windows use: OK, Cancel; linux use: Cancel, OK.
2017-10-24 00:53:00 +03:00
Chocobo1
5ab67faacb Use smaller data type for TriStateBool 2017-10-24 00:52:58 +03:00
Chocobo1
4213d37857 WebAPI: fix addPaused wrong default behavior
Add helper function
Sort include header
2017-10-24 00:52:57 +03:00
Chocobo1
0192922910 Refactor
Merge statements
Use case-insensitive contains()
Add const
Use value(), this avoids inserting empty values.
Use range based for loop
2017-10-24 00:52:56 +03:00
Chocobo1
d2b88e9f84 WebAPI: fix root_folder default behavior
Bug was introduced in
6b33db3ae3
2017-10-24 00:52:55 +03:00
Chocobo1
a32c4aca92 Add comboBox for selecting BitTorrent protocol. Closes #6316.
Use unicode string C_UTP in place of "uTP"
2017-10-24 00:52:54 +03:00
thalieht
91d41336a7 Create root folder option when adding a torrent in WebUI 2017-10-24 00:52:53 +03:00
Chocobo1
d73d790612 Rename option
The previous "Disk write cache size" is not accurate since it is also being used
for read cache, so rename it to "Disk cache".
2017-10-24 00:52:51 +03:00
Chocobo1
af0fed6669 Change default value of m_diskCacheSize. New default is 64 MB. 2017-10-24 00:52:50 +03:00
Eugene Shalygin
a24c13b902 Allow custom tray icons when system icon theme is used. Closes #7403. 2017-10-24 00:52:49 +03:00
Chocobo1
c44c6a8d88 Fix dereferencing freed pointer. Closes #7420.
The torrent is removed from session after `deleteTorrent()`
yet we still invoke `torrent->name()`, thus result in crash.
2017-10-24 00:52:48 +03:00
sledgehammer999
5f62a68e71 Travis: Update libtorrent bottle with boost 1.65+ fix. 2017-10-24 00:52:41 +03:00
Allan Nordhøy
5af90fee46 Spelling: HTTP/HTTPS 2017-10-23 19:03:40 +03:00
Chocobo1
b17566f113 Update coding guidelines
Add ranged-based for loop example
Add class inheritance example
Add Prefer pre-increment, pre-decrement operators section
Fix space after comment keyword
Fix header include order
[skip ci]
2017-10-23 19:03:39 +03:00
sledgehammer999
29edea050b Update Changelog. 2017-10-23 19:03:38 +03:00
sledgehammer999
7ceb646e90 Bump to 3.4.0beta2 2017-10-23 19:03:37 +03:00
sledgehammer999
0ff39e4d10 Sync translations from Transifex and run lupdate. 2017-10-23 19:02:44 +03:00
sledgehammer999
1e146c94bd Fix file list expansion on singlefile torrent with folder. 2017-10-23 18:12:43 +03:00
Vladimir Golovnev
8a0da04807 Fix CategoryFilterWidget::sizeHint() 2017-10-23 18:12:42 +03:00
Vladimir Golovnev
9e7a847cce Fix suggest_mode setting
Actually suggest_mode is of type int.
2017-10-23 18:12:41 +03:00
Chocobo1
63d3f20e51 Sort the resource lists
Update RCC header
2017-10-23 18:12:40 +03:00
Chocobo1
817e3fbb05 Cleanup src.pro 2017-10-23 18:12:39 +03:00
Chocobo1
263e96aba2 Move NOMINMAX define 2017-10-23 18:12:37 +03:00
Chocobo1
0379376fd8 Define QT_USE_QSTRINGBUILDER.
The old defines are deprecated.
QT_USE_QSTRINGBUILDER also supports QByteArray which we use extensively
in WebUI.
2017-10-23 18:12:36 +03:00
Chocobo1
de7efb50c2 Use Qt5 connect syntax 2017-10-23 18:12:35 +03:00
Chocobo1
400f8dc2d8 Setup parent ownership to avoid memory leak 2017-10-23 18:12:34 +03:00
Chocobo1
b2b63be798 Use enums for settings 2017-10-23 18:12:33 +03:00
Chocobo1
c9aba893de Add sanitize helper clampValue() 2017-10-23 18:12:32 +03:00
Chocobo1
1ac4cdcf4d Add send_buffer_watermark send_buffer_low_watermark
send_buffer_watermark_factor knobs
2017-10-23 18:12:30 +03:00
Chocobo1
08a0fef18a Add suggest_mode knob 2017-10-23 18:12:29 +03:00
Chocobo1
6f54c170ab Add choking_algorithm & seed_choking_algorithm knob 2017-10-23 18:12:28 +03:00
Chocobo1
d3b4c7bec4 Add allow_multiple_connections_per_ip knob. Closes #5884. 2017-10-23 18:12:27 +03:00
Chocobo1
f8dfe1ea57 Add mixed_mode_algorithm knob 2017-10-23 18:12:26 +03:00
Chocobo1
ce5f8bab44 Add guided_read_cache knob
cleanup header include order
2017-10-23 18:12:24 +03:00
Vladimir Golovnev
59cf70f8f2 Fix RSS Downloader fails to rename rule
Closes #7333.
2017-10-23 18:12:23 +03:00
Vladimir Golovnev (qlassez)
561975f435 Improve BandwidthScheduler
Don't disable scheduler when manually switching speed limits.
Closes #7306.
2017-10-23 18:12:22 +03:00
Vladimir Golovnev
eae6fea830 Skip user input events when adding torrent
Closes #7327.
2017-10-23 18:12:21 +03:00
Evengard
2673c2b5b2 Disable skipping of loopback interfaces
This fixes the absence of VPN tunnel interfaces under Windows and works around the QTBUG-32349
Fixes #7291
2017-10-23 18:12:20 +03:00
Eugene Shalygin
3c17f3a836 Fix ignoring of incorrect version strings in search plugins. Closes #7101.
Printing of Version with all components set to zero was segfaulting due
to underflow in array index. Also add log message for such plugins.
2017-10-23 18:12:19 +03:00
Chocobo1
0890154e16 WebAPI: fix validating wrong header field. Closes #7311.
X-Forwarded-Host is a foreign proxy setting, it isn't the same as
qbt's local setting and thus it makes no sense to verify it.
2017-10-23 18:12:17 +03:00
sledgehammer999
0877824875 Check for Qt5Svg when configuring. 2017-10-23 18:12:16 +03:00
Chocobo1
60bd5999b0 Wrap class & functions in anonymous namespace
Rename vars
Cleanup class interfaces
Pass by reference whenever possible
2017-10-23 18:12:15 +03:00
sledgehammer999
d0ec60fa01 Switch settings to signed int because libtorrent expects them that way. 2017-10-23 18:12:14 +03:00
sledgehammer999
e7a70a4acc Options to better memory control by libtorrent. Closes #7029. 2017-10-23 18:12:13 +03:00
Eugene Shalygin
85cb49e8e1 Use pixmap cache for file icons on Mac OS and Windows. Closes #7264. 2017-10-23 18:12:12 +03:00
Vladimir Golovnev (qlassez)
3f00a6e5e3 Improve utils/fs.* and fix coding style 2017-10-23 18:12:10 +03:00
vit9696
35e18a2e09 Fix notification display on macOS 2017-10-23 18:12:09 +03:00
sledgehammer999
8ae2ae3b5c Fix broken build. 2017-10-23 18:12:08 +03:00
vit9696
27c5f2aede Fix macOS window restoration after using hide icon 2017-10-23 18:12:07 +03:00
sledgehammer999
34a69aa0b2 Use simpler ifdef style. 2017-10-23 18:12:06 +03:00
Brian Kendall
72fc903f4a Fixed mac specific compiler errors and cleaned up Objective C code
Created new file src/gui/macutilities.mm, moved code from mainwindow.cpp and torrentcontentmodel.cpp that used the Objective C runtime into it and converted it to actual Objective C. Rewrote pixmapForExtension() so that it doesn't call into private Qt functions.
2017-10-23 18:12:05 +03:00
sledgehammer999
4f04992de8 Fix connection problems when a specific interface/ip is configured.
Closes #7235.
Bug related to #7099 and Qt.
2017-10-23 18:12:04 +03:00
vit9696
1b147494d4 Unify preference window borders across the tabs 2017-10-23 18:12:02 +03:00
sledgehammer999
b535a0b44e Fix calculation of 'Average time in queue' stat under libtorrent 1.1.x 2017-10-23 18:12:01 +03:00
Thomas Piccirello
6c2271584c Use single quotes for char.
Use case insensitive compare.
Swap conditionals
2017-10-23 18:12:00 +03:00
Thomas Piccirello
1002b28c95 Add auto torrent management to webui context menu (addresses #6815) 2017-10-23 18:11:54 +03:00
Chocobo1
dfded7bc9d Add space between widgets in left side panel. Closes #7224. 2017-10-23 02:11:55 +03:00
sledgehammer999
36fde9ede5 Error out in configure script if the proper Qt/qmake version isn't found.
Closes #7250.
Partially reverts e64bb1de8c.
2017-10-23 02:11:54 +03:00
Chocobo1
6b4ac1b960 Initialize variables
Remove unused variable
2017-10-23 02:11:53 +03:00
Thomas Piccirello
cc141ba02f Add option to rename torrent from WebUI
Addresses #6815.
2017-10-23 02:11:52 +03:00
Vladimir Golovnev (qlassez)
8fc931a61b Use qUtf8Printable() for logging strings
qDebug(), qInfo(), qWarning(), qCritical(), qFatal() expect %s arguments
to be UTF-8 encoded, while qPrintable() converts to local 8-bit encoding.
Therefore qUtf8Printable() should be used for logging strings instead of
qPrintable().
2017-10-23 02:11:51 +03:00
Vladimir Golovnev (qlassez)
0b6cf54508 Don't remove shared temp folder
Don't remove shared temp folder when torrent finished and moved to
its "complete" folder. Only torrents with stripped root folder
have subfolder in temp folder so they should remove it.
2017-10-23 02:11:50 +03:00
sledgehammer999
ff12163176 Follow project coding style. 2017-10-23 02:11:49 +03:00
sledgehammer999
6a8a0bbd6b Catch possible exceptions when parsing IPs. Closes #7249. 2017-10-23 02:11:47 +03:00
sledgehammer999
f8ebffac65 Use dpiawareness=1 on Windows. Closes #5393. 2017-10-23 02:11:46 +03:00
Vladimir Golovnev (qlassez)
e58f4c0bdf Remove legacy RSS settings after converting
Closes #7226.
2017-10-23 02:11:45 +03:00
thalieht
f450ff278d Remove indentation for category/tag filter widgets in all platforms 2017-10-23 02:11:44 +03:00
Chocobo1
566fd893f4 Prefill torrent name when creating a new torrent. Closes #7229. 2017-10-23 02:11:43 +03:00
sledgehammer999
30ab46999c Fix explicit Torrent Management Mode in Add New Torrent dialog. Closes #5602. 2017-10-23 02:11:35 +03:00
sledgehammer999
0320f9d5b5 Update Changelog. 2017-08-07 08:55:30 +03:00
sledgehammer999
ad7c9ed123 Bump to 3.4.0beta 2017-08-07 08:40:22 +03:00
sledgehammer999
25acdba344 Sync translations from Transifex and run lupdate. 2017-08-07 08:38:09 +03:00
Chocobo1
786059802b Correctly handle translation
Fixup of 07a85a1018
2017-08-07 08:27:09 +03:00
Chocobo1
0ae708114b Move "Copy hash" menu item above "Copy magnet link"
Fix wrong "Copy hash" icon used in webUI
Fixup of 145641ac41
2017-08-07 08:27:08 +03:00
vit9696
fbeaabb841 Fix file type icons not displaying on macOS 2017-08-07 08:27:07 +03:00
Tom Piccirello
98bef605a7 Set torrent location from webui context menu (addresses #6815) (#7062)
* Add option to set torrent location from webui context menu (addresses #6815)

* Update debug messages

* Use logger

* Remove redundant curly braces

* Remove message

* Use log message from transferlistwidget

* Use QDir

* Remove unused import

* Check if newLocation is an empty string
2017-08-07 08:27:05 +03:00
Tom Piccirello
37a0e48b46 Add copy options to webui context menu (addresses #6815) (#7036)
* Add copy options to webui context menu
Add Copy Hash to gui (closes #6964)

* Use switch statement

* Use camel case, switch from signal to qaction.

* Rename variable

* Change variable name
2017-08-07 08:27:04 +03:00
sledgehammer999
fea1a66aba Fix some more strings. 2017-08-07 08:27:03 +03:00
Allan Nordhøy
0ffdb51f95 display, URLs, esc ' 2017-08-07 08:27:01 +03:00
Vladimir Golovnev (qlassez)
4e596629fd Don't replace existing files when relocating torrent 2017-08-07 08:27:00 +03:00
Vladimir Golovnev (qlassez)
61281dd226 Don't remove shared temp folder 2017-08-07 08:26:59 +03:00
Vladimir Golovnev (Glassez)
61d1f2180f Don't create subfolder inside temp folder 2017-08-07 08:26:58 +03:00
vlakoff
3bcf941205 Windows installer: also detect running process when it is 64-bit
Replacing FindProcDLL with a different one that can be found here:

http://forums.winamp.com/showthread.php?t=322583#post2777719
2017-08-07 08:26:56 +03:00
Tony Gregerson
1746c9d331 Improve checkbox interface for selecting tags in the context menu. Closes #7060 2017-08-07 08:26:55 +03:00
Vladimir Golovnev (Glassez)
58c31c5353 Fix temporary subfolder isn't deleted 2017-08-07 08:26:47 +03:00
sledgehammer999
e872719ef1 Update Transifex config file. 2017-07-27 19:19:10 +03:00
1052 changed files with 127253 additions and 121424 deletions

View File

@@ -1,14 +1,20 @@
**Please provide the following information**
### qBittorrent version and Operating System:
### qBittorrent version and Operating System
(type here)
### If on linux, libtorrent and Qt version:
### If on linux, libtorrent and Qt version
(type here)
### What is the problem:
### What is the problem
(type here)
### What is the expected behavior:
### What is the expected behavior
(type here)
### Steps to reproduce:
### Steps to reproduce
(type here)
### Extra info(if any):
### Extra info(if any)
(type here)

View File

@@ -76,10 +76,13 @@ before_install:
- shopt -s expand_aliases
- alias make="colormake -j3" # Using nprocs/2 sometimes may fail (gcc is killed by system)
#- libt_path="$HOME/libt_install"
#- ltconf="$ltconf --prefix="$libt_path" --disable-geoip"
- qbt_path="$HOME/qbt_install"
- qbtconf="$qbtconf --prefix="$qbt_path" PKG_CONFIG_PATH="$libt_path/lib/pkgconfig":/opt/qt55/lib/pkgconfig:$PKG_CONFIG_PATH"
- |
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
qbtconf="$qbtconf --prefix="$qbt_path" PKG_CONFIG_PATH=/opt/qt55/lib/pkgconfig:$PKG_CONFIG_PATH"
else
qbtconf="$qbtconf --prefix="$qbt_path""
fi
# options for specific branches
- if [ "$gui" = false ]; then qbtconf="$qbtconf --disable-gui" ; fi
@@ -131,13 +134,13 @@ install:
cp "version" $HOME/hombebrew_cache
cd "$HOME/hombebrew_cache"
wget https://builds.shiki.hu/homebrew/libtorrent-rasterbar.rb
wget https://builds.shiki.hu/homebrew/libtorrent-rasterbar-1.0.11+git20172003.8736a59adc.el_capitan.bottle.tar.gz
wget https://builds.shiki.hu/homebrew/libtorrent-rasterbar-1.1.6+git20180101.b45acf28a5+patched-configure.el_capitan.bottle.tar.gz
fi
# Copy custom libtorrent bottle to homebrew's cache so it can find and install it
# Also install our custom libtorrent formula by passing the local path to it
# These 2 files are restored from Travis' cache.
cp "$HOME/hombebrew_cache/libtorrent-rasterbar-1.0.11+git20172003.8736a59adc.el_capitan.bottle.tar.gz" "$(brew --cache)"
cp "$HOME/hombebrew_cache/libtorrent-rasterbar-1.1.6+git20180101.b45acf28a5+patched-configure.el_capitan.bottle.tar.gz" "$(brew --cache)"
brew install "$HOME/hombebrew_cache/libtorrent-rasterbar.rb"
if [ "$build_system" = "cmake" ]; then
@@ -168,11 +171,15 @@ script:
BUILD_TOOL="ninja"
fi
if [ "$build_system" = "qmake" ]; then
./bootstrap.sh && ./configure $qbtconf
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
# For some reason for RC_1_1 we need to also specify the OpenSSL compiler/linker flags
# Homebrew doesn't symlink OpenSSL for security reasons
./bootstrap.sh && ./configure $qbtconf CXXFLAGS="$(PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH" pkg-config --cflags openssl)" LDFLAGS="$(PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH" pkg-config --libs openssl)"
sed -i "" -e "s/^\(CC.*&&\).*$/\1 $CC/" src/Makefile # workaround for Qt & ccache: https://bugreports.qt.io/browse/QTBUG-31034
sed -i "" -e "s/^\(CXX.*&&\).*$/\1 $CXX/" src/Makefile
sed -i "" -e 's/^\(CXXFLAGS.*\)$/\1 -Wno-unused-local-typedefs -Wno-inconsistent-missing-override/' src/Makefile
else
./bootstrap.sh && ./configure $qbtconf
fi
BUILD_TOOL="make"
fi

16
AUTHORS
View File

@@ -34,6 +34,14 @@ Code from other projects:
license: GPLv2/3
Images Authors:
* files: src/icons/skin/qbittorrent-tray.svg (and related pngs)
copyright: Provided by HVS <hvs linuxmail org> (raster first proposal) and Atif Afzal(@atfzl github) <atif5801@gmail.com> (vectorized and modified)
license: GPLv2+
* files: src/qbittorrent_file.ico src/icons/fileicon.svg
copyright: 'uknown.svg' (LGPLv3+) from Oxygen Icon Theme was used as base which was slightly modified and 'qbittorrent-tray.svg' (GPLv2+) was overlayed above it.
license: GPLv3+
* files: src/icons/*.png
copyright: Gnome Icon Theme
license: GPLv2
@@ -44,10 +52,10 @@ Images Authors:
license: LGPL
url: http://www.oxygen-icons.org
* files: src/icons/flags/*.png
copyright: Mark James <mjames@gmail.com>
license: Public Domain
url: http://www.famfamfam.com
* files: src/icons/flags/*.svg
copyright: lipis/flag-icon-css
license: MIT
url: https://github.com/lipis/flag-icon-css/
* files: src/icons/skin/*.png
files: src/menuicons/YYxYY/*.png

View File

@@ -22,13 +22,8 @@ add_definitions(-DQBT_VERSION_MINOR=${VER_MINOR})
add_definitions(-DQBT_VERSION_BUGFIX=${VER_BUGFIX})
add_definitions(-DQBT_VERSION_BUILD=${VER_BUILD})
# os2 {
# DEFINES += DQBT_VERSION=\'\"v$${PROJECT_VERSION}\"\'
# DEFINES += DQBT_VERSION_2=\'\"$${PROJECT_VERSION}\"\'
# } else {
add_definitions(-DQBT_VERSION="v${PROJECT_VERSION}")
add_definitions(-DQBT_VERSION_2="${PROJECT_VERSION}")
# }
if (UNIX AND NOT APPLE)
include(GNUInstallDirs)

View File

@@ -9,7 +9,7 @@ If you make changes in a file that still uses another coding style, make sure th
```c++
int myFunction(int a)
{
//code
// code
}
void myFunction() {} // empty body
@@ -17,29 +17,29 @@ void myFunction() {} // empty body
MyClass::MyClass(int *parent)
: m_parent(parent)
{
//initialize
// initialize
}
int MyClass::myMethod(int a)
{
//code
// code
}
class MyOtherClass
{
public:
//code
// code
protected:
//code
// code
private:
//code
// code
};
namespace Name
{
//code
// code
}
// Lambdas
@@ -54,20 +54,20 @@ namespace Name
#### b. Other code blocks ####
```c++
if (condition) {
//code
// code
}
for (int a = 0; a < b; ++b) {
//code
// code
}
switch (a) {
case 1:
//blah
// blah
case 2:
//blah
// blah
default:
//blah
// blah
}
```
@@ -75,17 +75,17 @@ default:
```c++
switch (var) {
case 1: {
//declare local variables
//code
// declare local variables
// code
}
break;
case 2: {
//declare local variables
//code
// declare local variables
// code
}
break;
default:
//code
// code
}
```
@@ -103,13 +103,13 @@ QVariantMap map {{"key1", 5}, {"key2", 10}};
#### a. Multiple tests ####
```c++
if (condition) {
//code
// code
}
else if (condition) {
//code
// code
}
else {
//code
// code
}
```
The `else if`/`else` must be on their own lines.
@@ -154,7 +154,7 @@ myClass::myClass(int a, int b, int c, int d)
, m_c(c)
, m_d(d)
{
//code
// code
}
```
@@ -231,8 +231,8 @@ Example:
#include <libtorrent/version.hpp>
#include "base/bittorrent/session.h"
#include "base/bittorrent/infohash.h"
#include "base/bittorrent/session.h"
#include "base/utils/fs.h"
#include "base/utils/misc.h"
#include "base/utils/string.h"
@@ -240,7 +240,23 @@ Example:
```
### 9. Misc. ###
### 9. Include guard. ###
`#pragma once` should be used instead of "include guard" in new code:
```c++
// examplewidget.h
#pragma once
#include <QWidget>
class ExampleWidget : public QWidget
{
// (some code omitted)
};
```
### 10. Misc. ###
* Line breaks for long lines with operation:
@@ -282,20 +298,32 @@ auto spinBox = static_cast<QSpinBox*>(sender());
// we know the variable type based on the right-hand expression
```
* Space around operations eg `a = b + c` or `a=b+c`:
Before and after the assignment and other binary (and ternary) operators there should be a space.<br/>
There should not be a space between increment/decrement and its operand.<br/>
Some valid use cases:
* Notice the spaces in the following specific situations:
```c++
// Before and after the assignment and other binary (and ternary) operators there should be a space
// There should not be a space between increment/decrement and its operand
a += 20;
a = (b <= MAX_B ? b : MAX_B);
++a;
b--;
--b;
for (int a = 0; a < b; ++b) {
// code
}
// Range-based for loop, spaces before and after the colon
for (auto i : container) {
}
// Derived class, spaces before and after the colon
class Derived : public Base
{
};
```
* Prefer pre-increment, pre-decrement operators
```c++
++i, --j; // Yes
i++, j--; // No
```
* private/public/protected must not be indented

141
Changelog
View File

@@ -1,4 +1,78 @@
Unreleased - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.4.0
* Fri Feb 16 2018 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.0.4
- FEATURE: Add source field in Torrent creator. Closes #7965. (Chocobo1)
- FEATURE: Torrent creator: raise maximum piece size to 32 MiB (Chocobo1)
- FEATURE: Add a force reannounce option in the transfer list context menu. Closes #6448. (Jesse Bryan)
- BUGFIX: Fix sorting of country flags column in Peers tab. (sledgehammer999)
- BUGFIX: Fix natural sorting when the common part of 2 strings ends partially in a number which continues in the uncommon part. Closes #8080 #6732. (sledgehammer999)
- BUGFIX: Fix application of speed limits on LAN and μTP connections. Closes #7745. (sledgehammer999)
- BUGFIX: Make peer information flags in peerlist more readable. (thalieht)
- BUGFIX: Fix gui issues on high DPI monitor. (Chocobo1)
- BUGFIX: Fix dialog and column size on high DPI monitors. (Chocobo1)
- BUGFIX: Fix constant status of '[F] Downloading'. Closes #7628. (sledgehammer999)
- BUGFIX: Fix translation context. Closes #8211. (sledgehammer999)
- BUGFIX: Separate subnet whitelist options into two lines. (Thomas Piccirello)
- BUGFIX: Don't set application name twice. (Luís Pereira)
- BUGFIX: Set default file log size to 65 KiB and delete backup logs older than 1 month. (sledgehammer999)
- WEBUI: Only prepend scheme when it is not present. Closes #8057. (Chocobo1)
- WEBUI: Add "Remaining" and "Availability" columns to webui Content tab. (Thomas Piccirello)
- WEBUI: Make value formatting consistent with GUI (Thomas Piccirello)
- WEBUI: Reposition Total Size column to match gui (Thomas Piccirello)
- WEBUI: Add Tags and Time Active columns (Thomas Piccirello)
- WEBUI: Use https for www.qbittorrent.org (Thomas Piccirello)
- WEBUI: Match webui statuses to gui, closes #7516 (Thomas Piccirello)
- WEBUI: Right-align stat values (Thomas Piccirello)
- WEBUI: Add missing units. (Thomas Piccirello)
- RSS: Fix crash when deleting rule because it tries to update. Closes #8094 (glassez)
- RSS: Don't process new/updated RSS rules when disabled (glassez)
- RSS: Remove legacy and corrupted RSS settings (glassez)
- SEARCH: Search only when category is supported by plugin. Closes #8053. (jan.karberg)
- SEARCH: Only add search separators as needed. (Thomas Piccirello)
- COSMETIC: Tweak spacing in torrent properties widget and speed widget. (Chocobo1)
- WINDOWS: Use standard folder icon for open file behavior on Windows. Closes #7880. (Chocobo1)
- WINDOWS: Revert "Run external program" function. Now you will not be able to directly run batch scripts. (Chocobo1)
- MACOS: Fix torrent file selection in Finder on mac (vit9696)
- MACOS: Fix Finder reveal in preview and torrent contents (vit9696)
- MACOS: Fix cmd+w not closing the main window on macOS (vit9696)
- OTHER: Fix splitting of compiler flags in configure. Autoconf removes a set of [] during script translation, resulting in a wrong sed command. (sledgehammer999)
- OTHER: configure: Parse all compiler related flags together. (sledgehammer999)
- OTHER: Update copyright year. (sledgehammer999)
* Sun Dec 17 2017 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.0.3
- BUGFIX: Add height padding to the transfer list icons. Closes #7951. (sledgehammer999)
- BUGFIX: Allow to drag-n-drop URLs into mainwindow to initiate download. (Chocobo1)
- BUGFIX: Fix crash when fitlering search results. Stable sorting is removed. Closes #7952.(Chocobo1)
- WEBUI: Fix missing qbt logo on login page in webUI. Closes #7953. (Chocobo1)
- WEBUI: Add check to avoid type error after logout. (Chocobo1)
- WEBUI: Use POST for logout command. This is to avoid browser being smart to prefetch the link then logging out the user. (Chocobo1)
- WEBUI: Fix WebUI is not reachable via IPv6. (glassez)
- WINDOWS: Disable the "?" help button in all dialogs on Windows. Closes #7365. Requires Qt 5.10. (Chocobo1)
* Fri Dec 01 2017 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.0.2
- BUGFIX: Fix crash on some systems when creating address object for 255.255.255.255. Closes #7735. (sledgehammer999)
- PERFORMANCE: Change MixedModeAlgorithm default to TCP. This was the v3_3_x default and should sustain higher speeds. Closes #7779. (Chocobo1)
- PERFORMANCE: Stop logging IP filter parsing errors after a while, otherwise the GUI freezes or qBittorrent doesn't start. (sledgehammer999)
- GUI: Implement stable sort. Rows in transfer list shouldn't flicker anymore. (Chocobo1)
- WEBUI: Fix build when webui is disabled. (Heiko Becker)
- RSS: Fix build because of missing header. Closes #7805. (thoradia)
- RSS: Fix RSS parser. (glassez)
- RSS: Implement Import/Export RSS rules in legacy(aka v3_3_x) format. (glassez)
- RSS: Implement Import/Export RSS rules in JSON format. (glassez)
- WINDOWS: Fixed blurry text under Windows by setting DPI awareness to default. (TheNicker)
- LINUX: Fix i386 build. (Evgeny Lensky)
* Wed Nov 22 2017 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.0.1
- BUGFIX: Fix crash on opening torrent/magnet (uninitialized pointer). Closes #7739 #7723. (sledgehammer999)
- BUGFIX: Enable preferences Apply button when ip banlist is modified (Thomas Piccirello)
- BUGFIX: Allow drag-n-drop magnet links to mainwindow. Closes #7742. (Chocobo1)
- BUGFIX: Fix crash when aborting a torrent creation process. Closes #7783. (Chocobo1)
- BUGFIX: Correctly check if torrent passed during application start already exists. (sledgehammer999)
- WEBUI: Add ip subnet whitelist for bypassing webui auth (Thomas Piccirello)
- WEBUI: Fix logo missing in login page (Chocobo1)
- COSMETIC: Fix english typo. (sledgehammer999)
- OTHER: cmake: qtsingleapplication should always be built statically (luigino)
* Mon Nov 20 2017 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v4.0.0
- FEATURE: Change qbittorrent logo. Issue #6467. (HVS, Atif Afzal, sledgehammer999)
- FEATURE: New icon theme with SVG source, so we can scale it appropriately in the future. (Bert Verhelst)
- FEATURE: Drop Qt 4 support. Raise minimum Qt version to 5.5.1 (evsh)
- FEATURE: UI for managing locally banned IP list (dzmat)
@@ -18,20 +92,85 @@ Unreleased - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.4.0
- FEATURE: Fetch Favicons via google as a final fallback (KingLucius)
- FEATURE: Add a Tags (multi-label) feature to the GUI. Closes #13. (tgregerson)
- FEATURE: Use the system icons for each file type in the Content tab (evsh)
- FEATURE: Use SVG files for monochrome tray icons. Closes #6085. (evsh)
- FEATURE: Prefill torrent name when creating a new torrent. Closes #7229. (Chocobo1)
- FEATURE: Expose more libtorrent options in advanced settings (Chocobo1)
- FEATURE: Add comboBox for selecting BitTorrent protocol. Closes #6316. (Chocobo1)
- FEATURE: Allow SMTP sender to be set. Closes #7575. (Chocobo1)
- FEATURE: Allow to specify if announcing to all tiers is desired. (sledgehammer999)
- FEATURE: Configurable number of history of paths in Add New Torrent dialog. (evsh)
- BUGFIX: Adjust icons names to better fit FDO scheme (evsh)
- BUGFIX: Optimized IP filter parsing, making blazingly fast (sledgehammer999, evsh)
- BUGFIX: Fix dialogs didn't position on the correct screen which qBittorrent window is on. Closes #1690, #2474, #3538. (Chocobo1)
- BUGFIX: Refactor and improve StatusBar (glassez)
- BUGFIX: Set expiration date for newly added cookie to +2 years from now, instead of +99 years. (Chocobo1)
- BUGFIX: Don't create subfolder inside temp folder (glassez)
- BUGFIX: Don't replace existing files when relocating torrent (glassez)
- BUGFIX: Fix explicit Torrent Management Mode in Add New Torrent dialog. Closes #5602. (sledgehammer999)
- BUGFIX: Fix calculation of 'Average time in queue' stat under libtorrent 1.1.x (sledgehammer999)
- BUGFIX: Don't disable bandwidth scheduler when manually switching speed limits. Closes #7306. (glassez)
- BUGFIX: Fix dereferencing freed pointer. Closes #7420. (Chocobo1)
- BUGFIX: Change the default cache size to 64MiB. (Chocobo1)
- BUGFIX: The previous "Disk write cache size" is not accurate since it is also being used for read cache, so rename it to "Disk cache". (Chocobo1)
- BUGFIX: Replace dialog ok-cancel buttons with QDialogButtonBox, which follows the platform specific button order. (Chocobo1)
- BUGFIX: Better reporting of success/failure of torrent and file deletion. (sledgehammer999)
- BUGFIX: Fix last activity calculation. Closes #7461. (Chocobo1)
- BUGFIX: Save state of options windows on cancel too. (silverqx)
- BUGFIX: Persist size and treeview header state in preview dialog. (silverqx)
- BUGFIX: Show torrent name in "add new torrent" dialog on merging trackers (Chocobo1)
- BUGFIX: Properly pre-select the selected torrent's current ratio limiting options in UpDownRatioDlg dialogs. Fixes #7352 (thalieht)
- BUGFIX: Optimize code for SpeedWidget. (dzmat)
- BUGFIX: Disable processing events when adding torrents(prevents crashes). Closes #7436. (Chocobo1)
- BUGFIX: Open links in browser. Closes #7651. (Chocobo1)
- BUGFIX: Change default settings for tracker/tier announces to mimick μTorrent behavior. (sledgehammer999)
- BUGFIX: Explicitly set UPnP state on start-up. Closes #7338. (Chocobo1)
- BUGFIX: Include/print caught signal in stackdump (Chocobo1)
- COSMETIC: Trackerlist: Set text alignment of columns with numbers to the right (thalieht)
- COSMETIC: Enable alternatingRowColors for "Manage Cookie" dialog (Chocobo1)
- COSMETIC: Remove indentation for category/tag filter widgets in all platforms (thalieht)
- COSMETIC: Add space between widgets in left side panel. Closes #7224. (Chocobo1, glassez)
- COSMETIC: Unify preference window borders across the tabs (vit9696)
- COSMETIC: Center Options dialog when showed. (silverqx)
- COSMETIC: Show delete accelerator key in menu. closes #7508 (Nick Korotysh)
- COSMETIC: Set QTextOption::NoWrap property in "Download from URLs" dialog (Chocobo1)
- COSMETIC: Use SVG icons for the country flags. Closes #6223. (sledgehammer999)
- WEBUI: Allow to load/use ECDSA certificate in webUI. (Chocobo1)
- WEBUI: Add copy options to webui context menu (addresses #6815) (#7036) (Tom Piccirello)
- WEBUI: Set torrent location from webui context menu (addresses #6815) (#7062) (Tom Piccirello)
- WEBUI: Add option to rename torrent from WebUI (Thomas Piccirello)
- WEBUI: Add auto torrent management to webui context menu (addresses #6815) (Thomas Piccirello)
- WEBUI: Option for "Create subfolder" when adding new torrent. (thalieht)
- WEBUI: Fix addPaused wrong default behavior. (Chocobo1)
- WEBUI: Reposition "Priority" menu option in WebUI to match gui. Closes #7072. (Thomas Piccirello)
- WEBUI: Report TCPServer errorString() if webui fails to listen to port. (Matthew Fioravante)
- WEBUI: Exit gracefully when failed to initialize web server with qbt-nox (Chocobo1)
- WEBUI: Add file-to-piece-index mappings in /query/propertiesFiles command (Chocobo1)
- WEBUI: Add optional parameters for /command/download & /command/upload (Chocobo1)
- WEBUI: Print error messages upon receiving invalid header fields. (Chocobo1)
- WEBUI: Add WebUi\Address config option. (Matthew Fioravante)
- WEBUI: Reinitialize webUI server when "IP address" setting changed. An app restart won't be necessary from now on. (Chocobo1)
- WEBUI: Improve log and error messages (Chocobo1)
- SEARCH: Use explicit class for search plugin versions (evsh)
- SEARCH: Remove all search plugins from repo. There is another repo named 'search-plugins'. (sledgehammer999)
- SEARCH: Update the backend when a new plugin favicon is downloaded. (sledgehammer999)
- SEARCH: Allow search plugins sorting. Closes #7526. (Nick Korotysh)
- RSS: Redesigned RSS subsystem (glassez)
- RSS: Do not use hardcoded colors in RSS feed view (evsh)
- RSS: Improve RSS events logging (glassez)
- WINDOWS: Use dpiawareness=1 on Windows. Closes #5393. (sledgehammer999)
- WINDOWS: Reformat Windows build configuration files. (glassez)
- LINUX: Allow custom tray icons when system icon theme is used. Closes #7403. (evsh)
- MACOS: Various macOS UI improvements (vit9696)
- MACOS: Fix main menu item location on macOS (vit9696)
- MACOS: Fix macOS window restoration after using hide icon (vit9696)
- MACOS: Fix notification display on macOS (vit9696)
- OTHER: Use new classes/methods from libtorrent and stop using deprecate ones. (glassez)
- OTHER: Various string fixes (Allan Nordhøy, sledgehammer999)
- OTHER: cmake: do not use Qt5Widgets when locating QtSingleApplication. Closes #7551. (evsh)
- OTHER: Update BOOST m4 macros and simplify AX_BOOST_BASE usage (Chocobo1)
- OTHER: Drop OS/2 support. (sledgehammer999)
- OTHER: Optimize file size of PNG and SVG files. (sledgehammer999)
- OTHER: Add new translators in the About page.
* Thu Jun 01 2017 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.3.13
- BUGFIX: Fixed UI glitch about torrent numbers in the sidepanel. Fixes #6454. (evsh)

View File

@@ -35,7 +35,7 @@ You can also download it from [here](https://github.com/qbittorrent/qBittorrent/
### Misc:
For more information please visit:
http://www.qbittorrent.org
https://www.qbittorrent.org
or our wiki here:
http://wiki.qbittorrent.org

View File

@@ -1,74 +0,0 @@
qBittorrent - A BitTorrent client in Qt4
------------------------------------------
This is the eComStation (OS/2) qBittorrent part of the readme. See also README for more general information.
Building qBittorrent
********************
Requirements
============
- gcc based build env (recommended gcc v4.4.2 or greater)
- Qt4 for eCS (OS/2) dev package (see http://svn.netlabs.org/qt4 for more information)
- libtorrent-rasterbar for eCS (OS/2) port (see http://svn.netlabs.org/ports for more information)
- boost for eCS (OS/2) port (see http://svn.netlabs.org/ports for more information)
How to build
============
First you need to create the conf.pri file in the same dir as this readme.os2 is.
the conf.pri file has the following content:
##### conf.pri content begin #####
BINDIR = ./bin
INCDIR = ./include
LIBDIR = ./lib
DATADIR = ./share
CONFIG += staticlib
INCLUDEPATH += x:/trees/libtorrent/trunk/include
LIBS += -Lx:/trees/libtorrent/trunk/src/.libs \
-Lx:/trees/boost/trunk/stage/lib \
-Lx:/trees/openssl \
-Lx:/extras/lib
##### conf.pri content end #####
Of course all the above path references have to be adjusted to your build env.
Now you can either do a normal build or a shadow build. A shadow build has the
advantage that no created files are in the same dir as the sources are.
For a normal build do the following:
Simply type:
$ qmake
Followed by:
$ make
For a shadow build do the following:
given your sources are in x:\trees\qbittorrent\trunk create a
x:\trees\qbittorrent\build directory
Now switch to the created directory and type:
$ qmake ..\trunk
Followed by:
$ make
If all works fine you should get a working qbittorrent executable.
If you have any question regarding the eCS (OS/2) port of qBittorrent you can meet me (_diver) on IRC:
#netlabs on irc.freenode.net
------------------------------------------
Silvan Scherrer <silvan.scherrer@aroa.ch>

View File

@@ -30,9 +30,9 @@ IF(QT4_FOUND)
NAMES ${QTSINGLEAPPLICATION_NAMES}
PATHS ${QT_LIBRARY_DIR}
)
ELSEIF(Qt5Widgets_FOUND)
ELSEIF(Qt5Core_FOUND)
message(STATUS "Looking for Qt5 single application library")
FOREACH(TOP_INCLUDE_PATH in ${Qt5Widgets_INCLUDE_DIRS} ${FRAMEWORK_INCLUDE_DIR})
FOREACH(TOP_INCLUDE_PATH in ${Qt5Core_INCLUDE_DIRS} ${FRAMEWORK_INCLUDE_DIR})
FIND_PATH(QTSINGLEAPPLICATION_INCLUDE_DIR QtSingleApplication ${TOP_INCLUDE_PATH}/QtSolutions)
IF(QTSINGLEAPPLICATION_INCLUDE_DIR)
@@ -43,12 +43,12 @@ ELSEIF(Qt5Widgets_FOUND)
SET(QTSINGLEAPPLICATION_NAMES ${QTSINGLEAPPLICATION_NAMES}
Qt5Solutions_SingleApplication-2.6 libQt5Solutions_SingleApplication-2.6
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
GET_TARGET_PROPERTY(QT5_WIDGETSLIBRARY Qt5::Widgets LOCATION)
GET_FILENAME_COMPONENT(QT5_WIDGETSLIBRARYPATH ${QT5_WIDGETSLIBRARY} PATH)
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_WIDGETSLIBRARYPATH}
PATHS ${_QT5_CORELIBRARYPATH}
)
ENDIF()

View File

@@ -24,6 +24,7 @@ add_definitions(-DUNICODE
-D_WIN32_IE=0x0501
-D_CRT_SECURE_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
-DNOMINMAX
)
# and boost
set(Boost_USE_STATIC_LIBS True)

61
conf.pri.windows Normal file
View File

@@ -0,0 +1,61 @@
# Adapt these paths
# Point these to the include folders
INCLUDEPATH += $$quote(C:/qBittorrent/boost)
INCLUDEPATH += $$quote(C:/qBittorrent/libtorrent/include)
INCLUDEPATH += $$quote(C:/qBittorrent/zlib/include)
INCLUDEPATH += $$quote(C:/qBittorrent/openssl/include)
# Point these to the lib folders
LIBS += $$quote(-LC:/qBittorrent/boost/stage/lib)
LIBS += $$quote(-LC:/qBittorrent/libtorrent/lib)
LIBS += $$quote(-LC:/qBittorrent/zlib/lib)
LIBS += $$quote(-LC:/qBittorrent/openssl/lib)
# Adapt the lib names/versions accordingly
# If you want to use Boost auto-linking then disable
# BOOST_ALL_NO_LIB below and omit Boost libraries here
CONFIG(debug, debug|release) {
LIBS += libtorrentd.lib \
libboost_system-vc140-mt-sgd-1_64.lib
}
else {
LIBS += libtorrent.lib \
libboost_system-vc140-mt-s-1_64.lib
}
LIBS += libeay32.lib ssleay32.lib
LIBS += zlib.lib
# ...or if you use MinGW
#CONFIG(debug, debug|release) {
# LIBS += libtorrent-rasterbar \
# libboost_system-mt
#}
#else {
# LIBS += libtorrent-rasterbar \
# libboost_system-mt
#}
#LIBS += libcrypto libssl
#LIBS += libz
DEFINES += NTDDI_VERSION=0x05010000
DEFINES += _WIN32_WINNT=0x0501
DEFINES += _WIN32_IE=0x0501
# Disable to use Boost auto-linking
DEFINES += BOOST_ALL_NO_LIB
# Use one of the following options
DEFINES += BOOST_SYSTEM_STATIC_LINK
#DEFINES += BOOST_SYSTEM_DYN_LINK
# Boost 1.60+ defaults to Vista+ support. The define below enables XP support again.
DEFINES += BOOST_USE_WINAPI_VERSION=0x0501
# Enable if building against libtorrent 1.0.x (RC_1_0) (static linking)
#DEFINES += BOOST_ASIO_SEPARATE_COMPILATION
# Enable if building against libtorrent 1.0.x (RC_1_0) (dynamic linking)
#DEFINES += BOOST_ASIO_DYN_LINK
# Enable if building against libtorrent 1.1.x (RC_1_1)
# built with this flag defined
#DEFINES += TORRENT_NO_DEPRECATE
# Enable if linking dynamically against libtorrent
#DEFINES += TORRENT_LINKING_SHARED
# Enable stack trace support
CONFIG += strace_win

435
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 v3.2.0alpha.
# Generated by GNU Autoconf 2.69 for qbittorrent v4.0.4.
#
# Report bugs to <bugs.qbittorrent.org>.
#
@@ -580,10 +580,10 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='qbittorrent'
PACKAGE_TARNAME='qbittorrent'
PACKAGE_VERSION='v3.2.0alpha'
PACKAGE_STRING='qbittorrent v3.2.0alpha'
PACKAGE_VERSION='v4.0.4'
PACKAGE_STRING='qbittorrent v4.0.4'
PACKAGE_BUGREPORT='bugs.qbittorrent.org'
PACKAGE_URL='http://www.qbittorrent.org/'
PACKAGE_URL='https://www.qbittorrent.org/'
ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
@@ -606,6 +606,8 @@ libtorrent_CFLAGS
BOOST_SYSTEM_LIB
BOOST_LDFLAGS
BOOST_CPPFLAGS
Qt5Svg_LIBS
Qt5Svg_CFLAGS
QT_QMAKE
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
@@ -688,6 +690,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -737,6 +740,8 @@ PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
QT_QMAKE
Qt5Svg_CFLAGS
Qt5Svg_LIBS
libtorrent_CFLAGS
libtorrent_LIBS
zlib_CFLAGS
@@ -779,6 +784,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1031,6 +1037,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1168,7 +1183,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1281,7 +1296,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 v3.2.0alpha to adapt to many kinds of systems.
\`configure' configures qbittorrent v4.0.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1321,6 +1336,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1351,7 +1367,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of qbittorrent v3.2.0alpha:";;
short | recursive ) echo "Configuration of qbittorrent v4.0.4:";;
esac
cat <<\_ACEOF
@@ -1408,6 +1424,9 @@ Some influential environment variables:
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
QT_QMAKE value of host_bins for Qt5Core >= 5.5.1, overriding pkg-config
Qt5Svg_CFLAGS
C compiler flags for Qt5Svg, overriding pkg-config
Qt5Svg_LIBS linker flags for Qt5Svg, overriding pkg-config
libtorrent_CFLAGS
C compiler flags for libtorrent, overriding pkg-config
libtorrent_LIBS
@@ -1419,7 +1438,7 @@ Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to <bugs.qbittorrent.org>.
qbittorrent home page: <http://www.qbittorrent.org/>.
qbittorrent home page: <https://www.qbittorrent.org/>.
_ACEOF
ac_status=$?
fi
@@ -1482,7 +1501,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
qbittorrent configure v3.2.0alpha
qbittorrent configure v4.0.4
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1621,7 +1640,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 v3.2.0alpha, which was
It was created by qbittorrent $as_me v4.0.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3799,7 +3818,7 @@ fi
# Define the identity of the package.
PACKAGE='qbittorrent'
VERSION='v3.2.0alpha'
VERSION='v4.0.4'
cat >>confdefs.h <<_ACEOF
@@ -4477,6 +4496,104 @@ $as_echo "not found" >&6; }
fi
if test "x$QT_QMAKE" = "x"; then :
as_fn_error $? "Could not find qmake" "$LINENO" 5
fi
if test "x$enable_gui" = "xyes"; then :
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt5Svg" >&5
$as_echo_n "checking for Qt5Svg... " >&6; }
if test -n "$Qt5Svg_CFLAGS"; then
pkg_cv_Qt5Svg_CFLAGS="$Qt5Svg_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Svg >= 5.5.1\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5Svg >= 5.5.1") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_Qt5Svg_CFLAGS=`$PKG_CONFIG --cflags "Qt5Svg >= 5.5.1" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$Qt5Svg_LIBS"; then
pkg_cv_Qt5Svg_LIBS="$Qt5Svg_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Svg >= 5.5.1\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5Svg >= 5.5.1") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_Qt5Svg_LIBS=`$PKG_CONFIG --libs "Qt5Svg >= 5.5.1" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
Qt5Svg_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "Qt5Svg >= 5.5.1" 2>&1`
else
Qt5Svg_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "Qt5Svg >= 5.5.1" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$Qt5Svg_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (Qt5Svg >= 5.5.1) were not met:
$Qt5Svg_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables Qt5Svg_CFLAGS
and Qt5Svg_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables Qt5Svg_CFLAGS
and Qt5Svg_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
Qt5Svg_CFLAGS=$pkg_cv_Qt5Svg_CFLAGS
Qt5Svg_LIBS=$pkg_cv_Qt5Svg_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether QtDBus should be enabled" >&5
$as_echo_n "checking whether QtDBus should be enabled... " >&6; }
case "x$enable_qt_dbus" in #(
@@ -4523,15 +4640,14 @@ esac
# Check whether --with-boost was given.
if test "${with_boost+set}" = set; then :
withval=$with_boost;
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ac_boost_path=""
else
want_boost="yes"
ac_boost_path="$withval"
fi
case $withval in #(
no) :
want_boost="no";_AX_BOOST_BASE_boost_path="" ;; #(
yes) :
want_boost="yes";_AX_BOOST_BASE_boost_path="" ;; #(
*) :
want_boost="yes";_AX_BOOST_BASE_boost_path="$withval" ;;
esac
else
want_boost="yes"
@@ -4543,78 +4659,121 @@ fi
# Check whether --with-boost-libdir was given.
if test "${with_boost_libdir+set}" = set; then :
withval=$with_boost_libdir;
if test -d "$withval"
then
ac_boost_lib_path="$withval"
else
as_fn_error $? "--with-boost-libdir expected directory name" "$LINENO" 5
fi
if test -d "$withval"; then :
_AX_BOOST_BASE_boost_lib_path="$withval"
else
as_fn_error $? "--with-boost-libdir expected directory name" "$LINENO" 5
fi
else
ac_boost_lib_path=""
_AX_BOOST_BASE_boost_lib_path=""
fi
if test "x$want_boost" = "xyes"; then
boost_lib_version_req=1.35
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([0-9]*\.[0-9]*\)'`
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([0-9]*\)'`
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[0-9]*\.\([0-9]*\)'`
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
boost_lib_version_req_sub_minor="0"
fi
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= $boost_lib_version_req" >&5
$as_echo_n "checking for boostlib >= $boost_lib_version_req... " >&6; }
BOOST_LDFLAGS=""
BOOST_CPPFLAGS=""
if test "x$want_boost" = "xyes"; then :
if test "x1.35" = "x"; then :
_AX_BOOST_BASE_TONUMERICVERSION_req="1.20.0"
else
_AX_BOOST_BASE_TONUMERICVERSION_req="1.35"
fi
_AX_BOOST_BASE_TONUMERICVERSION_req_shorten=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([0-9]*\.[0-9]*\)'`
_AX_BOOST_BASE_TONUMERICVERSION_req_major=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([0-9]*\)'`
if test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_major" = "x"; then :
as_fn_error $? "You should at least specify libboost major version" "$LINENO" 5
fi
_AX_BOOST_BASE_TONUMERICVERSION_req_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[0-9]*\.\([0-9]*\)'`
if test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_minor" = "x"; then :
_AX_BOOST_BASE_TONUMERICVERSION_req_minor="0"
fi
_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
if test "X$_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor" = "X"; then :
_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor="0"
fi
_AX_BOOST_BASE_TONUMERICVERSION_RET=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req_major \* 100000 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_minor \* 100 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor`
WANT_BOOST_VERSION=$_AX_BOOST_BASE_TONUMERICVERSION_RET
succeeded=no
libsubdirs="lib"
ax_arch=`uname -m`
case $ax_arch in
x86_64)
libsubdirs="lib64 libx32 lib lib64"
;;
ppc64|s390x|sparc64|aarch64|ppc64le)
libsubdirs="lib64 lib lib64 ppc64le"
;;
esac
libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
case ${host_cpu} in #(
x86_64) :
libsubdirs="lib64 libx32 lib lib64" ;; #(
ppc64|s390x|sparc64|aarch64|ppc64le) :
libsubdirs="lib64 lib lib64" ;; #(
*) :
libsubdirs="lib"
;;
esac
case ${host_cpu} in
i?86)
libsubdirs="lib/i386-${host_os} $libsubdirs"
;;
esac
case ${host_cpu} in #(
i?86) :
multiarch_libsubdir="lib/i386-${host_os}" ;; #(
*) :
multiarch_libsubdir="lib/${host_cpu}-${host_os}"
;;
esac
if test "$ac_boost_path" != ""; then
BOOST_CPPFLAGS="-I$ac_boost_path/include"
for ac_boost_path_tmp in $libsubdirs; do
if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
break
fi
done
elif test "$cross_compiling" != yes; then
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
for libsubdir in $libsubdirs ; do
if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
if test "x$_AX_BOOST_BASE_boost_path" != "x"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= 1.35 ($WANT_BOOST_VERSION) includes in \"$_AX_BOOST_BASE_boost_path/include\"" >&5
$as_echo_n "checking for boostlib >= 1.35 ($WANT_BOOST_VERSION) includes in \"$_AX_BOOST_BASE_boost_path/include\"... " >&6; }
if test -d "$_AX_BOOST_BASE_boost_path/include" && test -r "$_AX_BOOST_BASE_boost_path/include"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include"
for _AX_BOOST_BASE_boost_path_tmp in $multiarch_libsubdir $libsubdirs; do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= 1.35 ($WANT_BOOST_VERSION) lib path in \"$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp\"" >&5
$as_echo_n "checking for boostlib >= 1.35 ($WANT_BOOST_VERSION) lib path in \"$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp\"... " >&6; }
if test -d "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" && test -r "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" ; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp";
break;
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
done
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
else
if test X"$cross_compiling" = Xyes; then
search_libsubdirs=$multiarch_libsubdir
else
search_libsubdirs="$multiarch_libsubdir $libsubdirs"
fi
for _AX_BOOST_BASE_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
if test -d "$_AX_BOOST_BASE_boost_path_tmp/include/boost" && test -r "$_AX_BOOST_BASE_boost_path_tmp/include/boost" ; then
for libsubdir in $search_libsubdirs ; do
if ls "$_AX_BOOST_BASE_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path_tmp/$libsubdir"
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path_tmp/include"
break;
fi
done
fi
if test "$ac_boost_lib_path" != ""; then
BOOST_LDFLAGS="-L$ac_boost_lib_path"
fi
fi
if test "x$_AX_BOOST_BASE_boost_lib_path" != "x"; then :
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_lib_path"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= 1.35 ($WANT_BOOST_VERSION)" >&5
$as_echo_n "checking for boostlib >= 1.35 ($WANT_BOOST_VERSION)... " >&6; }
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
@@ -4633,17 +4792,13 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <boost/version.hpp>
#include <boost/version.hpp>
int
main ()
{
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($WANT_BOOST_VERSION))]));
;
return 0;
@@ -4667,39 +4822,47 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test "x$succeeded" != "xyes"; then
if test "x$succeeded" != "xyes" ; then
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
BOOST_CPPFLAGS=
BOOST_LDFLAGS=
if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
BOOST_LDFLAGS=
fi
_version=0
if test "$ac_boost_path" != ""; then
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
if test -n "$_AX_BOOST_BASE_boost_path" ; then
if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path"; then
for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
if test "x$V_CHECK" = "x1" ; then
_version=$_version_tmp
fi
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include/boost-$VERSION_UNDERSCORE"
done
if test -z "$BOOST_CPPFLAGS"; then
if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then
BOOST_CPPFLAGS="-I$ac_boost_path"
if test -d "$_AX_BOOST_BASE_boost_path/boost" && test -r "$_AX_BOOST_BASE_boost_path/boost"; then
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path"
fi
fi
if test -n "$BOOST_CPPFLAGS" && test -z "$BOOST_LDFLAGS"; then
for libsubdir in $libsubdirs ; do
if ls "$_AX_BOOST_BASE_boost_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$libsubdir"
fi
fi
else
if test "$cross_compiling" != yes; then
for ac_boost_path in /usr /usr/local /opt /opt/local ; do
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
if test "x$cross_compiling" != "xyes" ; then
for _AX_BOOST_BASE_boost_path in /usr /usr/local /opt /opt/local ; do
if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path" ; then
for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
if test "x$V_CHECK" = "x1" ; then
_version=$_version_tmp
best_path=$ac_boost_path
best_path=$_AX_BOOST_BASE_boost_path
fi
done
fi
@@ -4707,7 +4870,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
if test "$ac_boost_lib_path" = ""; then
if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
for libsubdir in $libsubdirs ; do
if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
@@ -4715,7 +4878,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
fi
fi
if test "x$BOOST_ROOT" != "x"; then
if test -n "$BOOST_ROOT" ; then
for libsubdir in $libsubdirs ; do
if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
@@ -4724,7 +4887,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
stage_version_shorten=`expr $stage_version : '\([0-9]*\.[0-9]*\)'`
V_CHECK=`expr $stage_version_shorten \>\= $_version`
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
if test "x$V_CHECK" = "x1" && test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: We will use a staged boost library from $BOOST_ROOT" >&5
$as_echo "$as_me: We will use a staged boost library from $BOOST_ROOT" >&6;}
BOOST_CPPFLAGS="-I$BOOST_ROOT"
@@ -4748,17 +4911,13 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <boost/version.hpp>
#include <boost/version.hpp>
int
main ()
{
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($WANT_BOOST_VERSION))]));
;
return 0;
@@ -4781,41 +4940,37 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
fi
if test "$succeeded" != "yes" ; then
if test "$_version" = "0" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&5
$as_echo "$as_me: We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&6;}
if test "x$succeeded" != "xyes" ; then
if test "x$_version" = "x0" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: We could not detect the boost libraries (version 1.35 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&5
$as_echo "$as_me: We could not detect the boost libraries (version 1.35 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&6;}
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: Your boost libraries seems to old (version $_version)." >&5
$as_echo "$as_me: Your boost libraries seems to old (version $_version)." >&6;}
fi
# execute ACTION-IF-NOT-FOUND (if present):
:
as_fn_error $? "Could not find Boost" "$LINENO" 5
else
$as_echo "#define HAVE_BOOST /**/" >>confdefs.h
# execute ACTION-IF-FOUND (if present):
:
{ $as_echo "$as_me:${as_lineno-$LINENO}: Boost CPPFLAGS: \"$BOOST_CPPFLAGS\"
Boost LDFLAGS: \"$BOOST_LDFLAGS\"" >&5
$as_echo "$as_me: Boost CPPFLAGS: \"$BOOST_CPPFLAGS\"
Boost LDFLAGS: \"$BOOST_LDFLAGS\"" >&6;}
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
# HAVE_BOOST is set to an empty value when Boost is found. I don't know
# how to test for a set vs unset variable.
if test "x$BOOST_CPPFLAGS" = "x"; then :
as_fn_error $? "Could not find Boost" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: Boost CPPFLAGS: $BOOST_CPPFLAGS" >&5
$as_echo "$as_me: Boost CPPFLAGS: $BOOST_CPPFLAGS" >&6;}
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
fi
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
@@ -5059,15 +5214,9 @@ fi
LDFLAGS="$LDFLAGS_SAVED"
fi
# HAVE_BOOST_SYSTEM is set to an empty value when Boost.System is found.
# I don't know how to test for a set vs unset variable.
if test "x$BOOST_SYSTEM_LIB" = "x"; then :
as_fn_error $? "Could not find Boost.System" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: Boost.System LIB: $BOOST_SYSTEM_LIB" >&5
$as_echo "$as_me: Boost.System LIB: $BOOST_SYSTEM_LIB" >&6;}
LIBS="$BOOST_SYSTEM_LIB $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: Boost.System LIB: \"$BOOST_SYSTEM_LIB\"" >&5
$as_echo "$as_me: Boost.System LIB: \"$BOOST_SYSTEM_LIB\"" >&6;}
LIBS="$BOOST_SYSTEM_LIB $LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which qtsingleapplication to use" >&5
$as_echo_n "checking which qtsingleapplication to use... " >&6; }
@@ -5352,7 +5501,7 @@ extract() {
new_line='
'
# Convert " -" to "\n" if not between quotes and remove possible leading white spaces
string=$(echo " $*" | $SED -e "s: -:\\${new_line}:g" -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g" -e 's/^[:space:]*//')
string=$(echo " $*" | $SED -e "s: -:\\${new_line}:g" -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g" -e 's/^[[:space:]]*//')
SAVEIFS=$IFS
IFS=$(printf "\n\b")
for i in $string; do
@@ -5366,9 +5515,8 @@ extract() {
IFS=$SAVEIFS
}
extract $CPPFLAGS
extract "$CFLAGS $CPPFLAGS $CXXFLAGS"
QBT_ADD_DEFINES="$QBT_ADD_DEFINES $QBT_CONF_DEFINES"
QBT_CONF_EXTRA_CFLAGS="$QBT_CONF_EXTRA_CFLAGS $CXXFLAGS"
# Substitute the values of these vars in conf.pri.in
@@ -5950,7 +6098,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 v3.2.0alpha, which was
This file was extended by qbittorrent $as_me v4.0.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6002,13 +6150,13 @@ Configuration commands:
$config_commands
Report bugs to <bugs.qbittorrent.org>.
qbittorrent home page: <http://www.qbittorrent.org/>."
qbittorrent home page: <https://www.qbittorrent.org/>."
_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 v3.2.0alpha
qbittorrent config.status v4.0.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -7265,7 +7413,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 v3.2.0alpha, which was
This file was extended by qbittorrent $as_me v4.0.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -7317,13 +7465,13 @@ Configuration commands:
$config_commands
Report bugs to <bugs.qbittorrent.org>.
qbittorrent home page: <http://www.qbittorrent.org/>."
qbittorrent home page: <https://www.qbittorrent.org/>."
_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 v3.2.0alpha
qbittorrent config.status v4.0.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -8024,4 +8172,3 @@ else
as_fn_error $? "Failed running $QT_QMAKE to generate the makefile" "$LINENO" 5
fi
$as_echo

View File

@@ -1,4 +1,4 @@
AC_INIT([qbittorrent], [v3.2.0alpha], [bugs.qbittorrent.org], [], [http://www.qbittorrent.org/])
AC_INIT([qbittorrent], [v4.0.4], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
@@ -116,6 +116,12 @@ AS_CASE(["x$enable_webui"],
AC_MSG_ERROR([Unknown option "$enable_webui". Use either "yes" or "no".])])
FIND_QT5()
AS_IF([test "x$QT_QMAKE" = "x"],
[AC_MSG_ERROR([Could not find qmake])
])
AS_IF([test "x$enable_gui" = "xyes"],
[PKG_CHECK_MODULES(Qt5Svg, [Qt5Svg >= 5.5.1])
])
AC_MSG_CHECKING([whether QtDBus should be enabled])
AS_CASE(["x$enable_qt_dbus"],
["xyes"],
@@ -132,22 +138,16 @@ AS_CASE(["x$enable_qt_dbus"],
AC_MSG_ERROR([Unknown option "$enable_qt_dbus". Use either "yes" or "no".])])
AX_BOOST_BASE([1.35])
# HAVE_BOOST is set to an empty value when Boost is found. I don't know
# how to test for a set vs unset variable.
AS_IF([test "x$BOOST_CPPFLAGS" = "x"],
[AC_MSG_ERROR([Could not find Boost])],
[AC_MSG_NOTICE([Boost CPPFLAGS: $BOOST_CPPFLAGS])
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"])
AX_BOOST_BASE([1.35],
[AC_MSG_NOTICE([Boost CPPFLAGS: "$BOOST_CPPFLAGS"
Boost LDFLAGS: "$BOOST_LDFLAGS"])],
[AC_MSG_ERROR([Could not find Boost])])
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
AX_BOOST_SYSTEM()
# HAVE_BOOST_SYSTEM is set to an empty value when Boost.System is found.
# I don't know how to test for a set vs unset variable.
AS_IF([test "x$BOOST_SYSTEM_LIB" = "x"],
[AC_MSG_ERROR([Could not find Boost.System])],
[AC_MSG_NOTICE([Boost.System LIB: $BOOST_SYSTEM_LIB])
LIBS="$BOOST_SYSTEM_LIB $LIBS"])
AC_MSG_NOTICE([Boost.System LIB: "$BOOST_SYSTEM_LIB"])
LIBS="$BOOST_SYSTEM_LIB $LIBS"
AC_MSG_CHECKING([which qtsingleapplication to use])
AS_CASE(["x$with_qtsingleapplication"],
@@ -190,7 +190,7 @@ extract() {
new_line='
'
# Convert " -" to "\n" if not between quotes and remove possible leading white spaces
string=$(echo " $*" | $SED -e "s: -:\\${new_line}:g" -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g" -e 's/^[[:space:]]*//')
string=$(echo " $*" | $SED -e "s: -:\\${new_line}:g" -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g" -e 's/^[[[:space:]]]*//')
SAVEIFS=$IFS
IFS=$(printf "\n\b")
for i in $string; do
@@ -204,9 +204,8 @@ extract() {
IFS=$SAVEIFS
}
extract $CPPFLAGS
extract "$CFLAGS $CPPFLAGS $CXXFLAGS"
QBT_ADD_DEFINES="$QBT_ADD_DEFINES $QBT_CONF_DEFINES"
QBT_CONF_EXTRA_CFLAGS="$QBT_CONF_EXTRA_CFLAGS $CXXFLAGS"
# Substitute the values of these vars in conf.pri.in
AC_SUBST(QBT_CONF_INCLUDES)
@@ -234,4 +233,3 @@ AS_IF([test "x$ret" = "x0"],
[AC_MSG_NOTICE([Good, your configure finished.])],
[AC_MSG_ERROR([Failed running $QT_QMAKE to generate the makefile])])
AS_ECHO()

4
dist/mac/Info.plist vendored
View File

@@ -45,7 +45,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.4.0</string>
<string>4.0.4</string>
<key>CFBundleSignature</key>
<string>qBit</string>
<key>CFBundleExecutable</key>
@@ -59,7 +59,7 @@
<key>NSAppleScriptEnabled</key>
<string>YES</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2006-2017 The qBittorrent project</string>
<string>Copyright © 2006-2018 The qBittorrent project</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>

Binary file not shown.

Binary file not shown.

View File

@@ -25,10 +25,6 @@ if (GUI)
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.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/
COMPONENT data)
@@ -38,6 +34,7 @@ if (GUI)
COMPONENT data)
install(FILES
${qBittorrent_SOURCE_DIR}/src/icons/skin/qbittorrent-tray.svg
${qBittorrent_SOURCE_DIR}/src/icons/skin/qbittorrent-tray-dark.svg
${qBittorrent_SOURCE_DIR}/src/icons/skin/qbittorrent-tray-light.svg
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 893 B

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 893 B

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -11,7 +11,7 @@
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).
same features on all major platforms (Linux, Mac OS X, Windows, FreeBSD).
</p>
<p>
It is programmed in C++ / Qt and uses libtorrent (sometimes called
@@ -56,7 +56,7 @@
</image>
</screenshot>
</screenshots>
<url type="homepage">http://www.qbittorrent.org/</url>
<url type="homepage">https://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>

View File

@@ -86,7 +86,7 @@ Section $(inst_qbt_req) ;"qBittorrent (required)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "UninstallString" '"$INSTDIR\uninst.exe"'
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "DisplayIcon" '"$INSTDIR\qbittorrent.exe",0'
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "Publisher" "The qBittorrent project"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "URLInfoAbout" "http://www.qbittorrent.org"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "URLInfoAbout" "https://www.qbittorrent.org"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "DisplayVersion" "${PROG_VERSION}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "NoRepair" 1

Binary file not shown.

View File

@@ -27,7 +27,7 @@ XPStyle on
!define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
; Program specific
!define PROG_VERSION "3.4.0"
!define PROG_VERSION "4.0.4"
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
@@ -50,7 +50,7 @@ XPStyle on
;Installer Version Information
VIAddVersionKey "ProductName" "qBittorrent"
VIAddVersionKey "CompanyName" "The qBittorrent project"
VIAddVersionKey "LegalCopyright" "Copyright ©2006-2017 The qBittorrent project"
VIAddVersionKey "LegalCopyright" "Copyright ©2006-2018 The qBittorrent project"
VIAddVersionKey "FileDescription" "qBittorrent - A Bittorrent Client"
VIAddVersionKey "FileVersion" "${PROG_VERSION}"

View File

@@ -2,4 +2,4 @@
Translations = translations
[Platforms]
WindowsArguments = dpiawareness=0
;WindowsArguments = dpiawareness=1

View File

@@ -1,187 +0,0 @@
QBittorrent installation
0. CONTENTS OF THIS FILE
========================
1. INTRODUCTION
2. REQUIREMENTS
3. INSTALLATION
4. BUGREPORTS
5. CREDITS
6. SUPPORT AND DONATIONS
7. HISTORY
1. INTRODUCTION
===============
Welcome to QBittorrent port for OS/2 and eComStation.
2. REQUIREMENTS
===============
The following requirements can be installed either by rpm or by zip files.
RPM Installation:
klibc
-----
1. yum install libc
openssl 1.0
-----------
1. yum install openssl
pthread
-------
1. yum install pthread
GCC4Core
--------
1. yum install libgcc
2. yum install gcc-stack-protector
3. yum install gcc-stdc++-shared-library
4. yum install gcc-supc++-shared-library
Qt4 dll
-------
1. yum install libqt4
ZIP Installation:
klibc
-----
1. Download klibc 0.6.5 or better (see http://svn.netlabs.org/libc for more information)
2. Install the files to your libpath eg x:\ecs\dll
openssl 1.0
-----------
1. Download the zip file from http://rpm.netlabs.org/release/00/zip
2. Install the files to your libpath eg. x:\ecs\dll
pthread
-------
1. Download pthread 2012-03-13 or better from http://rpm.netlabs.org/release/00/zip
2. Install the files to your libpath eg. x:\ecs\dll
GCC4Core
--------
1. Download GCC4Core 1.2.1 or better from http://ftp.netlabs.org/pub/gcc
2. Install the files to your libpath eg. x:\ecs\dll
Qt4 dll
-------
1. Download Qt4 4.7.3 or better (see http://svn.netlabs.org/qt4 for more information)
2. Install the files according to the readme
3. INSTALLATION
===============
To install QBittorrent, do the following:
1. Create a directory for QBittorrent.
2. Extract the QBittorrent package to the new directory.
3. Create a WPS object for QBittorrent.exe.
4. Start QBittorrent
5. Happy torrenting
4. BUGREPORTS
=============
Please create bugreports at http://svn.netlabs.org/qtapps
Only bug reports with a reproducible bug are accepted. :-)
5. CREDITS
==========
The port was done by:
Silvan Scherrer aka _diver
Thanks go to:
* Dmitry A. Kuminov
They either helped me when I had some nasty questions or did some testing for
me.
6. SUPPORT AND DONATIONS
========================
QBittorrent port is based on volunteer work. If you would like to support further
development, you can do so in one of the following ways:
* Donate to the Qt4 project: see qt.netlabs.org for more information
* Contribute to the project: Besides actual development, this also includes
maintaining the documentation and the project web site as well as help
for users.
7. HISTORY
==========
2012-09-19
* updated to 3.0.4 code level of QBittorrent
* updated libtorrent to 0.16.3 level
2012-09-06
* updated to 3.0.2 code level of QBittorrent
2012-05-14
* updated to 2.9.8 code level of QBittorrent
2012-03-15
* updated to 2.9.5 code level of QBittorrent
2011-09-26
* updated to 2.8.5 code level of QBittorrent
* updated to Qt 4.7.3
2011-06-20
* updated to 2.7.3 code level of QBittorrent
* updated libtorrent to 0.15.6 level
2010-12-23
* updated to 2.5.2 code level of QBittorrent
2010-11-22
* updated to 2.4.11 code level of QBittorrent
2010-xx-xx
* initial port

View File

@@ -1,5 +1,5 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
# https://www.gnu.org/software/autoconf-archive/ax_boost_base.html
# ===========================================================================
#
# SYNOPSIS
@@ -33,7 +33,15 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 26
#serial 42
# example boost program (need to pass version)
m4_define([_AX_BOOST_BASE_PROGRAM],
[AC_LANG_PROGRAM([[
#include <boost/version.hpp>
]],[[
(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($1))]));
]])])
AC_DEFUN([AX_BOOST_BASE],
[
@@ -44,104 +52,121 @@ AC_ARG_WITH([boost],
or disable it (ARG=no)
@<:@ARG=yes@:>@ ])],
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ac_boost_path=""
else
want_boost="yes"
ac_boost_path="$withval"
fi
AS_CASE([$withval],
[no],[want_boost="no";_AX_BOOST_BASE_boost_path=""],
[yes],[want_boost="yes";_AX_BOOST_BASE_boost_path=""],
[want_boost="yes";_AX_BOOST_BASE_boost_path="$withval"])
],
[want_boost="yes"])
AC_ARG_WITH([boost-libdir],
AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
[Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
[
if test -d "$withval"
then
ac_boost_lib_path="$withval"
else
AC_MSG_ERROR(--with-boost-libdir expected directory name)
fi
],
[ac_boost_lib_path=""]
)
[AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
[Force given directory for boost libraries.
Note that this will override library path detection,
so use this parameter only if default library detection fails
and you know exactly where your boost libraries are located.])],
[
AS_IF([test -d "$withval"],
[_AX_BOOST_BASE_boost_lib_path="$withval"],
[AC_MSG_ERROR([--with-boost-libdir expected directory name])])
],
[_AX_BOOST_BASE_boost_lib_path=""])
if test "x$want_boost" = "xyes"; then
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
boost_lib_version_req_sub_minor="0"
fi
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
BOOST_LDFLAGS=""
BOOST_CPPFLAGS=""
AS_IF([test "x$want_boost" = "xyes"],
[_AX_BOOST_BASE_RUNDETECT([$1],[$2],[$3])])
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS)
])
# convert a version string in $2 to numeric and affect to polymorphic var $1
AC_DEFUN([_AX_BOOST_BASE_TONUMERICVERSION],[
AS_IF([test "x$2" = "x"],[_AX_BOOST_BASE_TONUMERICVERSION_req="1.20.0"],[_AX_BOOST_BASE_TONUMERICVERSION_req="$2"])
_AX_BOOST_BASE_TONUMERICVERSION_req_shorten=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\.[[0-9]]*\)'`
_AX_BOOST_BASE_TONUMERICVERSION_req_major=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\)'`
AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_major" = "x"],
[AC_MSG_ERROR([You should at least specify libboost major version])])
_AX_BOOST_BASE_TONUMERICVERSION_req_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.\([[0-9]]*\)'`
AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_minor" = "x"],
[_AX_BOOST_BASE_TONUMERICVERSION_req_minor="0"])
_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
AS_IF([test "X$_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor" = "X"],
[_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor="0"])
_AX_BOOST_BASE_TONUMERICVERSION_RET=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req_major \* 100000 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_minor \* 100 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor`
AS_VAR_SET($1,$_AX_BOOST_BASE_TONUMERICVERSION_RET)
])
dnl Run the detection of boost should be run only if $want_boost
AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
_AX_BOOST_BASE_TONUMERICVERSION(WANT_BOOST_VERSION,[$1])
succeeded=no
AC_REQUIRE([AC_CANONICAL_HOST])
dnl On 64-bit systems check for system libraries in both lib64 and lib.
dnl The former is specified by FHS, but e.g. Debian does not adhere to
dnl this (as it rises problems for generic multi-arch support).
dnl The last entry in the list is chosen by default when no libraries
dnl are found, e.g. when only header-only libraries are installed!
libsubdirs="lib"
ax_arch=`uname -m`
case $ax_arch in
x86_64)
libsubdirs="lib64 libx32 lib lib64"
;;
ppc64|s390x|sparc64|aarch64|ppc64le)
libsubdirs="lib64 lib lib64 ppc64le"
;;
esac
AS_CASE([${host_cpu}],
[x86_64],[libsubdirs="lib64 libx32 lib lib64"],
[ppc64|s390x|sparc64|aarch64|ppc64le],[libsubdirs="lib64 lib lib64"],
[libsubdirs="lib"]
)
dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
dnl them priority over the other paths since, if libs are found there, they
dnl are almost assuredly the ones desired.
AC_REQUIRE([AC_CANONICAL_HOST])
libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
case ${host_cpu} in
i?86)
libsubdirs="lib/i386-${host_os} $libsubdirs"
;;
esac
AS_CASE([${host_cpu}],
[i?86],[multiarch_libsubdir="lib/i386-${host_os}"],
[multiarch_libsubdir="lib/${host_cpu}-${host_os}"]
)
dnl first we check the system location for boost libraries
dnl this location ist chosen if boost libraries are installed with the --layout=system option
dnl or if you install boost with RPM
if test "$ac_boost_path" != ""; then
BOOST_CPPFLAGS="-I$ac_boost_path/include"
for ac_boost_path_tmp in $libsubdirs; do
if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
break
fi
done
elif test "$cross_compiling" != yes; then
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
for libsubdir in $libsubdirs ; do
if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
AS_IF([test "x$_AX_BOOST_BASE_boost_path" != "x"],[
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) includes in "$_AX_BOOST_BASE_boost_path/include"])
AS_IF([test -d "$_AX_BOOST_BASE_boost_path/include" && test -r "$_AX_BOOST_BASE_boost_path/include"],[
AC_MSG_RESULT([yes])
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include"
for _AX_BOOST_BASE_boost_path_tmp in $multiarch_libsubdir $libsubdirs; do
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) lib path in "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp"])
AS_IF([test -d "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" && test -r "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" ],[
AC_MSG_RESULT([yes])
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp";
break;
],
[AC_MSG_RESULT([no])])
done],[
AC_MSG_RESULT([no])])
],[
if test X"$cross_compiling" = Xyes; then
search_libsubdirs=$multiarch_libsubdir
else
search_libsubdirs="$multiarch_libsubdir $libsubdirs"
fi
for _AX_BOOST_BASE_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
if test -d "$_AX_BOOST_BASE_boost_path_tmp/include/boost" && test -r "$_AX_BOOST_BASE_boost_path_tmp/include/boost" ; then
for libsubdir in $search_libsubdirs ; do
if ls "$_AX_BOOST_BASE_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path_tmp/$libsubdir"
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path_tmp/include"
break;
fi
done
fi
])
dnl overwrite ld flags if we have required special directory with
dnl --with-boost-libdir parameter
if test "$ac_boost_lib_path" != ""; then
BOOST_LDFLAGS="-L$ac_boost_lib_path"
fi
AS_IF([test "x$_AX_BOOST_BASE_boost_lib_path" != "x"],
[BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_lib_path"])
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION)])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
@@ -152,15 +177,7 @@ if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CXX])
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
@@ -172,40 +189,50 @@ if test "x$want_boost" = "xyes"; then
dnl if we found no boost with system layout we search for boost libraries
dnl built and installed without the --layout=system option or for a staged(not installed) version
if test "x$succeeded" != "xyes"; then
if test "x$succeeded" != "xyes" ; then
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
BOOST_CPPFLAGS=
BOOST_LDFLAGS=
if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
BOOST_LDFLAGS=
fi
_version=0
if test "$ac_boost_path" != ""; then
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
if test -n "$_AX_BOOST_BASE_boost_path" ; then
if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path"; then
for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
if test "x$V_CHECK" = "x1" ; then
_version=$_version_tmp
fi
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include/boost-$VERSION_UNDERSCORE"
done
dnl if nothing found search for layout used in Windows distributions
if test -z "$BOOST_CPPFLAGS"; then
if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then
BOOST_CPPFLAGS="-I$ac_boost_path"
if test -d "$_AX_BOOST_BASE_boost_path/boost" && test -r "$_AX_BOOST_BASE_boost_path/boost"; then
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path"
fi
fi
dnl if we found something and BOOST_LDFLAGS was unset before
dnl (because "$_AX_BOOST_BASE_boost_lib_path" = ""), set it here.
if test -n "$BOOST_CPPFLAGS" && test -z "$BOOST_LDFLAGS"; then
for libsubdir in $libsubdirs ; do
if ls "$_AX_BOOST_BASE_boost_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$libsubdir"
fi
fi
else
if test "$cross_compiling" != yes; then
for ac_boost_path in /usr /usr/local /opt /opt/local ; do
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
if test "x$cross_compiling" != "xyes" ; then
for _AX_BOOST_BASE_boost_path in /usr /usr/local /opt /opt/local ; do
if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path" ; then
for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
if test "x$V_CHECK" = "x1" ; then
_version=$_version_tmp
best_path=$ac_boost_path
best_path=$_AX_BOOST_BASE_boost_path
fi
done
fi
@@ -213,7 +240,7 @@ if test "x$want_boost" = "xyes"; then
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
if test "$ac_boost_lib_path" = ""; then
if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
for libsubdir in $libsubdirs ; do
if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
@@ -221,7 +248,7 @@ if test "x$want_boost" = "xyes"; then
fi
fi
if test "x$BOOST_ROOT" != "x"; then
if test -n "$BOOST_ROOT" ; then
for libsubdir in $libsubdirs ; do
if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
@@ -230,7 +257,7 @@ if test "x$want_boost" = "xyes"; then
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
V_CHECK=`expr $stage_version_shorten \>\= $_version`
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
if test "x$V_CHECK" = "x1" && test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
BOOST_CPPFLAGS="-I$BOOST_ROOT"
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
@@ -245,15 +272,7 @@ if test "x$want_boost" = "xyes"; then
export LDFLAGS
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
@@ -262,17 +281,15 @@ if test "x$want_boost" = "xyes"; then
AC_LANG_POP([C++])
fi
if test "$succeeded" != "yes" ; then
if test "$_version" = "0" ; then
AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
if test "x$succeeded" != "xyes" ; then
if test "x$_version" = "x0" ; then
AC_MSG_NOTICE([[We could not detect the boost libraries (version $1 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
else
AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
fi
# execute ACTION-IF-NOT-FOUND (if present):
ifelse([$3], , :, [$3])
else
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS)
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
# execute ACTION-IF-FOUND (if present):
ifelse([$2], , :, [$2])
@@ -280,6 +297,5 @@ if test "x$want_boost" = "xyes"; then
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])

View File

@@ -1,5 +1,5 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_system.html
# https://www.gnu.org/software/autoconf-archive/ax_boost_system.html
# ===========================================================================
#
# SYNOPSIS
@@ -31,7 +31,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 18
#serial 19
AC_DEFUN([AX_BOOST_SYSTEM],
[

View File

@@ -9,7 +9,7 @@ exists($$OUT_PWD/../conf.pri) {
include(conf.pri)
}
LIBS += -framework Carbon -framework IOKit
LIBS += -framework Carbon -framework IOKit -framework AppKit
QT_LANG_PATH = ../dist/qt-translations
DIST_PATH = ../dist/mac

View File

@@ -1,16 +0,0 @@
exists(conf.pri) {
# to the conf.pri goes all system dependent stuff
include(conf.pri)
}
LIBS += \
-ltorrent-rasterbar \
-lboost_thread \
-lboost_system \
-lboost_filesystem \
-lssl -lcrypto -lidn -lpthread -lz
RC_FILE = qbittorrent_os2.rc
# LIBTORRENT DEFINES
DEFINES += BOOST_ASIO_DYN_LINK

View File

@@ -2,7 +2,7 @@ TS_IN = $$fromfile(src/src.pro,TRANSLATIONS)
TS_IN_NOEXT = $$replace(TS_IN,".ts","")
isEmpty(QMAKE_LRELEASE) {
win32|os2:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe
win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe
else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
unix {
equals(QT_MAJOR_VERSION, 5) {

View File

@@ -13,7 +13,7 @@ find_package(LibtorrentRasterbar REQUIRED)
# Qt
list(APPEND QBT_QT_COMPONENTS Core Network Xml)
if (GUI)
list (APPEND QBT_QT_COMPONENTS Concurrent Gui Svg Widgets)
list (APPEND QBT_QT_COMPONENTS Gui Svg Widgets)
if (WIN32)
list (APPEND QBT_QT_COMPONENTS WinExtras)
endif(WIN32)
@@ -40,11 +40,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
# defines
add_definitions(-DQT_NO_CAST_TO_ASCII)
# Fast concatenation (Qt >= 4.6)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
if (WIN32)
add_definitions(-DNOMINMAX)
endif (WIN32)
# Efficient construction for QString & QByteArray (Qt >= 4.8)
add_definitions(-DQT_USE_QSTRINGBUILDER)
if (NOT GUI)
add_definitions(-DDISABLE_GUI -DDISABLE_COUNTRIES_RESOLUTION)

View File

@@ -87,7 +87,7 @@ namespace
const QString KEY_FILELOGGER_PATH = FILELOGGER_SETTINGS_KEY("Path");
const QString KEY_FILELOGGER_BACKUP = FILELOGGER_SETTINGS_KEY("Backup");
const QString KEY_FILELOGGER_DELETEOLD = FILELOGGER_SETTINGS_KEY("DeleteOld");
const QString KEY_FILELOGGER_MAXSIZE = FILELOGGER_SETTINGS_KEY("MaxSize");
const QString KEY_FILELOGGER_MAXSIZEBYTES = FILELOGGER_SETTINGS_KEY("MaxSizeBytes");
const QString KEY_FILELOGGER_AGE = FILELOGGER_SETTINGS_KEY("Age");
const QString KEY_FILELOGGER_AGETYPE = FILELOGGER_SETTINGS_KEY("AgeType");
@@ -98,6 +98,10 @@ namespace
const char PARAMS_SEPARATOR[] = "|";
const QString DEFAULT_PORTABLE_MODE_PROFILE_DIR = QLatin1String("profile");
const int MIN_FILELOG_SIZE = 1024; // 1KiB
const int MAX_FILELOG_SIZE = 1000 * 1024 * 1024; // 1000MiB
const int DEFAULT_FILELOG_SIZE = 65 * 1024; // 65KiB
}
Application::Application(const QString &id, int &argc, char **argv)
@@ -105,6 +109,9 @@ Application::Application(const QString &id, int &argc, char **argv)
, m_running(false)
, m_shutdownAct(ShutdownDialogAction::Exit)
, m_commandLineArgs(parseCommandLine(this->arguments()))
#ifndef DISABLE_WEBUI
, m_webui(nullptr)
#endif
{
qRegisterMetaType<Log::Msg>("Log::Msg");
@@ -125,7 +132,6 @@ Application::Application(const QString &id, int &argc, char **argv)
if (m_commandLineArgs.webUiPort > 0) // it will be -1 when user did not set any value
Preferences::instance()->setWebUiPort(m_commandLineArgs.webUiPort);
setApplicationName("qBittorrent");
initializeTranslation();
#if !defined(DISABLE_GUI)
@@ -146,6 +152,13 @@ Application::Application(const QString &id, int &argc, char **argv)
Logger::instance()->addMessage(tr("qBittorrent %1 started", "qBittorrent v3.2.0alpha started").arg(QBT_VERSION));
}
Application::~Application()
{
// we still need to call cleanup()
// in case the App failed to start
cleanup();
}
#ifndef DISABLE_GUI
QPointer<MainWindow> Application::mainWindow()
{
@@ -211,29 +224,22 @@ void Application::setFileLoggerDeleteOld(bool value)
int Application::fileLoggerMaxSize() const
{
int val = settings()->loadValue(KEY_FILELOGGER_MAXSIZE, 10).toInt();
if (val < 1)
return 1;
if (val > 1000)
return 1000;
return val;
int val = settings()->loadValue(KEY_FILELOGGER_MAXSIZEBYTES, DEFAULT_FILELOG_SIZE).toInt();
return std::min(std::max(val, MIN_FILELOG_SIZE), MAX_FILELOG_SIZE);
}
void Application::setFileLoggerMaxSize(const int value)
void Application::setFileLoggerMaxSize(const int bytes)
{
int clampedValue = std::min(std::max(bytes, MIN_FILELOG_SIZE), MAX_FILELOG_SIZE);
if (m_fileLogger)
m_fileLogger->setMaxSize(value);
settings()->storeValue(KEY_FILELOGGER_MAXSIZE, std::min(std::max(value, 1), 1000));
m_fileLogger->setMaxSize(clampedValue);
settings()->storeValue(KEY_FILELOGGER_MAXSIZEBYTES, clampedValue);
}
int Application::fileLoggerAge() const
{
int val = settings()->loadValue(KEY_FILELOGGER_AGE, 6).toInt();
if (val < 1)
return 1;
if (val > 365)
return 365;
return val;
int val = settings()->loadValue(KEY_FILELOGGER_AGE, 1).toInt();
return std::min(std::max(val, 1), 365);
}
void Application::setFileLoggerAge(const int value)
@@ -281,48 +287,27 @@ void Application::runExternalProgram(BitTorrent::TorrentHandle *const torrent) c
#if defined(Q_OS_UNIX)
QProcess::startDetached(QLatin1String("/bin/sh"), {QLatin1String("-c"), program});
#elif defined(Q_OS_WIN) // test cmd: `echo "%F" > "c:\ab ba.txt"`
program.prepend(QLatin1String("\"")).append(QLatin1String("\""));
program.prepend(Utils::Misc::windowsSystemPath() + QLatin1String("\\cmd.exe /C "));
const int cmdMaxLength = 32768; // max length (incl. terminate char) for `lpCommandLine` in `CreateProcessW()`
if ((program.size() + 1) > cmdMaxLength) {
logger->addMessage(tr("Torrent: %1, run external program command too long (length > %2), execution failed.").arg(torrent->name()).arg(cmdMaxLength), Log::CRITICAL);
return;
}
STARTUPINFOW si = {0};
si.cb = sizeof(si);
PROCESS_INFORMATION pi = {0};
WCHAR *arg = new WCHAR[program.size() + 1];
program.toWCharArray(arg);
arg[program.size()] = L'\0';
if (CreateProcessW(NULL, arg, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) {
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
delete[] arg;
#else
QProcess::startDetached(program);
#endif
}
void Application::sendNotificationEmail(BitTorrent::TorrentHandle *const torrent)
void Application::sendNotificationEmail(const BitTorrent::TorrentHandle *torrent)
{
// Prepare mail content
QString content = QObject::tr("Torrent name: %1").arg(torrent->name()) + "\n";
content += QObject::tr("Torrent size: %1").arg(Utils::Misc::friendlyUnit(torrent->wantedSize())) + "\n";
content += QObject::tr("Save path: %1").arg(torrent->savePath()) + "\n\n";
content += QObject::tr("The torrent was downloaded in %1.",
"The torrent was downloaded in 1 hour and 20 seconds")
.arg(Utils::Misc::userFriendlyDuration(torrent->activeTime())) + "\n\n\n";
content += QObject::tr("Thank you for using qBittorrent.") + "\n";
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";
// Send the notification email
Net::Smtp *sender = new Net::Smtp;
sender->sendMail("notification@qbittorrent.org",
Preferences::instance()->getMailNotificationEmail(),
QObject::tr("[qBittorrent] '%1' has finished downloading").arg(torrent->name()),
const Preferences *pref = Preferences::instance();
Net::Smtp *smtp = new Net::Smtp(this);
smtp->sendMail(pref->getMailNotificationSender(),
pref->getMailNotificationEmail(),
tr("[qBittorrent] '%1' has finished downloading").arg(torrent->name()),
content);
}
@@ -483,7 +468,12 @@ int Application::exec(const QStringList &params)
#ifndef DISABLE_WEBUI
m_webui = new WebUI;
#endif
#ifdef DISABLE_GUI
if (m_webui->isErrored())
return 1;
connect(m_webui, &WebUI::fatalError, this, []() { QCoreApplication::exit(1); });
#endif // DISABLE_GUI
#endif // DISABLE_WEBUI
new RSS::Session; // create RSS::Session singleton
new RSS::AutoDownloader; // create RSS::AutoDownloader singleton
@@ -506,15 +496,15 @@ int Application::exec(const QStringList &params)
#endif // DISABLE_GUI
m_running = true;
// Now UI is ready to process signals from Session
BitTorrent::Session::instance()->startUpTorrents();
m_paramsQueue = params + m_paramsQueue;
if (!m_paramsQueue.isEmpty()) {
processParams(m_paramsQueue);
m_paramsQueue.clear();
}
// Now UI is ready to process signals from Session
BitTorrent::Session::instance()->startUpTorrents();
return BaseApplication::exec();
}
@@ -554,7 +544,7 @@ bool Application::event(QEvent *ev)
if (path.isEmpty())
// Get the url instead
path = static_cast<QFileOpenEvent *>(ev)->url().toString();
qDebug("Received a mac file open event: %s", qPrintable(path));
qDebug("Received a mac file open event: %s", qUtf8Printable(path));
if (m_running)
processParams(QStringList(path));
else
@@ -587,18 +577,18 @@ void Application::initializeTranslation()
// Load translation
QString localeStr = pref->getLocale();
if (m_qtTranslator.load(QString::fromUtf8("qtbase_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) ||
m_qtTranslator.load(QString::fromUtf8("qt_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
qDebug("Qt %s locale recognized, using translation.", qPrintable(localeStr));
if (m_qtTranslator.load(QLatin1String("qtbase_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) ||
m_qtTranslator.load(QLatin1String("qt_") + localeStr, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
qDebug("Qt %s locale recognized, using translation.", qUtf8Printable(localeStr));
else
qDebug("Qt %s locale unrecognized, using default (en).", qPrintable(localeStr));
qDebug("Qt %s locale unrecognized, using default (en).", qUtf8Printable(localeStr));
installTranslator(&m_qtTranslator);
if (m_translator.load(QString::fromUtf8(":/lang/qbittorrent_") + localeStr))
qDebug("%s locale recognized, using translation.", qPrintable(localeStr));
if (m_translator.load(QLatin1String(":/lang/qbittorrent_") + localeStr))
qDebug("%s locale recognized, using translation.", qUtf8Printable(localeStr));
else
qDebug("%s locale unrecognized, using default (en).", qPrintable(localeStr));
qDebug("%s locale unrecognized, using default (en).", qUtf8Printable(localeStr));
installTranslator(&m_translator);
#ifndef DISABLE_GUI
@@ -642,37 +632,36 @@ void Application::shutdownCleanup(QSessionManager &manager)
void Application::cleanup()
{
#ifndef DISABLE_GUI
#ifdef Q_OS_WIN
// cleanup() can be called multiple times during shutdown. We only need it once.
static QAtomicInt alreadyDone;
if (!alreadyDone.testAndSetAcquire(0, 1))
return;
#endif // Q_OS_WIN
// Hide the window and not leave it on screen as
// unresponsive. Also for Windows take the WinId
// after it's hidden, because hide() may cause a
// WinId change.
m_window->hide();
#ifndef DISABLE_GUI
if (m_window) {
// Hide the window and not leave it on screen as
// unresponsive. Also for Windows take the WinId
// after it's hidden, because hide() may cause a
// WinId change.
m_window->hide();
#ifdef Q_OS_WIN
typedef BOOL (WINAPI *PSHUTDOWNBRCREATE)(HWND, LPCWSTR);
PSHUTDOWNBRCREATE shutdownBRCreate = (PSHUTDOWNBRCREATE)::GetProcAddress(::GetModuleHandleW(L"User32.dll"), "ShutdownBlockReasonCreate");
// Only available on Vista+
if (shutdownBRCreate)
shutdownBRCreate((HWND)m_window->effectiveWinId(), tr("Saving torrent progress...").toStdWString().c_str());
typedef BOOL (WINAPI *PSHUTDOWNBRCREATE)(HWND, LPCWSTR);
PSHUTDOWNBRCREATE shutdownBRCreate = (PSHUTDOWNBRCREATE)::GetProcAddress(::GetModuleHandleW(L"User32.dll"), "ShutdownBlockReasonCreate");
// Only available on Vista+
if (shutdownBRCreate)
shutdownBRCreate((HWND)m_window->effectiveWinId(), tr("Saving torrent progress...").toStdWString().c_str());
#endif // Q_OS_WIN
// Do manual cleanup in MainWindow to force widgets
// to save their Preferences, stop all timers and
// delete as many widgets as possible to leave only
// a 'shell' MainWindow.
// We need a valid window handle for Windows Vista+
// otherwise the system shutdown will continue even
// though we created a ShutdownBlockReason
m_window->cleanup();
// Do manual cleanup in MainWindow to force widgets
// to save their Preferences, stop all timers and
// delete as many widgets as possible to leave only
// a 'shell' MainWindow.
// We need a valid window handle for Windows Vista+
// otherwise the system shutdown will continue even
// though we created a ShutdownBlockReason
m_window->cleanup();
}
#endif // DISABLE_GUI
#ifndef DISABLE_WEBUI
@@ -697,14 +686,16 @@ void Application::cleanup()
Utils::Fs::removeDirRecursive(Utils::Fs::tempPath());
#ifndef DISABLE_GUI
if (m_window) {
#ifdef Q_OS_WIN
typedef BOOL (WINAPI *PSHUTDOWNBRDESTROY)(HWND);
PSHUTDOWNBRDESTROY shutdownBRDestroy = (PSHUTDOWNBRDESTROY)::GetProcAddress(::GetModuleHandleW(L"User32.dll"), "ShutdownBlockReasonDestroy");
// Only available on Vista+
if (shutdownBRDestroy)
shutdownBRDestroy((HWND)m_window->effectiveWinId());
typedef BOOL (WINAPI *PSHUTDOWNBRDESTROY)(HWND);
PSHUTDOWNBRDESTROY shutdownBRDestroy = (PSHUTDOWNBRDESTROY)::GetProcAddress(::GetModuleHandleW(L"User32.dll"), "ShutdownBlockReasonDestroy");
// Only available on Vista+
if (shutdownBRDestroy)
shutdownBRDestroy((HWND)m_window->effectiveWinId());
#endif // Q_OS_WIN
delete m_window;
delete m_window;
}
#endif // DISABLE_GUI
if (m_shutdownAct != ShutdownDialogAction::Exit) {

View File

@@ -73,9 +73,11 @@ namespace RSS
class Application : public BaseApplication
{
Q_OBJECT
Q_DISABLE_COPY(Application)
public:
Application(const QString &id, int &argc, char **argv);
~Application() override;
#if (defined(Q_OS_WIN) && !defined(DISABLE_GUI))
bool isRunning();
@@ -99,7 +101,7 @@ public:
bool isFileLoggerDeleteOld() const;
void setFileLoggerDeleteOld(bool value);
int fileLoggerMaxSize() const;
void setFileLoggerMaxSize(const int value);
void setFileLoggerMaxSize(const int bytes);
int fileLoggerAge() const;
void setFileLoggerAge(const int value);
int fileLoggerAgeType() const;
@@ -132,7 +134,7 @@ private:
#endif
#ifndef DISABLE_WEBUI
QPointer<WebUI> m_webui;
WebUI *m_webui;
#endif
// FileLog
@@ -145,7 +147,7 @@ private:
void initializeTranslation();
void processParams(const QStringList &params);
void runExternalProgram(BitTorrent::TorrentHandle *const torrent) const;
void sendNotificationEmail(BitTorrent::TorrentHandle *const torrent);
void sendNotificationEmail(const BitTorrent::TorrentHandle *torrent);
void validateCommandLineParameters();
};

View File

@@ -417,7 +417,7 @@ QBtCommandLineParameters parseCommandLine(const QStringList &args)
else if (arg == WEBUI_PORT_OPTION) {
result.webUiPort = WEBUI_PORT_OPTION.value(arg);
if ((result.webUiPort < 1) || (result.webUiPort > 65535))
throw CommandLineParameterError(QObject::tr("%1 must specify the correct port (1 to 65535).")
throw CommandLineParameterError(QObject::tr("%1 must specify a valid port (1 to 65535).")
.arg(QLatin1String("--webui-port")));
}
#ifndef DISABLE_GUI
@@ -523,11 +523,11 @@ QString makeUsage(const QString &prgName)
stream << QObject::tr("Options:") << '\n';
#ifndef Q_OS_WIN
stream << SHOW_VERSION_OPTION.usage() << wrapText(QObject::tr("Displays program version and exit")) << '\n';
stream << SHOW_VERSION_OPTION.usage() << wrapText(QObject::tr("Display program version and exit")) << '\n';
#endif
stream << SHOW_HELP_OPTION.usage() << wrapText(QObject::tr("Displays this help message and exit")) << '\n';
stream << SHOW_HELP_OPTION.usage() << wrapText(QObject::tr("Display this help message and exit")) << '\n';
stream << WEBUI_PORT_OPTION.usage(QObject::tr("port"))
<< wrapText(QObject::tr("Changes the Web UI port"))
<< wrapText(QObject::tr("Change the Web UI port"))
<< '\n';
#ifndef DISABLE_GUI
stream << NO_SPLASH_OPTION.usage() << wrapText(QObject::tr("Disable splash screen")) << '\n';
@@ -543,9 +543,10 @@ QString makeUsage(const QString &prgName)
<< wrapText(QObject::tr("Hack into libtorrent fastresume files and make file paths relative "
"to the profile directory")) << '\n';
stream << PORTABLE_OPTION.usage()
<< wrapText(QObject::tr("Shortcut for --profile=<exe dir>/profile --relative-fastresume")) << '\n';
stream << Option::padUsageText(QObject::tr("files or urls"))
<< wrapText(QObject::tr("Downloads the torrents passed by the user")) << '\n'
<< wrapText(QObject::tr("Shortcut for %1", "Shortcut for --profile=<exe dir>/profile --relative-fastresume")
.arg(QLatin1String("--profile=<exe dir>/profile --relative-fastresume"))) << '\n';
stream << Option::padUsageText(QObject::tr("files or URLs"))
<< wrapText(QObject::tr("Download the torrents passed by the user")) << '\n'
<< '\n';
stream << wrapText(QObject::tr("Options when adding new torrents:"), 0) << '\n';
@@ -559,7 +560,7 @@ QString makeUsage(const QString &prgName)
stream << FIRST_AND_LAST_OPTION.usage()
<< wrapText(QObject::tr("Download first and last pieces first")) << '\n';
stream << SKIP_DIALOG_OPTION.usage()
<< wrapText(QObject::tr("Specifies whether the \"Add New Torrent\" dialog opens when adding a "
<< wrapText(QObject::tr("Specify whether the \"Add New Torrent\" dialog opens when adding a "
"torrent.")) << '\n';
stream << '\n';

View File

@@ -135,7 +135,7 @@ void FileLogger::addLogMessage(const Log::Msg &msg)
str << QDateTime::fromMSecsSinceEpoch(msg.timestamp).toString(Qt::ISODate) << " - " << msg.message << endl;
if (m_backup && (m_logFile->size() >= (m_maxSize * 1024 * 1024))) {
if (m_backup && (m_logFile->size() >= m_maxSize)) {
closeLogFile();
int counter = 0;
QString backupLogFilename = m_path + ".bak";

View File

@@ -84,10 +84,17 @@ void sigNormalHandler(int signum);
void sigAbnormalHandler(int signum);
// sys_signame[] is only defined in BSD
const char *sysSigName[] = {
#if defined(Q_OS_WIN)
"", "", "SIGINT", "", "SIGILL", "", "SIGABRT_COMPAT", "", "SIGFPE", "",
"", "SIGSEGV", "", "", "", "SIGTERM", "", "", "", "",
"", "SIGBREAK", "SIGABRT", "", "", "", "", "", "", "",
"", ""
#else
"", "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", "SIGABRT", "SIGBUS", "SIGFPE", "SIGKILL",
"SIGUSR1", "SIGSEGV", "SIGUSR2", "SIGPIPE", "SIGALRM", "SIGTERM", "SIGSTKFLT", "SIGCHLD", "SIGCONT", "SIGSTOP",
"SIGTSTP", "SIGTTIN", "SIGTTOU", "SIGURG", "SIGXCPU", "SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH", "SIGIO",
"SIGPWR", "SIGUNUSED"
#endif
};
#endif
@@ -205,6 +212,10 @@ int main(int argc, char *argv[])
// 3. https://bugreports.qt.io/browse/QTBUG-46015
qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
// this is the default in Qt6
app->setAttribute(Qt::AA_DisableWindowContextHelpButton);
#endif
#endif
#if defined(Q_OS_MAC)
@@ -214,7 +225,7 @@ int main(int argc, char *argv[])
QByteArray path = "/usr/local/bin:";
path += qgetenv("PATH");
qputenv("PATH", path.constData());
// On OS X the standard is to not show icons in the menus
app->setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
@@ -276,12 +287,11 @@ void reportToUser(const char* str)
void sigNormalHandler(int signum)
{
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
const char str1[] = "Catching signal: ";
const char *sigName = sysSigName[signum];
const char str2[] = "\nExiting cleanly\n";
reportToUser(str1);
reportToUser(sigName);
reportToUser(str2);
const char msg1[] = "Catching signal: ";
const char msg2[] = "\nExiting cleanly\n";
reportToUser(msg1);
reportToUser(sysSigName[signum]);
reportToUser(msg2);
#endif // !defined Q_OS_WIN && !defined Q_OS_HAIKU
signal(signum, SIG_DFL);
qApp->exit(); // unsafe, but exit anyway
@@ -289,19 +299,20 @@ void sigNormalHandler(int signum)
void sigAbnormalHandler(int signum)
{
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
const char str1[] = "\n\n*************************************************************\nCatching signal: ";
const char *sigName = sysSigName[signum];
const char str2[] = "\nPlease file a bug report at http://bug.qbittorrent.org and provide the following information:\n\n"
"qBittorrent version: " QBT_VERSION "\n";
reportToUser(str1);
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
const char msg[] = "\n\n*************************************************************\n"
"Please file a bug report at http://bug.qbittorrent.org and provide the following information:\n\n"
"qBittorrent version: " QBT_VERSION "\n\n"
"Caught signal: ";
reportToUser(msg);
reportToUser(sigName);
reportToUser(str2);
reportToUser("\n");
print_stacktrace(); // unsafe
#endif // !defined Q_OS_WIN && !defined Q_OS_HAIKU
#ifdef STACKTRACE_WIN
StraceDlg dlg; // unsafe
dlg.setStacktraceString(straceWin::getBacktrace());
dlg.setStacktraceString(QLatin1String(sigName), straceWin::getBacktrace());
dlg.exec();
#endif // STACKTRACE_WIN
signal(signum, SIG_DFL);

View File

@@ -16,7 +16,7 @@ else (GUI)
list(APPEND QBT_QTSINGLEAPPLICATION_SOURCES qtsinglecoreapplication.cpp)
endif (GUI)
add_library(qtsingleapplication ${QBT_QTSINGLEAPPLICATION_HEADERS} ${QBT_QTSINGLEAPPLICATION_SOURCES})
add_library(qtsingleapplication STATIC ${QBT_QTSINGLEAPPLICATION_HEADERS} ${QBT_QTSINGLEAPPLICATION_SOURCES})
target_include_directories(qtsingleapplication INTERFACE "${qtsingleapplication_SOURCE_DIR}")
target_link_qt_components(qtsingleapplication Network)

View File

@@ -176,8 +176,17 @@ void QtLocalPeer::receiveConnection()
if (!socket)
return;
while (socket->bytesAvailable() < (int)sizeof(quint32))
while (true) {
if (socket->state() == QLocalSocket::UnconnectedState) {
qWarning("QtLocalPeer: Peer disconnected");
delete socket;
return;
}
if (socket->bytesAvailable() >= qint64(sizeof(quint32)))
break;
socket->waitForReadyRead();
}
QDataStream ds(socket);
QByteArray uMsg;
quint32 remaining;

View File

@@ -14,7 +14,7 @@
/** Print a demangled stack backtrace of the caller function to FILE* out. */
static inline void print_stacktrace(FILE *out = stderr, unsigned int max_frames = 63)
{
fprintf(out, "stack trace:\n");
fprintf(out, "Stack trace:\n");
// storage array for stack trace address data
std::vector<void *> addrlist(max_frames + 1);

View File

@@ -40,13 +40,13 @@ class StraceDlg : public QDialog, private Ui::errorDialog
Q_OBJECT
public:
StraceDlg(QWidget* parent = 0)
StraceDlg(QWidget *parent = nullptr)
: QDialog(parent)
{
setupUi(this);
}
void setStacktraceString(const QString& trace)
void setStacktraceString(const QString &sigName, const QString &trace)
{
// try to call Qt function as less as possible
QString htmlStr = QString(
@@ -68,14 +68,16 @@ public:
"Libtorrent version: %1<br/>"
"Qt version: " QT_VERSION_STR "<br/>"
"Boost version: %2<br/>"
"OS version: %3"
"</font></p><br/>"
"<pre><code>%4</code></pre>"
"OS version: %3<br/><br/>"
"Caught signal: %4"
"</font></p>"
"<pre><code>%5</code></pre>"
"<br/><hr><br/><br/>")
.arg(Utils::Misc::libtorrentVersionString())
.arg(Utils::Misc::boostVersionString())
.arg(Utils::Misc::osName())
.arg(trace);
.arg(Utils::Misc::libtorrentVersionString())
.arg(Utils::Misc::boostVersionString())
.arg(Utils::Misc::osName())
.arg(sigName)
.arg(trace);
errorText->setHtml(htmlStr);
}

View File

@@ -195,7 +195,7 @@ bool upgrade(bool ask = true)
resumeData["qBt-forced"] = false;
resumeData["qBt-savePath"] = oldTorrent.value("save_path").toString().toStdString();
resumeData["qBt-ratioLimit"] = QString::number(oldTorrent.value("max_ratio", -2).toReal()).toStdString();
resumeData["qBt-ratioLimit"] = static_cast<int>(oldTorrent.value("max_ratio", -2).toReal() * 1000);
resumeData["qBt-label"] = oldTorrent.value("label").toString().toStdString();
resumeData["qBt-name"] = oldTorrent.value("name").toString().toStdString();
resumeData["qBt-seedStatus"] = oldTorrent.value("seed").toBool();

View File

@@ -141,5 +141,6 @@ endif ()
if (APPLE)
find_library(IOKit_LIBRARY IOKit)
find_library(Carbon_LIBRARY Carbon)
target_link_libraries(qbt_base PRIVATE ${Carbon_LIBRARY} ${IOKit_LIBRARY})
find_library(AppKit_LIBRARY AppKit)
target_link_libraries(qbt_base PRIVATE ${Carbon_LIBRARY} ${IOKit_LIBRARY} ${AppKit_LIBRARY})
endif (APPLE)

View File

@@ -1,124 +1,124 @@
HEADERS += \
$$PWD/asyncfilestorage.h \
$$PWD/types.h \
$$PWD/tristatebool.h \
$$PWD/bittorrent/addtorrentparams.h \
$$PWD/bittorrent/cachestatus.h \
$$PWD/bittorrent/infohash.h \
$$PWD/bittorrent/magneturi.h \
$$PWD/bittorrent/peerinfo.h \
$$PWD/bittorrent/private/bandwidthscheduler.h \
$$PWD/bittorrent/private/filterparserthread.h \
$$PWD/bittorrent/private/resumedatasavingmanager.h \
$$PWD/bittorrent/private/speedmonitor.h \
$$PWD/bittorrent/private/statistics.h \
$$PWD/bittorrent/session.h \
$$PWD/bittorrent/sessionstatus.h \
$$PWD/bittorrent/torrentcreatorthread.h \
$$PWD/bittorrent/torrenthandle.h \
$$PWD/bittorrent/torrentinfo.h \
$$PWD/bittorrent/tracker.h \
$$PWD/bittorrent/trackerentry.h \
$$PWD/filesystemwatcher.h \
$$PWD/logger.h \
$$PWD/settingsstorage.h \
$$PWD/settingvalue.h \
$$PWD/preferences.h \
$$PWD/indexrange.h \
$$PWD/iconprovider.h \
$$PWD/http/irequesthandler.h \
$$PWD/global.h \
$$PWD/http/connection.h \
$$PWD/http/irequesthandler.h \
$$PWD/http/requestparser.h \
$$PWD/http/responsebuilder.h \
$$PWD/http/responsegenerator.h \
$$PWD/http/server.h \
$$PWD/http/types.h \
$$PWD/http/responsebuilder.h \
$$PWD/iconprovider.h \
$$PWD/indexrange.h \
$$PWD/logger.h \
$$PWD/net/dnsupdater.h \
$$PWD/net/downloadmanager.h \
$$PWD/net/downloadhandler.h \
$$PWD/net/downloadmanager.h \
$$PWD/net/geoipmanager.h \
$$PWD/net/portforwarder.h \
$$PWD/net/private/geoipdatabase.h \
$$PWD/net/proxyconfigurationmanager.h \
$$PWD/net/reverseresolution.h \
$$PWD/net/smtp.h \
$$PWD/net/private/geoipdatabase.h \
$$PWD/bittorrent/addtorrentparams.h \
$$PWD/bittorrent/infohash.h \
$$PWD/bittorrent/session.h \
$$PWD/bittorrent/sessionstatus.h \
$$PWD/bittorrent/cachestatus.h \
$$PWD/bittorrent/magneturi.h \
$$PWD/bittorrent/torrentinfo.h \
$$PWD/bittorrent/torrenthandle.h \
$$PWD/bittorrent/peerinfo.h \
$$PWD/bittorrent/trackerentry.h \
$$PWD/bittorrent/tracker.h \
$$PWD/bittorrent/torrentcreatorthread.h \
$$PWD/bittorrent/private/speedmonitor.h \
$$PWD/bittorrent/private/bandwidthscheduler.h \
$$PWD/bittorrent/private/filterparserthread.h \
$$PWD/bittorrent/private/statistics.h \
$$PWD/bittorrent/private/resumedatasavingmanager.h \
$$PWD/preferences.h \
$$PWD/private/profile_p.h \
$$PWD/profile.h \
$$PWD/rss/private/rss_parser.h \
$$PWD/rss/rss_article.h \
$$PWD/rss/rss_item.h \
$$PWD/rss/rss_feed.h \
$$PWD/rss/rss_folder.h \
$$PWD/rss/rss_session.h \
$$PWD/rss/rss_autodownloader.h \
$$PWD/rss/rss_autodownloadrule.h \
$$PWD/rss/private/rss_parser.h \
$$PWD/rss/rss_feed.h \
$$PWD/rss/rss_folder.h \
$$PWD/rss/rss_item.h \
$$PWD/rss/rss_session.h \
$$PWD/scanfoldersmodel.h \
$$PWD/searchengine.h \
$$PWD/settingsstorage.h \
$$PWD/settingvalue.h \
$$PWD/torrentfileguard.h \
$$PWD/torrentfilter.h \
$$PWD/tristatebool.h \
$$PWD/types.h \
$$PWD/unicodestrings.h \
$$PWD/utils/fs.h \
$$PWD/utils/gzip.h \
$$PWD/utils/misc.h \
$$PWD/utils/net.h \
$$PWD/utils/random.h \
$$PWD/utils/string.h \
$$PWD/utils/version.h \
$$PWD/profile.h \
$$PWD/private/profile_p.h \
$$PWD/unicodestrings.h \
$$PWD/torrentfileguard.h \
$$PWD/torrentfilter.h \
$$PWD/scanfoldersmodel.h \
$$PWD/searchengine.h \
$$PWD/global.h
$$PWD/utils/version.h
SOURCES += \
$$PWD/asyncfilestorage.cpp \
$$PWD/tristatebool.cpp \
$$PWD/bittorrent/infohash.cpp \
$$PWD/bittorrent/magneturi.cpp \
$$PWD/bittorrent/peerinfo.cpp \
$$PWD/bittorrent/private/bandwidthscheduler.cpp \
$$PWD/bittorrent/private/filterparserthread.cpp \
$$PWD/bittorrent/private/resumedatasavingmanager.cpp \
$$PWD/bittorrent/private/speedmonitor.cpp \
$$PWD/bittorrent/private/statistics.cpp \
$$PWD/bittorrent/session.cpp \
$$PWD/bittorrent/torrentcreatorthread.cpp \
$$PWD/bittorrent/torrenthandle.cpp \
$$PWD/bittorrent/torrentinfo.cpp \
$$PWD/bittorrent/tracker.cpp \
$$PWD/bittorrent/trackerentry.cpp \
$$PWD/filesystemwatcher.cpp \
$$PWD/logger.cpp \
$$PWD/settingsstorage.cpp \
$$PWD/preferences.cpp \
$$PWD/iconprovider.cpp \
$$PWD/http/connection.cpp \
$$PWD/http/requestparser.cpp \
$$PWD/http/responsebuilder.cpp \
$$PWD/http/responsegenerator.cpp \
$$PWD/http/server.cpp \
$$PWD/http/responsebuilder.cpp \
$$PWD/iconprovider.cpp \
$$PWD/logger.cpp \
$$PWD/net/dnsupdater.cpp \
$$PWD/net/downloadmanager.cpp \
$$PWD/net/downloadhandler.cpp \
$$PWD/net/downloadmanager.cpp \
$$PWD/net/geoipmanager.cpp \
$$PWD/net/portforwarder.cpp \
$$PWD/net/private/geoipdatabase.cpp \
$$PWD/net/proxyconfigurationmanager.cpp \
$$PWD/net/reverseresolution.cpp \
$$PWD/net/smtp.cpp \
$$PWD/net/private/geoipdatabase.cpp \
$$PWD/bittorrent/infohash.cpp \
$$PWD/bittorrent/session.cpp \
$$PWD/bittorrent/magneturi.cpp \
$$PWD/bittorrent/torrentinfo.cpp \
$$PWD/bittorrent/torrenthandle.cpp \
$$PWD/bittorrent/peerinfo.cpp \
$$PWD/bittorrent/trackerentry.cpp \
$$PWD/bittorrent/tracker.cpp \
$$PWD/bittorrent/torrentcreatorthread.cpp \
$$PWD/bittorrent/private/speedmonitor.cpp \
$$PWD/bittorrent/private/bandwidthscheduler.cpp \
$$PWD/bittorrent/private/filterparserthread.cpp \
$$PWD/bittorrent/private/statistics.cpp \
$$PWD/bittorrent/private/resumedatasavingmanager.cpp \
$$PWD/preferences.cpp \
$$PWD/private/profile_p.cpp \
$$PWD/profile.cpp \
$$PWD/rss/private/rss_parser.cpp \
$$PWD/rss/rss_article.cpp \
$$PWD/rss/rss_item.cpp \
$$PWD/rss/rss_feed.cpp \
$$PWD/rss/rss_folder.cpp \
$$PWD/rss/rss_session.cpp \
$$PWD/rss/rss_autodownloader.cpp \
$$PWD/rss/rss_autodownloadrule.cpp \
$$PWD/rss/private/rss_parser.cpp \
$$PWD/rss/rss_feed.cpp \
$$PWD/rss/rss_folder.cpp \
$$PWD/rss/rss_item.cpp \
$$PWD/rss/rss_session.cpp \
$$PWD/scanfoldersmodel.cpp \
$$PWD/searchengine.cpp \
$$PWD/settingsstorage.cpp \
$$PWD/torrentfileguard.cpp \
$$PWD/torrentfilter.cpp \
$$PWD/tristatebool.cpp \
$$PWD/utils/fs.cpp \
$$PWD/utils/gzip.cpp \
$$PWD/utils/misc.cpp \
$$PWD/utils/net.cpp \
$$PWD/utils/random.cpp \
$$PWD/utils/string.cpp \
$$PWD/profile.cpp \
$$PWD/private/profile_p.cpp \
$$PWD/torrentfileguard.cpp \
$$PWD/torrentfilter.cpp \
$$PWD/scanfoldersmodel.cpp \
$$PWD/searchengine.cpp
$$PWD/utils/string.cpp

View File

@@ -51,5 +51,8 @@ namespace BitTorrent
bool ignoreShareLimits = false;
bool skipChecking = false;
TriStateBool createSubfolder;
TriStateBool useAutoTMM;
int uploadLimit = -1;
int downloadLimit = -1;
};
}

View File

@@ -29,8 +29,8 @@
#ifndef BITTORRENT_INFOHASH_H
#define BITTORRENT_INFOHASH_H
#include <libtorrent/sha1_hash.hpp>
#include <QString>
#include <libtorrent/sha1_hash.hpp>
namespace BitTorrent
{

View File

@@ -29,8 +29,8 @@
#ifndef BITTORRENT_MAGNETURI_H
#define BITTORRENT_MAGNETURI_H
#include <QString>
#include <QList>
#include <QString>
#include <QUrl>
#include <libtorrent/add_torrent_params.hpp>

View File

@@ -26,12 +26,13 @@
* exception statement from your version.
*/
#include "base/net/geoipmanager.h"
#include "base/utils/string.h"
#include "base/unicodestrings.h"
#include "base/bittorrent/torrenthandle.h"
#include "peerinfo.h"
#include "base/bittorrent/torrenthandle.h"
#include "base/net/geoipmanager.h"
#include "base/unicodestrings.h"
#include "base/utils/string.h"
namespace libt = libtorrent;
using namespace BitTorrent;
@@ -99,7 +100,6 @@ bool PeerInfo::isRemoteChocked() const
return (m_nativeInfo.flags & libt::peer_info::remote_choked);
}
bool PeerInfo::isSupportsExtensions() const
{
return (m_nativeInfo.flags & libt::peer_info::supports_extensions);
@@ -115,7 +115,6 @@ bool PeerInfo::isHandshake() const
return (m_nativeInfo.flags & libt::peer_info::handshake);
}
bool PeerInfo::isConnecting() const
{
return (m_nativeInfo.flags & libt::peer_info::connecting);
@@ -136,7 +135,6 @@ bool PeerInfo::optimisticUnchoke() const
return (m_nativeInfo.flags & libt::peer_info::optimistic_unchoke);
}
bool PeerInfo::isSnubbed() const
{
return (m_nativeInfo.flags & libt::peer_info::snubbed);
@@ -152,7 +150,6 @@ bool PeerInfo::isEndgameMode() const
return (m_nativeInfo.flags & libt::peer_info::endgame_mode);
}
bool PeerInfo::isHolepunched() const
{
return (m_nativeInfo.flags & libt::peer_info::holepunched);
@@ -183,7 +180,6 @@ bool PeerInfo::isPlaintextEncrypted() const
return (m_nativeInfo.flags & libt::peer_info::plaintext_encrypted);
}
PeerAddress PeerInfo::address() const
{
return PeerAddress(QHostAddress(QString::fromStdString(m_nativeInfo.ip.address().to_string())),
@@ -195,7 +191,6 @@ QString PeerInfo::client() const
return QString::fromStdString(m_nativeInfo.client);
}
qreal PeerInfo::progress() const
{
return m_nativeInfo.progress;
@@ -206,7 +201,6 @@ int PeerInfo::payloadUpSpeed() const
return m_nativeInfo.payload_up_speed;
}
int PeerInfo::payloadDownSpeed() const
{
return m_nativeInfo.payload_down_speed;
@@ -217,7 +211,6 @@ qlonglong PeerInfo::totalUpload() const
return m_nativeInfo.total_upload;
}
qlonglong PeerInfo::totalDownload() const
{
return m_nativeInfo.total_download;
@@ -239,7 +232,7 @@ QString PeerInfo::connectionType() const
return QString::fromUtf8(C_UTP);
QString connection;
switch(m_nativeInfo.connection_type) {
switch (m_nativeInfo.connection_type) {
case libt::peer_info::http_seed:
case libt::peer_info::web_seed:
connection = "Web";
@@ -280,117 +273,116 @@ qreal PeerInfo::relevance() const
void PeerInfo::determineFlags()
{
QStringList flagsDescriptionList;
if (isInteresting()) {
//d = Your client wants to download, but peer doesn't want to send (interested and choked)
// d = Your client wants to download, but peer doesn't want to send (interested and choked)
if (isRemoteChocked()) {
m_flags += "d ";
m_flagsDescription += tr("interested(local) and choked(peer)");
m_flagsDescription += ", ";
flagsDescriptionList += "d = "
+ tr("Interested(local) and Choked(peer)");
}
else {
//D = Currently downloading (interested and not choked)
// D = Currently downloading (interested and not choked)
m_flags += "D ";
m_flagsDescription += tr("interested(local) and unchoked(peer)");
m_flagsDescription += ", ";
flagsDescriptionList += "D = "
+ tr("interested(local) and unchoked(peer)");
}
}
if (isRemoteInterested()) {
//u = Peer wants your client to upload, but your client doesn't want to (interested and choked)
// u = Peer wants your client to upload, but your client doesn't want to (interested and choked)
if (isChocked()) {
m_flags += "u ";
m_flagsDescription += tr("interested(peer) and choked(local)");
m_flagsDescription += ", ";
flagsDescriptionList += "u = "
+ tr("interested(peer) and choked(local)");
}
else {
//U = Currently uploading (interested and not choked)
// U = Currently uploading (interested and not choked)
m_flags += "U ";
m_flagsDescription += tr("interested(peer) and unchoked(local)");
m_flagsDescription += ", ";
flagsDescriptionList += "U = "
+ tr("interested(peer) and unchoked(local)");
}
}
//O = Optimistic unchoke
// O = Optimistic unchoke
if (optimisticUnchoke()) {
m_flags += "O ";
m_flagsDescription += tr("optimistic unchoke");
m_flagsDescription += ", ";
flagsDescriptionList += "O = "
+ tr("optimistic unchoke");
}
//S = Peer is snubbed
// S = Peer is snubbed
if (isSnubbed()) {
m_flags += "S ";
m_flagsDescription += tr("peer snubbed");
m_flagsDescription += ", ";
flagsDescriptionList += "S = "
+ tr("peer snubbed");
}
//I = Peer is an incoming connection
// I = Peer is an incoming connection
if (!isLocalConnection()) {
m_flags += "I ";
m_flagsDescription += tr("incoming connection");
m_flagsDescription += ", ";
flagsDescriptionList += "I = "
+ tr("incoming connection");
}
//K = Peer is unchoking your client, but your client is not interested
// K = Peer is unchoking your client, but your client is not interested
if (!isRemoteChocked() && !isInteresting()) {
m_flags += "K ";
m_flagsDescription += tr("not interested(local) and unchoked(peer)");
m_flagsDescription += ", ";
flagsDescriptionList += "K = "
+ tr("not interested(local) and unchoked(peer)");
}
//? = Your client unchoked the peer but the peer is not interested
// ? = Your client unchoked the peer but the peer is not interested
if (!isChocked() && !isRemoteInterested()) {
m_flags += "? ";
m_flagsDescription += tr("not interested(peer) and unchoked(local)");
m_flagsDescription += ", ";
flagsDescriptionList += "? = "
+ tr("not interested(peer) and unchoked(local)");
}
//X = Peer was included in peerlists obtained through Peer Exchange (PEX)
// X = Peer was included in peerlists obtained through Peer Exchange (PEX)
if (fromPeX()) {
m_flags += "X ";
m_flagsDescription += tr("peer from PEX");
m_flagsDescription += ", ";
flagsDescriptionList += "X = "
+ tr("peer from PEX");
}
//H = Peer was obtained through DHT
// H = Peer was obtained through DHT
if (fromDHT()) {
m_flags += "H ";
m_flagsDescription += tr("peer from DHT");
m_flagsDescription += ", ";
flagsDescriptionList += "H = "
+ tr("peer from DHT");
}
//E = Peer is using Protocol Encryption (all traffic)
// E = Peer is using Protocol Encryption (all traffic)
if (isRC4Encrypted()) {
m_flags += "E ";
m_flagsDescription += tr("encrypted traffic");
m_flagsDescription += ", ";
flagsDescriptionList += "E = "
+ tr("encrypted traffic");
}
//e = Peer is using Protocol Encryption (handshake)
// e = Peer is using Protocol Encryption (handshake)
if (isPlaintextEncrypted()) {
m_flags += "e ";
m_flagsDescription += tr("encrypted handshake");
m_flagsDescription += ", ";
flagsDescriptionList += "e = "
+ tr("encrypted handshake");
}
//P = Peer is using uTorrent uTP
// P = Peer is using uTorrent uTP
if (useUTPSocket()) {
m_flags += "P ";
m_flagsDescription += QString::fromUtf8(C_UTP);
m_flagsDescription += ", ";
flagsDescriptionList += "P = "
+ QString::fromUtf8(C_UTP);
}
//L = Peer is local
// L = Peer is local
if (fromLSD()) {
m_flags += "L";
m_flagsDescription += tr("peer from LSD");
flagsDescriptionList += "L = "
+ tr("peer from LSD");
}
m_flags = m_flags.trimmed();
m_flagsDescription = m_flagsDescription.trimmed();
if (m_flagsDescription.endsWith(',', Qt::CaseInsensitive))
m_flagsDescription.chop(1);
m_flagsDescription = flagsDescriptionList.join('\n');
}
QString PeerInfo::flags() const

View File

@@ -29,11 +29,11 @@
#ifndef BITTORRENT_PEERINFO_H
#define BITTORRENT_PEERINFO_H
#include <libtorrent/peer_info.hpp>
#include <QHostAddress>
#include <QBitArray>
#include <QCoreApplication>
#include <QHostAddress>
#include <libtorrent/peer_info.hpp>
namespace BitTorrent
{

View File

@@ -1,6 +1,7 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2010 Christophe Dumez
* Copyright (C) 2017 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2010 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
@@ -24,72 +25,78 @@
* 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 <QTime>
#include <QDateTime>
#include "base/bittorrent/session.h"
#include "base/preferences.h"
#include "bandwidthscheduler.h"
#include <utility>
#include <QDate>
#include <QTime>
#include "base/preferences.h"
BandwidthScheduler::BandwidthScheduler(QObject *parent)
: QTimer(parent)
: QObject(parent)
, m_lastAlternative(false)
{
// Single shot, we call start() again manually
setSingleShot(true);
// Connect Signals/Slots
connect(this, SIGNAL(timeout()), this, SLOT(start()));
connect(&m_timer, &QTimer::timeout, this, &BandwidthScheduler::onTimeout);
}
void BandwidthScheduler::start()
{
const Preferences* const pref = Preferences::instance();
bool alt_bw_enabled = BitTorrent::Session::instance()->isAltGlobalSpeedLimitEnabled();
QTime start = pref->getSchedulerStartTime();
QTime end = pref->getSchedulerEndTime();
QTime now = QTime::currentTime();
int sched_days = pref->getSchedulerDays();
int day = QDateTime::currentDateTime().toLocalTime().date().dayOfWeek();
bool new_mode = false;
bool reverse = false;
if (start > end) {
QTime temp = start;
start = end;
end = temp;
reverse = true;
}
if ((start <= now) && (end >= now)) {
switch(sched_days) {
case EVERY_DAY:
new_mode = true;
break;
case WEEK_ENDS:
if ((day == 6) || (day == 7))
new_mode = true;
break;
case WEEK_DAYS:
if ((day != 6) && (day != 7))
new_mode = true;
break;
default:
if (day == (sched_days - 2))
new_mode = true;
}
}
if (reverse)
new_mode = !new_mode;
if (new_mode != alt_bw_enabled)
emit switchToAlternativeMode(new_mode);
m_lastAlternative = isTimeForAlternative();
emit bandwidthLimitRequested(m_lastAlternative);
// Timeout regularly to accommodate for external system clock changes
// eg from the user or from a timesync utility
QTimer::start(1500);
m_timer.start(30000);
}
bool BandwidthScheduler::isTimeForAlternative() const
{
const Preferences* const pref = Preferences::instance();
QTime start = pref->getSchedulerStartTime();
QTime end = pref->getSchedulerEndTime();
const QTime now = QTime::currentTime();
const int schedulerDays = pref->getSchedulerDays();
const int day = QDate::currentDate().dayOfWeek();
bool alternative = false;
if (start > end) {
std::swap(start, end);
alternative = true;
}
if ((start <= now) && (end >= now)) {
switch (schedulerDays) {
case EVERY_DAY:
alternative = !alternative;
break;
case WEEK_ENDS:
if ((day == 6) || (day == 7))
alternative = !alternative;
break;
case WEEK_DAYS:
if ((day != 6) && (day != 7))
alternative = !alternative;
break;
default:
if (day == (schedulerDays - 2))
alternative = !alternative;
}
}
return alternative;
}
void BandwidthScheduler::onTimeout()
{
bool alternative = isTimeForAlternative();
if (alternative != m_lastAlternative) {
m_lastAlternative = alternative;
emit bandwidthLimitRequested(alternative);
}
}

View File

@@ -1,6 +1,7 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2010 Christophe Dumez
* Copyright (C) 2017 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2010 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
@@ -24,27 +25,32 @@
* 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 BANDWIDTHSCHEDULER_H
#define BANDWIDTHSCHEDULER_H
#include <QObject>
#include <QTimer>
class BandwidthScheduler : public QTimer
class BandwidthScheduler: public QObject
{
Q_OBJECT
Q_DISABLE_COPY(BandwidthScheduler)
public:
BandwidthScheduler(QObject *parent = 0);
public slots:
explicit BandwidthScheduler(QObject *parent = nullptr);
void start();
signals:
void switchToAlternativeMode(bool alternative);
void bandwidthLimitRequested(bool alternative);
private:
bool isTimeForAlternative() const;
void onTimeout();
QTimer m_timer;
bool m_lastAlternative;
};
#endif // BANDWIDTHSCHEDULER_H

View File

@@ -1,6 +1,6 @@
/*
* Bittorrent Client using Qt and libt.
* 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
@@ -24,17 +24,15 @@
* 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 "filterparserthread.h"
#include <cctype>
#include <QDataStream>
#include <QFile>
#include <cctype>
#include "base/logger.h"
namespace libt = libtorrent;
@@ -104,6 +102,7 @@ namespace
}
const int BUFFER_SIZE = 2 * 1024 * 1024; // 2 MiB
const int MAX_LOGGED_ERRORS = 5;
}
FilterParserThread::FilterParserThread(QObject *parent)
@@ -126,7 +125,7 @@ int FilterParserThread::parseDATFilterFile()
if (!file.exists()) return ruleCount;
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
LogMsg(tr("I/O Error: Could not open ip filter file in read mode."), Log::CRITICAL);
LogMsg(tr("I/O Error: Could not open IP filter file in read mode."), Log::CRITICAL);
return ruleCount;
}
@@ -136,6 +135,12 @@ int FilterParserThread::parseDATFilterFile()
int start = 0;
int endOfLine = -1;
int nbLine = 0;
int parseErrorCount = 0;
const auto addLog = [&parseErrorCount](const QString &msg)
{
if (parseErrorCount <= MAX_LOGGED_ERRORS)
LogMsg(msg, Log::CRITICAL);
};
while (true) {
bytesRead = file.read(buffer.data() + offset, BUFFER_SIZE - offset - 1);
@@ -204,7 +209,8 @@ int FilterParserThread::parseDATFilterFile()
int endOfIPRange = ((firstComma == -1) ? (endOfLine - 1) : (firstComma - 1));
int delimIP = findAndNullDelimiter(buffer.data(), '-', start, endOfIPRange);
if (delimIP == -1) {
LogMsg(tr("IP filter line %1 is malformed.").arg(nbLine), Log::CRITICAL);
++parseErrorCount;
addLog(tr("IP filter line %1 is malformed.").arg(nbLine));
start = endOfLine;
continue;
}
@@ -212,7 +218,8 @@ int FilterParserThread::parseDATFilterFile()
libt::address startAddr;
int newStart = trim(buffer.data(), start, delimIP - 1);
if (!parseIPAddress(buffer.data() + newStart, startAddr)) {
LogMsg(tr("IP filter line %1 is malformed. Start IP of the range is malformed.").arg(nbLine), Log::CRITICAL);
++parseErrorCount;
addLog(tr("IP filter line %1 is malformed. Start IP of the range is malformed.").arg(nbLine));
start = endOfLine;
continue;
}
@@ -220,14 +227,16 @@ int FilterParserThread::parseDATFilterFile()
libt::address endAddr;
newStart = trim(buffer.data(), delimIP + 1, endOfIPRange);
if (!parseIPAddress(buffer.data() + newStart, endAddr)) {
LogMsg(tr("IP filter line %1 is malformed. End IP of the range is malformed.").arg(nbLine), Log::CRITICAL);
++parseErrorCount;
addLog(tr("IP filter line %1 is malformed. End IP of the range is malformed.").arg(nbLine));
start = endOfLine;
continue;
}
if ((startAddr.is_v4() != endAddr.is_v4())
|| (startAddr.is_v6() != endAddr.is_v6())) {
LogMsg(tr("IP filter line %1 is malformed. One IP is IPv4 and the other is IPv6!").arg(nbLine), Log::CRITICAL);
++parseErrorCount;
addLog(tr("IP filter line %1 is malformed. One IP is IPv4 and the other is IPv6!").arg(nbLine));
start = endOfLine;
continue;
}
@@ -240,8 +249,9 @@ int FilterParserThread::parseDATFilterFile()
++ruleCount;
}
catch (std::exception &e) {
LogMsg(tr("IP filter exception thrown for line %1. Exception is: %2").arg(nbLine)
.arg(QString::fromLocal8Bit(e.what())), Log::CRITICAL);
++parseErrorCount;
addLog(tr("IP filter exception thrown for line %1. Exception is: %2")
.arg(nbLine).arg(QString::fromLocal8Bit(e.what())));
}
}
@@ -249,6 +259,9 @@ int FilterParserThread::parseDATFilterFile()
offset = 0;
}
if (parseErrorCount > MAX_LOGGED_ERRORS)
LogMsg(tr("%1 extra IP filter parsing errors occurred.", "513 extra IP filter parsing errors occurred.")
.arg(parseErrorCount - MAX_LOGGED_ERRORS), Log::CRITICAL);
return ruleCount;
}
@@ -260,7 +273,7 @@ int FilterParserThread::parseP2PFilterFile()
if (!file.exists()) return ruleCount;
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
LogMsg(tr("I/O Error: Could not open ip filter file in read mode."), Log::CRITICAL);
LogMsg(tr("I/O Error: Could not open IP filter file in read mode."), Log::CRITICAL);
return ruleCount;
}
@@ -270,6 +283,12 @@ int FilterParserThread::parseP2PFilterFile()
int start = 0;
int endOfLine = -1;
int nbLine = 0;
int parseErrorCount = 0;
const auto addLog = [&parseErrorCount](const QString &msg)
{
if (parseErrorCount <= MAX_LOGGED_ERRORS)
LogMsg(msg, Log::CRITICAL);
};
while (true) {
bytesRead = file.read(buffer.data() + offset, BUFFER_SIZE - offset - 1);
@@ -321,7 +340,8 @@ int FilterParserThread::parseP2PFilterFile()
// The "Some organization" part might contain a ':' char itself so we find the last occurrence
int partsDelimiter = findAndNullDelimiter(buffer.data(), ':', start, endOfLine, true);
if (partsDelimiter == -1) {
LogMsg(tr("IP filter line %1 is malformed.").arg(nbLine), Log::CRITICAL);
++parseErrorCount;
addLog(tr("IP filter line %1 is malformed.").arg(nbLine));
start = endOfLine;
continue;
}
@@ -329,7 +349,8 @@ int FilterParserThread::parseP2PFilterFile()
// IP Range should be split by a dash
int delimIP = findAndNullDelimiter(buffer.data(), '-', partsDelimiter + 1, endOfLine);
if (delimIP == -1) {
LogMsg(tr("IP filter line %1 is malformed.").arg(nbLine), Log::CRITICAL);
++parseErrorCount;
addLog(tr("IP filter line %1 is malformed.").arg(nbLine));
start = endOfLine;
continue;
}
@@ -337,7 +358,8 @@ int FilterParserThread::parseP2PFilterFile()
libt::address startAddr;
int newStart = trim(buffer.data(), partsDelimiter + 1, delimIP - 1);
if (!parseIPAddress(buffer.data() + newStart, startAddr)) {
LogMsg(tr("IP filter line %1 is malformed. Start IP of the range is malformed.").arg(nbLine), Log::CRITICAL);
++parseErrorCount;
addLog(tr("IP filter line %1 is malformed. Start IP of the range is malformed.").arg(nbLine));
start = endOfLine;
continue;
}
@@ -345,14 +367,16 @@ int FilterParserThread::parseP2PFilterFile()
libt::address endAddr;
newStart = trim(buffer.data(), delimIP + 1, endOfLine);
if (!parseIPAddress(buffer.data() + newStart, endAddr)) {
LogMsg(tr("IP filter line %1 is malformed. End IP of the range is malformed.").arg(nbLine), Log::CRITICAL);
++parseErrorCount;
addLog(tr("IP filter line %1 is malformed. End IP of the range is malformed.").arg(nbLine));
start = endOfLine;
continue;
}
if ((startAddr.is_v4() != endAddr.is_v4())
|| (startAddr.is_v6() != endAddr.is_v6())) {
LogMsg(tr("IP filter line %1 is malformed. One IP is IPv4 and the other is IPv6!").arg(nbLine), Log::CRITICAL);
++parseErrorCount;
addLog(tr("IP filter line %1 is malformed. One IP is IPv4 and the other is IPv6!").arg(nbLine));
start = endOfLine;
continue;
}
@@ -364,8 +388,9 @@ int FilterParserThread::parseP2PFilterFile()
++ruleCount;
}
catch (std::exception &e) {
LogMsg(tr("IP filter exception thrown for line %1. Exception is: %2").arg(nbLine)
.arg(QString::fromLocal8Bit(e.what())), Log::CRITICAL);
++parseErrorCount;
addLog(tr("IP filter exception thrown for line %1. Exception is: %2")
.arg(nbLine).arg(QString::fromLocal8Bit(e.what())));
}
}
@@ -373,6 +398,9 @@ int FilterParserThread::parseP2PFilterFile()
offset = 0;
}
if (parseErrorCount > MAX_LOGGED_ERRORS)
LogMsg(tr("%1 extra IP filter parsing errors occurred.", "513 extra IP filter parsing errors occurred.")
.arg(parseErrorCount - MAX_LOGGED_ERRORS), Log::CRITICAL);
return ruleCount;
}
@@ -407,7 +435,7 @@ int FilterParserThread::parseP2BFilterFile()
if (!file.exists()) return ruleCount;
if (!file.open(QIODevice::ReadOnly)) {
LogMsg(tr("I/O Error: Could not open ip filter file in read mode."), Log::CRITICAL);
LogMsg(tr("I/O Error: Could not open IP filter file in read mode."), Log::CRITICAL);
return ruleCount;
}
@@ -444,7 +472,7 @@ int FilterParserThread::parseP2BFilterFile()
m_filter.add_rule(first, last, libt::ip_filter::blocked);
++ruleCount;
}
catch(std::exception &) {}
catch (std::exception &) {}
}
}
else if (version == 3) {
@@ -494,7 +522,7 @@ int FilterParserThread::parseP2BFilterFile()
m_filter.add_rule(first, last, libt::ip_filter::blocked);
++ruleCount;
}
catch(std::exception &) {}
catch (std::exception &) {}
if (m_abort) return ruleCount;
}
@@ -553,7 +581,7 @@ void FilterParserThread::run()
try {
emit IPFilterParsed(ruleCount);
}
catch(std::exception &) {
catch (std::exception &) {
emit IPFilterError();
}

View File

@@ -1,6 +1,6 @@
/*
* Bittorrent Client using Qt and libtorrent.
* 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
@@ -24,8 +24,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 FILTERPARSERTHREAD_H
@@ -42,7 +40,7 @@ class FilterParserThread : public QThread
Q_OBJECT
public:
FilterParserThread(QObject *parent = 0);
FilterParserThread(QObject *parent = nullptr);
~FilterParserThread();
void processFilterFile(const QString &filePath);
libtorrent::ip_filter IPfilter();

View File

@@ -29,11 +29,11 @@
#ifndef RESUMEDATASAVINGMANAGER_H
#define RESUMEDATASAVINGMANAGER_H
#include <QObject>
#include <QByteArray>
#include <QDir>
#include <QObject>
class ResumeDataSavingManager: public QObject
class ResumeDataSavingManager : public QObject
{
Q_OBJECT

View File

@@ -4,9 +4,9 @@
#include <libtorrent/session.hpp>
#include "base/bittorrent/session.h"
#include "base/bittorrent/sessionstatus.h"
#include "base/profile.h"
#include "base/bittorrent/session.h"
static const qint64 SAVE_INTERVAL = 15 * 60 * 1000;

View File

@@ -4,7 +4,10 @@
#include <QObject>
#include <QTimer>
namespace BitTorrent { class Session; }
namespace BitTorrent
{
class Session;
}
class Statistics : QObject
{

File diff suppressed because it is too large Load Diff

View File

@@ -151,6 +151,47 @@ namespace BitTorrent
uint nbErrored = 0;
};
class SessionSettingsEnums
{
Q_GADGET
public:
// TODO: remove `SessionSettingsEnums` wrapper when we can use `Q_ENUM_NS` directly (QT >= 5.8 only)
enum class ChokingAlgorithm : int
{
FixedSlots = 0,
RateBased = 1
};
Q_ENUM(ChokingAlgorithm)
enum class SeedChokingAlgorithm : int
{
RoundRobin = 0,
FastestUpload = 1,
AntiLeech = 2
};
Q_ENUM(SeedChokingAlgorithm)
enum class MixedModeAlgorithm : int
{
TCP = 0,
Proportional = 1
};
Q_ENUM(MixedModeAlgorithm)
enum class BTProtocol : int
{
Both = 0,
TCP = 1,
UTP = 2
};
Q_ENUM(BTProtocol)
};
using ChokingAlgorithm = SessionSettingsEnums::ChokingAlgorithm;
using SeedChokingAlgorithm = SessionSettingsEnums::SeedChokingAlgorithm;
using MixedModeAlgorithm = SessionSettingsEnums::MixedModeAlgorithm;
using BTProtocol = SessionSettingsEnums::BTProtocol;
#if LIBTORRENT_VERSION_NUM >= 10100
struct SessionMetricIndices
{
@@ -188,6 +229,9 @@ namespace BitTorrent
int diskBlocksInUse = 0;
int numBlocksRead = 0;
int numBlocksCacheHits = 0;
int writeJobs = 0;
int readJobs = 0;
int hashJobs = 0;
int queuedDiskJobs = 0;
int diskJobTime = 0;
} disk;
@@ -210,13 +254,13 @@ namespace BitTorrent
void setTempPath(QString path);
bool isTempPathEnabled() const;
void setTempPathEnabled(bool enabled);
QString torrentTempPath(const InfoHash &hash) const;
QString torrentTempPath(const TorrentInfo &torrentInfo) const;
static bool isValidCategoryName(const QString &name);
// returns category itself and all top level categories
static QStringList expandCategory(const QString &category);
QStringList categories() const;
const QStringMap &categories() const;
QString categorySavePath(const QString &categoryName) const;
bool addCategory(const QString &name, const QString &savePath = "");
bool editCategory(const QString &name, const QString &savePath);
@@ -314,6 +358,10 @@ namespace BitTorrent
void setForceProxyEnabled(bool enabled);
bool isProxyPeerConnectionsEnabled() const;
void setProxyPeerConnectionsEnabled(bool enabled);
ChokingAlgorithm chokingAlgorithm() const;
void setChokingAlgorithm(ChokingAlgorithm mode);
SeedChokingAlgorithm seedChokingAlgorithm() const;
void setSeedChokingAlgorithm(SeedChokingAlgorithm mode);
bool isAddTrackersEnabled() const;
void setAddTrackersEnabled(bool enabled);
QString additionalTrackers() const;
@@ -324,22 +372,34 @@ namespace BitTorrent
void setIPFilterFile(QString path);
bool announceToAllTrackers() const;
void setAnnounceToAllTrackers(bool val);
uint diskCacheSize() const;
void setDiskCacheSize(uint size);
uint diskCacheTTL() const;
void setDiskCacheTTL(uint ttl);
bool announceToAllTiers() const;
void setAnnounceToAllTiers(bool val);
int diskCacheSize() const;
void setDiskCacheSize(int size);
int diskCacheTTL() const;
void setDiskCacheTTL(int ttl);
bool useOSCache() const;
void setUseOSCache(bool use);
bool isGuidedReadCacheEnabled() const;
void setGuidedReadCacheEnabled(bool enabled);
bool isSuggestModeEnabled() const;
void setSuggestMode(bool mode);
int sendBufferWatermark() const;
void setSendBufferWatermark(int value);
int sendBufferLowWatermark() const;
void setSendBufferLowWatermark(int value);
int sendBufferWatermarkFactor() const;
void setSendBufferWatermarkFactor(int value);
bool isAnonymousModeEnabled() const;
void setAnonymousModeEnabled(bool enabled);
bool isQueueingSystemEnabled() const;
void setQueueingSystemEnabled(bool enabled);
bool ignoreSlowTorrentsForQueueing() const;
void setIgnoreSlowTorrentsForQueueing(bool ignore);
uint outgoingPortsMin() const;
void setOutgoingPortsMin(uint min);
uint outgoingPortsMax() const;
void setOutgoingPortsMax(uint max);
int outgoingPortsMin() const;
void setOutgoingPortsMin(int min);
int outgoingPortsMax() const;
void setOutgoingPortsMax(int max);
bool ignoreLimitsOnLAN() const;
void setIgnoreLimitsOnLAN(bool ignore);
bool includeOverheadInLimits() const;
@@ -364,10 +424,14 @@ namespace BitTorrent
void setMaxActiveUploads(int max);
int maxActiveTorrents() const;
void setMaxActiveTorrents(int max);
bool isUTPEnabled() const;
void setUTPEnabled(bool enabled);
BTProtocol btProtocol() const;
void setBTProtocol(BTProtocol protocol);
bool isUTPRateLimited() const;
void setUTPRateLimited(bool limited);
MixedModeAlgorithm utpMixedMode() const;
void setUtpMixedMode(MixedModeAlgorithm mode);
bool multiConnectionsPerIpEnabled() const;
void setMultiConnectionsPerIpEnabled(bool enabled);
bool isTrackerFilteringEnabled() const;
void setTrackerFilteringEnabled(bool enabled);
QStringList bannedIPs() const;
@@ -477,13 +541,19 @@ namespace BitTorrent
void handleDownloadFinished(const QString &url, const QString &filePath);
void handleDownloadFailed(const QString &url, const QString &reason);
void handleRedirectedToMagnet(const QString &url, const QString &magnetUri);
void switchToAlternativeMode(bool alternative);
// Session reconfiguration triggers
void networkOnlineStateChanged(const bool online);
void networkConfigurationChange(const QNetworkConfiguration&);
private:
struct RemovingTorrentData
{
QString name;
QString savePathToRemove;
bool requestedFileDeletion;
};
explicit Session(QObject *parent = 0);
~Session();
@@ -497,17 +567,19 @@ namespace BitTorrent
#if LIBTORRENT_VERSION_NUM < 10100
void configure(libtorrent::session_settings &sessionSettings);
void adjustLimits(libtorrent::session_settings &sessionSettings);
void applyBandwidthLimits(libtorrent::session_settings &sessionSettings);
#else
void configure(libtorrent::settings_pack &settingsPack);
void configurePeerClasses();
void adjustLimits(libtorrent::settings_pack &settingsPack);
void applyBandwidthLimits(libtorrent::settings_pack &settingsPack);
void initMetrics();
#endif
void adjustLimits();
void applyBandwidthLimits();
void processBannedIPs(libtorrent::ip_filter &filter);
const QStringList getListeningIPs();
void configureListeningInterface();
void changeSpeedLimitMode_impl(bool alternative);
void enableTracker(bool enable);
void enableBandwidthScheduler();
void populateAdditionalTrackers();
@@ -569,17 +641,23 @@ namespace BitTorrent
CachedSettingValue<bool> m_isTrackerFilteringEnabled;
CachedSettingValue<QString> m_IPFilterFile;
CachedSettingValue<bool> m_announceToAllTrackers;
CachedSettingValue<uint> m_diskCacheSize;
CachedSettingValue<uint> m_diskCacheTTL;
CachedSettingValue<bool> m_announceToAllTiers;
CachedSettingValue<int> m_diskCacheSize;
CachedSettingValue<int> m_diskCacheTTL;
CachedSettingValue<bool> m_useOSCache;
CachedSettingValue<bool> m_guidedReadCacheEnabled;
CachedSettingValue<bool> m_isSuggestMode;
CachedSettingValue<int> m_sendBufferWatermark;
CachedSettingValue<int> m_sendBufferLowWatermark;
CachedSettingValue<int> m_sendBufferWatermarkFactor;
CachedSettingValue<bool> m_isAnonymousModeEnabled;
CachedSettingValue<bool> m_isQueueingEnabled;
CachedSettingValue<int> m_maxActiveDownloads;
CachedSettingValue<int> m_maxActiveUploads;
CachedSettingValue<int> m_maxActiveTorrents;
CachedSettingValue<bool> m_ignoreSlowTorrentsForQueueing;
CachedSettingValue<uint> m_outgoingPortsMin;
CachedSettingValue<uint> m_outgoingPortsMax;
CachedSettingValue<int> m_outgoingPortsMin;
CachedSettingValue<int> m_outgoingPortsMax;
CachedSettingValue<bool> m_ignoreLimitsOnLAN;
CachedSettingValue<bool> m_includeOverheadInLimits;
CachedSettingValue<QString> m_announceIP;
@@ -589,8 +667,10 @@ namespace BitTorrent
CachedSettingValue<int> m_maxUploads;
CachedSettingValue<int> m_maxConnectionsPerTorrent;
CachedSettingValue<int> m_maxUploadsPerTorrent;
CachedSettingValue<bool> m_isUTPEnabled;
CachedSettingValue<BTProtocol> m_btProtocol;
CachedSettingValue<bool> m_isUTPRateLimited;
CachedSettingValue<MixedModeAlgorithm> m_utpMixedMode;
CachedSettingValue<bool> m_multiConnectionsPerIpEnabled;
CachedSettingValue<bool> m_isAddTrackersEnabled;
CachedSettingValue<QString> m_additionalTrackers;
CachedSettingValue<qreal> m_globalMaxRatio;
@@ -618,6 +698,8 @@ namespace BitTorrent
CachedSettingValue<int> m_encryption;
CachedSettingValue<bool> m_isForceProxyEnabled;
CachedSettingValue<bool> m_isProxyPeerConnectionsEnabled;
CachedSettingValue<ChokingAlgorithm> m_chokingAlgorithm;
CachedSettingValue<SeedChokingAlgorithm> m_seedChokingAlgorithm;
CachedSettingValue<QVariantMap> m_storedCategories;
CachedSettingValue<QStringList> m_storedTags;
CachedSettingValue<int> m_maxRatioAction;
@@ -642,7 +724,6 @@ namespace BitTorrent
QList<BitTorrent::TrackerEntry> m_additionalTrackerList;
QString m_resumeFolderPath;
QFile m_resumeFolderLock;
QHash<InfoHash, QString> m_savePathsToRemove;
bool m_useProxy;
QTimer *m_refreshTimer;
@@ -662,6 +743,7 @@ namespace BitTorrent
QHash<InfoHash, TorrentHandle *> m_torrents;
QHash<InfoHash, AddTorrentData> m_addingTorrents;
QHash<QString, AddTorrentParams> m_downloadedTorrents;
QHash<InfoHash, RemovingTorrentData> m_removingTorrents;
TorrentStatusReport m_torrentStatusReport;
QStringMap m_categories;
QSet<QString> m_tags;

View File

@@ -35,8 +35,8 @@
#include <boost/bind.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/create_torrent.hpp>
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/storage.hpp>
#include <libtorrent/torrent_info.hpp>
#include <QFile>
@@ -44,120 +44,115 @@
#include "base/utils/misc.h"
#include "base/utils/string.h"
namespace
{
// do not include files and folders whose
// name starts with a .
bool fileFilter(const std::string &f)
{
return !Utils::Fs::fileName(QString::fromStdString(f)).startsWith('.');
}
}
namespace libt = libtorrent;
using namespace BitTorrent;
// do not include files and folders whose
// name starts with a .
bool fileFilter(const std::string &f)
{
return !Utils::Fs::fileName(QString::fromStdString(f)).startsWith('.');
}
TorrentCreatorThread::TorrentCreatorThread(QObject *parent)
: QThread(parent)
, m_private(false)
, m_pieceSize(0)
{
}
TorrentCreatorThread::~TorrentCreatorThread()
{
requestInterruption();
wait(1000);
wait();
}
void TorrentCreatorThread::create(const QString &inputPath, const QString &savePath, const QStringList &trackers,
const QStringList &urlSeeds, const QString &comment, bool isPrivate, int pieceSize)
void TorrentCreatorThread::create(const TorrentCreatorParams &params)
{
m_inputPath = Utils::Fs::fromNativePath(inputPath);
m_savePath = Utils::Fs::fromNativePath(savePath);
if (QFile(m_savePath).exists())
Utils::Fs::forceRemove(m_savePath);
m_trackers = trackers;
m_urlSeeds = urlSeeds;
m_comment = comment;
m_private = isPrivate;
m_pieceSize = pieceSize;
m_params = params;
start();
}
void TorrentCreatorThread::sendProgressSignal(int numHashes, int numPieces)
void TorrentCreatorThread::sendProgressSignal(int currentPieceIdx, int totalPieces)
{
emit updateProgress(static_cast<int>((numHashes * 100.) / numPieces));
emit updateProgress(static_cast<int>((currentPieceIdx * 100.) / totalPieces));
}
void TorrentCreatorThread::run()
{
const QString creatorStr("qBittorrent " QBT_VERSION);
emit updateProgress(0);
QString creator_str("qBittorrent " QBT_VERSION);
try {
libt::file_storage fs;
// Adding files to the torrent
libt::add_files(fs, Utils::Fs::toNativePath(m_inputPath).toStdString(), fileFilter);
libt::add_files(fs, Utils::Fs::toNativePath(m_params.inputPath).toStdString(), fileFilter);
if (isInterruptionRequested()) return;
libt::create_torrent t(fs, m_pieceSize);
libt::create_torrent newTorrent(fs, m_params.pieceSize);
// Add url seeds
foreach (const QString &seed, m_urlSeeds)
t.add_url_seed(seed.trimmed().toStdString());
foreach (QString seed, m_params.urlSeeds) {
seed = seed.trimmed();
if (!seed.isEmpty())
newTorrent.add_url_seed(seed.toStdString());
}
int tier = 0;
bool newline = false;
foreach (const QString &tracker, m_trackers) {
if (tracker.isEmpty()) {
if (newline)
continue;
foreach (const QString &tracker, m_params.trackers) {
if (tracker.isEmpty())
++tier;
newline = true;
continue;
}
t.add_tracker(tracker.trimmed().toStdString(), tier);
newline = false;
else
newTorrent.add_tracker(tracker.trimmed().toStdString(), tier);
}
if (isInterruptionRequested()) return;
// calculate the hash for all pieces
const QString parentPath = Utils::Fs::branchPath(m_inputPath) + "/";
libt::set_piece_hashes(t, Utils::Fs::toNativePath(parentPath).toStdString(), boost::bind(&TorrentCreatorThread::sendProgressSignal, this, _1, t.num_pieces()));
const QString parentPath = Utils::Fs::branchPath(m_params.inputPath) + "/";
libt::set_piece_hashes(newTorrent, Utils::Fs::toNativePath(parentPath).toStdString()
, [this, &newTorrent](const int n) { sendProgressSignal(n, newTorrent.num_pieces()); });
// Set qBittorrent as creator and add user comment to
// torrent_info structure
t.set_creator(creator_str.toUtf8().constData());
t.set_comment(m_comment.toUtf8().constData());
newTorrent.set_creator(creatorStr.toUtf8().constData());
newTorrent.set_comment(m_params.comment.toUtf8().constData());
// Is private ?
t.set_priv(m_private);
newTorrent.set_priv(m_params.isPrivate);
if (isInterruptionRequested()) return;
// create the torrent and print it to out
qDebug("Saving to %s", qPrintable(m_savePath));
libt::entry entry = newTorrent.generate();
// add source field
if (!m_params.source.isEmpty())
entry["info"]["source"] = m_params.source.toStdString();
if (isInterruptionRequested()) return;
// create the torrent
std::ofstream outfile(
#ifdef _MSC_VER
wchar_t *savePathW = new wchar_t[m_savePath.length() + 1];
int len = Utils::Fs::toNativePath(m_savePath).toWCharArray(savePathW);
savePathW[len] = L'\0';
std::ofstream outfile(savePathW, std::ios_base::out | std::ios_base::binary);
delete[] savePathW;
Utils::Fs::toNativePath(m_params.savePath).toStdWString().c_str()
#else
std::ofstream outfile(Utils::Fs::toNativePath(m_savePath).toLocal8Bit().constData(), std::ios_base::out | std::ios_base::binary);
Utils::Fs::toNativePath(m_params.savePath).toUtf8().constData()
#endif
, (std::ios_base::out | std::ios_base::binary | std::ios_base::trunc));
if (outfile.fail())
throw std::exception();
throw std::runtime_error(tr("create new torrent file failed").toStdString());
if (isInterruptionRequested()) return;
libt::bencode(std::ostream_iterator<char>(outfile), t.generate());
libt::bencode(std::ostream_iterator<char>(outfile), entry);
outfile.close();
emit updateProgress(100);
emit creationSuccess(m_savePath, parentPath);
emit creationSuccess(m_params.savePath, parentPath);
}
catch (std::exception& e) {
emit creationFailure(QString::fromStdString(e.what()));
catch (const std::exception &e) {
emit creationFailure(e.what());
}
}

View File

@@ -36,16 +36,27 @@
namespace BitTorrent
{
struct TorrentCreatorParams
{
bool isPrivate;
int pieceSize;
QString inputPath;
QString savePath;
QString comment;
QString source;
QStringList trackers;
QStringList urlSeeds;
};
class TorrentCreatorThread : public QThread
{
Q_OBJECT
public:
TorrentCreatorThread(QObject *parent = 0);
TorrentCreatorThread(QObject *parent = nullptr);
~TorrentCreatorThread();
void create(const QString &inputPath, const QString &savePath, const QStringList &trackers,
const QStringList &urlSeeds, const QString &comment, bool isPrivate, int pieceSize);
void create(const TorrentCreatorParams &params);
static int calculateTotalPieces(const QString &inputPath, const int pieceSize);
@@ -58,15 +69,9 @@ namespace BitTorrent
void updateProgress(int progress);
private:
void sendProgressSignal(int numHashes, int numPieces);
void sendProgressSignal(int currentPieceIdx, int totalPieces);
QString m_inputPath;
QString m_savePath;
QStringList m_trackers;
QStringList m_urlSeeds;
QString m_comment;
bool m_private;
int m_pieceSize;
TorrentCreatorParams m_params;
};
}

View File

@@ -27,20 +27,23 @@
* exception statement from your version.
*/
#include "torrenthandle.h"
#include <algorithm>
#include <type_traits>
#include <QDebug>
#include <QStringList>
#include <QFile>
#include <QDir>
#include <QByteArray>
#include <QBitArray>
#include <QByteArray>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QStringList>
#include <libtorrent/entry.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/address.hpp>
#include <libtorrent/alert_types.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/create_torrent.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/magnet_uri.hpp>
#if LIBTORRENT_VERSION_NUM >= 10100
#include <libtorrent/time.hpp>
@@ -55,13 +58,12 @@
#include "base/logger.h"
#include "base/preferences.h"
#include "base/profile.h"
#include "base/utils/string.h"
#include "base/utils/fs.h"
#include "base/utils/misc.h"
#include "session.h"
#include "base/utils/string.h"
#include "peerinfo.h"
#include "session.h"
#include "trackerentry.h"
#include "torrenthandle.h"
const QString QB_EXT {".!qB"};
@@ -93,6 +95,8 @@ AddTorrentData::AddTorrentData()
, hasRootFolder(true)
, addForced(false)
, addPaused(false)
, uploadLimit(-1)
, downloadLimit(-1)
, ratioLimit(TorrentHandle::USE_GLOBAL_RATIO)
, seedingTimeLimit(TorrentHandle::USE_GLOBAL_SEEDING_TIME)
{
@@ -116,68 +120,19 @@ AddTorrentData::AddTorrentData(const AddTorrentParams &params)
, addPaused(params.addPaused == TriStateBool::Undefined
? Session::instance()->isAddTorrentPaused()
: params.addPaused == TriStateBool::True)
, uploadLimit(params.uploadLimit)
, downloadLimit(params.downloadLimit)
, filePriorities(params.filePriorities)
, ratioLimit(params.ignoreShareLimits ? TorrentHandle::NO_RATIO_LIMIT : TorrentHandle::USE_GLOBAL_RATIO)
, seedingTimeLimit(params.ignoreShareLimits ? TorrentHandle::NO_SEEDING_TIME_LIMIT : TorrentHandle::USE_GLOBAL_SEEDING_TIME)
{
}
// TorrentState
TorrentState::TorrentState(int value)
: m_value(value)
{
}
QString TorrentState::toString() const
{
switch (m_value) {
case Error:
return QLatin1String("error");
case MissingFiles:
return QLatin1String("missingFiles");
case Uploading:
return QLatin1String("uploading");
case PausedUploading:
return QLatin1String("pausedUP");
case QueuedUploading:
return QLatin1String("queuedUP");
case StalledUploading:
return QLatin1String("stalledUP");
case CheckingUploading:
return QLatin1String("checkingUP");
case ForcedUploading:
return QLatin1String("forcedUP");
case Allocating:
return QLatin1String("allocating");
case Downloading:
return QLatin1String("downloading");
case DownloadingMetadata:
return QLatin1String("metaDL");
case PausedDownloading:
return QLatin1String("pausedDL");
case QueuedDownloading:
return QLatin1String("queuedDL");
case StalledDownloading:
return QLatin1String("stalledDL");
case CheckingDownloading:
return QLatin1String("checkingDL");
case ForcedDownloading:
return QLatin1String("forcedDL");
#if LIBTORRENT_VERSION_NUM < 10100
case QueuedForChecking:
return QLatin1String("queuedForChecking");
#endif
case CheckingResumeData:
return QLatin1String("checkingResumeData");
default:
return QLatin1String("unknown");
}
}
TorrentState::operator int() const
{
return m_value;
bool useAutoTMM = (params.useAutoTMM == TriStateBool::Undefined
? !Session::instance()->isAutoTMMDisabledByDefault()
: params.useAutoTMM == TriStateBool::True);
if (useAutoTMM)
savePath = "";
else if (savePath.trimmed().isEmpty())
savePath = Session::instance()->defaultSavePath();
}
// TorrentHandle
@@ -201,6 +156,8 @@ const int TorrentHandle::MAX_SEEDING_TIME = 525600;
// The following can be removed after one or two libtorrent releases on each branch.
namespace
{
const char i18nContext[] = "TorrentHandle";
// new constructor is available
template<typename T, typename std::enable_if<std::is_constructible<T, libt::torrent_info, bool>::value, int>::type = 0>
T makeTorrentCreator(const libtorrent::torrent_info & ti)
@@ -390,7 +347,7 @@ void TorrentHandle::setAutoTMMEnabled(bool enabled)
m_session->handleTorrentSavingModeChanged(this);
if (m_useAutoTMM)
move_impl(m_session->categorySavePath(m_category));
move_impl(m_session->categorySavePath(m_category), true);
}
bool TorrentHandle::hasRootFolder() const
@@ -1101,10 +1058,9 @@ int TorrentHandle::timeSinceDownload() const
int TorrentHandle::timeSinceActivity() const
{
if (m_nativeStatus.time_since_upload < m_nativeStatus.time_since_download)
return m_nativeStatus.time_since_upload;
else
return m_nativeStatus.time_since_download;
return ((m_nativeStatus.time_since_upload < 0) != (m_nativeStatus.time_since_download < 0))
? std::max(m_nativeStatus.time_since_upload, m_nativeStatus.time_since_download)
: std::min(m_nativeStatus.time_since_upload, m_nativeStatus.time_since_download);
}
int TorrentHandle::downloadLimit() const
@@ -1173,38 +1129,20 @@ qreal TorrentHandle::distributedCopies() const
return m_nativeStatus.distributed_copies;
}
qreal TorrentHandle::maxRatio(bool *usesGlobalRatio) const
qreal TorrentHandle::maxRatio() const
{
qreal ratioLimit = m_ratioLimit;
if (m_ratioLimit == USE_GLOBAL_RATIO)
return m_session->globalMaxRatio();
if (ratioLimit == USE_GLOBAL_RATIO) {
ratioLimit = m_session->globalMaxRatio();
if (usesGlobalRatio)
*usesGlobalRatio = true;
}
else {
if (usesGlobalRatio)
*usesGlobalRatio = false;
}
return ratioLimit;
return m_ratioLimit;
}
int TorrentHandle::maxSeedingTime(bool *usesGlobalSeedingTime) const
int TorrentHandle::maxSeedingTime() const
{
int seedingTimeLimit = m_seedingTimeLimit;
if (m_seedingTimeLimit == USE_GLOBAL_SEEDING_TIME)
return m_session->globalMaxSeedingMinutes();
if (seedingTimeLimit == USE_GLOBAL_SEEDING_TIME) {
seedingTimeLimit = m_session->globalMaxSeedingMinutes();
if (usesGlobalSeedingTime)
*usesGlobalSeedingTime = true;
}
else {
if (usesGlobalSeedingTime)
*usesGlobalSeedingTime = false;
}
return seedingTimeLimit;
return m_seedingTimeLimit;
}
qreal TorrentHandle::realRatio() const
@@ -1285,7 +1223,7 @@ bool TorrentHandle::setCategory(const QString &category)
if (m_useAutoTMM) {
if (!m_session->isDisableAutoTMMWhenCategoryChanged())
move_impl(m_session->categorySavePath(m_category));
move_impl(m_session->categorySavePath(m_category), true);
else
setAutoTMMEnabled(false);
}
@@ -1305,16 +1243,16 @@ void TorrentHandle::move(QString path)
if (!path.endsWith('/'))
path += '/';
move_impl(path);
move_impl(path, false);
}
void TorrentHandle::move_impl(QString path)
void TorrentHandle::move_impl(QString path, bool overwrite)
{
path = Utils::Fs::toNativePath(path);
if (path == savePath()) return;
path = Utils::Fs::toNativePath(path);
if (!useTempPath()) {
moveStorage(path);
moveStorage(path, overwrite);
}
else {
m_savePath = path;
@@ -1416,21 +1354,23 @@ void TorrentHandle::resume(bool forced)
m_nativeHandle.resume();
}
void TorrentHandle::moveStorage(const QString &newPath)
void TorrentHandle::moveStorage(const QString &newPath, bool overwrite)
{
if (isMoveInProgress()) {
qDebug("enqueue move storage to %s", qPrintable(newPath));
m_queuedPath = newPath;
qDebug("enqueue move storage to %s", qUtf8Printable(newPath));
m_moveStorageInfo.queuedPath = newPath;
m_moveStorageInfo.queuedOverwrite = overwrite;
}
else {
const QString oldPath = nativeActualSavePath();
if (QDir(oldPath) == QDir(newPath)) return;
qDebug("move storage: %s to %s", qPrintable(oldPath), qPrintable(newPath));
qDebug("move storage: %s to %s", qUtf8Printable(oldPath), qUtf8Printable(newPath));
// Actually move the storage
m_nativeHandle.move_storage(newPath.toUtf8().constData());
m_oldPath = oldPath;
m_newPath = newPath;
m_nativeHandle.move_storage(newPath.toUtf8().constData()
, (overwrite ? libt::always_replace_files : libt::dont_replace));
m_moveStorageInfo.oldPath = oldPath;
m_moveStorageInfo.newPath = newPath;
}
}
@@ -1492,22 +1432,27 @@ void TorrentHandle::handleStorageMovedAlert(libtorrent::storage_moved_alert *p)
#else
const QString newPath(p->storage_path());
#endif
if (newPath != m_newPath) {
if (newPath != m_moveStorageInfo.newPath) {
qWarning() << Q_FUNC_INFO << ": New path doesn't match a path in a queue.";
return;
}
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);
qDebug("Torrent is successfully moved from %s to %s"
, qUtf8Printable(m_moveStorageInfo.oldPath), qUtf8Printable(m_moveStorageInfo.newPath));
const QDir oldDir {m_moveStorageInfo.oldPath};
if ((oldDir == QDir(m_session->torrentTempPath(info())))
&& (oldDir != QDir(m_session->tempPath()))) {
// torrent without root folder still has it in its temporary save path
// so its temp path isn't equal to temp path root
qDebug() << "Removing torrent temp folder:" << m_moveStorageInfo.oldPath;
Utils::Fs::smartRemoveEmptyFolderTree(m_moveStorageInfo.oldPath);
}
updateStatus();
m_newPath.clear();
if (!m_queuedPath.isEmpty()) {
moveStorage(m_queuedPath);
m_queuedPath.clear();
m_moveStorageInfo.newPath.clear();
if (!m_moveStorageInfo.queuedPath.isEmpty()) {
moveStorage(m_moveStorageInfo.queuedPath, m_moveStorageInfo.queuedOverwrite);
m_moveStorageInfo.queuedPath.clear();
}
if (!useTempPath()) {
@@ -1526,13 +1471,13 @@ void TorrentHandle::handleStorageMovedFailedAlert(libtorrent::storage_moved_fail
return;
}
Logger::instance()->addMessage(tr("Could not move torrent: '%1'. Reason: %2")
LogMsg(QCoreApplication::translate(i18nContext, "Could not move torrent: '%1'. Reason: %2")
.arg(name()).arg(QString::fromStdString(p->message())), Log::CRITICAL);
m_newPath.clear();
if (!m_queuedPath.isEmpty()) {
moveStorage(m_queuedPath);
m_queuedPath.clear();
m_moveStorageInfo.newPath.clear();
if (!m_moveStorageInfo.queuedPath.isEmpty()) {
moveStorage(m_moveStorageInfo.queuedPath, m_moveStorageInfo.queuedOverwrite);
m_moveStorageInfo.queuedPath.clear();
}
while (!isMoveInProgress() && (m_renameCount == 0) && !m_moveFinishedTriggers.isEmpty())
@@ -1546,7 +1491,7 @@ void TorrentHandle::handleTrackerReplyAlert(libtorrent::tracker_reply_alert *p)
#else
QString trackerUrl(p->tracker_url());
#endif
qDebug("Received a tracker reply from %s (Num_peers = %d)", qPrintable(trackerUrl), p->num_peers);
qDebug("Received a tracker reply from %s (Num_peers = %d)", qUtf8Printable(trackerUrl), p->num_peers);
// Connection was successful now. Remove possible old errors
m_trackerInfos[trackerUrl].lastMessage.clear(); // Reset error/warning message
m_trackerInfos[trackerUrl].numPeers = p->num_peers;
@@ -1563,7 +1508,7 @@ void TorrentHandle::handleTrackerWarningAlert(libtorrent::tracker_warning_alert
QString trackerUrl(p->tracker_url());
QString message = QString::fromStdString(p->message());
#endif
qDebug("Received a tracker warning for %s: %s", qPrintable(trackerUrl), qPrintable(message));
qDebug("Received a tracker warning for %s: %s", qUtf8Printable(trackerUrl), qUtf8Printable(message));
// Connection was successful now but there is a warning message
m_trackerInfos[trackerUrl].lastMessage = message; // Store warning message
@@ -1579,7 +1524,7 @@ void TorrentHandle::handleTrackerErrorAlert(libtorrent::tracker_error_alert *p)
QString trackerUrl(p->tracker_url());
QString message = QString::fromStdString(p->message());
#endif
qDebug("Received a tracker error for %s: %s", qPrintable(trackerUrl), qPrintable(message));
qDebug("Received a tracker error for %s: %s", qUtf8Printable(trackerUrl), qUtf8Printable(message));
m_trackerInfos[trackerUrl].lastMessage = message;
if (p->status_code == 401)
@@ -1591,7 +1536,7 @@ void TorrentHandle::handleTrackerErrorAlert(libtorrent::tracker_error_alert *p)
void TorrentHandle::handleTorrentCheckedAlert(libtorrent::torrent_checked_alert *p)
{
Q_UNUSED(p);
qDebug("%s have just finished checking", qPrintable(hash()));
qDebug("%s have just finished checking", qUtf8Printable(hash()));
updateStatus();
@@ -1614,7 +1559,7 @@ void TorrentHandle::handleTorrentCheckedAlert(libtorrent::torrent_checked_alert
void TorrentHandle::handleTorrentFinishedAlert(libtorrent::torrent_finished_alert *p)
{
Q_UNUSED(p);
qDebug("Got a torrent finished alert for %s", qPrintable(name()));
qDebug("Got a torrent finished alert for %s", qUtf8Printable(name()));
qDebug("Torrent has seed status: %s", m_hasSeedStatus ? "yes" : "no");
if (m_hasSeedStatus) return;
@@ -1673,8 +1618,8 @@ void TorrentHandle::handleSaveResumeDataAlert(libtorrent::save_resume_data_alert
resumeData["save_path"] = Profile::instance().toPortablePath(QString::fromStdString(savePath)).toStdString();
}
resumeData["qBt-savePath"] = m_useAutoTMM ? "" : Profile::instance().toPortablePath(m_savePath).toStdString();
resumeData["qBt-ratioLimit"] = QString::number(m_ratioLimit).toStdString();
resumeData["qBt-seedingTimeLimit"] = QString::number(m_seedingTimeLimit).toStdString();
resumeData["qBt-ratioLimit"] = static_cast<int>(m_ratioLimit * 1000);
resumeData["qBt-seedingTimeLimit"] = m_seedingTimeLimit;
resumeData["qBt-category"] = m_category.toStdString();
resumeData["qBt-tags"] = setToEntryList(m_tags);
resumeData["qBt-name"] = m_name.toStdString();
@@ -1698,19 +1643,19 @@ void TorrentHandle::handleSaveResumeDataFailedAlert(libtorrent::save_resume_data
void TorrentHandle::handleFastResumeRejectedAlert(libtorrent::fastresume_rejected_alert *p)
{
qDebug("/!\\ Fast resume failed for %s, reason: %s", qPrintable(name()), p->message().c_str());
qDebug("/!\\ Fast resume failed for %s, reason: %s", qUtf8Printable(name()), p->message().c_str());
Logger *const logger = Logger::instance();
updateStatus();
if (p->error.value() == libt::errors::mismatching_file_size) {
// Mismatching file size (files were probably moved)
logger->addMessage(tr("File sizes mismatch for torrent '%1', pausing it.").arg(name()), Log::CRITICAL);
logger->addMessage(QCoreApplication::translate(i18nContext, "File sizes mismatch for torrent '%1', pausing it.").arg(name()), Log::CRITICAL);
m_hasMissingFiles = true;
if (!isPaused())
pause();
}
else {
logger->addMessage(tr("Fast resume data was rejected for torrent '%1'. Reason: %2. Checking again...")
logger->addMessage(QCoreApplication::translate(i18nContext, "Fast resume data was rejected for torrent '%1'. Reason: %2. Checking again...")
.arg(name()).arg(QString::fromStdString(p->message())), Log::CRITICAL);
}
}
@@ -1733,9 +1678,9 @@ void TorrentHandle::handleFileRenamedAlert(libtorrent::file_renamed_alert *p)
newPathParts.removeLast();
QString newPath = newPathParts.join("/");
if (!newPathParts.isEmpty() && (oldPath != newPath)) {
qDebug("oldPath(%s) != newPath(%s)", qPrintable(oldPath), qPrintable(newPath));
qDebug("oldPath(%s) != newPath(%s)", qUtf8Printable(oldPath), qUtf8Printable(newPath));
oldPath = QString("%1/%2").arg(savePath(true)).arg(oldPath);
qDebug("Detected folder renaming, attempt to delete old folder: %s", qPrintable(oldPath));
qDebug("Detected folder renaming, attempt to delete old folder: %s", qUtf8Printable(oldPath));
QDir().rmpath(oldPath);
}
}
@@ -1760,13 +1705,13 @@ void TorrentHandle::handleFileCompletedAlert(libtorrent::file_completed_alert *p
{
updateStatus();
qDebug("A file completed download in torrent \"%s\"", qPrintable(name()));
qDebug("A file completed download in torrent \"%s\"", qUtf8Printable(name()));
if (m_session->isAppendExtensionEnabled()) {
QString name = filePath(p->index);
if (name.endsWith(QB_EXT)) {
const QString oldName = name;
name.chop(QB_EXT.size());
qDebug("Renaming %s to %s", qPrintable(oldName), qPrintable(name));
qDebug("Renaming %s to %s", qUtf8Printable(oldName), qUtf8Printable(name));
renameFile(p->index, name);
}
}
@@ -1783,7 +1728,7 @@ void TorrentHandle::handleStatsAlert(libtorrent::stats_alert *p)
void TorrentHandle::handleMetadataReceivedAlert(libt::metadata_received_alert *p)
{
Q_UNUSED(p);
qDebug("Metadata received for torrent %s.", qPrintable(name()));
qDebug("Metadata received for torrent %s.", qUtf8Printable(name()));
updateStatus();
if (m_session->isAppendExtensionEnabled())
manageIncompleteFiles();
@@ -1816,7 +1761,7 @@ void TorrentHandle::handleTempPathChanged()
void TorrentHandle::handleCategorySavePathChanged()
{
if (m_useAutoTMM)
move_impl(m_session->categorySavePath(m_category));
move_impl(m_session->categorySavePath(m_category), true);
}
void TorrentHandle::handleAppendExtensionToggled()
@@ -1926,12 +1871,12 @@ void TorrentHandle::adjustActualSavePath_impl()
path = savePath();
}
else {
// Moving all downloading torrents to temporary save path
path = m_session->torrentTempPath(hash());
qDebug() << "Moving torrent to its temp save path:" << path;
// Moving all downloading torrents to temporary folder
path = m_session->torrentTempPath(info());
qDebug() << "Moving torrent to its temporary folder:" << path;
}
moveStorage(Utils::Fs::toNativePath(path));
moveStorage(Utils::Fs::toNativePath(path), true);
}
libtorrent::torrent_handle TorrentHandle::nativeHandle() const
@@ -1951,7 +1896,7 @@ void TorrentHandle::updateTorrentInfo()
bool TorrentHandle::isMoveInProgress() const
{
return !m_newPath.isEmpty();
return !m_moveStorageInfo.newPath.isEmpty();
}
bool TorrentHandle::useTempPath() const

View File

@@ -104,6 +104,8 @@ namespace BitTorrent
bool hasRootFolder;
bool addForced;
bool addPaused;
int uploadLimit;
int downloadLimit;
// for new torrents
QVector<int> filePriorities;
// for resumed torrents
@@ -120,48 +122,35 @@ namespace BitTorrent
quint32 numPeers = 0;
};
class TorrentState
enum class TorrentState
{
public:
enum
{
Unknown = -1,
Unknown = -1,
ForcedDownloading,
Downloading,
DownloadingMetadata,
Allocating,
StalledDownloading,
ForcedDownloading,
Downloading,
DownloadingMetadata,
Allocating,
StalledDownloading,
ForcedUploading,
Uploading,
StalledUploading,
QueuedDownloading,
QueuedUploading,
CheckingUploading,
CheckingDownloading,
ForcedUploading,
Uploading,
StalledUploading,
#if LIBTORRENT_VERSION_NUM < 10100
QueuedForChecking,
QueuedForChecking,
#endif
CheckingResumeData,
CheckingResumeData,
QueuedDownloading,
QueuedUploading,
PausedDownloading,
PausedUploading,
CheckingUploading,
CheckingDownloading,
MissingFiles,
Error
};
PausedDownloading,
PausedUploading,
TorrentState(int value);
operator int() const;
QString toString() const;
private:
int m_value;
MissingFiles,
Error
};
class TorrentHandle : public QObject
@@ -244,6 +233,8 @@ namespace BitTorrent
QString rootPath(bool actual = false) const;
QString contentPath(bool actual = false) const;
bool useTempPath() const;
bool isAutoTMMEnabled() const;
void setAutoTMMEnabled(bool enabled);
QString category() const;
@@ -326,8 +317,8 @@ namespace BitTorrent
QBitArray downloadingPieces() const;
QVector<int> pieceAvailability() const;
qreal distributedCopies() const;
qreal maxRatio(bool *usesGlobalRatio = 0) const;
int maxSeedingTime(bool *usesGlobalSeedingTime = 0) const;
qreal maxRatio() const;
int maxSeedingTime() const;
qreal realRatio() const;
int uploadPayloadRate() const;
int downloadPayloadRate() const;
@@ -416,13 +407,12 @@ namespace BitTorrent
void handleStatsAlert(libtorrent::stats_alert *p);
bool isMoveInProgress() const;
bool useTempPath() const;
QString nativeActualSavePath() const;
void adjustActualSavePath();
void adjustActualSavePath_impl();
void move_impl(QString path);
void moveStorage(const QString &newPath);
void move_impl(QString path, bool overwrite);
void moveStorage(const QString &newPath, bool overwrite);
void manageIncompleteFiles();
bool addTracker(const TrackerEntry &tracker);
bool addUrlSeed(const QUrl &urlSeed);
@@ -437,11 +427,16 @@ namespace BitTorrent
InfoHash m_hash;
QString m_oldPath;
QString m_newPath;
// m_queuedPath is where files should be moved to,
// when current moving is completed
QString m_queuedPath;
struct
{
QString oldPath;
QString newPath;
// queuedPath is where files should be moved to,
// when current moving is completed
QString queuedPath;
bool queuedOverwrite = true;
} m_moveStorageInfo;
// m_moveFinishedTriggers is activated only when the following conditions are met:
// all file rename jobs complete, all file move jobs complete
QQueue<EventTrigger> m_moveFinishedTriggers;
@@ -468,4 +463,6 @@ namespace BitTorrent
};
}
Q_DECLARE_METATYPE(BitTorrent::TorrentState)
#endif // BITTORRENT_TORRENTHANDLE_H

View File

@@ -67,7 +67,7 @@ TorrentInfo TorrentInfo::loadFromFile(const QString &path, QString &error)
TorrentInfo info(NativePtr(new libt::torrent_info(Utils::Fs::toNativePath(path).toStdString(), ec)));
if (ec) {
error = QString::fromUtf8(ec.message().c_str());
qDebug("Cannot load .torrent file: %s", qPrintable(error));
qDebug("Cannot load .torrent file: %s", qUtf8Printable(error));
}
return info;
@@ -308,9 +308,29 @@ int BitTorrent::TorrentInfo::fileIndex(const QString& fileName) const
return -1;
}
bool TorrentInfo::hasRootFolder() const
{
QString testRootFolder;
for (int i = 0; i < filesCount(); ++i) {
const QString filePath = this->filePath(i);
if (QDir::isAbsolutePath(filePath)) continue;
const auto filePathElements = filePath.splitRef('/');
// if at least one file has no root folder, no common root folder exists
if (filePathElements.count() <= 1) return false;
if (testRootFolder.isEmpty())
testRootFolder = filePathElements.at(0).toString();
else if (testRootFolder != filePathElements.at(0))
return false;
}
return true;
}
void TorrentInfo::stripRootFolder()
{
if (filesCount() <= 1) return;
if (!hasRootFolder()) return;
libtorrent::file_storage files = m_nativeInfo->files();

View File

@@ -100,6 +100,8 @@ namespace BitTorrent
PieceRange filePieces(int fileIndex) const;
void renameFile(uint index, const QString &newPath);
bool hasRootFolder() const;
void stripRootFolder();
NativePtr nativeInfo() const;

View File

@@ -1,7 +1,7 @@
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2015 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
@@ -25,16 +25,15 @@
* 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 <vector>
#include <libtorrent/bencode.hpp>
#include <libtorrent/entry.hpp>
#include "base/preferences.h"
#include "base/http/server.h"
#include "base/preferences.h"
#include "base/utils/string.h"
#include "tracker.h"
@@ -109,14 +108,14 @@ Http::Response Tracker::processRequest(const Http::Request &request, const Http:
{
clear(); // clear response
//qDebug("Tracker received the following request:\n%s", qPrintable(parser.toString()));
//qDebug("Tracker received the following request:\n%s", qUtf8Printable(parser.toString()));
// Is request a GET request?
if (request.method != "GET") {
qDebug("Tracker: Unsupported HTTP request: %s", qPrintable(request.method));
qDebug("Tracker: Unsupported HTTP request: %s", qUtf8Printable(request.method));
status(100, "Invalid request type");
}
else if (!request.path.startsWith("/announce", Qt::CaseInsensitive)) {
qDebug("Tracker: Unrecognized path: %s", qPrintable(request.path));
qDebug("Tracker: Unrecognized path: %s", qUtf8Printable(request.path));
status(100, "Invalid request type");
}
else {
@@ -146,7 +145,7 @@ void Tracker::respondToAnnounceRequest()
annonceReq.infoHash = gets.value("info_hash");
// info_hash cannot be longer than 20 bytes
/*if (annonce_req.info_hash.toLatin1().length() > 20) {
qDebug("Tracker: Info_hash is not 20 byte long: %s (%d)", qPrintable(annonce_req.info_hash), annonce_req.info_hash.toLatin1().length());
qDebug("Tracker: Info_hash is not 20 byte long: %s (%d)", qUtf8Printable(annonce_req.info_hash), annonce_req.info_hash.toLatin1().length());
status(150, "Invalid infohash");
return;
}*/
@@ -160,7 +159,7 @@ void Tracker::respondToAnnounceRequest()
annonceReq.peer.peerId = gets.value("peer_id");
// peer_id cannot be longer than 20 bytes
/*if (annonce_req.peer.peer_id.length() > 20) {
qDebug("Tracker: peer_id is not 20 byte long: %s", qPrintable(annonce_req.peer.peer_id));
qDebug("Tracker: peer_id is not 20 byte long: %s", qUtf8Printable(annonce_req.peer.peer_id));
status(151, "Invalid peerid");
return;
}*/
@@ -183,7 +182,7 @@ void Tracker::respondToAnnounceRequest()
annonceReq.event = "";
if (gets.contains("event")) {
annonceReq.event = gets.value("event");
qDebug("Tracker: event is %s", qPrintable(annonceReq.event));
qDebug("Tracker: event is %s", qUtf8Printable(annonceReq.event));
}
// 5. Get numwant

View File

@@ -1,7 +1,7 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2015 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2010 Christophe Dumez
* Copyright (C) 2010 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
@@ -25,17 +25,16 @@
* 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 BITTORRENT_TRACKER_H
#define BITTORRENT_TRACKER_H
#include <QHash>
#include "base/http/types.h"
#include "base/http/responsebuilder.h"
#include "base/http/irequesthandler.h"
#include "base/http/responsebuilder.h"
#include "base/http/types.h"
namespace libtorrent
{
@@ -82,7 +81,7 @@ namespace BitTorrent
Q_DISABLE_COPY(Tracker)
public:
explicit Tracker(QObject *parent = 0);
explicit Tracker(QObject *parent = nullptr);
~Tracker();
bool start();

View File

@@ -12,9 +12,9 @@
#endif
#endif
#include "base/preferences.h"
#include "base/bittorrent/torrentinfo.h"
#include "base/bittorrent/magneturi.h"
#include "base/bittorrent/torrentinfo.h"
#include "base/preferences.h"
#include "filesystemwatcher.h"
#ifndef CIFS_MAGIC_NUMBER
@@ -71,7 +71,7 @@ void FileSystemWatcher::addPath(const QString &path)
// Check if the path points to a network file system or not
if (isNetworkFileSystem(path)) {
// Network mode
qDebug("Network folder detected: %s", qPrintable(path));
qDebug("Network folder detected: %s", qUtf8Printable(path));
qDebug("Using file polling mode instead of inotify...");
m_watchedFolders << dir;
// Set up the watch timer
@@ -84,7 +84,7 @@ void FileSystemWatcher::addPath(const QString &path)
else {
#endif
// Normal mode
qDebug("FS Watching is watching %s in normal mode", qPrintable(path));
qDebug("FS Watching is watching %s in normal mode", qUtf8Printable(path));
QFileSystemWatcher::addPath(path);
scanLocalFolder(path);
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
@@ -111,13 +111,13 @@ void FileSystemWatcher::removePath(const QString &path)
void FileSystemWatcher::scanLocalFolder(QString path)
{
qDebug("scanLocalFolder(%s) called", qPrintable(path));
qDebug("scanLocalFolder(%s) called", qUtf8Printable(path));
QStringList torrents;
// Local folders scan
addTorrentsFromDir(QDir(path), torrents);
// Report detected torrent files
if (!torrents.empty()) {
qDebug("The following files are being reported: %s", qPrintable(torrents.join("\n")));
qDebug("The following files are being reported: %s", qUtf8Printable(torrents.join("\n")));
emit torrentsAdded(torrents);
}
}
@@ -129,12 +129,12 @@ void FileSystemWatcher::scanNetworkFolders()
QStringList torrents;
// Network folders scan
foreach (const QDir &dir, m_watchedFolders) {
//qDebug("FSWatcher: Polling manually folder %s", qPrintable(dir.path()));
//qDebug("FSWatcher: Polling manually folder %s", qUtf8Printable(dir.path()));
addTorrentsFromDir(dir, torrents);
}
// Report detected torrent files
if (!torrents.empty()) {
qDebug("The following files are being reported: %s", qPrintable(torrents.join("\n")));
qDebug("The following files are being reported: %s", qUtf8Printable(torrents.join("\n")));
emit torrentsAdded(torrents);
}
#endif
@@ -201,7 +201,7 @@ void FileSystemWatcher::addTorrentsFromDir(const QDir &dir, QStringList &torrent
torrents << fileAbsPath;
}
else if (!m_partialTorrents.contains(fileAbsPath)) {
qDebug("Partial torrent detected at: %s", qPrintable(fileAbsPath));
qDebug("Partial torrent detected at: %s", qUtf8Printable(fileAbsPath));
qDebug("Delay the file's processing...");
m_partialTorrents.insert(fileAbsPath, 0);
}

View File

@@ -1,12 +1,12 @@
#ifndef FILESYSTEMWATCHER_H
#define FILESYSTEMWATCHER_H
#include <QFileSystemWatcher>
#include <QDir>
#include <QTimer>
#include <QFileSystemWatcher>
#include <QHash>
#include <QPointer>
#include <QStringList>
#include <QHash>
#include <QTimer>
/*
* Subclassing QFileSystemWatcher in order to support Network File
@@ -17,7 +17,7 @@ class FileSystemWatcher : public QFileSystemWatcher
Q_OBJECT
public:
explicit FileSystemWatcher(QObject *parent = 0);
explicit FileSystemWatcher(QObject *parent = nullptr);
~FileSystemWatcher();
QStringList directories() const;

View File

@@ -1,7 +1,7 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2006 Ishan Arora and Christophe Dumez
* Copyright (C) 2006 Ishan Arora and 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
@@ -25,21 +25,20 @@
* 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 "requestparser.h"
#include <QDebug>
#include <QDir>
#include <QStringList>
#include <QUrl>
#include <QUrlQuery>
#include <QDir>
#include <QDebug>
#include "requestparser.h"
const QByteArray EOL("\r\n");
const QByteArray EOH("\r\n\r\n");
inline QString unquoted(const QString& str)
inline QString unquoted(const QString &str)
{
if ((str[0] == '\"') && (str[str.length() - 1] == '\"'))
return str.mid(1, str.length() - 2);
@@ -49,7 +48,7 @@ inline QString unquoted(const QString& str)
using namespace Http;
RequestParser::ErrorCode RequestParser::parse(const QByteArray& data, Request& request, uint maxContentLength)
RequestParser::ErrorCode RequestParser::parse(const QByteArray &data, Request &request, uint maxContentLength)
{
return RequestParser(maxContentLength).parseHttpRequest(data, request);
}
@@ -59,42 +58,42 @@ RequestParser::RequestParser(uint maxContentLength)
{
}
RequestParser::ErrorCode RequestParser::parseHttpRequest(const QByteArray& data, Request& request)
RequestParser::ErrorCode RequestParser::parseHttpRequest(const QByteArray &data, Request &request)
{
m_request = Request();
// Parse HTTP request header
const int header_end = data.indexOf(EOH);
if (header_end < 0) {
const int headerEnd = data.indexOf(EOH);
if (headerEnd < 0) {
qDebug() << Q_FUNC_INFO << "incomplete request";
return IncompleteRequest;
}
if (!parseHttpHeader(data.left(header_end))) {
if (!parseHttpHeader(data.left(headerEnd))) {
qWarning() << Q_FUNC_INFO << "header parsing error";
return BadRequest;
}
// Parse HTTP request message
if (m_request.headers.contains("content-length")) {
int content_length = m_request.headers["content-length"].toInt();
if (content_length < 0) {
qWarning() << Q_FUNC_INFO << "bad request: content-length negative";
int contentLength = m_request.headers["content-length"].toInt();
if (contentLength < 0) {
qWarning() << Q_FUNC_INFO << "bad request: content-length is negative";
return BadRequest;
}
if (content_length > static_cast<int>(m_maxContentLength)) {
if (contentLength > static_cast<int>(m_maxContentLength)) {
qWarning() << Q_FUNC_INFO << "bad request: message too long";
return BadRequest;
}
QByteArray content = data.mid(header_end + EOH.length(), content_length);
if (content.length() < content_length) {
QByteArray content = data.mid(headerEnd + EOH.length(), contentLength);
if (content.length() < contentLength) {
qDebug() << Q_FUNC_INFO << "incomplete request";
return IncompleteRequest;
}
if ((content_length > 0) && !parseContent(content)) {
if ((contentLength > 0) && !parseContent(content)) {
qWarning() << Q_FUNC_INFO << "message parsing error";
return BadRequest;
}
@@ -102,7 +101,7 @@ RequestParser::ErrorCode RequestParser::parseHttpRequest(const QByteArray& data,
// qDebug() << Q_FUNC_INFO;
// qDebug() << "HTTP Request header:";
// qDebug() << data.left(header_end) << "\n";
// qDebug() << data.left(headerEnd) << "\n";
request = m_request;
return NoError;
@@ -132,7 +131,7 @@ bool RequestParser::parseStartingLine(const QString &line)
return false;
}
bool RequestParser::parseHeaderLine(const QString &line, QPair<QString, QString>& out)
bool RequestParser::parseHeaderLine(const QString &line, QPair<QString, QString> &out)
{
int i = line.indexOf(QLatin1Char(':'));
if (i == -1) {
@@ -150,7 +149,7 @@ bool RequestParser::parseHttpHeader(const QByteArray &data)
QStringList lines = str.trimmed().split(EOL);
QStringList headerLines;
foreach (const QString& line, lines) {
foreach (const QString &line, lines) {
if (line[0].isSpace()) { // header line continuation
if (!headerLines.isEmpty()) { // really continuation
headerLines.last() += QLatin1Char(' ');
@@ -181,7 +180,7 @@ bool RequestParser::parseHttpHeader(const QByteArray &data)
return true;
}
QList<QByteArray> RequestParser::splitMultipartData(const QByteArray& data, const QByteArray& boundary)
QList<QByteArray> RequestParser::splitMultipartData(const QByteArray &data, const QByteArray &boundary)
{
QList<QByteArray> ret;
QByteArray sep = boundary + EOL;
@@ -205,7 +204,7 @@ QList<QByteArray> RequestParser::splitMultipartData(const QByteArray& data, cons
return ret;
}
bool RequestParser::parseContent(const QByteArray& data)
bool RequestParser::parseContent(const QByteArray &data)
{
// Parse message content
qDebug() << Q_FUNC_INFO << "Content-Length: " << m_request.headers["content-length"];
@@ -243,14 +242,14 @@ Content-Disposition: form-data; name=\"Upload\"
Submit Query
--cH2ae0GI3KM7GI3Ij5ae0ei4Ij5Ij5--
**/
QString content_type = m_request.headers["content-type"];
if (content_type.startsWith("multipart/form-data")) {
QString contentType = m_request.headers["content-type"];
if (contentType.startsWith("multipart/form-data")) {
const QRegExp boundaryRegexQuoted("boundary=\"([ \\w'()+,-\\./:=\\?]+)\"");
const QRegExp boundaryRegexNotQuoted("boundary=([\\w'()+,-\\./:=\\?]+)");
QByteArray boundary;
if (boundaryRegexQuoted.indexIn(content_type) < 0) {
if (boundaryRegexNotQuoted.indexIn(content_type) < 0) {
if (boundaryRegexQuoted.indexIn(contentType) < 0) {
if (boundaryRegexNotQuoted.indexIn(contentType) < 0) {
qWarning() << "Could not find boundary in multipart/form-data header!";
return false;
}
@@ -274,21 +273,21 @@ Submit Query
return true;
}
qWarning() << Q_FUNC_INFO << "unknown content type:" << qPrintable(content_type);
qWarning() << Q_FUNC_INFO << "unknown content type:" << qPrintable(contentType);
return false;
}
bool RequestParser::parseFormData(const QByteArray& data)
bool RequestParser::parseFormData(const QByteArray &data)
{
// Parse form data header
const int header_end = data.indexOf(EOH);
if (header_end < 0) {
const int headerEnd = data.indexOf(EOH);
if (headerEnd < 0) {
qDebug() << "Invalid form data: \n" << data;
return false;
}
QString header_str = QString::fromUtf8(data.left(header_end));
QStringList lines = header_str.trimmed().split(EOL);
QString headerStr = QString::fromUtf8(data.left(headerEnd));
QStringList lines = headerStr.trimmed().split(EOL);
QStringMap headers;
foreach (const QString& line, lines) {
QPair<QString, QString> header;
@@ -302,7 +301,7 @@ bool RequestParser::parseFormData(const QByteArray& data)
if (!headers.contains("content-disposition")
|| !parseHeaderValue(headers["content-disposition"], disposition)
|| !disposition.contains("name")) {
qDebug() << "Invalid form data header: \n" << header_str;
qDebug() << "Invalid form data header: \n" << headerStr;
return false;
}
@@ -310,18 +309,18 @@ bool RequestParser::parseFormData(const QByteArray& data)
UploadedFile ufile;
ufile.filename = disposition["filename"];
ufile.type = disposition["content-type"];
ufile.data = data.mid(header_end + EOH.length());
ufile.data = data.mid(headerEnd + EOH.length());
m_request.files.append(ufile);
}
else {
m_request.posts[disposition["name"]] = QString::fromUtf8(data.mid(header_end + EOH.length()));
m_request.posts[disposition["name"]] = QString::fromUtf8(data.mid(headerEnd + EOH.length()));
}
return true;
}
bool RequestParser::parseHeaderValue(const QString& value, QStringMap& out)
bool RequestParser::parseHeaderValue(const QString &value, QStringMap &out)
{
int pos = value.indexOf(QLatin1Char(';'));
if (pos == -1) {

View File

@@ -1,7 +1,7 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2006 Ishan Arora and Christophe Dumez
* Copyright (C) 2006 Ishan Arora and 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
@@ -25,8 +25,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 HTTP_REQUESTPARSER_H

View File

@@ -37,7 +37,7 @@ namespace Http
class ResponseBuilder : public QObject
{
public:
explicit ResponseBuilder(QObject *parent = 0);
explicit ResponseBuilder(QObject *parent = nullptr);
protected:
void status(uint code = 200, const QString &text = QLatin1String("OK"));

View File

@@ -1,7 +1,7 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2006 Ishan Arora and Christophe Dumez
* Copyright (C) 2006 Ishan Arora and 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
@@ -25,8 +25,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 "responsegenerator.h"
@@ -69,7 +67,7 @@ QByteArray Http::toByteArray(Response response)
QString Http::httpDate()
{
// [RFC 7231] 7.1.1.1. Date/Time Formats
// example: "Sun, 06 Nov 1994 08:49:37 GMT"
// 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"));

View File

@@ -1,7 +1,7 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2006 Ishan Arora and Christophe Dumez
* Copyright (C) 2006 Ishan Arora and 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
@@ -25,8 +25,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
*/

View File

@@ -34,7 +34,6 @@
#include <QNetworkProxy>
#include <QStringList>
#include <QTimer>
#ifndef QT_NO_OPENSSL
#include <QSslSocket>
#else
@@ -123,15 +122,13 @@ bool Server::setupHttps(const QByteArray &certificates, const QByteArray &key)
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)
{
if (!sslKey.isNull() && areCertsValid) {
m_key = sslKey;
m_certificates = certs;
m_https = true;
return true;
}
else
{
else {
disableHttps();
return false;
}
@@ -164,4 +161,4 @@ QList<QSslCipher> Server::safeCipherList() const
return safeCiphers;
}
#endif
#endif // QT_NO_OPENSSL

View File

@@ -25,8 +25,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
*/
@@ -46,13 +44,13 @@ namespace Http
class IRequestHandler;
class Connection;
class Server: public QTcpServer
class Server : public QTcpServer
{
Q_OBJECT
Q_DISABLE_COPY(Server)
public:
Server(IRequestHandler *requestHandler, QObject *parent = 0);
Server(IRequestHandler *requestHandler, QObject *parent = nullptr);
~Server();
#ifndef QT_NO_OPENSSL
@@ -67,7 +65,7 @@ namespace Http
void incomingConnection(qintptr socketDescriptor);
IRequestHandler *m_requestHandler;
QList<Connection *> m_connections; // for tracking persistence connections
QList<Connection *> m_connections; // for tracking persistent connections
#ifndef QT_NO_OPENSSL
QList<QSslCipher> safeCipherList() const;

View File

@@ -59,6 +59,7 @@ namespace Http
const char CONTENT_TYPE_JSON[] = "application/json";
const char CONTENT_TYPE_PNG[] = "image/png";
const char CONTENT_TYPE_TXT[] = "text/plain; charset=UTF-8";
const char CONTENT_TYPE_SVG[] = "image/svg+xml";
// portability: "\r\n" doesn't guarantee mapping to the correct value
const char CRLF[] = {0x0D, 0x0A, '\0'};

View File

@@ -1,6 +1,6 @@
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2011 Christophe Dumez
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2011 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
@@ -24,8 +24,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 <QDebug>
@@ -34,8 +32,8 @@
#include <QUrlQuery>
#include "base/logger.h"
#include "base/net/downloadmanager.h"
#include "base/net/downloadhandler.h"
#include "base/net/downloadmanager.h"
#include "dnsupdater.h"
using namespace Net;
@@ -143,7 +141,7 @@ QString DNSUpdater::getUpdateUrl() const
Q_ASSERT(!m_lastIP.isNull());
// Service specific
switch(m_service) {
switch (m_service) {
case DNS::DYNDNS:
url.setHost("members.dyndns.org");
break;
@@ -230,7 +228,6 @@ void DNSUpdater::processIPUpdateReply(const QString &reply)
if (code == "abuse") {
logger->addMessage(tr("Dynamic DNS error: Your username was blocked due to abuse."), Log::CRITICAL);
m_state = FATAL;
return;
}
}
@@ -289,7 +286,7 @@ void DNSUpdater::updateCredentials()
QUrl DNSUpdater::getRegistrationUrl(int service)
{
switch(service) {
switch (service) {
case DNS::DYNDNS:
return QUrl("https://www.dyndns.com/account/services/hosts/add.html");
case DNS::NOIP:

View File

@@ -1,6 +1,6 @@
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2011 Christophe Dumez
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2011 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
@@ -24,16 +24,14 @@
* 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 DNSUPDATER_H
#define DNSUPDATER_H
#include <QObject>
#include <QHostAddress>
#include <QDateTime>
#include <QHostAddress>
#include <QObject>
#include <QTimer>
#include "base/preferences.h"
@@ -41,12 +39,12 @@
namespace Net
{
// Based on http://www.dyndns.com/developers/specs/
class DNSUpdater: public QObject
class DNSUpdater : public QObject
{
Q_OBJECT
public:
explicit DNSUpdater(QObject *parent = 0);
explicit DNSUpdater(QObject *parent = nullptr);
~DNSUpdater();
static QUrl getRegistrationUrl(int service);

View File

@@ -27,20 +27,21 @@
* exception statement from your version.
*/
#include <QTemporaryFile>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkProxy>
#include <QNetworkCookie>
#include <QUrl>
#include "downloadhandler.h"
#include <QDebug>
#include <QNetworkAccessManager>
#include <QNetworkCookie>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QTemporaryFile>
#include <QUrl>
#include "base/utils/fs.h"
#include "base/utils/gzip.h"
#include "base/utils/misc.h"
#include "downloadmanager.h"
#include "downloadhandler.h"
static QString errorCodeToString(QNetworkReply::NetworkError status);
@@ -73,11 +74,11 @@ QString DownloadHandler::url() const
void DownloadHandler::processFinishedDownload()
{
QString url = m_reply->url().toString();
qDebug("Download finished: %s", qPrintable(url));
qDebug("Download finished: %s", qUtf8Printable(url));
// Check if the request was successful
if (m_reply->error() != QNetworkReply::NoError) {
// Failure
qDebug("Download failure (%s), reason: %s", qPrintable(url), qPrintable(errorCodeToString(m_reply->error())));
qDebug("Download failure (%s), reason: %s", qUtf8Printable(url), qUtf8Printable(errorCodeToString(m_reply->error())));
emit downloadFailed(m_url, errorCodeToString(m_reply->error()));
this->deleteLater();
}
@@ -150,7 +151,7 @@ bool DownloadHandler::saveToFile(const QByteArray &replyData, QString &filePath)
tmpfile->setAutoRemove(false);
filePath = tmpfile->fileName();
qDebug("Temporary filename is: %s", qPrintable(filePath));
qDebug("Temporary filename is: %s", qUtf8Printable(filePath));
if (m_reply->isOpen() || m_reply->open(QIODevice::ReadOnly)) {
tmpfile->write(replyData);
tmpfile->close();
@@ -174,7 +175,7 @@ void DownloadHandler::handleRedirection(QUrl newUrl)
newUrl = m_reply->url().resolved(newUrl);
const QString newUrlString = newUrl.toString();
qDebug("Redirecting from %s to %s", qPrintable(m_reply->url().toString()), qPrintable(newUrlString));
qDebug("Redirecting from %s to %s", qUtf8Printable(m_reply->url().toString()), qUtf8Printable(newUrlString));
// Redirect to magnet workaround
if (newUrlString.startsWith("magnet:", Qt::CaseInsensitive)) {
@@ -192,14 +193,14 @@ void DownloadHandler::handleRedirection(QUrl newUrl)
m_reply->deleteLater();
m_reply = tmp->m_reply;
init();
tmp->m_reply = 0;
tmp->m_reply = nullptr;
delete tmp;
}
}
QString errorCodeToString(QNetworkReply::NetworkError status)
{
switch(status) {
switch (status) {
case QNetworkReply::HostNotFoundError:
return QObject::tr("The remote host name was not found (invalid hostname)");
case QNetworkReply::OperationCanceledError:

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