Commit graph

490 commits

Author SHA1 Message Date
Chocobo1
e3425cfa9e
Defer closing logger instance
So that logger can still be used in shutdown stage.
2022-06-18 17:14:54 +08:00
Chocobo1
af78344e5d
Use coarse timestamp format
Since format in milliseconds doesn't add additional value and is
slower than just seconds.
2022-06-18 17:14:42 +08:00
Chocobo1
61adfea196
Fix garbage text appeared in log file
Fix up fed969ed64.
2022-06-18 04:18:27 +08:00
Chocobo1
fed969ed64
Avoid string encoding conversion
Use UTF-16 string literals to match QTextStream internal buffer
encoding.
2022-06-09 12:24:31 +08:00
Chocobo1
eddeda7bab
Remove usage of QTextStream
Other classes already provide rich methods so avoid another
layer of QTextStream which slow things down (slightly).

PR #17180.
2022-06-09 11:18:41 +08:00
Chocobo1
9cd993d1da
Merge pull request #17116 from Chocobo1/cleanup
Clean up usage of `static` keyword
2022-05-31 12:39:30 +08:00
sledgehammer999
242874e705
Use CMake to update translation files
It uses lupdate directly.
Qt's `qt_add_lupdate()` cmake function doesn't help much.
First of all it is Qt6 only.
Secondly, our project is split into multiple targets but we need all
strings into a single .ts file per language.
Thirdly, it looks like it will skip source files that are added conditionally into the build
via cmake condition checking (eg DBUS source files). We need to gather all strings present
in the source files regardless of the build configuration.

