diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-07-21 09:27:04 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-07-21 09:27:04 -0300 |
commit | 29cb15950e632dd70fa004f721c529c6d0c8041b (patch) | |
tree | 8af6b7bde4fd7fdd7c6cd3a3ab6d4c034b98c221 /qt-ui | |
parent | d776bb9eb35444aff80fbd2ec2390f3351ee4e4e (diff) | |
download | subsurface-29cb15950e632dd70fa004f721c529c6d0c8041b.tar.gz |
Added ( finally ) the code to reduce depth on the planner
Added the code to reduce depth on the planner. Depth
cannot be lower than 40m and it also won't let the
user reduce if there's any point on the 'reduced' area.
the icon is ugly - we need an artist.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/diveplanner.cpp | 39 | ||||
-rw-r--r-- | qt-ui/diveplanner.h | 2 |
2 files changed, 41 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()); diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index 7f33f044b..468df0ed9 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -85,6 +85,8 @@ private slots: void keyRightAction(); void increaseTime(); void increaseDepth(); + void decreaseTime(); + void decreaseDepth();; void okClicked(); void cancelClicked(); |