fix: enable modernize-use-designated-initializers (#8592)

* fix(qt): enable `modernize-use-designated-initializers`

* fix(gtk): enable `modernize-use-designated-initializers`
This commit is contained in:
Yat Ho
2026-02-22 00:45:14 +08:00
committed by GitHub
parent f89242c855
commit 5b52ba92c0
8 changed files with 190 additions and 117 deletions

View File

@@ -22,7 +22,6 @@ Checks:
- misc-*
- -misc-include-cleaner
- modernize-*
- -modernize-use-designated-initializers
- -modernize-use-ranges
- -modernize-use-trailing-return-type
- performance-*

View File

@@ -340,7 +340,7 @@ void FileList::Impl::refresh()
int sort_column_id = 0;
store_->get_sort_column_id(sort_column_id, order);
RefreshData refresh_data{ sort_column_id, false, tor };
RefreshData refresh_data{ .sort_column_id = sort_column_id, .resort_needed = false, .tor = tor };
gtr_tree_model_foreach_postorder(
store_,
[this, &refresh_data](Gtk::TreeModel::iterator const& iter)

View File

@@ -472,15 +472,24 @@ Glib::RefPtr<Gtk::ListStore> FilterBar::Impl::show_mode_filter_model_new()
};
static auto constexpr types = std::array<FilterTypeInfo, 9>({ {
{ ShowMode::ShowAll, nullptr, N_("All"), nullptr },
{ ShowModeSeparator, nullptr, nullptr, nullptr },
{ ShowMode::ShowActive, nullptr, N_("Active"), "system-run" },
{ ShowMode::ShowDownloading, "Verb", NC_("Verb", "Downloading"), "network-receive" },
{ ShowMode::ShowSeeding, "Verb", NC_("Verb", "Seeding"), "network-transmit" },
{ ShowMode::ShowPaused, nullptr, N_("Paused"), "media-playback-pause" },
{ ShowMode::ShowFinished, nullptr, N_("Finished"), "media-playback-stop" },
{ ShowMode::ShowVerifying, "Verb", NC_("Verb", "Verifying"), "view-refresh" },
{ ShowMode::ShowError, nullptr, N_("Error"), "dialog-error" },
{ .show_mode = ShowMode::ShowAll, .context = nullptr, .name = N_("All"), .icon_name = nullptr },
{ .show_mode = ShowModeSeparator, .context = nullptr, .name = nullptr, .icon_name = nullptr },
{ .show_mode = ShowMode::ShowActive, .context = nullptr, .name = N_("Active"), .icon_name = "system-run" },
{ .show_mode = ShowMode::ShowDownloading,
.context = "Verb",
.name = NC_("Verb", "Downloading"),
.icon_name = "network-receive" },
{ .show_mode = ShowMode::ShowSeeding,
.context = "Verb",
.name = NC_("Verb", "Seeding"),
.icon_name = "network-transmit" },
{ .show_mode = ShowMode::ShowPaused, .context = nullptr, .name = N_("Paused"), .icon_name = "media-playback-pause" },
{ .show_mode = ShowMode::ShowFinished, .context = nullptr, .name = N_("Finished"), .icon_name = "media-playback-stop" },
{ .show_mode = ShowMode::ShowVerifying,
.context = "Verb",
.name = NC_("Verb", "Verifying"),
.icon_name = "view-refresh" },
{ .show_mode = ShowMode::ShowError, .context = nullptr, .name = N_("Error"), .icon_name = "dialog-error" },
} });
auto store = Gtk::ListStore::create(show_mode_filter_cols);

View File

@@ -230,7 +230,7 @@ void gtr_notify_torrent_completed(Glib::RefPtr<Session> const& core, tr_torrent_
auto const* const tor = core->find_torrent(tor_id);
auto const n = TrNotification{ core, tor_id };
auto const n = TrNotification{ .core = core, .torrent_id = tor_id };
std::vector<Glib::ustring> actions;
if (server_supports_actions)
@@ -282,7 +282,7 @@ void gtr_notify_torrent_added(Glib::RefPtr<Session> const& core, tr_torrent_id_t
actions.emplace_back(_("Start Now"));
}
auto const n = TrNotification{ core, tor_id };
auto const n = TrNotification{ .core = core, .torrent_id = tor_id };
proxy->call(
"Notify",