1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-30 10:52:00 +00:00

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 { "" };
>                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Charles Kerr 2021-05-21 16:38:08 -05:00 committed by GitHub
parent c9a9652abf
commit 5c8f7d410c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -13,7 +13,7 @@
class BaseDialog : public QDialog
{
public:
BaseDialog(QWidget* parent = nullptr, Qt::WindowFlags flags = 0) :
BaseDialog(QWidget* parent = nullptr, Qt::WindowFlags flags = {}) :
QDialog(parent, flags)
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

View file

@ -1368,12 +1368,12 @@ void DetailsDialog::onRemoveTrackerClicked()
// make a map of torrentIds to announce URLs to remove
QItemSelectionModel* selection_model = ui_.trackersView->selectionModel();
QModelIndexList selected_rows = selection_model->selectedRows();
QMap<int, int> torrent_id_to_tracker_ids;
QMultiMap<int, int> torrent_id_to_tracker_ids;
for (QModelIndex const& i : selected_rows)
{
auto const inf = ui_.trackersView->model()->data(i, TrackerModel::TrackerRole).value<TrackerInfo>();
torrent_id_to_tracker_ids.insertMulti(inf.torrent_id, inf.st.id);
torrent_id_to_tracker_ids.insert(inf.torrent_id, inf.st.id);
}
// batch all of a tracker's torrents into one command

View file

@ -375,8 +375,8 @@ void Prefs::initDefaults(tr_variant* d) const
{
auto constexpr FilterMode = std::string_view { "all" };
auto constexpr SessionHost = std::string_view { "localhost" };
auto constexpr SessionPassword = std::string_view { "" };
auto constexpr SessionUsername = std::string_view { "" };
auto constexpr SessionPassword = std::string_view {};
auto constexpr SessionUsername = std::string_view {};
auto constexpr SortMode = std::string_view { "sort-by-name" };
auto constexpr SoundCommand =
std::string_view { "canberra-gtk-play -i complete-download -d 'transmission torrent downloaded'" };