aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-18 19:08:58 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-19 20:12:59 +0900
commit5e3f7ba22fe2dcb8af597d011bba16b3a7317c2a (patch)
tree59093563a68a469edcc1013cb8c4fc473e605273 /qt-ui/mainwindow.cpp
parentb36c8f07c7019fac1bc72d3b44a4486ea6d3458d (diff)
downloadsubsurface-5e3f7ba22fe2dcb8af597d011bba16b3a7317c2a.tar.gz
Fix selection after downloading dives from the dive computer
If we successfully download dives, the old selection should be cleared and the one of the newly downloaded dives should be selected. I decided to pick the last dive downloaded, which for most dive computers (but for example not for the Uemis SDA) will be the first or earliest of the dives. That seems much more intuitive than keeping the previous selection around. Of course this is harder than it should be because of the way we track selections and because we need a consistent dive list model in order to change the selection. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index f37b1c25d..efa50bc0c 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -124,14 +124,14 @@ MainWindow *MainWindow::instance()
}
// this gets called after we download dives from a divecomputer
-void MainWindow::refreshDisplay(bool recreateDiveList)
+void MainWindow::refreshDisplay(bool doRecreateDiveList)
{
showError(get_error_string());
ui.InfoWidget->reload();
TankInfoModel::instance()->update();
ui.globe->reload();
- if (recreateDiveList)
- ui.ListWidget->reload(DiveTripModel::CURRENT);
+ if (doRecreateDiveList)
+ recreateDiveList();
ui.ListWidget->setFocus();
WSInfoModel::instance()->updateInfo();
// refresh the yearly stats if the window has an instance
@@ -143,6 +143,11 @@ void MainWindow::refreshDisplay(bool recreateDiveList)
}
}
+void MainWindow::recreateDiveList()
+{
+ ui.ListWidget->reload(DiveTripModel::CURRENT);
+}
+
void MainWindow::current_dive_changed(int divenr)
{
if (divenr >= 0) {