2013-04-14 03:44:02 +00:00
|
|
|
/*
|
|
|
|
* maintab.cpp
|
|
|
|
*
|
|
|
|
* classes for the "notebook" area of the main window of Subsurface
|
|
|
|
*
|
|
|
|
*/
|
2013-04-07 22:20:43 +00:00
|
|
|
#include "maintab.h"
|
|
|
|
#include "ui_maintab.h"
|
2013-04-13 13:17:59 +00:00
|
|
|
#include "addcylinderdialog.h"
|
|
|
|
|
|
|
|
#include <QLabel>
|
2013-04-07 22:20:43 +00:00
|
|
|
|
|
|
|
MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
2013-04-13 13:17:59 +00:00
|
|
|
ui(new Ui::MainTab()),
|
|
|
|
weightModel(new WeightModel()),
|
|
|
|
cylindersModel(new CylindersModel())
|
2013-04-07 22:20:43 +00:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2013-04-13 13:17:59 +00:00
|
|
|
ui->cylinders->setModel(cylindersModel);
|
|
|
|
ui->weights->setModel(weightModel);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainTab::clearEquipment()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainTab::clearInfo()
|
|
|
|
{
|
2013-04-14 13:56:51 +00:00
|
|
|
ui->sac->setText(QString());
|
|
|
|
ui->otu->setText(QString());
|
|
|
|
ui->oxygenhelium->setText(QString());
|
|
|
|
ui->gasused->setText(QString());
|
|
|
|
ui->date->setText(QString());
|
|
|
|
ui->divetime->setText(QString());
|
|
|
|
ui->surfinterval->setText(QString());
|
|
|
|
ui->maxdepth->setText(QString());
|
|
|
|
ui->avgdepth->setText(QString());
|
|
|
|
ui->visibility->setText(QString());
|
|
|
|
ui->watertemperature->setText(QString());
|
|
|
|
ui->airtemperature->setText(QString());
|
|
|
|
ui->airpress->setText(QString());
|
2013-04-13 13:17:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainTab::clearStats()
|
|
|
|
{
|
2013-04-14 13:56:51 +00:00
|
|
|
ui->maxdepth_2->setText(QString());
|
|
|
|
ui->mindepth->setText(QString());
|
|
|
|
ui->avgdepth->setText(QString());
|
|
|
|
ui->maxsac->setText(QString());
|
|
|
|
ui->minsac->setText(QString());
|
|
|
|
ui->avgsac->setText(QString());
|
|
|
|
ui->dives->setText(QString());
|
|
|
|
ui->maxtemp->setText(QString());
|
|
|
|
ui->mintemp->setText(QString());
|
|
|
|
ui->avgtemp->setText(QString());
|
|
|
|
ui->totaltime->setText(QString());
|
|
|
|
ui->avgtime->setText(QString());
|
|
|
|
ui->longestdive->setText(QString());
|
|
|
|
ui->shortestdive->setText(QString());
|
2013-04-13 13:17:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainTab::on_addCylinder_clicked()
|
|
|
|
{
|
2013-05-01 21:49:17 +00:00
|
|
|
if (cylindersModel->rowCount() >= MAX_CYLINDERS)
|
|
|
|
return;
|
|
|
|
|
2013-04-13 13:17:59 +00:00
|
|
|
AddCylinderDialog dialog(this);
|
|
|
|
cylinder_t *newCylinder = (cylinder_t*) malloc(sizeof(cylinder_t));
|
|
|
|
newCylinder->type.description = "";
|
|
|
|
|
|
|
|
dialog.setCylinder(newCylinder);
|
|
|
|
int result = dialog.exec();
|
|
|
|
if (result == QDialog::Rejected){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dialog.updateCylinder();
|
|
|
|
cylindersModel->add(newCylinder);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainTab::on_editCylinder_clicked()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainTab::on_delCylinder_clicked()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-05-01 21:30:34 +00:00
|
|
|
void MainTab::on_addWeight_clicked()
|
|
|
|
{
|
2013-05-01 21:49:17 +00:00
|
|
|
if (weightModel->rowCount() >= MAX_WEIGHTSYSTEMS)
|
|
|
|
return;
|
|
|
|
|
2013-05-01 21:30:34 +00:00
|
|
|
/* this needs a dialog - right now we just fill in a dummy */
|
|
|
|
weightsystem_t *newWeightsystem = (weightsystem_t *) malloc(sizeof(weightsystem_t));
|
|
|
|
newWeightsystem->description = "Just testing";
|
|
|
|
newWeightsystem->weight.grams = 15000;
|
|
|
|
weightModel->add(newWeightsystem);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainTab::on_editWeight_clicked()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainTab::on_delWeight_clicked()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-04-13 13:17:59 +00:00
|
|
|
void MainTab::reload()
|
|
|
|
{
|
|
|
|
cylindersModel->update();
|
2013-04-07 22:20:43 +00:00
|
|
|
}
|