mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 22:35:27 +00:00
Make the Plus Button on the planner work.
Clicking on the plus button now adds a new stop on the planner. The depth is always 10m and the time is 10 minutes after the last stop. can be changed by double clicking or dragging the balls around the canvas. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
813722633d
commit
923b4cd9b1
2 changed files with 15 additions and 2 deletions
|
@ -830,6 +830,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget* parent, Qt::WindowFlags f): QWidge
|
|||
ui->tableWidget->setModel(DivePlannerPointsModel::instance());
|
||||
ui->tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::GAS, new AirTypesDelegate(this));
|
||||
|
||||
connect(ui->tableWidget, SIGNAL(addButtonClicked()), DivePlannerPointsModel::instance(), SLOT(addStop()));
|
||||
connect(ui->startTime, SIGNAL(timeChanged(QTime)), this, SLOT(startTimeChanged(QTime)));
|
||||
connect(ui->ATMPressure, SIGNAL(textChanged(QString)), this, SLOT(atmPressureChanged(QString)));
|
||||
connect(ui->bottomSAC, SIGNAL(textChanged(QString)), this, SLOT(bottomSacChanged(QString)));
|
||||
|
@ -846,7 +847,6 @@ DivePlannerWidget::DivePlannerWidget(QWidget* parent, Qt::WindowFlags f): QWidge
|
|||
ui->decoStopSAC->setText("17");
|
||||
ui->lowGF->setText("30");
|
||||
ui->highGF->setText("75");
|
||||
|
||||
}
|
||||
|
||||
void DivePlannerWidget::startTimeChanged(const QTime& time)
|
||||
|
@ -1026,6 +1026,18 @@ bool divePointsLessThan(const divedatapoint& p1, const divedatapoint& p2){
|
|||
int DivePlannerPointsModel::addStop(int meters, int minutes, const QString& gas, int ccpoint)
|
||||
{
|
||||
int row = divepoints.count();
|
||||
if(meters == 0 && minutes == 0){
|
||||
if(row == 0){
|
||||
meters = 10000;
|
||||
minutes = 600;
|
||||
}
|
||||
else{
|
||||
divedatapoint p = at(row-1);
|
||||
meters = p.depth;
|
||||
minutes = p.time + 600;
|
||||
}
|
||||
}
|
||||
|
||||
// check if there's already a new stop before this one:
|
||||
for(int i = 0; i < divepoints.count(); i++){
|
||||
const divedatapoint& dp = divepoints.at(i);
|
||||
|
@ -1048,6 +1060,7 @@ int DivePlannerPointsModel::addStop(int meters, int minutes, const QString& gas,
|
|||
divedatapoint before = at(row-1);
|
||||
point.o2 = before.o2;
|
||||
point.he = before.he;
|
||||
point.po2 = 0;
|
||||
}
|
||||
divepoints.append( point );
|
||||
std::sort(divepoints.begin(), divepoints.end(), divePointsLessThan);
|
||||
|
|
|
@ -36,11 +36,11 @@ public:
|
|||
/**
|
||||
* @return the row number.
|
||||
*/
|
||||
int addStop(int meters, int minutes,const QString& gas, int ccpoint );
|
||||
void editStop(int row, divedatapoint newData );
|
||||
divedatapoint at(int row);
|
||||
struct diveplan getDiveplan();
|
||||
public slots:
|
||||
int addStop(int meters = 0, int minutes = 0,const QString& gas = QString(), int ccpoint = 0 );
|
||||
void setGFHigh(short gfhigh);
|
||||
void setGFLow(short ghflow);
|
||||
void setSurfacePressure(int pressure);
|
||||
|
|
Loading…
Add table
Reference in a new issue