diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-07-02 10:53:08 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-07-02 10:53:08 -0300 |
commit | c98894fd5200008a8ef77b748bd5bdb4684cebdd (patch) | |
tree | fdf0f1cd88b50dcc925d5928de76b576f86b2781 /qt-ui/diveplanner.h | |
parent | ca517f1bf8f3c690e2d3651d7f74e1b68ed3bb98 (diff) | |
download | subsurface-c98894fd5200008a8ef77b748bd5bdb4684cebdd.tar.gz |
Added a method and a simple stub to position things using percentage.
Added a method and a simple stub to position things on the canvas
using percentage - this way I have a proper control on where I want
to put things on screen and it will make simpler for future changes,
even if the amount of code written is a bit bigger.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/diveplanner.h')
-rw-r--r-- | qt-ui/diveplanner.h | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index fff6a6e57..5f0ec7e08 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -65,10 +65,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 +78,41 @@ 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. }; #endif |