summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-12-27 10:06:11 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-01-07 09:33:52 -0800
commitf1fc89b978c178fcd0f4f3ddb7629dc7df0d939d (patch)
tree14290d807253d3fc222da25ae9a283c365c59ca6 /desktop-widgets/mainwindow.cpp
parentb5704ddb57d905e66f5f71558bb07b2f165913a9 (diff)
downloadsubsurface-f1fc89b978c178fcd0f4f3ddb7629dc7df0d939d.tar.gz
Dive list: split DiveTripModel into distinct models (tree and list)
The DiveTripModel was used to represent both, trip and list views. Thus many functions had conditionals checking for the current mode and both modes had to be represented by the same data structure. Instead, split the model in two and derive them from a base class, which implements common functions and defines an interface. The model can be switched by a call to resetModel(), which invalidates any pointer obtained by instance(). This is quite surprising behavior. To handle it, straighten out the control flow: DiveListView --> MultiFilterSortModel --> DiveTripModelBase Before, DiveListView accessed DiveTripModelBase directly. A goal of this commit is to enable usage of the same model by mobile and desktop. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r--desktop-widgets/mainwindow.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 6c0b42c9d..aba1cfc63 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -702,7 +702,7 @@ void MainWindow::cleanUpEmpty()
mainTab->updateDiveInfo(true);
graphics->setEmptyState();
diveList->reload();
- diveList->setSortOrder(DiveTripModel::NR, Qt::DescendingOrder);
+ diveList->setSortOrder(DiveTripModelBase::NR, Qt::DescendingOrder);
MapWidget::instance()->reload();
if (!existing_filename)
setTitle();