2017-04-27 18:26:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2017-04-04 17:21:30 +00:00
|
|
|
#include "TabDiveExtraInfo.h"
|
|
|
|
#include "ui_TabDiveExtraInfo.h"
|
2020-05-06 20:25:48 +00:00
|
|
|
#include "core/dive.h"
|
2022-04-04 16:57:28 +00:00
|
|
|
#include "core/selection.h"
|
2019-11-02 21:52:27 +00:00
|
|
|
#include "qt-models/divecomputerextradatamodel.h"
|
2017-04-04 17:21:30 +00:00
|
|
|
|
2022-09-09 16:12:31 +00:00
|
|
|
TabDiveExtraInfo::TabDiveExtraInfo(MainTab *parent) :
|
2017-04-04 17:21:30 +00:00
|
|
|
TabBase(parent),
|
|
|
|
ui(new Ui::TabDiveExtraInfo()),
|
2020-05-06 20:25:48 +00:00
|
|
|
extraDataModel(new ExtraDataModel(this))
|
2017-04-04 17:21:30 +00:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
ui->extraData->setModel(extraDataModel);
|
|
|
|
}
|
|
|
|
|
|
|
|
TabDiveExtraInfo::~TabDiveExtraInfo()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2022-09-04 09:04:01 +00:00
|
|
|
void TabDiveExtraInfo::updateData(const std::vector<dive *> &, dive *currentDive, int currentDC)
|
2017-04-04 17:21:30 +00:00
|
|
|
{
|
2024-06-30 18:38:12 +00:00
|
|
|
if (currentDive)
|
|
|
|
extraDataModel->updateDiveComputer(currentDive->get_dc(currentDC));
|
2024-05-08 11:35:52 +00:00
|
|
|
|
|
|
|
ui->extraData->setVisible(false); // This will cause the resize to include rows outside the current viewport
|
|
|
|
ui->extraData->resizeColumnsToContents();
|
|
|
|
ui->extraData->setVisible(true);
|
2017-04-04 17:21:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TabDiveExtraInfo::clear()
|
|
|
|
{
|
2020-05-06 20:25:48 +00:00
|
|
|
extraDataModel->clear();
|
2017-04-04 17:21:30 +00:00
|
|
|
}
|