mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
1e4d360d0c
This patch makes the behavior of inserting new hanflers correct. it can only be inserted now inside of the plane defined by the Depth ruler and Time ruler. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
87 lines
1.8 KiB
C++
87 lines
1.8 KiB
C++
#ifndef DIVEPLANNER_H
|
|
#define DIVEPLANNER_H
|
|
|
|
#include <QGraphicsView>
|
|
#include <QGraphicsPathItem>
|
|
#include <QDialog>
|
|
|
|
class DiveHandler : public QGraphicsEllipseItem{
|
|
public:
|
|
DiveHandler();
|
|
QGraphicsLineItem *from;
|
|
QGraphicsLineItem *to;
|
|
qreal time;
|
|
qreal depth;
|
|
};
|
|
|
|
class Ruler : public QGraphicsLineItem{
|
|
public:
|
|
Ruler();
|
|
void setMinimum(double minimum);
|
|
void setMaximum(double maximum);
|
|
void setTickInterval(double interval);
|
|
void setOrientation(Qt::Orientation orientation);
|
|
void updateTicks();
|
|
double minimum() const;
|
|
double maximum() const;
|
|
qreal valueAt(const QPointF& p);
|
|
qreal posAtValue(qreal value);
|
|
|
|
private:
|
|
Qt::Orientation orientation;
|
|
QList<QGraphicsLineItem*> ticks;
|
|
double min;
|
|
double max;
|
|
double interval;
|
|
double posBegin;
|
|
double posEnd;
|
|
};
|
|
|
|
class DivePlannerGraphics : public QGraphicsView {
|
|
Q_OBJECT
|
|
public:
|
|
DivePlannerGraphics(QWidget* parent = 0);
|
|
protected:
|
|
virtual void mouseDoubleClickEvent(QMouseEvent* event);
|
|
virtual void showEvent(QShowEvent* event);
|
|
virtual void resizeEvent(QResizeEvent* event);
|
|
virtual void mouseMoveEvent(QMouseEvent* event);
|
|
virtual void mousePressEvent(QMouseEvent* event);
|
|
virtual void mouseReleaseEvent(QMouseEvent* event);
|
|
|
|
void clear_generated_deco();
|
|
void create_deco_stop();
|
|
bool isPointOutOfBoundaries(QPointF point);
|
|
|
|
private:
|
|
|
|
void moveActiveHandler(QPointF pos);
|
|
QList<QGraphicsLineItem*> lines;
|
|
QList<DiveHandler *> handles;
|
|
QGraphicsLineItem *verticalLine;
|
|
QGraphicsLineItem *horizontalLine;
|
|
DiveHandler *activeDraggedHandler;
|
|
|
|
Ruler *timeLine;
|
|
QGraphicsSimpleTextItem *timeString;
|
|
|
|
Ruler *depthLine;
|
|
QGraphicsSimpleTextItem *depthString;
|
|
|
|
};
|
|
|
|
namespace Ui{
|
|
class DivePlanner;
|
|
}
|
|
|
|
class DivePlanner : public QDialog{
|
|
Q_OBJECT
|
|
public:
|
|
static DivePlanner *instance();
|
|
struct dive* getDive();
|
|
|
|
private:
|
|
DivePlanner();
|
|
Ui::DivePlanner *ui;
|
|
};
|
|
#endif
|