diff options
-rw-r--r-- | qt-ui/diveplanner.cpp | 10 | ||||
-rw-r--r-- | qt-ui/diveplanner.h | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 7c355a64a..4a8ade9df 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -8,6 +8,7 @@ #include <QGraphicsWidget> #include <QGraphicsProxyWidget> #include <QPushButton> +#include <QGraphicsSceneMouseEvent> #include "ui_diveplanner.h" #include "mainwindow.h" @@ -119,6 +120,7 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent) scene()->addItem(cancelBtn); connect(cancelBtn, SIGNAL(clicked()), this, SLOT(cancelClicked())); + minMinutes = TIME_INITIAL_MAX; setRenderHint(QPainter::Antialiasing); } @@ -151,7 +153,10 @@ void DivePlannerGraphics::increaseDepth() void DivePlannerGraphics::increaseTime() { - qDebug() << "Increase Time Clicked"; + minMinutes += 10; + timeLine->setMaximum( minMinutes ); + timeLine->updateTicks(); + createDecoStops(); } void DivePlannerGraphics::mouseDoubleClickEvent(QMouseEvent* event) @@ -222,7 +227,7 @@ void DivePlannerGraphics::createDecoStops() if (timeLine->maximum() < dp->time / 60.0 + 5 || dp->time / 60.0 + 15 < timeLine->maximum()) { - double newMax = fmax(dp->time / 60.0 + 5, TIME_INITIAL_MAX); + double newMax = fmax(dp->time / 60.0 + 5, minMinutes); timeLine->setMaximum(newMax); timeLine->updateTicks(); } @@ -553,5 +558,6 @@ void Button::setText(const QString& t) void Button::mousePressEvent(QGraphicsSceneMouseEvent* event) { + event->ignore(); emit clicked(); } diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index a7459de1b..e9dfd91e9 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -72,8 +72,8 @@ protected: void createDecoStops(); bool isPointOutOfBoundaries(const QPointF& point); void deleteTemporaryDivePlan(struct divedatapoint* dp); - qreal fromPercent(qreal percent, Qt::Orientation orientation); + private slots: void increaseTime(); void increaseDepth(); @@ -117,6 +117,8 @@ private: Button *lessDepth; // remove 10 meters to the depth ruler. Button *okBtn; // accepts, and creates a new dive based on the plan. Button *cancelBtn; // rejects, and clears the dive plan. + + int minMinutes; // this holds the minimum duration of the dive. }; #endif |