mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
Fix issues reported by clang-tidy modernize checks (GTK client) (#4137)
* Fix `modernize-avoid-c-arrays` clang-tidy issues * Fix `modernize-raw-string-literal` clang-tidy issues * Fix `modernize-use-nodiscard` clang-tidy issues * Fix `modernize-deprecated-headers` clang-tidy issues * Fix `modernize-pass-by-value` clang-tidy issues * Extend clang-tidy configuration Enable all `modernize` checks except for one (use-trailing-return-type) which is an extensive stylistic change for later.
This commit is contained in:
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
TR_DISABLE_COPY_MOVE(Impl)
|
||||
|
||||
Glib::RefPtr<Gtk::TreeSelection> get_selection() const;
|
||||
[[nodiscard]] Glib::RefPtr<Gtk::TreeSelection> get_selection() const;
|
||||
|
||||
void refresh();
|
||||
|
||||
@@ -65,8 +65,8 @@ private:
|
||||
void init_view(Gtk::TreeView* view, Glib::RefPtr<Gtk::TreeModel> const& model);
|
||||
|
||||
Glib::RefPtr<Gio::MenuModel> createOptionsMenu();
|
||||
Glib::RefPtr<Gio::MenuModel> createSpeedMenu(Glib::RefPtr<Gio::SimpleActionGroup> actions, tr_direction dir);
|
||||
Glib::RefPtr<Gio::MenuModel> createRatioMenu(Glib::RefPtr<Gio::SimpleActionGroup> actions);
|
||||
Glib::RefPtr<Gio::MenuModel> createSpeedMenu(Glib::RefPtr<Gio::SimpleActionGroup> const& actions, tr_direction dir);
|
||||
Glib::RefPtr<Gio::MenuModel> createRatioMenu(Glib::RefPtr<Gio::SimpleActionGroup> const& actions);
|
||||
|
||||
Glib::RefPtr<Gio::MenuModel> createStatsMenu();
|
||||
|
||||
@@ -292,7 +292,9 @@ void MainWindow::Impl::onSpeedSet(tr_direction dir, int KBps)
|
||||
core_->set_pref(dir == TR_UP ? TR_KEY_speed_limit_up_enabled : TR_KEY_speed_limit_down_enabled, true);
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gio::MenuModel> MainWindow::Impl::createSpeedMenu(Glib::RefPtr<Gio::SimpleActionGroup> actions, tr_direction dir)
|
||||
Glib::RefPtr<Gio::MenuModel> MainWindow::Impl::createSpeedMenu(
|
||||
Glib::RefPtr<Gio::SimpleActionGroup> const& actions,
|
||||
tr_direction dir)
|
||||
{
|
||||
auto& info = speed_menu_info_[dir];
|
||||
|
||||
@@ -353,9 +355,9 @@ void MainWindow::Impl::onRatioSet(double ratio)
|
||||
core_->set_pref(TR_KEY_ratio_limit_enabled, true);
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gio::MenuModel> MainWindow::Impl::createRatioMenu(Glib::RefPtr<Gio::SimpleActionGroup> actions)
|
||||
Glib::RefPtr<Gio::MenuModel> MainWindow::Impl::createRatioMenu(Glib::RefPtr<Gio::SimpleActionGroup> const& actions)
|
||||
{
|
||||
static double const stockRatios[] = { 0.25, 0.5, 0.75, 1, 1.5, 2, 3 };
|
||||
static auto const stockRatios = std::array<double, 7>({ 0.25, 0.5, 0.75, 1, 1.5, 2, 3 });
|
||||
|
||||
auto& info = ratio_menu_info_;
|
||||
|
||||
@@ -459,16 +461,18 @@ void MainWindow::Impl::onOptionsClicked()
|
||||
|
||||
Glib::RefPtr<Gio::MenuModel> MainWindow::Impl::createStatsMenu()
|
||||
{
|
||||
static struct
|
||||
struct StatsModeInfo
|
||||
{
|
||||
char const* val;
|
||||
char const* i18n;
|
||||
} const stats_modes[] = {
|
||||
};
|
||||
|
||||
static auto const stats_modes = std::array<StatsModeInfo, 4>({ {
|
||||
{ "total-ratio", N_("Total Ratio") },
|
||||
{ "session-ratio", N_("Session Ratio") },
|
||||
{ "total-transfer", N_("Total Transfer") },
|
||||
{ "session-transfer", N_("Session Transfer") },
|
||||
};
|
||||
} });
|
||||
|
||||
auto top = Gio::Menu::create();
|
||||
auto actions = Gio::SimpleActionGroup::create();
|
||||
|
||||
Reference in New Issue
Block a user