Commit Graph

75 Commits

Author SHA1 Message Date
Charles Kerr 7c11809672
fix: more clang-tidy warnings (#6608)
* fix: readability-redundant-casting warnings in gtk

* fix: bugprone-move-forwarding-reference warnings in gtk

* fix: readability-redundant-casting warnings in qt

* fix: bugprone-switch-missing-default-case warnings in qt

* fix: readability-use-std-min-max warning in qt client

* fix: readability-static-accessed-through-instance warning in qt client

* fix: cppcoreguidelines-avoid-const-or-ref-data-members warning in qt client

* fix: readability-avoid-nested-conditional-operator warning in qt client

* fixup! fix: readability-use-std-min-max warning in qt client

* fix: readability-redundant-member-init warnings in gtk client

* fix: performance-avoid-endl warnings in gtk client

* chore: disable readability-qualified-auto

too many false warnings

* chore: disable cppcoreguidelines-avoid-const-or-ref-data-members

* chore: fix readability-duplicate-include warning in gtk client

* chore: fix modernize-use-nodiscard warning in gtk client

* chore: fix readability-convert-member-functions-to-static warning in gtk client

* fixup! fix: bugprone-move-forwarding-reference warnings in gtk

* chore: fix performance-enum-size warning in gtk client

* fix: cppcoreguidelines-prefer-member-initializer warning in gtk client

* fix: readability-identifier-naming warning in qt client

* Revert "chore: fix performance-enum-size warning in gtk client"

This reverts commit 5ce6b562f8.

* fix: readability-redundant-member-init warning in move tests

* fix: readability-redundant-casting warnings in tests

* fixup! fix: readability-identifier-naming warning in qt client

* fixup! fix: readability-avoid-nested-conditional-operator warning in qt client

* fix: readability-static-accessed-through-instance warning in qt client

* fix: readability-redundant-casting warning in watchdir tests
2024-02-17 13:31:49 -06:00
Charles Kerr 3f6969217c
chore: remove FMT_STRING macros (#6497) 2024-01-06 14:05:18 -06:00
Charles Kerr 22cde5d4b9
refactor: use new tr_variant API in rpcimpl (#6456)
* refactor: tr_rpc_request_exec_json takes a std::function callback

* refactor: tr_rpc_request_exec_json callback takes a tr_variant&&

* refactor: use new tr_variant API in rpcimpl.cc

* refactor: tr_rpc_request_exec_json() now takes a const& to the request

* fixup! refactor: use new tr_variant API in rpcimpl.cc

* chore: rename function to tr_rpc_request_exec()

* chore: remove unused DetailsDialog::Impl::build_torrent_ids_variant_list()

* refactor: minor copyediting in rpcimpl.cc getTorrents()

* refactor: split handler methods between sync, async

* refactor: remove unused args_out param from AsyncHandlers

* chore: fix new readability-inconsistent-declaration-parameter-name warning
2024-01-02 22:14:43 -06:00
Charles Kerr 76521a1751
refactor: Values pt. 7 - remove tr_formatter_init methods (#6258)
* refactor: initialize libtransmission::Values units in Application::initUnits()

* refactor: use libtransmission::Values instead of Formatter::unitStr()

* refactor: remove Formatter::Size, Formatter:Type

* refactor: use Values::Config to init units in transmission-qt

* refactor: use Values::Config to init units in transmission-mac

* chore: remove unused tr_formatter_foo_init() functions

* chore: make Value::operator+() const

* use Values::Speed, Values::Storage in GTK client

* chore: use snake_case for Formatter methods

* refactor: use Values::Speed in GTK client details dialog

* feat: add Values::Value::is_zero()

* refactor: remove unnecessary UTF8String calls
2023-11-15 22:15:40 -06:00
Charles Kerr 07d96036d9
refactor: Values pt. 6 - remove deprecated API (#6250) 2023-11-14 17:23:51 -06:00
Julien 8ac323d5d6
chore: removed copyright timespans in headers (#4850) 2023-11-01 16:11:11 -05:00
Charles Kerr 917c00e477
refactor: remove tr_torrentStatCached() (#6066) 2023-10-02 14:07:28 -05:00
Charles Kerr 5837603b6f
refactor: make tr_variant follow RAII (#5923) 2023-08-20 23:15:23 -05:00
Mike Gelfand 586cff9506
Switch to list view for torrents list (GTK 4) (#5858)
* Add compat operator* for RefPtr

* Rename `*_tree_view_*` button handling helpers to `*_item_view_*`

* Move torrent item colors to CSS

* Switch to list view for torrents list (GTK 4)

* Bump Fedora image to 39 (current rawhide) for GTK 4.11

Enable deprecations as there're lots of them in 4.11 and I'm not keen on
fixing them all right now. Disable warnings as errors due to
-Warray-bounds issue somewhere in libfmt.
2023-08-06 04:26:29 +01:00
Rafe S 9b0be18cb5
fix: missing #include in DetailsDialog.cc (#5737) 2023-07-07 10:22:27 -05:00
Charles Kerr 8183d7fddf
refactor: utils naming (#5696)
* chore: rename tr_strvContains to tr_strv_contains

* chore: rename tr_strvStartsWith to tr_strv_starts_with

* chore: rename tr_strvEndsWith to tr_strv_ends_with

* chore: rename tr_strvSep to tr_strv_sep

* chore: rename tr_strvStrip to tr_strv_strip

* chore: rename tr_strvToBuf to tr_strv_to_buf

* refactor: rename tr_saveFile() to tr_file_save()

rename tr_loadFile() to tr_file_read()

rename tr_moveFile() to tr_file_move()

* refactor: rename tr_parseNum() to tr_num_parse()

refactor: rename tr_parseNumRange() to tr_num_parse_range()

* chore: group related functions together in header
2023-06-30 09:49:58 -05:00
Charles Kerr c61d8b7cf7
refactor: rename tr_tracker_view.host to .host_and_port for clarity (#5508) 2023-05-08 20:28:10 -05:00
Charles Kerr 1b6b85989c
feat: add generic favicon_cache class for reuse between Qt, GTK app (#5294) 2023-04-22 21:11:16 -05:00
Charles Kerr 7d86d67bc7
chore: prefer fmt/core.h over fmt/format.h (#5404) 2023-04-16 15:34:19 -05:00
Charles Kerr affb69e395
fix: awkward grammar in details dialog running-time display (#4898) 2023-02-15 06:19:57 -06:00
Mike Gelfand 25b50a7dff
fix: adjust `Glib::ustring` creation in a few places (#4859)
From what I observed, ctor accepting `(begin, end)` is getting called
instead of one accepting `(data, size)` for no apparent reason in some
cases. Switch to a ctor accepting a `std::string` in those problematic
places.
2023-02-13 11:16:15 -06:00
Julien 4b8cfa2e57
chore: update copyrights to 2023 (#4834) 2023-02-11 14:49:42 -06:00
Mike Gelfand bd72b8c3fc
Fix clang-tidy issues stemming from header files (GTK client) (#4623)
* Fix `readability-avoid-const-params-in-decls` clang-tidy issues

* Fix `bugprone-macro-parentheses` clang-tidy issues

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

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

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

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

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

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

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

* Add headers filter for /gtk/ subdirectory
2023-01-21 12:06:20 +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 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 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
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 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 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 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 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
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
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 c75c6bf5c8
Add support for GTK 4 (#3916)
* Make compact mode switch work for both GTK 3 and 4

* Implement GTK 4-specific view gesture handling

* Fix torrents view context menu on GTK 4

* Explicitly show/hide menubar on startup/teardown

* Switch from `Gtk::Pixbuf` to `Gio::Icon` for views

* Support GTK 4 exceptions based on `std::exception`

* Fix options menu setup with GTK 4

* Use `delete-event` (GTK 3) and `close-request` (GTK 4) signals to handle window clousure

* Add custom file chooser button implementation

GTK 4 drops FileChooserButton widget and suggests implementing it using
Button.

* Add helpers to set X11 hints with GTK 4

* Remove `HigWorkarea` class that's no longer used

* Make main menu shortcuts work with GTK 4

* Make drops work in main window and make dialog with GTK 4

* Remove unused `gtr_action_get_widget()` helper

* Fix text direction mark setup with GTK 4 (due to switch to enum class)

* Fix file tree font size calculation with GTK 4

* Fix crash during shutdown with GTK 4

* Switch from `RadioButton` to `CheckButton` for compatibility with GTK 4

* Fix opening files with GTK 4

* Rework torrent cell renderer to support both GTK 3 and 4

* Disable system tray icon support with GTK 4

* Fix windows positioning with GTK 4

* Fix focus event handling with GTK 4

* Adapt to tree model row/iterator changes in GTK 4

* Adapt to toplevel/root window changes in GTK 4

* Adapt to clipboard changes in GTK 4

* Adapt to icon/theme changes in GTK 4

* Adapt to file/path changes in GTK 4

* Random leftover fixes for GTK 4 compatibility

* Clean up unused code

* Move GTK 3 *.ui files into a subdirectory

* Add GTK 4 *.ui files

* Search for both GTK 3 and 4 during configuration
2022-10-09 01:50:03 +03:00
Mike Gelfand aeaa6ca52f
Don't show duplicate add/edit tracker error dialogs (#3898)
Since we're already overriding `on_response()`, there's no point in
connecting `signal_response` to it, making it being called twice.

Broken-by: #3781
2022-10-07 15:09:48 -05:00
Mike Gelfand 3c8d8488ea
Run GTK dialogs in non-blocking fashion (#3805)
GTK 4 drops blocking `run()` method for dialogs. Switch to non-blocking
`show()` to support both GTK 3 and 4.
2022-09-10 21:15:01 +03:00
Mike Gelfand 9f0fbb38ec
Support change to enum definitions in gtkmm/glibmm/pangomm (#3801)
Newer versions (gtkmm 4 and its dependencies) of these libraries have
switched from enums to enum classes. Wrap the names with macros to
support both.
2022-09-10 16:19:54 +03:00
Dmitry Antipov ad125edea9
fix Wsuggest-override clang-16 warnings (#3795) 2022-09-09 07:34:28 -05:00
Mike Gelfand b41501eeb8
Switch to Gtk::Builder for all UI in GTK client (#3781)
* Move CSS definitions to resources

* Add Gtk::Builder helpers

* Switch StatsDialog to Gtk::Builder

* Switch RelocateDialog to Gtk::Builder

* Switch OptionsDialog to Gtk::Builder

* Switch MakeDialog to Gtk::Builder

* Switch FilterBar to Gtk::Builder

* Switch MainWindow to Gtk::Builder

* Switch MessageLogWindow to Gtk::Builder

* Switch DetailsDialog to Gtk::Builder

* Switch PrefsDialog to Gtk::Builder

* Fixup translatable strings

Since this branch was brewing for a while, changes happened in the meantime.
2022-09-08 01:25:04 +03:00
Charles Kerr bfec98c323
refactor: avoid tr_new() in transmission-remote (#3665) 2022-08-17 20:25:42 -05:00
Charles Kerr 29f57bc296
chore: iwyu headers (#3661) 2022-08-17 11:08:36 -05:00
Charles Kerr e49747ab51
feat: add tr_strvToBuf() (#3657)
* feat: add tr_getDefaultConfigDirToBuf()

* feat: add tr_getDefaultDownloadDirToBuf()

* feat: add tr_strvToBuf()

* feat: add tr_torrentFindFileToBuf()

* feat: add tr_torrentGetMagnetLinkToBuf()

* refactor: remove unused makeString() from tests

* feat: add tr_torrentFilenameToBuf()

* feat: add tr_torrentGetTrackerListToBuf()

* chore: remove obsolete comment references to tr_free

* chore: remove unused tr_strdup()

* chore: remove unused forward declarations
2022-08-16 19:28:57 -05:00
Charles Kerr 88a3149ce4
refactor: add tr_peer.activeReqCount() (#3373)
rename peer_stats.pendingReqs to .activeReqs for consistency
2022-06-28 20:48:39 -05:00
Charles Kerr 25fdb5805c
refactor: use tr_torrent_id_t (#3314)
* refactor: use semantic type tr_torrent_type_t in libtransmission

* refactor: use semantic type tr_torrent_type_t in gtk client

* refactor: use semantic type tr_torrent_type_t in qt client
2022-06-17 10:43:04 -05:00
Charles Kerr b85edf8d0f
fix: add i18n options for past tense, future tense time (#3245) 2022-06-14 21:56:27 -05:00
Balázs Meskó 0df6c23c7b
fix: mark non-c-strings for gettext i18n (#3210) 2022-06-08 01:04:17 -05:00
orbital-mango 0f29958751
Show torrent added date/time in details dialog (GTK). (#3124)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-05-23 11:09:21 -05:00
Charles Kerr 1ebac744a5
build: re-enable cert-err33-c clang-tidy warning (#2968)
* refactor: re-enable cert-err33-c clang-tidy warning

* refactor: use fmt::chrono in transmission-remote

* refactor: use fmt::chrono in transmission-show

* refactor: use fmt::chrono in GTK details dialog

* refactor: use fmt::chrono in tr_session

* refactor: remove tr_localtime_r

* refactor: remove tr_gmtime_r
2022-04-22 14:56:54 -05:00
Charles Kerr f4bb09428b
fixup: more libfmt usage regressions (#2924) 2022-04-15 19:56:16 -05:00
Charles Kerr ffda5bb68a
refactor: remove tr_strip_positional_args() (#2881)
* refactor: use fmt in gtk/SystemIconTray

* refactor: use fmt in gtk/MakeDialog

* refactor: remove unused tr_strip_positional_args()

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-04-07 08:23:04 -05:00
Charles Kerr 76f44b4b6f
fix: sonarcloud (#2868)
* refactor: make this variable const

* refactor: replace redundant type with auto

* refactor: use the nullptr literal

* refactor: replace declaration by structured binding declaration
2022-04-02 17:42:51 -05:00
Charles Kerr a250690f30
fix: sonarcloud (#2860)
* fix: break will never be executed

* fix: rewrite rimraf() to be non-throwing

* fix: conditional operation returns same value whether condition is true or false

* fix: use std::array instead of a C-style array

* fix: remove redundant access specifier

* fix: replace switch with if for readability

* fix: convert integer literal to a bool literal

* fix: replace const std::string reference to std::string_view

* fix: remove redundant access specifier

* fix: replace const std::string reference to std::string_view

* fix: remove unused parameter

* fix: remove redundant access specifier

* fix: use std::array instead of C-style array

* fix: remove redundant access specifier

* fix: replace const std::string reference with std::string_view

* fix: remove redundant access specifier

* fix: use std::array instead of C-style array

* fix: remove redundant access specifier

* fix: replace const std::string reference to std::string_view

* fix: remove redundant access specifier

* fix: merge if statement with enclosing one

* chore: clang-format

* chore: clang-format

* Revert "fix: remove redundant access specifier"

This reverts commit 054e4e7eec.

* Revert "fix: remove redundant access specifier"

This reverts commit 2c92f227e8.

* Revert "fix: remove redundant access specifier"

This reverts commit a0710202a8.

* Revert "fix: remove redundant access specifier"

This reverts commit 54da1d9397.

* Revert "fix: remove redundant access specifier"

This reverts commit f7b1777578.

* Revert "fix: remove redundant access specifier"

This reverts commit ad8e3dfff4.

* chore: revert access specifier change
2022-04-01 14:16:33 -05:00