diff options
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 1cabdfacf..74851cef0 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -110,6 +110,20 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent) scene()->addItem(plusTime); connect(plusTime, SIGNAL(clicked()), this, SLOT(increaseTime())); + lessDepth = new Button(); + lessDepth->setPixmap(QPixmap(":minimum")); + lessDepth->setPos(fromPercent(2, Qt::Horizontal), fromPercent(5, Qt::Vertical)); + lessDepth->setToolTip("Decreases maximum depth by 10m"); + scene()->addItem(lessDepth); + connect(lessDepth, SIGNAL(clicked()), this, SLOT(decreaseDepth())); + + lessTime = new Button(); + lessTime->setPixmap(QPixmap(":minimum")); + lessTime->setPos(fromPercent(92, Qt::Horizontal), fromPercent(95, Qt::Vertical)); + lessTime->setToolTip("Decreases minimum dive time by 10m"); + scene()->addItem(lessTime); + connect(lessTime, SIGNAL(clicked()), this, SLOT(decreaseTime())); + okBtn = new Button(); okBtn->setText(tr("Ok")); okBtn->setPos(fromPercent(1, Qt::Horizontal), fromPercent(95, Qt::Vertical)); @@ -295,6 +309,31 @@ void DivePlannerGraphics::increaseTime() createDecoStops(); } +void DivePlannerGraphics::decreaseDepth() +{ + if (depthLine->maximum() - 10 < MIN_DEEPNESS) + return; + + Q_FOREACH(DiveHandler *d, handles){ + if (depthLine->valueAt(d->pos()) > depthLine->maximum() - 10){ + QMessageBox::warning(mainWindow(), + tr("Handler Position Error"), + tr("One or more of your stops will be lost with this operations, \n" + "Please, remove them first.")); + return; + } + } + + depthLine->setMaximum(depthLine->maximum() - 10); + depthLine->updateTicks(); + createDecoStops(); +} + +void DivePlannerGraphics::decreaseTime() +{ + +} + void DivePlannerGraphics::mouseDoubleClickEvent(QMouseEvent* event) { QPointF mappedPos = mapToScene(event->pos()); |