On another note, this is a step towards reducing dependency on qmake/autoconf.
2022-05-29 02:49:57 +03:00
Chocobo1
7eaaa8f92a
Turn static variable into class member 2022-05-27 04:01:37 +08:00
Chocobo1
ca9f5a18d4
Suppress type narrowing warnings 2022-05-27 04:01:34 +08:00
Chocobo1
7c35904062
Use stacktrace dialog when GUI is enabled
PR #17022.
2022-05-13 12:12:36 +08:00
Chocobo1
5c3c6b63ba
Migrate to Boost.Stacktrace
PR #17014.
2022-05-12 11:06:05 +08:00
Chocobo1
002d56d8b3
Fix type mismatch
msys2 was reporting the following error:
```
D:/a/qbittorent_msys2/qbittorent_msys2/src/qBittorrent/src/app/application.cpp: In member function 'void Application::applyMemoryWorkingSetLimit()':
D:/a/qbittorent_msys2/qbittorent_msys2/src/qBittorrent/src/app/application.cpp:777:36: error: no matching function for call to 'min(unsigned int, long unsigned int)'
  777 |     const SIZE_T minSize = std::min((64 * MiB), (maxSize / 2));
      |                            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2022-05-08 16:48:29 +08:00
Chocobo1
21f4676b16
Rename method 2022-05-02 12:35:53 +08:00
Chocobo1
d69e6bb7aa
Move stacktrace dialog to gui folder 2022-05-01 14:24:39 +08:00
Chocobo1
64d8db0c93
Move system signal related functions to its own file
And revise "signal safe print" function.
PR #16953.
2022-05-01 12:32:51 +08:00
Chocobo1
639ed40314
Disable Linux-specific function when compiling for Windows 2022-04-29 13:49:31 +08:00
Chocobo1
c5cbda0bbe
Avoid splitting code over ifdef boundary
By removing unimportant debug message.
2022-04-29 13:49:31 +08:00
Chocobo1
59e37210f3
Use correct type for comparisons
`_write()` actually returns `int` type.

And fix wrong function parameters.

Closes #16938.
Closes #16944.
2022-04-29 13:49:31 +08:00
Chocobo1
bc937d38a2
Allow to set "working set limit" on non-Windows OS
PR #16874.
2022-04-16 11:36:58 +08:00
Chocobo1
a2b85ba1fd
Provide interface for Application class
PR #16864.
2022-04-14 12:04:58 +08:00
Chocobo1
3f762a416d
Use proper method for deferred calls 2022-04-12 16:23:39 +08:00
Chocobo1
a59a6ce8e4
Remove redundant function
This helper function is useless after using `Path` class.
2022-04-11 13:07:53 +08:00
Chocobo1
16bc0531f4
Simplify code 2022-04-05 10:39:23 +08:00
Chocobo1
39c34078d6
Move comparison operator out of class 2022-04-04 16:32:14 +08:00
Chocobo1
9318f05e2b
Merge pull request #16801 from Chocobo1/int
Migrate away from unsigned integer types
2022-04-04 13:13:36 +08:00
sledgehammer999
95f3073e6f
Merge pull request #16745 from sledgehammer999/drop_qt_translations_folder
Drop qt translations folder
2022-04-04 01:56:56 +03:00
Chocobo1
0eb6967bb2
Migrate away from unsigned integer types
Signed integers should be preferred in these cases.
2022-04-03 13:34:29 +08:00
sledgehammer999
f5239ffb0b
CMake: Use installed Qt's translations for packaging 2022-03-29 01:52:23 +03:00
Chocobo1
c6b772da11
Improve function interface
`SettingsStorage` methods require `QString` so make `SettingValue` follow it.
`Path::operator+` can use `QStringView` to accept wider audience.
2022-03-26 12:41:02 +08:00
Chocobo1
4ca6de2b54
Revise string literal usage
PR #16703.
2022-03-26 11:53:50 +08:00
Chocobo1
bbd936fdfa
Don't use explicit memory management
And avoid dangling pointers.
2022-03-24 14:44:38 +08:00
Vladimir Golovnev
c029122a8e
Avoid integer overflow when calculating working set size 2022-03-23 07:56:59 +03:00
Chocobo1
efc04645b7
Use QString literals
It covers src/webui and enables `QT_NO_CAST_FROM_ASCII`.
2022-03-20 13:33:40 +08:00
Chocobo1
f888fb4ac7
Remove unused code 2022-03-19 15:57:37 +08:00
Chocobo1
f0dd7b7dae
Use QString literals
This patch covers src/app and src/base folders.
Follow up of ab64ee872b.
2022-03-11 00:11:30 +08:00
Chocobo1
ab64ee872b
Use QString literals
The plan is to define `QT_NO_CAST_FROM_ASCII` eventually.
PR #16561.
2022-03-04 13:25:22 +08:00
Vladimir Golovnev
299f981441
Allow to limit max memory working set size
PR #16485.
2022-03-01 16:42:25 +03:00
Vladimir Golovnev
dd1bd8ad10
Implement class for handling filesystem paths
PR #15915.
2022-02-08 06:03:48 +03:00
Prince Gupta
96965ae347
CMake: Call UIC on the .ui files manually
Fixes unnecessary recompilation when editing GUI files.

PR #16151.
2022-01-26 14:44:44 +03:00
sledgehammer999
d25be686ee
Merge pull request #16030 from sledgehammer999/migrate_proxy_enum
Migrate proxy settings
2022-01-12 02:51:57 +02:00
sledgehammer999
a7c5826e05
Migrate proxy settings
Q_ENUM_NS(ProxyType) was introduced in 4.4.0.
Before that wrapping QMetaEnum used the int value itself for loading/storing.

Closes #15994
2022-01-11 02:50:03 +02:00
Chocobo1
9f6130cbaa
Move new line character out of translation string
PR #15948.
2022-01-08 12:24:49 +08:00
sledgehammer999
702c79a92f
Don't delete old config keys yet
It will allow users to go back to previous versions without
losing their settings.
2022-01-05 01:01:10 +02:00
sledgehammer999
a27822b557
Correct the order of the migrated settings' mappings 2022-01-04 16:48:17 +02:00
Vladimir Golovnev (Glassez)
fdbf8cb0ee
Correctly concatenate path components 2022-01-03 19:44:47 +03:00
Chocobo1
e7ebbffbfd
Set appropriate migration version number for new installations 2021-12-24 14:50:06 +08:00
Chocobo1
39f054eef6
Migrate "setting key mappings" to upgrade code 2021-12-24 14:50:06 +08:00
Chocobo1
aa3da942cb
Use correct URL scheme when https is enabled
Closes #15844.
PR #15847.
2021-12-17 11:49:11 +08:00
Chocobo1
b8a7ecfe69
Introduce versioning on main configuration file 2021-12-11 01:45:49 +08:00
Chocobo1
cbc2de6b85
Use proper method for checking value existence 2021-12-09 15:57:01 +08:00
Chocobo1
e3fe66d3ec
Store enum type in settings directly
Affected settings will be migrated to new keys so nothing should break.

PR #15800.
2021-12-06 13:53:52 +08:00
Chocobo1
71270260bf
Reformat code 2021-11-08 13:34:21 +08:00
Chocobo1
32698fe0be
Migrate away from low-level SettingsStorage class
Also add `QFlags<T>` support to `SettingsStorage`.
PR #15693.
2021-11-08 13:23:33 +08:00
Chocobo1
a5c531f0a4
Create lock file in config folder instead of temp folder
Some linux distros seem to alter TMPDIR environment variable and
therefore hamper qbt ability to find the lock files. So use config
folder instead of TMPDIR folder to create/locate the lock files.
Note that this change will also make qbt become one instance per-user
instead of one instance per-system.

Closes #15646.
2021-11-01 14:08:49 +08:00
Chocobo1
ca28fc27dc
Disable deprecated Qt functions
Also Qt6 by default set these attributes to our preferred value.
2021-10-13 12:00:21 +08:00
Vladimir Golovnev (Glassez)
86b1ac5d7c
CMake: Allow to build with Qt6 2021-10-02 09:23:49 +03:00
Chocobo1
ecd23d0abd
Merge pull request #15459 from Chocobo1/i18n
Revise description wordings
2021-09-19 13:29:08 +08:00
Chocobo1
46394a7c0f
Combine stream statements 2021-09-18 12:59:08 +08:00
Chocobo1
03012cc175
Revise description wordings 2021-09-18 12:59:07 +08:00
Chocobo1
21f72baae2
Use QSaveFile wherever applicable
expected.hpp was fetched from:
b803e3c07b/include/nonstd/expected.hpp
2021-09-15 21:54:44 +08:00
Chocobo1
81139c0098
Improve error detection when saving files 2021-09-05 12:20:22 +08:00
Chocobo1
11a063ea66
Merge pull request #15242 from Chocobo1/libt_version
Detect incompatible libtorrent v2 versions in build systems
2021-08-04 11:28:07 +08:00
Chocobo1
0a1865d0dd
Don't use old style cast 2021-08-01 13:48:46 +08:00
Chocobo1
49aab492e0
Use spinbox special value to represent "Use any available port"
WebAPI functionality is preserved (deprecated) for now and should be
removed in the future.
2021-07-29 11:50:52 +08:00
Vladimir Golovnev (Glassez)
399d3ad85a
Replace QStringRef with QStringView 2021-07-15 10:56:49 +03:00
Vladimir Golovnev (glassez)
27baa55443
Raise minimum Qt version to 5.15.2 2021-07-09 07:41:13 +03:00
Chocobo1
70d1cb86fd
Disable move constructor where it is sensible 2021-06-29 14:49:45 +08:00
Vladimir Golovnev
37f227ae74
Provide v1 and v2 infohashes in UI (#15097) 2021-06-25 20:44:23 +03:00
Vladimir Golovnev (Glassez)
50ddfea617 Remove lockfile only when last app instance is destroyed 2021-06-18 06:27:33 +03:00
Vladimir Golovnev (Glassez)
97c7f3bc67
Raise minimum Qt version to 5.14 2021-06-03 08:56:41 +03:00
brvphoenix
aebb9f89d1
Remove the lockfile on exit (#14997) 2021-05-23 14:29:41 +08:00
Vladimir Golovnev (Glassez)
2993fdb169
Improve "Watched folders" feature
Make "file system watcher" an application core component
and separate it from its presentation model.
2021-05-19 15:42:41 +03:00
Vladimir Golovnev (Glassez)
9565b695ef
Unify custom exceptions 2021-05-18 08:40:05 +03:00
Chocobo1
fdc186c92f
Revise tag related implementations
Fix #12690.
2021-04-27 11:47:52 +08:00
Nick Korotysh
28ef33b0a0
Improve Info.plist generation with CMake
- drop configure_file() and file(GENERATE) calls
- fill missed MACOSX_DEPLOYMENT_TARGET variable
2021-04-23 20:59:09 +03:00
Nick Korotysh
29e6b229ac
Don't use executable name as CFBundleName value 2021-04-20 01:49:32 +03:00
Chocobo1
a64bb1a990
Simplify natural sort classes interface
Now the comparison function/class should be constructed before usage.
This change also make it easier to plug in into various containers which
will require a compare function type (such as std::set).
2021-04-10 14:18:18 +08:00
Vladimir Golovnev (Glassez)
135cad576c
Don't use removed QApplication attribute 2021-03-27 19:28:00 +03:00
Vladimir Golovnev (Glassez)
561fbf2cca
Don't use removed QTextStream::setCodec()
QTextStream encodes as UTF-8 by default.
2021-03-27 19:25:32 +03:00
Vladimir Golovnev (Glassez)
61d2ff359b
Use QRegularExpression instead of deprecated QRegExp
Now it follows closely the definition of wildcard for glob patterns.
The backslash (\) character is not an escape char in this context.
In order to match one of the special characters, place it in square
brackets (for example, [?]).
2021-03-22 07:50:47 +03:00
Vladimir Golovnev
a8ae97ba91
Merge pull request #14427 from glassez/qt-5.12
Raise minimum Qt version to 5.12
2021-03-14 20:43:39 +03:00
Chocobo1
d74df935f4
Replace parameters in one step
This would avoid the unwanted effect of replacing parameter coming from
another parameter.
2021-03-14 14:03:42 +08:00
Vladimir Golovnev (Glassez)
f022458383
Raise minimum supported Qt version to 5.12 2021-03-13 15:33:58 +03:00
Vladimir Golovnev (Glassez)
561b597031
Improve "info hash" handling
Define "torrent ID" concept, which is either a SHA1 hash for torrents of version 1,
or a SHA256 hash (truncated to SHA1 hash length) for torrents of version 2.
Add support for native libtorrent2 info hashes.
2021-03-12 12:43:14 +03:00
Vladimir Golovnev (Glassez)
166ec74ff9
Look for qbittorrent.pdb in installation directory
Pass application directory as PDB search path in SymInitialize.
Otherwise it searches in application working directory so when you
run qBittorrent with working directory other than its installation
one it can't find qbittorent.pdb file and produces broken stacktrace.
2021-03-07 17:41:51 +03:00
Vladimir Golovnev (Glassez)
8cfd803222
Drop implicit conversions between InfoHash and QString 2021-03-06 12:35:42 +03:00
Michał Kopeć
614376ed64 Add an option to disable icons in menus 2021-02-20 18:12:02 +01:00
Vladimir Golovnev (Glassez)
0b4fef19f6
Remove redundant suffix from TorrentHandle class
Originally, it was just a wrapper for libtorrent::torrent_handle class, so it mimicked its name.
It was then transformed into a more complex aggregate, but the name was retained (just by inertia).
Unlike libtorrent::torrent_handle class in whose name "handle" means the pattern used,
it does not matter for qBittorrent classes and just eats up space in the source code.
2021-01-06 16:28:17 +03:00
Mike Tzou
b79a1b5755
Merge pull request #14145 from Chocobo1/define
Generate version header when configuring project
2021-01-06 11:38:55 +08:00
Vladimir Golovnev (Glassez)
531ae501ad
Use std::optional<bool> instead of custom TriStateBool 2021-01-04 23:10:24 +03:00
Chocobo1
c669401767
Generate version header when configuring project
The basic idea is we create a version header template at
"src/base/version.h.in" and the build systems are expected to replace
strings that are enclosed with @ symbols and generate
"src/base/version.h" for other source files to consume/include.
2021-01-04 22:28:41 +08:00
Chocobo1
be5af2796d
Revise SettingsStorage store/load value interface 2021-01-02 12:48:26 +08:00
Chocobo1
e6cf186c23
Use function-pointer based signal-slot connection 2020-12-31 13:28:48 +08:00
Vladimir Golovnev (Glassez)
1d5dc283fe
Allow to add root folder to torrent content 2020-12-23 13:07:33 +03:00
FranciscoPombal
6152b83405 Use #pragma once instead of include guards 2020-12-12 19:41:32 +00:00
Chocobo1
498da509db
Use Qt provided forward declaration header 2020-12-09 18:21:02 +08:00
Vladimir Golovnev (Glassez)
c41df9ffbd
Improve coding style 2020-11-17 21:02:37 +03:00
Chocobo1
7e258bfe38
Fix typos 2020-10-20 18:56:30 +08:00
FranciscoPombal
776c1f1546 Always use multi-arg arg() overload when possible
Fixed clazy-qstring-arg Clazy warnings
2020-10-07 15:34:26 +01:00
Vladimir Golovnev (Glassez)
3d0543c444
Fix static build with Qt < 5.14 2020-09-28 07:10:49 +03:00