blob: f8c69ed9c53640ecd208402c6484b0178add8f2e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/*
* maintab.cpp
*
* classes for the "notebook" area of the main window of Subsurface
*
*/
#include "maintab.h"
#include "ui_maintab.h"
#include "addcylinderdialog.h"
#include <QLabel>
MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui(new Ui::MainTab()),
weightModel(new WeightModel()),
cylindersModel(new CylindersModel())
{
ui->setupUi(this);
ui->cylinders->setModel(cylindersModel);
ui->weights->setModel(weightModel);
}
void MainTab::clearEquipment()
{
}
void MainTab::clearInfo()
{
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());
}
void MainTab::clearStats()
{
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());
}
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::on_addWeight_clicked()
{
/* 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()
{
}
void MainTab::reload()
{
cylindersModel->update();
}
|