mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
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>
This commit is contained in:
parent
d776bb9eb3
commit
29cb15950e
2 changed files with 41 additions and 0 deletions
|
@ -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());
|
||||
|
|
|
@ -85,6 +85,8 @@ private slots:
|
|||
void keyRightAction();
|
||||
void increaseTime();
|
||||
void increaseDepth();
|
||||
void decreaseTime();
|
||||
void decreaseDepth();;
|
||||
void okClicked();
|
||||
void cancelClicked();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue