Commit Graph

45 Commits

Author SHA1 Message Date
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 138ee3d7a0 Fix ICC build error due to template argument type reduction failure 2020-09-08 18:53:39 +03: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 f37253a3ab
feat: Torrent::update() returns a bitset of changed properties (#1334)
* refactor: Torrent::update() returns a delta bitset

Setting up for followup PRs where, instead of doing expensive work every
time there is a change, we can be more fine-grained and do the work only
if the relevant Torrent properties changed.

* chore: make uncrustify happy

* chore: fix #includes
2020-06-23 16:11:16 -05:00
Charles Kerr 83e4e4ca55
refactor: faster action sensitivity updates (#1333)
* refactor: faster action sensitivity updates

Currently we walk through every row in the model and pump its TorrentRole data, which can be expensive for long lists. However since we're only interested in the selected rows, let's save some traversal overhead by getting that list directly and walking it instead.
2020-06-23 12:16:07 -05:00
Charles Kerr fcda077cdd
chore: remove extraneous/default class destructors (#1317)
* chore: remove extraneous/default class destructors

* fixup! chore: remove extraneous/default class destructors
2020-06-15 09:30:29 -05:00
Charles Kerr 51573a3c1e
chore: clang-tidy cleanups (#1287)
* chore: fix syntax error in clang-tidy config file
2020-06-05 14:02:11 -05:00
Charles Kerr 1f28470cf4
chore: prefer QStringLiteral (#1284)
Further reading:
* https://forum.qt.io/topic/78540/qstringliteral-vs-qlatin1string/2
* https://woboq.com/blog/qstringliteral.html
* https://www.qt.io/blog/2014/06/13/qt-weekly-13-qstringliteral

tl;dr: QLatin1Literal uses less memory than QStringLiteral; however,
since most Qt APIs require a QString argument, there's extra runtime
cost of converting QLatin1Strings to QStrings. QStringLiteral uses a
little more memory but constructs its QStrings at compile time.

ok, the `prefer-qstringliteral` branch is getting out of control: the
secondary goal of fixing a .clang-tidy issue is causing more diffs
than the primary goal. So, I'm breaking it into two separate PRs.
2020-05-29 12:40:07 -05:00
Charles Kerr 070a7f2ffc
refactor: use snake_case field naming in qt client (#1262)
* refactor: use snake_case field naming in qt client

* fix: some missed symbols

* chore: make uncrustify happy

* fixup! refactor: use snake_case field naming in qt client
2020-05-27 16:53:12 -05:00
Charles Kerr d43aeb6a5c
chore: add clang-tidy checks to Qt client (#1236)
* chore: add clang-tidy integration for Qt client
2020-05-19 20:32:51 -05:00
Charles Kerr 797700e63f
perf: lazy-update actions enabled on change events (#1187)
* perf: lazy-update actions enabled on change events

Actions' sensitivity was being lazy-updated in response to other events
but accidentally were doing immediate updates in response to torrentsChanged
signals being emitted from TorrentModel. This commit makes that path a
lazy-update as well.

* chore: uncrustify

* refactor: make the idle updater a lambda again
2020-05-01 23:23:47 -05:00
Mike Gelfand 20119f006c
Fixup recent Qt client changes (#1107)
* Add EDIT_DATE torrent property declaration (Qt client)

Switch to static assertion to help avoid similar issues in the future.

* Only declare std::hash<QString> for Qt < 5.14

* Pass main window as context when connecting lambdas to torrents model signals (Qt client)

This helps to automatically disconnect from signals on main window
destruction. If not done, use after free is possible since main window is
destroyed before torrents model.

Fixes: #1106
2020-01-14 23:28:34 +02:00
Charles Kerr c62cb35fd4
qt client speedups
* faster updating of trackers combobox.
* generate trackerDisplayNames just once per torrent
* refactor: cache torrent delegate's warning emblem
* refactor: change mainwin refresh debounce to 200ms
* refactor: do not store trackers, hosts in QVariant
* refactor: don't use `virtual` when it's not needed
* refactor: faster counting torrents-matching-filter
* refactor: faster tracker handling in filterbar
* refactor: improve json parser's prealloc heuristic
* refactor: make Torrent::hasError() faster
* refactor: remove redundant speed stats collection
* refactor: remove unnecessary tor->isQueued() calls
* refactor: use unordered containers where possible
* scale favicons only once, when adding to the cache
2019-11-11 19:37:05 -06:00
Charles Kerr d857a5821a
refractor: simplify torrent model signal emissions (#1044)
refractor: simplify torrent model signal emissions

The Torrent->Application signal connections make up for about 5% of the
app's memory use. Move this to the TorrentModel so that there are only a
handful of signal connections.

Moving signals to TorrentModel means batch change signals can be emitted
instead of per-change-per-torrent emissions and can be handled that way.
2019-11-09 08:44:40 -06:00
Charles Kerr 973afda057
refactor: keep torrent's time properties as time_t (#1042)
* refactor: keep torrent's time properties as time_t

Comparing QDateTimes is expensive. Keep the torrents' time properties in
the time_t form that we got them from RPG in; difftime() is cheaper.
2019-11-06 17:31:41 -06:00
Charles Kerr aa9b752cd9
refactor: don't load the same stock more than once (#1041)
* refactor: don't load the same stock more than once

Some actions share an icon -- for example, "start all", "start now", and
"start" each use "media-playback-start". When this happens, get the icon
once and cache it to avoid hitting the disk more often than necessary.

In addition, the statusbar's network transfer icon was being reloaded in
a periodic upkeep timer, reloading with QIcon::fromTheme each time. Only
give icons are needed, so load them once and cache them.

* refactor: better lookup of torrent mime-type icons

filename-to-mime-type and mime-type-to-icon lookups are both expensive,
so do a better job of detecting top-level folders and caching the icons
based on file suffixes.

This also lets find a good mime icon even if the torrent doesn't have
its 'files' property populated yet from RPC.
2019-11-06 15:09:04 -06:00
Mike Gelfand 10cdd7f790 Use explicit boolean conversions 2019-07-14 16:25:07 +03:00
Mike Gelfand 82df3a87f4 Update to Uncrustify 0.68.1
Tweak a few rules in the process. Now all code in cli, daemon, gtk,
libtransmission, qt, and utils is properly formatted with no manual
intervention.
2019-02-15 09:21:48 +03:00
Mike Gelfand e1d53855f4 Avoid declaring multiple variables on the same line 2017-05-01 18:46:41 +03:00
Mike Gelfand fbd8d4c79f Fix a number of other style inconsistencies met along the way 2017-04-30 19:33:55 +03:00
Mike Gelfand a762c770f2 Make conditional expressions explicitly boolean 2017-04-30 19:26:01 +03:00
Mike Gelfand 6da99c05e2 Use nullptr consistencty instead of 0 and NULL (Qt client) 2017-04-30 19:26:01 +03:00
Mike Gelfand dadffa2c0f Align type qualifiers to the right (code style)
This way all the qualifiers (`const`, `volatile`, `mutable`) are grouped
together, e.g. `T const* const x` vs. `const T* const x`. Also helps reading
types right-to-left, e.g. "constant pointer to constant T" vs. "constant
pointer to T which is constant".
2017-04-20 19:53:20 +03:00
Mike Gelfand d7930984ef Adjust uncrustify config, reformat all but Mac client
There're places where manual intervention is still required as uncrustify
is not ideal (unfortunately), but at least one may rely on it to do the
right thing most of the time (e.g. when sending in a patch).

The style itself is quite different from what we had before but making it
uniform across all the codebase is the key. I also hope that it'll make the
code more readable (YMMV) and less sensitive to further changes.
2017-04-20 10:01:22 +03:00
Mike Gelfand c77946e49a Set icon for "Open URL" action (Qt client) 2017-02-18 21:22:34 +03:00
Markus Amalthea Magnuson 727b9671f7 Update all website links to canonical HTTPS version. 2016-10-31 10:00:11 +01:00
Robert Vehse 13bae8179e Update all instances of the donation link. Fixes #26. 2016-09-23 04:36:41 +02:00
Mike Gelfand 2248d3670f Get rid of $Id$ SVN keywords in source files 2016-09-02 23:10:15 +03:00
Mike Gelfand 2b917de65b Refactor RPC requests code for proper queueing (patch by intelfx @ GH-10)
This refactoring is driven by the need to be able to do true queued RPC calls
(where each successive call uses the result of the previous).

Currently, such queueing of requests is done by assigning them special "magic"
tag numbers, which are then intercepted in one big switch() statement and acted
upon. This (aside from making code greatly unclear) effectively makes each such
queue a singleton, because state passing is restricted to global variables.

We refactor RpcClient to assign an unique tag to each remote call, and then
abstract all the call<->response matching with Qt's future/promise mechanism.

Finally, we introduce a "RPC request queue" class (RpcQueue) which is built on
top of QFutureWatcher and C++11's <functional> library. This class maintains
a queue of functions, where each function receives an RPC response, does
necessary processing, performs another call and finally returns its future.
2016-04-19 20:41:59 +00:00
Mike Gelfand cc1f6f3a5c Fix dropping .torrent files into main window on Windows
Previously used `QUrl::fromPercentEncoding()` leads to paths like
"/C:/test/a.torrent" which obviously aren't valid filesystem paths.
2016-03-15 06:04:49 +00:00
Mike Gelfand 4434c900e3 Don't force-add "Show options dialog" checkbox when opening a torrent
If open file dialog is a native one, setting the layout will do more harm
than good. Specifically, on Windows with Qt 5 the dialog becomes completely
unusable.
2015-11-14 14:22:57 +00:00
Mike Gelfand 000895322f Clear filter upon double clicking on filtered torrent list notice 2015-10-24 20:56:45 +00:00
Mike Gelfand 585e3df30c Show notice on top of filtered torrents list
This has a couple of benefits: 1) it is clearly visible to the user that
the list is filtered (doesn't display all the torrents) even when filter
bar is hidden, 2) doesn't lead to filter bar controls being shifted to
the left/right as when "Show:" label text changes.
2015-10-19 20:30:26 +00:00
Mike Gelfand c8920abad6 #5993: Improve magnets handling in main window
Disable "Open Folder" and "Verify Local Data" actions for magnets in
Torrent menu. If more than one torrent is selected, "Verify Local Data"
is enabled but only non-magnets are verified if activated.
Add a few sanity checks when opening folder, just in case.
2015-10-04 06:16:59 +00:00
Mike Gelfand 68c6c0aa3c Sync main context menu with "Torrent" menu; hide menu icons on Mac 2015-09-01 23:19:01 +00:00
Mike Gelfand 0f7bea1bd3 Fix session dialog not showing up after first close 2015-09-01 20:39:34 +00:00
Mike Gelfand 0aa572b657 Refactor action groups initialization/handling and trackers merging a bit 2015-08-06 20:28:44 +00:00
Mike Gelfand fd9c2c74f4 Remove some unused includes/macros; fix build (re. QPointer) 2015-07-30 06:55:28 +00:00
Mike Gelfand f592083f15 Create dialogs on demand, don't keep them ready all the time 2015-07-30 06:18:02 +00:00
Mike Gelfand 1a885dcb17 Some look-and-feel improvements for Mac and GTK+ styles (Qt client) 2015-06-28 14:18:06 +00:00
Mike Gelfand 5120fc0f2c Unify/prettify Qt client headers style 2015-06-12 22:12:12 +00:00
Mike Gelfand 07912d230b Use PascalCase for Qt client filenames
Split FileTree.{h,cc} and FilterBar.{h,cc} files so that each class
is in its own file.

This breaks translations (some classes got renamed => context changed),
to be fixed by next commit (along with Tx sync).
2015-06-10 21:27:11 +00:00
Renamed from qt/mainwin.cc (Browse further)