Commit Graph

806 Commits

Author SHA1 Message Date
Charles Kerr 59efe4642d
feat: allow filtering torrents by info hash in qt client (#1763)
* feat: allow filtering torrents by info hash
2021-08-27 12:58:47 -05:00
Mike Gelfand db3d40d0ed Switch to clang-format for code formatting, include Mac client 2021-08-16 00:38:29 +03:00
dubhater a7370fe8fb
Qt: Move icon after "Alternative Speed Limits" label (#503)
Looks better and matches the Gtk client.

Co-authored-by: dubhater <cantabile.desu@gmail.com>
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-07 17:57:59 +03:00
dubhater f804043b85
Qt: Use file selector in Set Location if session is local (#502)
It's the only place where Session::isServer() is used to decide if
a file selector should be used, or a text box. Session::isLocal()
is used everywhere else.

Co-authored-by: dubhater <cantabile.desu@gmail.com>
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-07 17:08:37 +03:00
dubhater 6f76d8fae7
Qt: Add tooltips for Options, Statistics buttons (#501)
Same as in the Gtk client.

Co-authored-by: dubhater <cantabile.desu@gmail.com>
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-07 14:21:06 +03:00
Charles Kerr 07d385cf44
refactor: torrent-complete-sound-command is a list (#1710)
* refactor: torrent-complete-sound-command is a list
2021-05-25 11:21:41 -05:00
Charles Kerr 16ec15d84b fixup! fix: dangling reference crash in FreeSpaceLabel (#1604) 2021-05-22 10:53:52 -05:00
Charles Kerr 5c8f7d410c
refactor: qt deprecations, pt 1 (#1707)
* refactor: use QMultiMap in DetailsDialog::onRemoveTrackerClicked()

* refactor: use 'QWindowFlags = {}' in BaseDialog

Fixes deprecated use:

> ../qt/BaseDialog.h:16:59: warning: 'QFlags' is deprecated: Use default constructor instead [-Wdeprecated-declarations]

* refactor: remove empty string in string_view ctor

Fixes readability-redundant-string-init warning:

> ../qt/Prefs.cc:379:20: error: redundant string initialization [readability-redundant-string-init,-warnings-as-errors]
>    auto constexpr SessionUsername = std::string_view { "" };
>                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-05-21 16:38:08 -05:00
Charles Kerr c9a9652abf
silence readability-function-cognitive-complexity (#1703) 2021-05-20 15:00:20 -05:00
Charles Kerr 7fd9fa15b7
fix: dangling reference crash in FreeSpaceLabel (#1694)
* fix: dangling reference crash in FreeSpaceLabel

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-05-18 12:36:46 -05:00
Charles Kerr 090a4b5ff8
fix: dangling reference crash in FreeSpaceLabel (#1604) 2021-01-24 22:20:21 -06:00
Charles Kerr 270a937909
feat: add remote server version to the about dialog (#1603) 2021-01-24 11:43:14 -06:00
Charles Kerr 41f225df7b
Remove posix memalign (#1520)
* refactor: remove unnecessary func tr_valloc()

We're only using it in a handful of places, and none of them need the
kind of alignment that posix_memalign() provide. So we can drop a few
dozen lines by removing the portability wrapper.
2020-11-15 15:53:42 -06:00
Charles Kerr 9d313a8816
sonarcloud warnings 9 (#1511)
* refactor: const correctness 

* refactor: fix some implicit conversions

* refactor: make local pointers const if their objects are not modified

* refactor: do not cast away const in torrent-cell-renderer

* refactor: remove call to deprecated gtk_icon_size_lookup_for_settings

* refactor: member functions that do not mutate their objects should be declared const

* chore: do not end comments with a semicolon
2020-11-08 21:31:02 -06:00
Charles Kerr 6b0408b320
refactor: fix more sonarcloud warnings (#1509)
* chore: simplify loop logic

* refactor: simplify isValidUtf8()

* refactor: use std::make_unique in Application::Application

* refactor: avoid raw pointers in DetailsDialog

* refactor: simplify DetailsDialog::refreshPref()

* refactor: make Application methods const

* refactor: reduce cognitive complexity of buildTrackerSummary()
2020-11-08 13:54:40 -06:00
Charles Kerr 7f147c65fb
refactor: fix more sonarcloud warnings (#1508)
* refactor: const correctness

* refactor: use getpwuid_r instead of getpwuid

* chore: simplify dict walking loop logic

* refactor: remove dead store assignment in announcer

* refactor: use std::make_shared
2020-11-05 16:46:21 -06:00
Mike Gelfand a6798adf2c Sync existing translations with Transifex 2020-11-03 20:26:30 +03:00
Charles Kerr 0bfbc3eba7
Sonarcloud warnings 4 (#1499)
* chore: fix some sonarcloud html warnings (e.g. deprecated attribute use)

* chore: uppercase literal suffixes

* chore: remove redundant casts

* chore: remove commented-out code

* chore: use qInfo() instead of std::cerr
2020-11-02 09:16:12 -06:00
Charles Kerr 73fdd722a7
Sonarcloud warnings 3 (#1498)
* chore: use ClassName:: for calling static methods

* chore: prefer to initialize member data in the class initializer
2020-11-01 19:13:32 -06:00
Charles Kerr 19e52d8b9a
chore: sonarcloud warnings 2 (#1496)
* fix "merge nested if" sonarcloud warnings

* fix explicit constructor warnings in qt client
2020-11-01 15:47:57 -06:00
Charles Kerr 973e63d897
refactor: use qt5's connect api (#1491)
* refactor: use qt5's connect syntax everywhere

https://wiki.qt.io/New_Signal_Slot_Syntax
2020-10-31 13:56:12 -05:00
Mike Gelfand 7cbfaf9d59 Fix qt/IconCache includes 2020-10-14 13:18:14 +03:00
Charles Kerr f59118d1fe
feat: add torrent-get 'primary-mime-type' to RPC. (#1464)
* feat: add torrent-get 'primary-mime-type' to RPC.

This is a cheap way for RPC clients to know what type of content is in a
torrent. This info can be used to display the torrent, e.g. by using an
icon that corresponds to the mime type.

* use size_t for content byte count

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* explicit boolean expressions

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* use uint64_t for content byte counts

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* avoid unnecessary logic branches

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* explicit cast

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* refactor: add an autogenerated mime-type.h header

* chore: maybe fix the win32 FTBFS

* chore: add mime-types.[ch] to xcode

* Squashed commit of the following:

commit 4c7153fa48
Author: Mike Gelfand <mikedld@users.noreply.github.com>
Date:   Tue Oct 13 03:15:19 2020 +0300

    Remove autotools-based build system (#1465)

    * Support .git files (e.g. for worktrees, submodules)
    * Fix symlinks in source tarball, switch to TXZ, adjust non-release name
    * Remove autotools stuff

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2020-10-13 10:33:56 -05:00
Mike Gelfand 4c7153fa48
Remove autotools-based build system (#1465)
* Support .git files (e.g. for worktrees, submodules)
* Fix symlinks in source tarball, switch to TXZ, adjust non-release name
* Remove autotools stuff
2020-10-13 03:15:19 +03:00
Mike Gelfand 32add75f0e Add new translations from Transifex (95% and higher)
Qt client: Arabic, Hebrew, Hindi, Croatian, Chinese (Taiwan).
2020-10-03 15:38:00 +03:00
Mike Gelfand 3a4cc558b6 Sync existing translations with Transifex 2020-10-03 15:36:23 +03:00
Charles Kerr 92fc42ceb5
Scrape www subdomain for favicon (#1451)
* fix: scrape other subdomains for favicon
2020-09-17 00:38:13 -05:00
Charles Kerr c2fb393390
chore: fix clang-tidy-11 warnings (#1436)
* refactor: mark subclass' destructors as override.

* refactor: use QUrl to parse announce URL strings.

The prompt for this was to work around a clang-tidy issue where
"char* host = nullptr;" triggers a "don't use varargs" warning,
but on the other hand it's also terser / cleaner.

* refactor: make the TorrentDelegate brushes const.

* refactor: s/auto/auto const*/ where appropriate

* chore: add some nonconst global warning exemptions

* chore: turn off warnings in GTest

* refactor: just disable the clang-tidy warning.

Apparently a std::array<T>::iterator is a T* on clang, since clang-tidy's
readability warning says we should use 'auto*' instead of 'auto'. However
adding that annotation fails on MSVC, where the is apparently _not_ a raw
pointer.

Since there's not a way to satisfy both of them at the same time, disable
the warning.
2020-09-09 09:24:39 -05:00
Charles Kerr bda60c5a18
feat: add 'TR_RPC_VERBOSE' env variable in Qt app. (#1435)
When set, this will log the RPC messages sent between the GUI and the
backend. This replaces the old `#ifdef DEBUG_HTTP` as something that can
be enabled without needing to recompile.
2020-09-08 17:20:46 -05:00
Charles Kerr 542feef77d
refactor: make torrents' mime icons lazy-loaded. (#1433)
* refactor: make torrents' mime icons lazy-loaded.

Another "small wins" patch, this time on CPU: icon loading is expensive,
so calculating them for every torrent all at once on startup isn't the
smartest way to do it.
2020-09-08 11:51:33 -05:00
Mike Gelfand 138ee3d7a0 Fix ICC build error due to template argument type reduction failure 2020-09-08 18:53:39 +03:00
Charles Kerr b156f55dca
refactor: use a vector for FavIcon cache keys (#1432)
* refactor: use a vector for FavIcon cache keys

Third of three PRs focused on small memory wins in transmission-qt.
This one saves 1-2 M off RES in my 15K torrent testbed. Not a major
improvement, but nice enough.

Previously we held the torrent's tracker keys in an unordered_set.
That container type is overkill for this field: the list is usually
short and almost never changes, so we don't need fast insertion time.
We can keep the same log N lookup by using a sorted vector and avoid
the excess container size & memory allocations of an unordered_set.
2020-09-08 08:58:14 -05:00
Charles Kerr b3c3168f16
refactor: intern repeated strings e.g. downloadDir (#1430)
* refactor: intern repeated strings e.g. downloadDir

Add an app-wide interned QString cache for commonly-repeated
strings. Currently used for download_dir, announce_url, comment,
creator, error_string.
2020-09-07 22:52:29 -05:00
Charles Kerr 9f7c865454
refactor: don't store torrent hashes in QStrings (#1428)
* refactor: keep torrent hash in std::array<char,20>

This replaces the hashString QString allocation with a compile-time
array that's included in sizeof the Torrent struct that owns it.
2020-09-07 16:19:10 -05:00
Charles Kerr 90ce7efc09
fixup: qt client nicer torrent add handling (#1427)
* refactor: omit unnecessary #include

* refactor: make the onDuplicatesTimer slot private.

* feat: show dupe torrents in dialog's detailText

* fix: a stupid bug that I introduced.
2020-09-07 10:20:48 -05:00
Charles Kerr fdaad67def fixup! refactor: make variant_headers reusable to qt app. (#1369) 2020-09-07 00:33:46 -05:00
Charles Kerr 6b89ee7903 fixup! refactor: make variant_headers reusable to qt app. (#1369) 2020-09-06 22:12:55 -05:00
Charles Kerr 4d7950dcb9 fixup! refactor: speed up FaviconCache::add() again. (#1402) 2020-09-02 19:33:45 -05:00
Charles Kerr 0bd915c34c fixup! refactor: speed up FaviconCache::add() again. (#1402) 2020-09-02 19:28:36 -05:00
Charles Kerr 848125d6d8 fixup! feat: nicer add-torrent workflow in the qt client. (#1410) 2020-09-02 09:25:45 -05:00
Charles Kerr cf9b81eb7d
feat: nicer add-torrent workflow in the qt client. (#1410)
* If you accidentally try to add a lot of duplicates -- for example, by
  starting up with a lot of duplicate torrents in the watchdir -- then
  coalesce all of them into a single error dialog instead of spamming
  the desktop with a different dialog for every duplicate.

* Make the duplicate torrent dialog's error message slightly terser to
  make it accommodate a long list of torrents: omit the ".torrent" file
  suffixes and show an abbreviated form of the existing torrent's hash.

* Support searching by torrent hash in the filterbar's text entry.
  This is useful when copy/pasting the hash from the duplicate torrent
  error dialog and is also consistent with the GTK client behavior.

* Copy the GTK client's behavior of appending ".added" to the end of
  .torrent files after they've been added to the session.
2020-08-26 20:42:41 -05:00
Charles Kerr 1bb9e2eef2
refactor: speed up FaviconCache::add() again. (#1402)
* refactor: speed up FaviconCache::add() again.

Another iteration on FaviconCache::add() since it's still showing up so
high in my perf tests. add()'s url argument is now a QString instead of
a QUrl, and the class has a private unordered_map that maps QString urls
into Keys. Basically, QUrl generation is so expensive that it's worth
caching the result to avoid constructing the intermediate QUrl object.

Also, ensure that the network reply's `deleteLater()` method is called
so that they don't leak, and add 'svg' to the icon list since it's now
supported on all major browsers.
2020-08-26 14:00:39 -05:00
Charles Kerr b8a02fdfb3 fixup! refactor: remove exit-time destructors from transmission-qt (#1395) 2020-08-16 20:43:14 -05:00
Charles Kerr 68920f5fa6
refactor: remove exit-time destructors from transmission-qt (#1395)
* refactor: remove exit-time destructors from transmission-qt
2020-08-15 10:42:51 -05:00
Charles Kerr 677dc73eac
refactor: use GTest for running tests (#1383)
* refactor: use google-test on libtransmission tests
2020-08-11 13:11:55 -05:00
Charles Kerr 49400ab443
fix: qt client memory leaks (#1378)
* fix: don't leak the qt client's QFileSystemWatcher

* fix: don't leak the Qt client's ListViewProxyStyle
2020-07-29 18:21:11 -05:00
Charles Kerr 77ced2b7c8
Fix Ubuntu 18.04 Qt FTBFS (#1377)
* fix: avoid qt5_add_translation options on old qt5

Check the Qt5Linguist version before passing 'OPTIONS -silent' to
qt5_add_translation(). 'OPTIONS' arg support was merged 2018-01-12
https://codereview.qt.nokia.com/gitweb?p=qt%2Fqttools.git;a=commit;h=9f3dba2ea3978936565aa5e7893415a8a765268e
and made it into the 5.11 release on 2018-05-22.

* fix: ftbfs include <cassert> before using assert()
2020-07-29 14:53:55 -05:00
Charles Kerr 8f12792186
fix: ensure details dialog is updated on selection (#1376)
* fix: ensure details dialog is updated on selection
2020-07-29 11:56:23 -05:00
Charles Kerr 9da4abb003
feat: add 'transfer.complete' notification hint (#1374)
Described at https://developer.gnome.org/notification-spec/#categories ,
this is for a file transfer or download complete notification.
2020-07-28 16:51:01 -05:00
Charles Kerr 910944733e
refactor: reuse one QRequestHeader across requests (#1373)
Minor optimization: since we don't actually change our request headers
very often, we can lazy-build the request once and reuse that instead of
having to rebuild it each time.
2020-07-28 10:56:40 -05:00