From 5e1e6110ce50b33e24667ce83ab5d2417a2a466e Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 30 Jul 2018 20:41:33 +0200 Subject: Cleanup: remove parameter from currentDiveChanged signal The currentDiveChanged signal was emitted by the DiveListView to inform the MainWindow of a change of current dive. The new current dive was passed as a parameter. The slot in MainWindow then called select_dive() on the dive. This seems pointless because: 1) In both emits, selected_dive dive was passed as argument. But MainWindow can read this global variable itself. 2) Calling select_dive() again is a no-op, because obviously, this already *was* the selected dive. Moreover it seems conceptually wrong to set the current dive in the slot that is informed of the change of the current dive. Signed-off-by: Berthold Stoeger --- desktop-widgets/mainwindow.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'desktop-widgets/mainwindow.cpp') diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index a9423e053..64ea2ef6d 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -193,7 +193,7 @@ MainWindow::MainWindow() : QMainWindow(), if (!QIcon::hasThemeIcon("window-close")) { QIcon::setThemeName("subsurface"); } - connect(dive_list(), SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int))); + connect(dive_list(), &DiveListView::currentDiveChanged, this, &MainWindow::current_dive_changed); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), diveListView, SLOT(update())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), diveListView, SLOT(reloadHeaderActions())); @@ -535,11 +535,8 @@ void MainWindow::configureToolbar() { } } -void MainWindow::current_dive_changed(int divenr) +void MainWindow::current_dive_changed() { - if (divenr >= 0) { - select_dive(divenr); - } graphics()->plotDive(nullptr, false, true); information()->updateDiveInfo(); configureToolbar(); -- cgit v1.2.3-70-g09d2