summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.h
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-08-26 13:18:21 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-08-26 13:18:21 -0300
commit024dd80664a160671922043762491d11f7d60b5a (patch)
treee5ccd02886afa42ec013c8123f0b8cb48d2403d2 /qt-ui/diveplanner.h
parent9856aaaa863b03994b2befdb255050a6686d6c12 (diff)
downloadsubsurface-024dd80664a160671922043762491d11f7d60b5a.tar.gz
First implementation of the Shared Model for the Planner
This implementation of the shared model already shares some, but not all data between the two views, but it's already a huge improvement. When the user clicks on the visual planner, it will update the view on the qt-widget based view. The editing of the view is still not allowed, and removing nodes is not allowed too ( yet. ) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/diveplanner.h')
-rw-r--r--qt-ui/diveplanner.h43
1 files changed, 37 insertions, 6 deletions
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index dad13cd05..ab466da8e 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -5,6 +5,9 @@
#include <QGraphicsPathItem>
#include <QDialog>
#include <QAbstractTableModel>
+#include <QDateTime>
+
+#include "dive.h"
namespace Ui{
class DivePlanner;
@@ -19,12 +22,30 @@ class DivePlannerPointsModel : public QAbstractTableModel{
public:
static DivePlannerPointsModel* instance();
enum Sections{DEPTH, DURATION, GAS, CCSETPOINT, COLUMNS};
- virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
- virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
- virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
+ virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
+ virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
+ virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+
+ /**
+ * @return the row number.
+ */
+ int addStop(int meters, int minutes,const QString& gas, int ccpoint );
+
+public slots:
+ void setGFHigh(short gfhigh);
+ void setGFLow(short ghflow);
+ void setSurfacePressure(int pressure);
+ void setBottomSac(int sac);
+ void setDecoSac(int sac);
+ void setStartTime(const QTime& t);
+ void setLastStop6m(bool value);
+ void createPlan();
+
private:
- explicit DivePlannerPointsModel(QObject* parent = 0);
+ explicit DivePlannerPointsModel(QObject* parent = 0);
+ struct diveplan diveplan;
+ QVector<divedatapoint> divepoints;
};
class Button : public QObject, public QGraphicsRectItem {
@@ -49,7 +70,7 @@ public:
int sec;
int mm;
protected:
- void mousePressEvent(QGraphicsSceneMouseEvent* event);
+ void mousePressEvent(QGraphicsSceneMouseEvent* event);
};
class Ruler : public QGraphicsLineItem{
@@ -165,6 +186,16 @@ class DivePlannerWidget : public QWidget {
Q_OBJECT
public:
explicit DivePlannerWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
+
+public slots:
+ void startTimeChanged(const QTime& time);
+ void atmPressureChanged(const QString& pressure);
+ void bottomSacChanged(const QString& bottomSac);
+ void decoSacChanged(const QString& decosac);
+ void gflowChanged(const QString& gflow);
+ void gfhighChanged(const QString& gfhigh);
+ void lastStopChanged(bool checked);
+
private:
Ui::DivePlanner *ui;
};