diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-07-02 13:43:48 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-07-02 13:43:48 -0700 |
commit | be6e6638de10fd120a7adeb5d85121f41e99a9c9 (patch) | |
tree | 40da4ef273388d3d276dafe07a3e814c70641257 /qt-ui/diveplanner.h | |
parent | 44c33742c26dcf9387b5c837c161e33ddc5eb060 (diff) | |
parent | 7c8bdf70d5300a0325c7c6cc8872373fc8274063 (diff) | |
download | subsurface-be6e6638de10fd120a7adeb5d85121f41e99a9c9.tar.gz |
Merge branch 'nitpicks' of github.com:tcanabrava/subsurface
Diffstat (limited to 'qt-ui/diveplanner.h')
-rw-r--r-- | qt-ui/diveplanner.h | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index fff6a6e57..e9dfd91e9 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -37,11 +37,14 @@ public: void setMaximum(double maximum); void setTickInterval(double interval); void setOrientation(Qt::Orientation orientation); + void setTickSize(qreal size); void updateTicks(); double minimum() const; double maximum() const; qreal valueAt(const QPointF& p); + qreal percentAt(const QPointF& p); qreal posAtValue(qreal value); + void setColor(const QColor& color); private: Qt::Orientation orientation; @@ -51,6 +54,7 @@ private: double interval; double posBegin; double posEnd; + double tickSize; }; class DivePlannerGraphics : public QGraphicsView { @@ -65,10 +69,11 @@ protected: virtual void mousePressEvent(QMouseEvent* event); virtual void mouseReleaseEvent(QMouseEvent* event); - void clearGeneratedDeco(); 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(); @@ -77,25 +82,43 @@ private slots: private: void moveActiveHandler(const QPointF& pos); + + /* This are the lines of the plotted dive. */ QList<QGraphicsLineItem*> lines; + + /* This is the user-entered handles. */ QList<DiveHandler *> handles; + + /* those are the lines that follows the mouse. */ QGraphicsLineItem *verticalLine; QGraphicsLineItem *horizontalLine; + + /* This is the handler that's being dragged. */ DiveHandler *activeDraggedHandler; + + // helper to save the positions where the drag-handler is valid. + QPointF lastValidPos; + + /* this is the background of the dive, the blue-gradient. */ QGraphicsPolygonItem *diveBg; + + /* This is the bottom ruler - the x axis, and it's associated text */ Ruler *timeLine; QGraphicsSimpleTextItem *timeString; + /* this is the left ruler, the y axis, and it's associated text. */ Ruler *depthLine; QGraphicsSimpleTextItem *depthString; - Button *plusTime; - Button *plusDepth; - Button *lessTime; - Button *lessDepth; - Button *okBtn; - Button *cancelBtn; - QPointF lastValidPos; + /* Buttons */ + Button *plusTime; // adds 10 minutes to the time ruler. + Button *plusDepth; // adds 10 meters to the depth ruler. + Button *lessTime; // remove 10 minutes to the time ruler. + 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 |