Commit Graph

13886 Commits

Author SHA1 Message Date
Charles Kerr 4091f273fa
refactor: prefer tr_variantDictFindStrView() in tests (#2132)
* refactor: prefer string_view in tests
2021-11-12 12:04:55 -06:00
Charles Kerr d1f8c28fcd
refactor: make piece checksums private (#2130)
* refactor: remove tr_info.pieces
2021-11-12 10:42:51 -06:00
Mike Gelfand 82b3da0a54
Don't use deprecated GTK APIs (#2129)
* Don't use deprecated Glib::Thread

* Don't use deprecated stock ID APIs

* Don't use deprecated operator const void* in IconInfo

* Don't use deprecated Gtk::TreeView::set_rules_hint()

* Don't use deprecated Gtk::Widget::set_margin_left()

* Don't use deprecated Gtk::UIManager

* Don't use deprecated sigc::mem_ptr accepting object pointer

* Enable {GDK,GIO,GLIB,GTK,PANGO,SIGCXX}MM deprecation guards

* Enable GTK deprecation guard

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-12 12:12:50 +03:00
Dzmitry Neviadomski 319e1fc6bb
Replace C rand() with uniform_int_distribution and mt19937. (#2089)
Reuse random engine and distribution itself and change only
distribution bounds via lightweight param type.
2021-11-11 13:03:33 -06:00
Dzmitry Neviadomski 53f799ada6
Migrate macOS BlocklistDownloader to NSURLSession. (#2101)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-10 12:55:15 -06:00
Dzmitry Neviadomski 1449ccac49
Migrate deprecated NSWorkspaceRecycleOperation (#2113)
Also make code flow less nested

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-10 12:20:06 -06:00
Charles Kerr 7693ef69bf
refactor: magnet metainfo (#2124)
* refactor: magnet-metainfo
2021-11-09 20:42:18 -06:00
Charles Kerr bdf1bb6d17
refactor: tr_strv*() util functions (#2123)
* feat: add tr_strv utils
2021-11-09 18:13:47 -06:00
Charles Kerr d8b57fe4dc
refactor: web_utils (#2121)
* chore: move web utils from web, utils to web-utils
2021-11-08 21:30:03 -06:00
Daniel Kamil Kozar 5df3505832
Add a "Start Now" action for newly added torrent notifications in the GTK client (#849)
* Add a "Start Now" action for newly added torrent notifications in the GTK client

* Const placement

* Compilation fixes

* post-merge fix

* Morph torrent_start_now into Session::start_now
2021-11-08 20:21:20 +03:00
Charles Kerr 4ecf74081c
refactor: remove tr_ctorSetMetainfoFromHash() (#2116)
* refactor: remove tr_ctorSetMetainfoFromHash()
2021-11-07 20:04:07 -06:00
Charles Kerr af4a953cd1
fixup! refactor: remove tr_piece struct (#2059) (#2115)
yet another fixup of the tr_piece struct removal
2021-11-07 18:25:45 -06:00
Charles Kerr 2bd328c082
fixup! refactor: c++ify torrent ctor (#2098) (#2114)
handle nullptrs in the accessor functions
2021-11-07 17:35:32 -06:00
Mike Gelfand c95616eb26
Bump minimum GTK version to 3.24 (#2112) 2021-11-07 13:08:17 +03:00
Mike Gelfand 17f8122ba2
Add MacStadum and SignPath sponsor links to readme (#2105)
* Add MacStadum and SignPath sponsor links to readme
2021-11-06 01:16:51 -05:00
Charles Kerr bbdb488224
perf: recycle variant tree walking helpers (#2100)
* perf: recycle the helper classes that walk through variant trees
2021-11-05 09:54:44 -05:00
Charles Kerr be22677f10
refactor: prefer string_view over raw char* (#2097) 2021-11-05 01:29:19 -05:00
Charles Kerr 087a804b49
fix: another piece priority fix (#2099)
move initialization to later in torrent construction so that we can correctly check whether the torrent is done or not
2021-11-05 00:06:19 -05:00
Charles Kerr 344ac056c8
refactor: c++ify torrent ctor (#2098)
* refactor: c++ify the torrent-ctor implementation
2021-11-04 22:08:38 -05:00
Charles Kerr 75ce9eae7b
perf: minor perf improvements (#2096)
* perf: use avoid unnecessary strlen when making log messages

* perf: avoid temporary string alloc/free in tr_metainfoAppendSanitizedPathComponent()
2021-11-03 20:36:32 -05:00
Charles Kerr 7724111a8b
refactor: increase use of tr sha1 digest t (#2091)
* refactor: make tr_sha1_digest_t an array of std::byte

* refactor: increase use of tr_sha1_digest_t
2021-11-03 19:55:04 -05:00
Mike Gelfand be74cb6356
Qt 6 support (#2069)
* Bump minimum Qt version to 5.6

* Switch from QRegExp to QRegularExpression

While still available, QRegExp has been moved to Qt6::Core5Compat module
and is not part of Qt6::Core.

* Use qIsEffectiveTLD instead of QUrl::topLevelDomain

The latter is not part of Qt6::Core. The former is a private utility in
Qt6::Network; using it for now, until (and if) we switch to something
non-Qt-specific.

* Use QStyle::State_Horizontal state when drawing progress bars

Although available for a long time, this state either didn't apply to
progress bars before Qt 6, or was deduced based on bar size. With Qt 6,
failing to specify it results in bad rendering.

* Don't use QStringRef (and associated methods)

While still available, QStringRef has been moved to Qt6::Core5Compat
module and is not part of Qt6::Core. Related method (e.g.
QString::midRef) have been removed in Qt 6.

* Use Qt::ItemIsAutoTristate instead of Qt::ItemIsTristate

The latter was deprecated and replaced with the former in Qt 5.6.

* Don't use QApplication::globalStrut

This property has been deprecated in Qt 5.15 and removed in Qt 6.

* Use QImage::fromHICON instead of QtWin::fromHICON

WinExtras module (providind the latter helper) has been removed in Qt 6.

* Use QStringDecoder instead of QTextCodec

While still available, QTextCodec has been moved to Qt6::Core5Compat
module and is not part of Qt6::Core.

* Don't forward-declare QStringList

Instead of being a standalone class, its definition has changed to
QList<QString> template specialization in Qt 6.

* Use explicit (since Qt 6) QFileInfo constructor

* Use QDateTime's {to,from}SecsSinceEpoch instead of {to,from}Time_t

The latter was deprecated in Qt 5.8 and removed in Qt 6.

* Don't use QFuture<>'s operator==

It has been removed in Qt 6. Since the original issue this code was
solving was caused by future reuse, just don't reuse futures and create
new finished ones when necessary.

* Use std::vector<> instead of QVector<>

The latter has been changed to a typedef for QList<>, which might not be
what one wants, and which also changed behavior a bit leading to
compilation errors.

* Don't use + for flags, cast to int explicitly

Operator+ for enum values has been deleted in Qt 6, so using operator|
instead. Then, there's no conversion from QFlags<> to QVariant, so need
to cast to int.

* Support Qt 6 in CMake and for MSI packaging

* Remove extra (empty) CMake variable use when constructing Qt target names

* Simplify logic in tr_qt_add_translation CMake helper

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-04 00:20:11 +03:00
Dzmitry Neviadomski 689063b305
Fix deprecated NSURL to NSString conversion. (#2090)
clang warning:
```
'stringByReplacingPercentEscapesUsingEncoding:' is deprecated: first deprecated in macOS 10.11 - Use -stringByRemovingPercentEncoding instead, which always uses the recommended UTF-8 encoding. [-Wdeprecated-declarations]
```

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-03 10:04:05 -05:00
Charles Kerr 655050ce70
build: enable more .clang-tidy checks (#2088)
* build: add more clang-tidy warnings
2021-11-03 08:59:39 -05:00
Dzmitry Neviadomski 1bf6189526
Migrate Deprecated OSAtomicIncrement32 function. (#2074)
As per clang output:
`warning: 'OSAtomicIncrement32' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_add_explicit(std::memory_order_relaxed) from <atomic> instead`
2021-11-03 01:00:52 -05:00
Dzmitry Neviadomski 25f68ec815
Bump minimum required CMake version to 3.9. (#2063)
Remove old CMake version checks.
2021-11-03 00:13:44 -05:00
Charles Kerr fa2ef23bdc
refactor: fix uninit var warnings in blocklist.cc (#2087) 2021-11-02 22:55:43 -05:00
Charles Kerr 002b45a95c
fixup! refactor: remove tr_piece struct (#2059) (#2086)
perf: discard piece priorities when done downloading
2021-11-02 21:55:33 -05:00
Charles Kerr 9dca5f2086
perf: intern the announcer module's URL strings (#2085)
* perf: intern the announcer module's internal URLs
2021-11-02 18:00:01 -05:00
Charles Kerr 790b0bb2b5
feat: add tr_quark_get_string_view() (#2083) 2021-11-01 20:01:27 -05:00
Charles Kerr e5225ba8a2
refactor: tr_torrentFindFromHashString() takes a std::string_view (#2082)
* refactor: tr_torrentFindFromHashString() takes a string_view
2021-11-01 19:18:09 -05:00
Charles Kerr 5594b16358
refactor: tr_quark_lookup() takes a std::string_view (#2081)
* refactor: tr_quark_lookup takes a std::string_view
2021-11-01 18:29:13 -05:00
Charles Kerr 3a4dd6de95
refactor: add TR_PRIsv and TR_PRIsv_ARG (#2080)
* refactor: add TR_PRIsv, TR_PRIsv_ARG macros

Like PRId64 and similar macros, these new macros are printf() helpers.
They are for passing std::string_views to printf()-like functions.
2021-11-01 17:14:17 -05:00
Charles Kerr ba59060737
feat: new function tr_variantGetStrView() (#2079)
* feat: new method tr_variantGetStrView()

* test: add new variant tests
2021-11-01 16:30:18 -05:00
Charles Kerr feaf12a205
refactor: tr_urlIsValid*() now takes a std::string_view (#2078)
* refactor: tr_urlIsValid*() now take a string_view arg
2021-11-01 15:36:14 -05:00
Charles Kerr da51a17c30
refactor: add util tr_strvstrip() to strip string_views (#2077) 2021-11-01 13:50:53 -05:00
Charles Kerr 3318430455
fix: crash in capitalizing trackername when no trackername (#2076) 2021-11-01 11:31:55 -05:00
Mike Gelfand eaeed301fa
Rename GTK client files to match the classes they contain (#2073)
This also brings naming closer to Qt client which simplifies things a
bit.
2021-11-01 03:11:23 +03:00
Mike Gelfand 63ad19fb5a
Move Application class to a separate file (#2072) 2021-11-01 00:04:31 +03:00
Charles Kerr 484e9ee64e
refactor: add a tr_urlParse() with no heap allocs (#2070) 2021-10-31 13:48:32 -05:00
Charles Kerr cedec74d26
perf: add tr_buildBuf() (#2068)
* refactor: add tr_buildBuf() utility
2021-10-31 11:38:10 -05:00
Dzmitry Neviadomski b8c01a581e
[macos] Replace Deprecated constants. (#2038)
* Replace Deprecated constants pt.1

- `NSOnState` -> `NSControlStateValueOn`
- `NSOffState` -> `NSControlStateValueOff`
- `MSMixedState` -> `NSControlStateValueMixed`

* Replace Deprecated constants pt.2

- `NS(\w+)AlertStyle` -> `NSAlertStyle$1`

* Replace Deprecated constants pt.3

- `NSFileHandlingPanel(\w+)Button` -> `NSModalResponse$1`

* Replace Deprecated constants pt.4

- `NSMouse(Entered|Exited)Mask` -> `NSEventMaskMouse$1`
- `NS(Left|Right)Mouse(Down|Up|Dragged)Mask` -> `NSEventMask$1Mouse$2`
- `NSMouse(Entered|Exited)` -> `NSEventTypeMouse$1`
- `NS(Left|Right)Mouse(Up|Down)` -> `NSEventType$1Mouse$2`

* Replace Deprecated constants pt.5

- `NSComposite(\w+)` -> `NSCompositingOperation$1`

* Replace Deprecated constants pt.6

- `NSAlternateKeyMask` -> `NSEventModifierFlagOption`
- `NSCommandKeyMask` -> `NSEventModifierFlagCommand`

* Replace Deprecated constants pt.7

- `NS(\w+)TextAlignment` -> `NSTextAlignment$1`
- `NSBackgroundStyleDark` -> `NSBackgroundStyleEmphasized`

* Replace Deprecated constants pt.8

- `NSTexturedRoundedBezelStyle` -> `NSBezelStyleTexturedRounded`
- `NSBorderlessWindowMask` -> `NSWindowStyleMaskBorderless`
- `NS(OK|Cancel)Button` -> `NSModalResponse$1`
2021-10-31 10:18:27 -05:00
depler 8cac7d6f94
Update file-win32.cc (#2066)
Fix pointer `return false` after refactoring
2021-10-31 02:15:07 -05:00
Mitch Livingston bbf543a43f
Merge pull request #2060 from nevack/nevack/vdkqueue-objc-warning
Fix clang warning in VDKQueue.m
2021-10-30 13:32:03 -04:00
Mitch Livingston 7ed412e011
Merge branch 'master' into nevack/vdkqueue-objc-warning 2021-10-30 13:31:27 -04:00
Charles Kerr 7c07f4acbb
perf: omit extra std::map in tr_torrentPrimaryMimeType() (#2064) 2021-10-30 11:49:47 -05:00
Dzmitry Neviadomski 85c4a323bb
Add VSCode configs to .gitignore (#2061)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-10-29 23:32:41 -05:00
Charles Kerr 9200d972c3
refactor: use a std::vector for tr_session.removed_torrents (#2062) 2021-10-29 18:49:15 -05:00
Charles Kerr f270d6081c
refactor: cppcoreguidelines-init-variables pt. 15 (#2055)
* refactor: uninit vars in subprocess-posix

* refactor: uninit vars in handshake

* refactor: uninit vars in file-posix

* refactor: uninit vars in platform-quota
2021-10-29 17:43:25 -05:00
Dzmitry Neviadomski cdec576fc9 Fix clang warning in VDKQueue.m
Fix warning `Method override for the designated
initializer of the superclass '-init' not found`
with `NS_UNAVAILABLE` marker.
2021-10-30 01:05:13 +03:00