summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-11-15 20:59:13 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-16 08:29:53 -0800
commit8a33c04894d6830885d7f47140962d5fdafd648f (patch)
treead14b83881042f4d9ec2f6dcdcc2db5d9a81fb43 /desktop-widgets/mainwindow.cpp
parentf0a89759bf38375d32ad70ba4710a98d30a47e5d (diff)
downloadsubsurface-8a33c04894d6830885d7f47140962d5fdafd648f.tar.gz
Cleanup: use DiveTripModelBase::clear() to reset the log
Introduce a DiveTripModelBase::clear() function that cleanly clears all dive data inside a beginResetModel()/endResetModel() pair. Thus, the UI will be cleanly reset and we can remove explicit calls to - graphics->setEmptyState() - mainTab->clearTabs() - mainTab->clearTabs() - diveList->reload() from MainWindow::closeCurrentFile(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r--desktop-widgets/mainwindow.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 632917733..7b3120ca4 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -657,12 +657,8 @@ void MainWindow::closeCurrentFile()
{
/* free the dives and trips */
clear_git_id();
- clear_dive_file_data();
+ DiveTripModelBase::instance()->clear();
setCurrentFile(nullptr);
- graphics->setEmptyState();
- mainTab->clearTabs();
- mainTab->updateDiveInfo();
- diveList->reload();
diveList->setSortOrder(DiveTripModelBase::NR, Qt::DescendingOrder);
MapWidget::instance()->reload();
LocationInformationModel::instance()->update();