summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-01-15 12:00:23 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-16 10:12:30 +0700
commitb50ae8700746f172350611b088e9f0d761768680 (patch)
tree8c284fb076ed7217b41e0bc57647e0beaa975ae9 /qt-ui
parent8773b4f9f0dd335e9326f9e45359332dd9f717de (diff)
downloadsubsurface-b50ae8700746f172350611b088e9f0d761768680.tar.gz
Initializing the new Profile Class.
Beginning of the code for the constructor, just constructing some of the items and preparing for the State Machine to come. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/profilewidget2.cpp35
-rw-r--r--qt-ui/profile/profilewidget2.h22
2 files changed, 53 insertions, 4 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 752644e27..ec832f9a8 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -1,7 +1,38 @@
#include "profilewidget2.h"
-
-ProfileWidget2::ProfileWidget2(QWidget *parent)
+#include "diveplotdatamodel.h"
+#include "divepixmapitem.h"
+#include "diverectitem.h"
+#include "divecartesianaxis.h"
+#include "diveprofileitem.h"
+#include <QStateMachine>
+
+ProfileWidget2::ProfileWidget2(QWidget *parent) :
+ QGraphicsView(parent),
+ dataModel(new DivePlotDataModel(this)),
+ currentState(INVALID),
+ stateMachine(new QStateMachine(this)),
+ background (new DivePixmapItem()),
+ profileYAxis(new DepthAxis()),
+ gasYAxis(new DiveCartesianAxis()),
+ timeAxis(new TimeAxis()),
+ depthController(new DiveRectItem()),
+ timeController(new DiveRectItem()),
+ diveProfileItem(new DiveProfileItem())
{
+ setScene(new QGraphicsScene());
+ scene()->setSceneRect(0, 0, 100, 100);
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ scene()->setItemIndexMethod(QGraphicsScene::NoIndex);
+ setOptimizationFlags(QGraphicsView::DontSavePainterState);
+ setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
+ setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
+
+ // Creating the needed items.
+ // ORDER: {BACKGROUND, PROFILE_Y_AXIS, GAS_Y_AXIS, TIME_AXIS, DEPTH_CONTROLLER, TIME_CONTROLLER, COLUMNS};
+ profileYAxis->setOrientation(Qt::Vertical);
+ gasYAxis->setOrientation(Qt::Vertical);
+ timeAxis->setOrientation(Qt::Horizontal);
}
// Currently just one dive, but the plan is to enable All of the selected dives.
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index b7eb4d45c..43d2e2b3d 100644
--- a/qt-ui/profile/profilewidget2.h
+++ b/qt-ui/profile/profilewidget2.h
@@ -2,7 +2,6 @@
#define PROFILEWIDGET2_H
#include <QGraphicsView>
-#include <QStateMachine>
// /* The idea of this widget is to display and edit the profile.
// * It has:
@@ -15,8 +14,15 @@
// * It needs to be dynamic, things should *flow* on it, not just appear / disappear.
// */
#include "graphicsview-common.h"
-
+struct DivePlotDataModel;
+struct DivePixmapItem;
+struct DiveRectItem;
+struct DepthAxis;
+struct DiveCartesianAxis;
+struct DiveProfileItem;
+struct TimeAxis;
struct dive;
+struct QStateMachine;
class ProfileWidget2 : public QGraphicsView {
Q_OBJECT
@@ -44,6 +50,18 @@ signals:
void startShowGasState();
void startShowTissueState();
void startHideTissueState();
+private:
+ DivePlotDataModel *dataModel;
+ State currentState;
+ QStateMachine *stateMachine;
+
+ DivePixmapItem *background ;
+ DepthAxis *profileYAxis ;
+ DiveCartesianAxis *gasYAxis;
+ TimeAxis *timeAxis;
+ DiveRectItem *depthController;
+ DiveRectItem *timeController;
+ DiveProfileItem *diveProfileItem;
};
#endif \ No newline at end of file