Commit Graph

1785 Commits

Author SHA1 Message Date
Charles Kerr 34881f6295
refactor: make parts of tr file private (#2241)
* refactor: make parts of tr_file private
2021-11-27 21:17:47 -06:00
Charles Kerr f6f0db75e1
fix: sonarcloud warnings / code smells (#2242)
* fix: use-init-statement

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1f6EvHJiycnfA7gfrG\&open\=AX1f6EvHJiycnfA7gfrG

* fix replace-use-of-new warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1ZNs41ZmlvCveKTzon\&open\=AX1ZNs41ZmlvCveKTzon

* fix has-virtual-functions-but-non-virtual-destructor warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1ZNs72ZmlvCveKTzo6\&open\=AX1ZNs72ZmlvCveKTzo6

* fix make-variable-const warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0_a_OVNJn7rAzml_7B\&open\=AX0_a_OVNJn7rAzml_7B

* fix remove-redundant-static-specifiers

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St-81usi2gyYkPTb\&open\=AX06St-81usi2gyYkPTb

* fix function-should-be-declared-const

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St-81usi2gyYkPTd\&open\=AX06St-81usi2gyYkPTd

* fix use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St-81usi2gyYkPTc\&open\=AX06St-81usi2gyYkPTc

* fix class-has-virtual-functions-but-non-virtual-destructor warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stz41usi2gyYkPTS\&open\=AX06Stz41usi2gyYkPTS

* fix remove-commented-out-code warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St241usi2gyYkPTT\&open\=AX06St241usi2gyYkPTT

* fix remove-commented-out-code warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St241usi2gyYkPTV\&open\=AX06St241usi2gyYkPTV

* fix has-virtual-functions-but-non-virtual-destructor warning

https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St241usi2gyYkPTW\&open\=AX06St241usi2gyYkPTW

* fix remove-commented-out-code warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06SuCA1usi2gyYkPTh\&open\=AX06SuCA1usi2gyYkPTh

* fix use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0rAQvnfJ-O-YIDS9xF\&open\=AX0rAQvnfJ-O-YIDS9xF

* fix use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0rAQvnfJ-O-YIDS9xG\&open\=AX0rAQvnfJ-O-YIDS9xG

* fix remove-redundant-access-specifier warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1ZNs5tZmlvCveKTzor\&open\=AX1ZNs5tZmlvCveKTzor

* fix use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX01Itl7f_SST5i7BN1l\&open\=AX01Itl7f_SST5i7BN1l

* fix use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0wDijI2l89lDvp1C9P\&open\=AX0wDijI2l89lDvp1C9P

* fix use-automatically-managed-memory-instead-of-new warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1f6E6HJiycnfA7gfrI\&open\=AX1f6E6HJiycnfA7gfrI

* fix use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0l8vknEafnvRiIHUEv\&open\=AX0l8vknEafnvRiIHUEv

* fixup! fix has-virtual-functions-but-non-virtual-destructor warning
2021-11-27 19:58:35 -06:00
Jonas Malaco 6cc9afe1c2
gtk: accept dropping URLs from browsers onto the main window (#2232)
Unlike files, which come as a URI list, links dragged from browsers have
textual selection types:

- Firefox: text/plain;charset=utf-8
- Chrome: UTF8_STRING

If the URI list for files is empty, try to pass the selection text to
add_from_url().
2021-11-26 09:59:10 -06:00
Charles Kerr 3811f66a5c
fix: honor dark mode in GTK client's message log (#2218) 2021-11-24 15:36:23 -06:00
evils 449b83e340
man pages: remove commas in option listings (#2204) 2021-11-23 23:12:15 -06:00
Mike Gelfand 90715c6fee
Use stock options and statistics icons in statusbar (GTK client) (#2200) 2021-11-21 14:36:52 +03:00
Charles Kerr a79a868257
refactor: make tr_variantFromBuf() public (#2187)
* refactor: add tr_variantFromBuf() and support inplace json/benc parsing
2021-11-17 23:37:35 -06:00
Charles Kerr ec94c90da9
fix: coverity warnings (#2186)
* fix: silence check_return warning

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924665\&defectInstanceId\=52245209\&mergedDefectId\=1494152

* fix: silence check_return warning

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924692\&defectInstanceId\=52245241\&mergedDefectId\=1493826

* fix: silence check_return warning

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924667\&defectInstanceId\=52245260\&mergedDefectId\=1493825

* fix: silence nullptr dereference warning

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924667\&defectInstanceId\=52245260\&mergedDefectId\=1493825

* fix: uninitialized variable in rpc-server z_stream

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924665\&defectInstanceId\=52245249\&mergedDefectId\=1494151

* fix: silence check_return warning

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924665\&defectInstanceId\=52245261\&mergedDefectId\=1492904

* fix: silence nullptr dereference warning

https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924689\&defectInstanceId\=52245236\&mergedDefectId\=1492890

* fix: silence unchecked return value warning

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924666\&defectInstanceId\=52245259\&mergedDefectId\=1491888
2021-11-17 15:56:50 -06:00
Mike Gelfand e3538f9371
Fix tracker cells rendering in RTL mode (GTK client) (#2173)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-15 21:53:32 +03:00
Charles Kerr cef3f43088
refactor: tr_web's callback now uses std::string_view (#2172)
* refactor: tr_web tasks now use a std::string_view argument
2021-11-15 12:10:18 -06:00
Mike Gelfand 54cd1a2612
Fix torrent cells rendering in RTL mode (GTK client) (#2170) 2021-11-15 19:32:41 +03:00
Mike Gelfand cc8ab3f79f
Fix activity filter combo size (GTK client) (#2169)
For non-C locales, empty string is translated into a multi-line text
containing descriptive translation headers, which then affects cell size
(and in turn, combo widget size) even though that cell is considered a
separator.
2021-11-15 17:25:11 +03:00
Mike Gelfand a26400c3dc
Fix inconsistent message log action state (GTK client) (#2167) 2021-11-15 15:26:44 +03:00
Charles Kerr f46c4c4df9
refactor: remove tr_variantGetStr (#2160) 2021-11-14 17:28:37 -06:00
Charles Kerr 932a72e61d
refactor: remove tr_variantDictFindStr from transmission-gtk (#2158) 2021-11-14 13:14:45 -06:00
Charles Kerr 47d41f51bf
build: disable exit-time-destructor warnings in GTK client (#2154)
* build: disable exit-time-destructor warnings in GTK client

* build: re-enable deprecation warnings (fixed by #2129)
2021-11-14 10:12:29 -06:00
Mike Gelfand 1c800511d7
Fix torrent counts in tracker filter bar combo (GTK client) (#2144)
Total count was correct, but per-tracker counts were 1 more than in
reality.
2021-11-14 14:46:33 +03:00
Mike Gelfand f0f81f9907 Add missing i18n include to Application (GTK client) 2021-11-14 01:33:16 +03:00
Mike Gelfand c8d6087759 Avoid implicit narrowing casts in Session (GTK clent) 2021-11-14 01:32:13 +03:00
Charles Kerr a8f640c559
refactor: tr_dirSpace() (#2143)
* refactor/tr_dirSpace
2021-11-13 12:09:14 -06:00
Mike Gelfand e144ad6da8
Fix pending_request_data memleak in Session (GTK client) (#2139) 2021-11-13 16:57:22 +03:00
Mike Gelfand 7c3f8b5701
Null-initialize MainWindow::Impl::popup_menu_ (GTK client) (#2138) 2021-11-13 15:59:39 +03:00
Mike Gelfand 1080a5b3f4
Include GTK client icon in resources once (#2137)
There is a fallback mechanism in GTK: when looking for an icon named
foo-a-b-c, it'll also try to find foo-a-b, foo-a, and foo, so the only
icon necessary (if all of them default to the same one) is foo. Given
that we're also installing this icon, including it in resources doesn't
make a lot of sense, by I'm leaving it just in case anyway (useful when
debugging without installing).
2021-11-13 15:20:16 +03:00
Mike Gelfand 82b3da0a54
Don't use deprecated GTK APIs (#2129)
* Don't use deprecated Glib::Thread

* Don't use deprecated stock ID APIs

* Don't use deprecated operator const void* in IconInfo

* Don't use deprecated Gtk::TreeView::set_rules_hint()

* Don't use deprecated Gtk::Widget::set_margin_left()

* Don't use deprecated Gtk::UIManager

* Don't use deprecated sigc::mem_ptr accepting object pointer

* Enable {GDK,GIO,GLIB,GTK,PANGO,SIGCXX}MM deprecation guards

* Enable GTK deprecation guard

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-12 12:12:50 +03:00
Charles Kerr d8b57fe4dc
refactor: web_utils (#2121)
* chore: move web utils from web, utils to web-utils
2021-11-08 21:30:03 -06:00
Daniel Kamil Kozar 5df3505832
Add a "Start Now" action for newly added torrent notifications in the GTK client (#849)
* Add a "Start Now" action for newly added torrent notifications in the GTK client

* Const placement

* Compilation fixes

* post-merge fix

* Morph torrent_start_now into Session::start_now
2021-11-08 20:21:20 +03:00
Mike Gelfand c95616eb26
Bump minimum GTK version to 3.24 (#2112) 2021-11-07 13:08:17 +03:00
Charles Kerr 790b0bb2b5
feat: add tr_quark_get_string_view() (#2083) 2021-11-01 20:01:27 -05:00
Mike Gelfand eaeed301fa
Rename GTK client files to match the classes they contain (#2073)
This also brings naming closer to Qt client which simplifies things a
bit.
2021-11-01 03:11:23 +03:00
Mike Gelfand 63ad19fb5a
Move Application class to a separate file (#2072) 2021-11-01 00:04:31 +03:00
Mike Gelfand 5da0a5d59b
Fix off-by-one mistake in `gtr_str_strip()` (#2057)
Was always trimming last non-whitespace char from the input text.

Fixes: #2027
2021-10-28 23:52:25 +03:00
Charles Kerr 16acdf5934
chore: silence minor GTK warnings (#2034)
* chore: fix clang-diagnostic-suggest-destructor-override in makemeta-ui

* chore: fix Wunused-private-field in tr-prefs

* chore: fix clang-diagnostic-c++98-compat-extra-semi in tr-core.cc

* chore: fix clang-analyzer-deadcode.DeadStores in tr-core.cc

* chore: fix clang-diagnostic-exit-time-destructors for Glib::Quarks in details.cc
2021-10-24 10:55:51 -05:00
Charles Kerr 8cdc2c633e
refactor: replace tr_torrentFiles() with tr_torrentFileProgress() (#1994)
* refactor: s/tr_torrentFiles/tr_torrentFileProgress

Replace tr_torrentFiles() with a new function, tr_torrentFileProgress().

tr_torrentFiles() heap-allocated an array of progress structs. There is
nothing intrinsic in tr_torrent making batch computation more efficient,
so this PR replaces it with tr_torrentFileProgress(), a per-file variant
that doesn't use the heap.
2021-10-21 13:31:03 -05:00
Charles Kerr 236a0965fa
refactor: tr_variant*Str() functions now take a std::string_view (#1990)
* refactor tr_variant*Str functions now take a std::string_view

* refactor: tr_torrentPrimaryMimeType returns a string-view
2021-10-19 21:30:50 -05:00
Daniel Kamil Kozar 77b11232f2
Add support for creating torrents with a source flag (#443)
* Add support for creating torrents with a source flag

* Add the source flag functionality for Mac OSX

* Source flag should be a part of the info dictionary

* Address review comments

* Rename "sourceFlag" to "source" since "Flag" is usually reserved for booleans.
* Free the "source" pointer in tr_metainfoFree.
* Add information about transmission-create argument to its manpage.

* Replace all occurences of "sourceFlag" with "source" and use "Source tag" in UI

* Settle on just "Source" in UI

* The last usage of "flag" hopefully bites the dust! ;-)

* Add a missing free for the source in tr_metainfoFree

* Add a "source" field to the torrent-get RPC method

* uncrustify

* Test for torrents having different infohashes due to different source flags.

This is the whole point of this feature, so it makes sense to test it.

* case is important

* try to incorporate the macosx xml changes
2021-10-18 18:05:39 -05:00
Mike Gelfand bf41e1487a
Switch from gtk to gtkmm (#1969)
* Gtk to gtkmm: main.cc

* Gtk to gtkmm: details.cc

* Gtk to gtkmm: tr-window.cc

* Gtk to gtkmm: tr-prefs.cc

* Gtk to gtkmm: open-dialog.cc

* Gtk to gtkmm: file-list.cc

* Gtk to gtkmm: filter.cc

* Gtk to gtkmm: torrent-cell-renderer.cc

* Gtk to gtkmm: msgwin.cc

* Gtk to gtkmm: makemeta-ui.cc

* Gtk to gtkmm: relocate.cc

* Gtk to gtkmm: stats.cc

* Gtk to gtkmm: dialogs.cc

* Gtk to gtkmm: hig.cc

* Gtk to gtkmm: favicon.cc

* Gtk to gtkmm: icons.cc

* Gtk to gtkmm: tr-icon.cc

* Gtk to gtkmm: actions.cc

* Gtk to gtkmm: notify.cc

* Gtk to gtkmm: util.cc

* Gtk to gtkmm: tr-core.cc

* Gtk to gtkmm: conf.cc

* Glibmm <2.62 compatibility (missing Glib::ustring::sprintf)

* Glibmm <2.56 compatibility (missing Glib::RefPtr<>::get)

* Bump glibmm to 2.50.1+ (C++17 fix in Glib::Variant)

* Fix empty timestamps on message log export (broken by #1444)

* Fix LGTM build issues

* Review fixes
2021-10-18 23:22:31 +03:00
Charles Kerr 567f1e48c8
tr_quark_new() now takes a std::string_view (#1961) 2021-10-15 08:28:47 -05:00
Charles Kerr 98e16a178f
refactor: add an enumeration of the script types (#1934)
* refactor: add an enumeration of the script types

This simplifies the API by having a single set of functions that can be
used for getting/setting all the script types.
2021-10-12 22:46:12 -05:00
Charles Kerr 1fb5a79813
refactor: use maybe unused attribute (#1918)
* refactor: replace TR_UNUSED with [[maybe_unused]]
2021-10-10 11:52:26 -05:00
Charles Kerr f876a100a0
refactor: add [[fallthrough]] annotation (#1886) 2021-10-06 12:24:02 -05:00
Charles Kerr 003685b40a
refactor: use nullptr instead of NULL (#1884)
* refactor: use nullptr instead of NULL.

No functional changes; just more C++ification
2021-10-06 11:32:17 -05:00
Mike Gelfand 4ac1c601f5
Port GTK client to C++ (#1833)
* Rename GTK client .c files to .cc

* Fix GTK client build errors after C to C++ switch

* Remove `G_{BEGIN,END}_DECLS`

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-09-25 13:47:09 +03:00
Sergey Fedoseev 846dafb07e
Add Sort by Queue menu item to popup menu (#1040)
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-18 23:15:40 +03:00
Mike Gelfand db3d40d0ed Switch to clang-format for code formatting, include Mac client 2021-08-16 00:38:29 +03:00
Daniel Kamil Kozar 79e8bc5c46
Remove unnecessary "id" member of TrNotification in gtk/notify.c (#851)
The "id" member's only purpose is to serve as the key for the
active_notifications hash table. However, the same thing can be very easily
achieved by switching the GHashTable's hash/equal functions to "direct", which
just use the void pointers (which all keys are in a GHashTable) directly as if
they were values, and use GUINT_TO_POINTER() when referring to this hash table's
key.

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-08 00:24:11 +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 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
Charles Kerr 46cb0b5e65
refactor: sonarcloud warnings about overly-complex looping logic (#1503)
* chore: simplify loop logic
2020-11-03 18:59:19 -06:00