mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Added button to reduce dive time on the planner.
Added a button and a method to reduce time on the dive planner. The dive planner will not reduce below deco-time and it will also not reduce below TIME_INITIAL_MAX. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
29cb15950e
commit
a6025c8efd
2 changed files with 17 additions and 1 deletions
|
@ -331,7 +331,19 @@ void DivePlannerGraphics::decreaseDepth()
|
|||
|
||||
void DivePlannerGraphics::decreaseTime()
|
||||
{
|
||||
|
||||
if (timeLine->maximum() -10 < TIME_INITIAL_MAX){
|
||||
qDebug() << "oi";
|
||||
return;
|
||||
}
|
||||
if (timeLine->maximum() - 10 < dpMaxTime){
|
||||
qDebug() << timeLine->maximum() << dpMaxTime;
|
||||
qDebug() << "Como?";
|
||||
return;
|
||||
}
|
||||
minMinutes -= 10;
|
||||
timeLine->setMaximum(timeLine->maximum() -10);
|
||||
timeLine->updateTicks();
|
||||
createDecoStops();
|
||||
}
|
||||
|
||||
void DivePlannerGraphics::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
|
@ -404,6 +416,8 @@ void DivePlannerGraphics::createDecoStops()
|
|||
while(dp->next)
|
||||
dp = dp->next;
|
||||
|
||||
dpMaxTime = dp->time / 60.0 + 5;
|
||||
|
||||
if (timeLine->maximum() < dp->time / 60.0 + 5 ||
|
||||
dp->time / 60.0 + 15 < timeLine->maximum()) {
|
||||
double newMax = fmax(dp->time / 60.0 + 5, minMinutes);
|
||||
|
@ -602,6 +616,7 @@ void DiveHandler::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
|||
|
||||
void Ruler::setMaximum(double maximum)
|
||||
{
|
||||
qDebug() << "Maximum set " << maximum;
|
||||
max = maximum;
|
||||
}
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ private:
|
|||
Button *cancelBtn; // rejects, and clears the dive plan.
|
||||
|
||||
int minMinutes; // this holds the minimum duration of the dive.
|
||||
int dpMaxTime; // this is the time of the dive calculated by the deco.
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue