Commit Graph

1977 Commits

Author SHA1 Message Date
Mike Gelfand 57e6b06921
Modernize CMake code (ongoing refactoring) (#4515)
* Use imported CMake target for CURL

* Use imported CMake target for fmtlib

* Use imported CMake target for WideInteger

* Use imported CMake target for FastFloat

* Use imported CMake target for UtfCpp

* Use imported CMake target for Threads

* Use imported CMake target for Iconv

* Use imported CMake target for crypto backend

* Use imported CMake target for GTK

* Use imported CMake target for Qt

* Use imported CMake target for deflate

* Use imported CMake target for libevent

* Use imported CMake target for natpmp

* Use imported CMake target for miniupnpc

* Use imported CMake target for dht

* Use imported CMake target for psl

* Use imported CMake target for libutp

* Use imported CMake target for libb64

* Use include directories from libtransmission target
2023-01-02 16:23:51 +00:00
Mike Gelfand bc380511db
Modernize CMake code (ongoing refactoring) (#4507)
* Reformat CMake code

* Bump minimum CMake version to 3.12

* Add target sources separately via `target_source()`

* Make `tr_win32_app_info()` add target sources on its own

* Don't use `include_directories()`

* Don't use `add_definitions()`

* Limit use of `add_compile_options()`

* Move VDKQueue target declaration to a subdirectory

* Add `tr_disable_source_files_compile()` helper

* Add `tr_target_glib_resources()` helper

* Add `tr_gettext_msgfmt()` helper

* Enable AUTOUIC for Qt client

* Enable AUTORCC for Qt client

* Remove AUTO{MOC,RCC,UIC} source group overrides

* Add `tr_target_idl_files()` helper

* Move source group setup to `tr_qt_add_translation()`

* Add `tr_target_xib_files()` helper

* Prefer `target_sources()` to intermediate variables

* Use explicit visibility versions of `target_*()` commands

* Prefer genexes to conditions in `target_*()` commands

* Add `tr_allow_compile_if()` helper

* Leave only top-level `project()`, remove the rest

* Minor fixups

* Fixup Mac QL plugin install

* Fixup IDE target folders and source groups
2023-01-01 19:49:48 +00:00
Mike Gelfand 192a76b621
Move GTK compatibility definitions into a separate header (#4493)
* Move GTK compatibility macros into a separate header

* Fix Cairo compatibility checks

* Move Glib-namespaced definitions to GtkCompat header

* Remove unused stringify definitions since we're using fmtlib
2022-12-29 02:42:20 +00:00
Mike Gelfand b64b696272
Fix/suppress clang-tidy issues in recently-added code (GTK client) (#4485)
* Fix `readability-convert-member-functions-to-static` clang-tidy issues

* Fix `modernize-use-nodiscard` clang-tidy issues

* Fix `cppcoreguidelines-owning-memory` clang-tidy issues

* Fix `performance-unnecessary-value-param` clang-tidy issues

* Fix `cppcoreguidelines-pro-type-reinterpret-cast` clang-tidy issues

* Fix `bugprone-easily-swappable-parameters` clang-tidy issues

* Fix `readability-named-parameter` clang-tidy issues

* Fix `readability-inconsistent-declaration-parameter-name` clang-tidy issue

* Fix `readability-else-after-return` clang-tidy issues

* Fix `cppcoreguidelines-special-member-functions` clang-tidy issues

* Fix `cppcoreguidelines-pro-type-vararg` clang-tidy issues

* Fix `cppcoreguidelines-pro-type-static-cast-downcast` clang-tidy issues

* Fix `cppcoreguidelines-pro-bounds-pointer-arithmetic` clang-tidy issues
2022-12-28 14:47:53 +00:00
Mike Gelfand a89b181f2c
Include individual headers (GTK client) (#4477)
This results in up to 15% single-threaded build time reduction.
2022-12-27 01:43:20 +00:00
Mike Gelfand 5fd0aff818
Automatically (re)order include directives (GTK client) (#4475)
* Automatically (re)order include directives (GTK client)

Include our headers first to ease IWYU enforcement.

* Fix includes missing from headers (GTK client)

* Fix build on Mac after includes reordering
2022-12-26 21:13:21 +00:00
Mike Gelfand 32531fe5ef
Use `Gio::List{Model,Store}` for torrents (#4430)
* Use `Gio::List{Model,Store}` for torrents

Switch from `Gtk::{TreeModel,ListStore}` in preparation for cell
renderers deprecation in GTK 4.10. That will require switching to the
new view classes (`Gtk::{Column,List}View`) which only work with `Gio`
models. Implement an adapter to support GTK+ 3 where the old view class
(`Gtk::TreeView`) only works with `Gtk` models; it is effective enough
but requires a signal connection per item to notify on row changes.

Refactor filtering and sorting (which now happen over the new model) to
use compatible `Gtk::Filter` and `Gtk::Sorter` classes. Although these
classes are only present in GTK 4, the abstraction is suitable for GTK+
3 as well so make our subclasses work for both versions.

Since items (of `Torrent` class) of the new model provide only a very
limited (by design) layer of compatibility with GTK+ 3 way of doing
things, refactor selection handling to do it the new way. Move selection
helpers into `MainWindow` to abstract them away since new view classes
handle it differently.

* Improve session load performance based on profiling results
2022-12-21 21:26:25 +00:00
Charles Kerr e17da3e19e
refactor: xunused (#4416)
* chore: remove unused function gtr_combo_box_new_enum()

* chore: remove unused function gtr_priority_combo_new()

* chore: remove unused function tr_logLevelToKey()

* refactor: remove unused tr_sessionGetDeleteSource()

* refactor: remove unused peer_atom::isValid()
2022-12-20 18:48:36 -06:00
Mike Gelfand e694c3e3a0
Use C++ (not C) warning flags for GTK client (#4395)
Use the opportunity to reduce duplication.
2022-12-18 01:02:03 +00:00
Mike Gelfand 6d495fbf98
Don't use message dialog to display blocklist update status (#4392)
Make it behave [almost] the same way port test works: display update
status and final result in the label below the URL entry. The only
difference is that label returns to its usual mode showing total number
of rules after a while once update is finished; could probably have
done it differently but decided against it to avoid affecting
translations.
2022-12-17 23:12:25 +00:00
Mike Gelfand 4c5b180f5a
Make preferences dialog non-modal (#4391)
This regressed with the switch to `Gtk::Builder` because the dialog was
non-modal before.

This is the cause of the issue with blocklist update status dialog: it
seems that if there's a modal dialog running, showing another non-modal
dialog will make it inaccessible to the user until the first dialog is
closed thus leaving the modal mode.
2022-12-17 21:07:07 +00:00
Mike Gelfand 67c4e4081c
Add `ENABLE_WERROR` option for use on CI (#4381)
Defaults to `OFF`. Downstream packagers are advised against enabling it
as we can't guarantee it working on every possible configuration.

Added the actual compile flag in the GTK client subdirectory and not
the top-level CMakeLists.txt file due to other subprojects not being
ready.

Fixed the only GTK client warning reported by Clang on Mac.
2022-12-16 22:38:30 +00:00
Mike Gelfand 0824c2da6d
Disconnect some more signals on widgets destruction (#4379)
This is applicable to any signals where emitter's lifetime isn't
controlled by the receiver.

There're still about 7 `Glib::signal_idle()` connections which aren't
tracked but I see the possibility of it leading to major issues as quite
low.
2022-12-16 17:40:28 +00:00
Mike Gelfand 3354634605
Improve error handling upon watch directory setup (#4355)
Failing to handle the exception may lead to a critical log message
(minor) and a crash during startup (major).
2022-12-12 17:12:30 +00:00
Mike Gelfand d2e0ca48a1
Simplify `PrefsDialog`'s `PageBase` further by passing builder via ctor (#4354) 2022-12-12 15:00:33 +00:00
Mike Gelfand f58c238d4a
Show "Enable uTP" checkbox in preferences if supported (GTK client) (#4349)
Broken with switch to CMake. Ideally, need an API/RPC method to request
core capabilities to support remote sessions.
2022-12-11 21:58:17 +00:00
Mike Gelfand 0e193a0cb3
Simplify widget initialization in preferences dialog (#4306) 2022-12-03 00:20:33 +00:00
Charles Kerr c4b290586e
fixup! refactor: GTK favicon lookup improvements (#4278) (#4286) 2022-11-30 14:51:38 -06:00
Charles Kerr 22d12aedc5
refactor: GTK favicon lookup improvements (#4278) 2022-11-29 18:09:32 -06:00
Charles Kerr e0a44a1e5d
refactor: remove references to FD_SETSIZE (#4263) 2022-11-28 14:36:39 -06:00
Charles Kerr ec6cb67c5c
fix GTK client message log window does not restore level selection (#4242)
* fix: save log level, encryption mod, preallocation mode as ints

* fix: ensure log level is saved in tr_sessionGetSettings()

* fix: ensure the right verbosity row is selected
2022-11-26 07:32:51 -06:00
Charles Kerr 554ba06ae2
fix: coverity warnings, sonarcloud code smells (#4232) 2022-11-24 10:17:02 -06:00
Charles Kerr 19bc15523f
fix: new sonarcloud, coverity, gcc warnings (#4229) 2022-11-23 13:47:04 -06:00
Charles Kerr 6cd6f78a9f
fix: eta display in GTK client details dialog (#4227) 2022-11-23 09:14:05 -06:00
Mike Gelfand 812588100d
Calculate percent done in range 0..100 instead of 0..1 (GTK client) (#4191) 2022-11-16 10:14:09 +00:00
Mike Gelfand ac6010557e
Fix issues reported by clang-tidy `bugprone` checks (GTK client) (#4183)
* Fix `bugprone-unchecked-optional-access` clang-tidy issues

* Fix `bugprone-easily-swappable-parameters` clang-tidy issues

* Extend clang-tidy configuration
2022-11-15 19:30:32 +00:00
Mike Gelfand 2bd6c8aff4
Fix issues reported by clang-tidy `cert` checks (GTK client) (#4174)
* Fix `cert-err33-c` clang-tidy issues

* Fix `cert-str34-c` clang-tidy issues

* Fold free-standing functions into `FilterBar::Impl`

This is in preparation to next commit fixing `cert-err58-cpp`.

* Fix `cert-err58-cpp` clang-tidy issues

* Extend clang-tidy configuration
2022-11-15 00:53:12 +00:00
Mike Gelfand 1d9159fffc
Fix incorrect selection behavior when building against GTK 4 (#4168)
View-relative coordinates were treated as bin window-relative, leading to
incorrect selected item calculation.

Broken since the introduction of GTK 4 support in #3916.
2022-11-14 18:27:15 +00:00
Mike Gelfand f8d981349e
Fix issues reported by clang-tidy `misc` checks (GTK client) (#4167)
* Fix `misc-const-correctness` clang-tidy issues

* Fix `misc-no-recursion` clang-tidy issues

* Extend clang-tidy configuration
2022-11-14 16:22:38 +00:00
Mike Gelfand fd9c454c45
Fix issues reported by clang-tidy `performance` checks (GTK client) (#4160)
* Fix `performance-move-const-arg` clang-tidy issues

* Fix `performance-no-automatic-move` clang-tidy issues

* Extend clang-tidy configuration
2022-11-13 20:50:07 +00:00
Mike Gelfand 49ce12ce38
Fix issues reported by clang-tidy `cppcoreguidelines` checks (GTK client) (#4158)
* Fix `cppcoreguidelines-pro-type-cstyle-cast` clang-tidy issues

* Fix `cppcoreguidelines-pro-type-member-init` clang-tidy issues

* Fix `cppcoreguidelines-prefer-member-initializer` clang-tidy issues

* Introduce `PageBase` for `PrefsDialog` pages

This is in preparation for next PR fixing `Glib::Timer` memory
management.

* Fix `cppcoreguidelines-owning-memory` clang-tidy issues

* Fix `cppcoreguidelines-pro-bounds-array-to-pointer-decay` clang-tidy issues

* Fix `cppcoreguidelines-special-member-functions` clang-tidy issues

* Fix `cppcoreguidelines-init-variables` clang-tidy issues

* Fix `cppcoreguidelines-macro-usage` clang-tidy issues

* Fix `cppcoreguidelines-pro-bounds-constant-array-index` clang-tidy issues

* Fix `cppcoreguidelines-non-private-member-variables-in-classes` clang-tidy issues

* Fix `cppcoreguidelines-pro-type-vararg` clang-tidy issues

* Fix `cppcoreguidelines-pro-bounds-pointer-arithmetic` clang-tidy issue

* Fix `cppcoreguidelines-pro-type-reinterpret-cast` clang-tidy issues

* Fix `cppcoreguidelines-pro-type-static-cast-downcast` clang-tidy issues

* Extend clang-tidy configuration

Enable all `cppcoreguidelines` checks except for three (`avoid-magic-
numbers`, `avoid-non-const-global-variables`, `narrowing-conversions`)
which require [more] extensive refactoring and were left for later.
2022-11-13 17:36:16 +00:00
Mike Gelfand 43acd7e3e4
Remove Xcode project in favor of CMake (#4147)
* Compile images into an assets catalog

* Optionally sign resulting Mac bundle

* Move 3rd-party/utility/test targets to their own folders

* Enable ARC via compile options unconditionally

* Install base and localized resources into correct directory

This seems like a Xcode quirk: if subdirectory containing the resource file
matches the destination directory name (and probably if there's more than one
resource file being installed there), the resulting folder structure then
contains an extra subdirectory, i.e. Resources/dirname/dirname/resname.

* Group source files for better structure in IDEs (Xcode, VS)

* Remove Xcode project

Using Xcode is still possible via "Xcode" CMake generator.

* Use ad-hoc signature if one is not specified

* Always use ad-hoc signature on link, leave proper signing to CPack

* Install localized resources into correct directory (QL plugin)

* Don't include CTest (we don't use additional targets it provides)

* Revert "Remove Xcode project"

This reverts commit dc069f654f.
2022-11-12 20:01:57 +00:00
Mike Gelfand 92b74fee74
Fix issues reported by clang-tidy `modernize` checks (GTK client) (#4137)
* Fix `modernize-avoid-c-arrays` clang-tidy issues

* Fix `modernize-raw-string-literal` clang-tidy issues

* Fix `modernize-use-nodiscard` clang-tidy issues

* Fix `modernize-deprecated-headers` clang-tidy issues

* Fix `modernize-pass-by-value` clang-tidy issues

* Extend clang-tidy configuration

Enable all `modernize` checks except for one (use-trailing-return-type)
which is an extensive stylistic change for later.
2022-11-10 20:35:31 +01:00
Mike Gelfand 1e32e44f60
Bind sensitivity properties in .ui files (#4128) 2022-11-09 20:46:23 +00:00
Mike Gelfand eec93de5ca
Fix issues reported by clang-tidy `readability` checks (GTK client) (#4127)
* Fix `readability-container-data-pointer` clang-tidy issues

* Fix `readability-container-size-empty` clang-tidy issues

* Fix `readability-isolate-declaration` clang-tidy issues

* Fix `readability-convert-member-functions-to-static` clang-tidy issues

* Fix `readability-else-after-return` clang-tidy issues

* Fix `readability-redundant-member-init` clang-tidy issues

* Fix `readability-uppercase-literal-suffix` clang-tidy issues

* Fix `readability-make-member-function-const` clang-tidy issues

* Fix `readability-simplify-boolean-expr` clang-tidy issues

* Fix `readability-qualified-auto` clang-tidy issues

* Fix `readability-avoid-const-params-in-decls` clang-tidy issues

* Fix `readability-implicit-bool-conversion` clang-tidy issues

* Fix `readability-inconsistent-declaration-parameter-name` clang-tidy issues

* Add initial .clang-tidy configuration

Currently enabling readability checks only, others to follow. Of the
four disabled readability checks, three (function-cognitive-complexity,
identifier-length, magic-numbers) require extensive refactoring and were
left for later, and one (redundant-access-specifiers) is not planned to
be fixed due to the current coding style - using extra sections to
separate methods from variables of the same visibility.
2022-11-09 16:58:36 +00:00
Mike Gelfand f9abbaca70
Adjust `Gio::File::query_info()` error handling (GTK client) (#4079)
The method never returns `nullptr`, but instead throws if an error
occurs. This regressed during the switch from GTK to GTKMM.
2022-11-02 17:17:29 +00:00
Charles Kerr 210bb03f2f
fix: recent signed-unsigned comparison warnings (#4034) 2022-10-26 11:20:10 -05:00
A Cœur 12e564096b
fix: "Implicit conversion loses integer precision" warnings (#3960) 2022-10-25 11:14:42 -05:00
Charles Kerr 798e873b87
fix: sonarcloud warnings (#4023) 2022-10-24 22:13:09 -05:00
Mike Gelfand 70f623f32b
Add user data parameter for torrent removal callback (#4009) 2022-10-23 11:51:35 -05:00
Mike Gelfand f0a0b855c6
Reload files list in details dialog, unless already loaded (GTK client) (#4004) 2022-10-22 10:42:38 +01:00
Mike Gelfand da27c3d18d
Prefer ayatana-appindicator over appindicator, if present (#4001) 2022-10-20 18:15:13 +01:00
Mike Gelfand 5564d9eb46
Catch dbus exceptions in async callbacks on completion (GTK client) (#3997)
GLIBMM will catch them for us, but in two cases print a warning instead
of suppressing, and in one other case still print a warning (as well as
we do) but without context.
2022-10-19 16:27:07 -05:00
Mike Gelfand f22ce40c72
Change progress bar color depending on torrent state (GTK client) (#3976)
* Rename `context` to `snapshot` in `TorrentCellRenderer`

* Change progress bar color depending on torrent state
2022-10-19 00:17:54 +01:00
Mike Gelfand 1b416962e6
Increase message log window width, disable overflow menu (GTK client) (#3971)
* Disable GTK 3 toolbars overflow menu

This prevents the toolbar from hiding its items when they don't fit. Not
an issue with GTK 4 where there's no dedicated toolbar widget and
associated logic.

* Increase default message log window width
2022-10-16 19:31:02 +03:00
Mike Gelfand ae2dd5eba9
Use fmt for string formatting (GTK client) (#3967) 2022-10-15 19:13:50 +03:00
Mike Gelfand 9ccaffb044
Fix session use after free (GTK client) (#3963)
In GLIB 2.68+ `Glib::RefPtr<>` is an alias for `std::shared_ptr<>` which
has no idea about GLIB's reference counting, thus destroying the object
instead of unreferencing it. Use `Glib::make_refptr_for_instance()` to
construct the smart pointer which passes in a custom reference-aware
deleter for us.

Fixes: #3954
2022-10-14 07:59:38 +03:00
Mike Gelfand 02cbfa917a
Don't scroll to message log bottom with no messages (GTK client) (#3959)
Fixes: #3956
2022-10-14 02:19:37 +03:00
Mike Gelfand 60340387e2
Make torrents context menu look more like one (GTK client) (#3957) 2022-10-13 19:18:33 +03:00
A Cœur 4ea9c87fea
fix: some typos (#3904) 2022-10-13 09:35:10 -05:00