Commit Graph

2004 Commits

Author SHA1 Message Date
Charles Kerr fd583ac878
deps: bump libfmt to v10.0.0 (#5635)
seems to be semver/minor safe for our API use

Fixes #5511.

Possibly fixes #5627.
2023-06-18 17:36:39 -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
Will Thompson dd22b52bbf
GTK: Improve appstream metainfo (#5407)
* gtk: Add release history to metainfo file

This is mandatory on Flathub (and possibly other software repositories).
On each new release, a <release> element should be prepended to this
list.

Ideally each <release> would include (translatable) release notes, but
this is the bare minimum.

https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-releases
https://www.freedesktop.org/software/appstream/docs/sect-Metadata-Releases.html

* gtk: Add more URLs to AppStream metainfo

This covers all the URL types from the AppStream specification.

https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-url

* gtk: Add translation info to AppStream metainfo

This allows information about per-language translation percentages to be
extracted at build-time and included in the repository's appstream file.
Software centres such as GNOME Software use this to indicate to the user
whether the app is translated into their language.

https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-translation
2023-05-07 13:02:49 -05:00
Charles Kerr 0d3b321bac
refactor: use snake_case for libtransmission class methods (#5497) 2023-05-05 23:11:05 -05:00
Mike Gelfand e8fcb025a0
fix: use user-preferred locale (#5444)
* Use user-preferred locale

Previous fix adding `L` format specifier was correct but only fixed half
of the problem, as C++ locale is set up to be "C" by default. GTK client
used to call `setlocale(LC_ALL, "")` to set up user-preferred locale
which only affected C functions and `std::locale` (used by libfmt) was
unaware of those changes.

Apply the fix to all the binaries since they're all doing some sort of
output to the user and calling libtransmission helpers, as well as using
libfmt directly.

* Improve libtransmission's json-test

Set the locale C++ way to avoid any sort of inconsistencies, and also
restore it to the old one once finished testing.

* Improve transmission-show test runner script

Quote outputs to avoid CMake error about `message()` being called with
no arguments. Capture stderr to the same output file. Fallback to `git
diff` if `diff` wasn't found. A few other minor changes.
2023-04-27 09:10:33 -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 a8e01ac38d
fix: minor warnings (#5409)
* chore: fix readability-qualified-auto warnings

* chore: fix clang-analyzer-core.uninitialized.Branch warning

* fix: collision of key 'ERROR' in transmission-qt

* chore: silence -Wshadow warning

* chore: silence warning C4100: 'iter': unreferenced formal parameter

* chore: fix warning C4127: conditional expression is constant warning
2023-04-17 23:11:09 -05:00
Charles Kerr 7d86d67bc7
chore: prefer fmt/core.h over fmt/format.h (#5404) 2023-04-16 15:34:19 -05:00
lawrence 23c248a5e9
fix: restore accidentally-deleted copyright notice (#5372)
Co-authored-by: lawrence <anonymous@null.null>
2023-04-12 13:03:00 -05:00
Gary Elshaw 1c64bdd352
fix: in prefs, reduce tracker list height to fit on small displays 2023-04-09 22:08:35 -05:00
Charles Kerr 47e141563a
fixup: address 5258 code review (#5295) 2023-03-27 11:04:10 -05:00
Charles Kerr 9fc0e4ff61
fix: disable-deprecated by default for end users (#5289)
deprecations can be turned on manually and are auto-enabled in CI
2023-03-24 13:34:30 -05:00
Charles Kerr a2bece2682
fix: GTK client prefs window too large for small displays (#5276) 2023-03-22 10:51:05 -05:00
Charles Kerr bfa62f6116
fix: handle DELETE_EVENT in create-torrent GTK dialog code (#5180) 2023-03-09 15:01:22 -06:00
Mike Gelfand 20071149c3
fix: split current and initially requested minimized state (#5175) 2023-03-07 21:07:23 -06:00
Mike Gelfand 9f2040d093
Only show/hide top-level windows on systray action (#4939) 2023-02-18 16:09:35 +00:00
Mike Gelfand 605c6bd031
Store percents as integer, with 2 digits of precision (#4933)
* Store percents as integer, with 2 digits of precision

* Fix GHA builds for Mac (missing pkg-config)

* Fix percents formatting
2023-02-18 01:14:01 +00: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 b85f85d3f9
Fix blurry progress bars in main window (GTK client) (#4756)
* Fix blurry progress bars in main window (GTK client)

Create surfaces similar to those provided by GTK, which includes similar
scale factor.

* Minor simplification to avoid needless macro use
2023-02-09 11:02:39 +00:00
Mike Gelfand fbb98ada4a
Fix issues reported by `hicpp` clang-tidy checks (GTK client) (#4711)
* Fix `hicpp-vararg` clang-tidy issues

* Fix `hicpp-explicit-conversions` clang-tidy issues

* Fix `hicpp-signed-bitwise` clang-tidy issues

* Enable the rest of `hicpp` clang-tidy checks
2023-02-03 16:12:48 +00:00
Mike Gelfand c4f4d3d45d
Fix torrents count label update (#4694) 2023-01-30 23:25:23 +00:00
Mike Gelfand e775de01bd
Simplify progress bars coloring (GTK client) (#4688)
I remember seeing better results when adding background during hue
adjustment, but can't clearly see the difference now. Since using
`DEST_OVER` Cairo operator results in crashes on some systems, don't
bother with the background, hopefully still getting acceptable results.
2023-01-29 23:20:28 +00:00
Mike Gelfand 0da0a55259
Destroy message dialog on error (#3805 regression) (#4625) 2023-01-21 15:56:38 +00: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 fa091495d6
Refactor sorting and filtering compatibility code (GTK client) (#4558)
* Refactor sorting and filtering compatibility code

Factor out parts of `TorrentFilter` and `TorrentSorter` classes into
reusable `FilterBase<>` and `SorterBase<>` templates.

Factor out filter and sort models setup from `FilterBar` and `Session`
classes into reusable `FilterListModel<>` and `SortListModel<>`
templates.

* Remove unused lambda capture (Clang build failure)
2023-01-08 15:31:03 +00:00
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