2013-06-20 15:33:26 +00:00
|
|
|
#ifndef DIVEPLANNER_H
|
|
|
|
#define DIVEPLANNER_H
|
|
|
|
|
|
|
|
#include <QGraphicsView>
|
|
|
|
#include <QGraphicsPathItem>
|
2013-06-20 21:40:59 +00:00
|
|
|
#include <QDialog>
|
2013-06-20 15:33:26 +00:00
|
|
|
|
2013-06-20 17:29:32 +00:00
|
|
|
class DiveHandler : public QGraphicsEllipseItem{
|
|
|
|
public:
|
|
|
|
DiveHandler();
|
|
|
|
QGraphicsLineItem *from;
|
|
|
|
QGraphicsLineItem *to;
|
2013-06-20 20:34:42 +00:00
|
|
|
qreal time;
|
|
|
|
qreal depth;
|
2013-06-20 17:29:32 +00:00
|
|
|
};
|
2013-06-20 18:52:27 +00:00
|
|
|
|
2013-06-20 19:48:24 +00:00
|
|
|
class Ruler : public QGraphicsLineItem{
|
2013-06-20 18:52:27 +00:00
|
|
|
public:
|
|
|
|
Ruler();
|
|
|
|
void setMinimum(double minimum);
|
|
|
|
void setMaximum(double maximum);
|
|
|
|
void setTickInterval(double interval);
|
|
|
|
void setOrientation(Qt::Orientation orientation);
|
2013-06-20 19:48:24 +00:00
|
|
|
void updateTicks();
|
2013-06-21 19:07:44 +00:00
|
|
|
double minimum() const;
|
|
|
|
double maximum() const;
|
2013-06-20 20:34:42 +00:00
|
|
|
qreal valueAt(const QPointF& p);
|
2013-06-20 21:25:03 +00:00
|
|
|
qreal posAtValue(qreal value);
|
2013-06-20 18:52:27 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Qt::Orientation orientation;
|
|
|
|
QList<QGraphicsLineItem*> ticks;
|
|
|
|
double min;
|
|
|
|
double max;
|
2013-06-20 19:48:24 +00:00
|
|
|
double interval;
|
2013-06-20 18:52:27 +00:00
|
|
|
double posBegin;
|
|
|
|
double posEnd;
|
|
|
|
};
|
|
|
|
|
2013-06-20 21:40:59 +00:00
|
|
|
class DivePlannerGraphics : public QGraphicsView {
|
2013-06-20 15:33:26 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-06-20 21:40:59 +00:00
|
|
|
DivePlannerGraphics(QWidget* parent = 0);
|
2013-06-20 15:37:41 +00:00
|
|
|
protected:
|
|
|
|
virtual void mouseDoubleClickEvent(QMouseEvent* event);
|
2013-06-20 16:28:04 +00:00
|
|
|
virtual void showEvent(QShowEvent* event);
|
|
|
|
virtual void resizeEvent(QResizeEvent* event);
|
2013-06-20 16:53:12 +00:00
|
|
|
virtual void mouseMoveEvent(QMouseEvent* event);
|
2013-06-20 17:46:40 +00:00
|
|
|
virtual void mousePressEvent(QMouseEvent* event);
|
|
|
|
virtual void mouseReleaseEvent(QMouseEvent* event);
|
2013-06-20 18:15:10 +00:00
|
|
|
|
2013-06-20 16:20:41 +00:00
|
|
|
void clear_generated_deco();
|
|
|
|
void create_deco_stop();
|
2013-06-21 19:28:17 +00:00
|
|
|
bool isPointOutOfBoundaries(const QPointF& point);
|
2013-06-20 17:29:32 +00:00
|
|
|
|
2013-06-20 15:33:26 +00:00
|
|
|
private:
|
2013-06-20 21:40:59 +00:00
|
|
|
|
2013-06-21 19:28:17 +00:00
|
|
|
void moveActiveHandler(const QPointF& pos);
|
2013-06-20 16:20:41 +00:00
|
|
|
QList<QGraphicsLineItem*> lines;
|
2013-06-20 17:29:32 +00:00
|
|
|
QList<DiveHandler *> handles;
|
2013-06-20 16:53:12 +00:00
|
|
|
QGraphicsLineItem *verticalLine;
|
|
|
|
QGraphicsLineItem *horizontalLine;
|
2013-06-20 17:46:40 +00:00
|
|
|
DiveHandler *activeDraggedHandler;
|
2013-06-20 19:48:24 +00:00
|
|
|
|
|
|
|
Ruler *timeLine;
|
2013-06-20 20:54:36 +00:00
|
|
|
QGraphicsSimpleTextItem *timeString;
|
|
|
|
|
2013-06-20 19:48:24 +00:00
|
|
|
Ruler *depthLine;
|
2013-06-20 20:54:36 +00:00
|
|
|
QGraphicsSimpleTextItem *depthString;
|
2013-06-20 19:48:24 +00:00
|
|
|
|
2013-06-20 15:33:26 +00:00
|
|
|
};
|
2013-06-20 21:40:59 +00:00
|
|
|
|
|
|
|
namespace Ui{
|
|
|
|
class DivePlanner;
|
|
|
|
}
|
|
|
|
|
|
|
|
class DivePlanner : public QDialog{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
static DivePlanner *instance();
|
|
|
|
struct dive* getDive();
|
|
|
|
|
|
|
|
private:
|
|
|
|
DivePlanner();
|
|
|
|
Ui::DivePlanner *ui;
|
|
|
|
};
|
2013-06-20 15:33:26 +00:00
|
|
|
#endif
|