mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01: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:
+1
-1
@@ -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);
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
+2
-2
@@ -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'" };
|
||||
|
||||
Reference in New Issue
Block a user