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()
|
|
|
|
{
|
|
|
|
QList<QLabel*> labels;
|
|
|
|
labels << ui->sac << ui->otu << ui->oxygenhelium << ui->gasused
|
|
|
|
<< ui->date << ui->divetime << ui->surfinterval
|
|
|
|
<< ui->maxdepth << ui->avgdepth << ui->visibility
|
|
|
|
<< ui->watertemperature << ui->airtemperature << ui->airpress;
|
|
|
|
|
|
|
|
Q_FOREACH(QLabel *l, labels){
|
|
|
|
l->setText(QString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainTab::clearStats()
|
|
|
|
{
|
|
|
|
QList<QLabel*> labels;
|
|
|
|
labels << ui->maxdepth_2 << ui->mindepth << ui->avgdepth
|
|
|
|
<< ui->maxsac << ui->minsac << ui->avgsac
|
|
|
|
<< ui->dives << ui->maxtemp << ui->mintemp << ui->avgtemp
|
|
|
|
<< ui->totaltime << ui->avgtime << ui->longestdive << ui->shortestdive;
|
|
|
|
|
|
|
|
Q_FOREACH(QLabel *l, labels){
|
|
|
|
l->setText(QString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainTab::on_addCylinder_clicked()
|
|
|
|
{
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainTab::reload()
|
|
|
|
{
|
|
|
|
cylindersModel->update();
|
2013-04-07 22:20:43 +00:00
|
|
|
}
|