diff options
Diffstat (limited to 'qt-ui/profile/profilewidget2.h')
-rw-r--r-- | qt-ui/profile/profilewidget2.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h index d00cb26c1..3c3d86d01 100644 --- a/qt-ui/profile/profilewidget2.h +++ b/qt-ui/profile/profilewidget2.h @@ -40,6 +40,9 @@ class DiveCalculatedTissue; class PartialPressureGasItem; class PartialGasPressureAxis; class AbstractProfilePolygonItem; +class DiveHandler; +class QGraphicsSimpleTextItem; +class QModelIndex; class ProfileWidget2 : public QGraphicsView { Q_OBJECT @@ -64,28 +67,47 @@ public: ProfileWidget2(QWidget *parent = 0); void plotDives(QList<dive *> dives); - void replot(); virtual bool eventFilter(QObject *, QEvent *); void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, DivePlotDataModel *model, int vData, int hData, int zValue); void setPrintMode(bool mode, bool grayscale = false); + bool isPointOutOfBoundaries(const QPointF &point) const; + State currentState; public slots: // Necessary to call from QAction's signals. void settingsChanged(); void setEmptyState(); void setProfileState(); + void setPlanState(); + void setAddState(); void changeGas(); void addBookmark(); void hideEvents(); void unhideEvents(); void removeEvent(); void editName(); + void makeFirstDC(); + void pointInserted(const QModelIndex &parent, int start, int end); + void pointsRemoved(const QModelIndex &, int start, int end); + void replot(); + + /* this is called for every move on the handlers. maybe we can speed up this a bit? */ + void recreatePlannedDive(); + + /* key press handlers */ + void keyEscAction(); + void keyDeleteAction(); + void keyUpAction(); + void keyDownAction(); + void keyLeftAction(); + void keyRightAction(); protected: virtual void resizeEvent(QResizeEvent *event); virtual void wheelEvent(QWheelEvent *event); virtual void mouseMoveEvent(QMouseEvent *event); virtual void contextMenuEvent(QContextMenuEvent *event); + virtual void mouseDoubleClickEvent(QMouseEvent *event); private: /*methods*/ void fixBackgroundPos(); @@ -94,10 +116,10 @@ private: /*methods*/ void setupItemSizes(); void addItemsToScene(); void setupItemOnScene(); + void disconnectTemporaryConnections(); private: DivePlotDataModel *dataModel; - State currentState; int zoomLevel; qreal zoomFactor; DivePixmapItem *background; @@ -130,6 +152,14 @@ private: RulerItem2 *rulerItem; bool isGrayscale; bool printMode; + + //specifics for ADD and PLAN + QList<DiveHandler *> handles; + QList<QGraphicsSimpleTextItem *> gases; + void repositionDiveHandlers(); + int fixHandlerIndex(DiveHandler *activeHandler); + friend class DiveHandler; + QHash<Qt::Key, QAction *> actionsForKeys; }; #endif // PROFILEWIDGET2_H |