From 7a443423bc633d8ea085879f9ad675cb134cc93c Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 6 May 2020 22:25:48 +0200 Subject: cleanup: generalize ExtraDataModel to display data of any dc The goal here is to remove a dependency on displayed_dive. While doing so, make the model more general and display any dc. Pass in the dc of the current dive instead of displayed dive, since all other tabs are already converted to show data of the current dive. The QStrings are cached since we generate them anyway, so we may just keep them. Thus, there is no danger of the dc becoming invalid. Signed-off-by: Berthold Stoeger --- desktop-widgets/tab-widgets/TabDiveExtraInfo.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'desktop-widgets/tab-widgets/TabDiveExtraInfo.cpp') diff --git a/desktop-widgets/tab-widgets/TabDiveExtraInfo.cpp b/desktop-widgets/tab-widgets/TabDiveExtraInfo.cpp index caf7c99bf..c078b7e40 100644 --- a/desktop-widgets/tab-widgets/TabDiveExtraInfo.cpp +++ b/desktop-widgets/tab-widgets/TabDiveExtraInfo.cpp @@ -1,12 +1,13 @@ // SPDX-License-Identifier: GPL-2.0 #include "TabDiveExtraInfo.h" #include "ui_TabDiveExtraInfo.h" +#include "core/dive.h" #include "qt-models/divecomputerextradatamodel.h" TabDiveExtraInfo::TabDiveExtraInfo(QWidget *parent) : TabBase(parent), ui(new Ui::TabDiveExtraInfo()), - extraDataModel(new ExtraDataModel()) + extraDataModel(new ExtraDataModel(this)) { ui->setupUi(this); ui->extraData->setModel(extraDataModel); @@ -19,11 +20,10 @@ TabDiveExtraInfo::~TabDiveExtraInfo() void TabDiveExtraInfo::updateData() { - extraDataModel->updateDive(); + extraDataModel->updateDiveComputer(current_dc); } void TabDiveExtraInfo::clear() { - extraDataModel->updateDive(); + extraDataModel->clear(); } - -- cgit v1.2.3-70-g09d2