mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
b5704ddb57
commit
f1fc89b978
8 changed files with 663 additions and 442 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue