Commit Graph

2017 Commits

Author SHA1 Message Date
Charles Kerr fbfbfac3ae
fix: minor coverity warnings (#5916)
* fix: unchecked return value from tr_variantDictFindInt()

coverity 1541113

* fix: unchecked return value from tr_variantDictFindBool()

coverity 1541112

* fix: copy-instead-of-move in tr_strlower()

coverity 1541092

* fix: use auto& instead of auto in test

coverity 1541084

* fix: logically dead code

coverity 1541065

* fix: copy-instead-of-move in tr_announcer_impl::addTorrent()

coverity 1541062

* fix: unchecked return value of tr_variantDictFindInt()

coverity 1541061

* fix: copy-instead-of-move in FilterBar::Impl::tracker_filter_model_update()

coverity 1541058

* fix: copy-instead-of-move in gtr_window_on_close()

* fix: silence invalid resource leak warning

coverity 1520595

* fix: unchecked return value from setsockopt()

coverity 1518345

* fix: dereference after null check (FORWARD_NULL)

coverity 1517816
2023-08-21 21:59:47 -05:00
Charles Kerr 5837603b6f
refactor: make tr_variant follow RAII (#5923) 2023-08-20 23:15:23 -05:00
Charles Kerr a4d205612a
refactor: add tr_variant_serde (#5903) 2023-08-17 11:02:45 -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
Charles Kerr ea9fd64830
refactor: tr_compare_3way() (#5799) 2023-07-15 21:55:44 -05:00
Gary Elshaw ff6617467e
fix: add missing tooltip for 'remove torrent' button (#5777) 2023-07-14 15:04:27 -05:00
Rafe S 9b0be18cb5
fix: missing #include in DetailsDialog.cc (#5737) 2023-07-07 10:22:27 -05:00
tearfur 2211086338
fix: conform to libcurl requirements to avoid memory leak (#5702) 2023-07-05 22:05:03 -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 ce66e5c442
iwyu: remove, add std headers where used (#5694)
* chore: remove unused #include <array>

* chore: remove unused #include <chrono>

* chore: remove unused #include <set>

* chore: remove unused #include <algorithm>

* chore: remove unused #include "interned-string.h"

* chore: remove unused #include <list>

* chore: remove unused #include <optional>

* chore: iwyu <cstddef>

* chore: iwyu <ctime>

* chore: remove unused #include <cerrno>

* chore: remove unused #include <deque>

* chore: remove unused #include <vector>

* chore: remove unused #include <memory>

* chore: remove unused #include <unordered_set>

* chore: remove unused #include <array>

* chore: remove unused #include <mutex>

* chore: remove unused #include <functional>

* chore: remove unused #include <cmath>
2023-06-29 23:51:55 -05:00
Charles Kerr 22bb9e5757
refactor: rename tr_dirSpace() to tr_sys_path_capacity() (#5689) 2023-06-29 10:23:00 -05:00
kramo 46dac775e0
Update GTK screenshot (#5660) 2023-06-23 14:50:07 -05:00
tearfur 41cfdce6fd
refactor: replace some C idioms with C++ ones (#5656)
* tidy up legecy practices

* remove undefined std::ignore usage

* avoid extra function stack level in daemon.cc
2023-06-22 17:58:16 -05:00
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