aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-10 17:33:46 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-10 17:33:46 -0300
commitb4835badb6addf8385b7800c673b25789089ea84 (patch)
treef4772d2292522cd44829db41577630cfa93a6753
parent1baef83791ce1dd29b4784420dc9c34cd5ff9680 (diff)
downloadsubsurface-b4835badb6addf8385b7800c673b25789089ea84.tar.gz
Added a 'Plan' mode and a 'Dive' mode on the profile.
Added a 'Plan' mode and a 'Dive' mode on the profile. Those modes tell the application what can be done: Plan - the dive's dinamyc and can be changed, 'Dive', the dive is fixed ( most probably downloaded from a dive computer and it's readonly. ) - now I need to properly populate stuff. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
-rw-r--r--qt-ui/profilegraphics.cpp20
-rw-r--r--qt-ui/profilegraphics.h4
2 files changed, 17 insertions, 7 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 1c6f76209..816a61827 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -268,6 +268,19 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
dc = fake_dc(dc);
}
+ QString nick(get_dc_nickname(dc->model, dc->deviceid));
+ if (nick.isEmpty())
+ nick = QString(dc->model);
+
+ if (nick.isEmpty())
+ nick = tr("unknown divecomputer");
+
+ if ( tr("unknown divecomputer") == nick){
+ mode = PLAN;
+ }else{
+ mode = DIVE;
+ }
+
/*
* Set up limits that are independent of
* the dive computer
@@ -309,13 +322,6 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
scene()->addItem(rect);
/* Put the dive computer name in the lower left corner */
- QString nick(get_dc_nickname(dc->model, dc->deviceid));
- if (nick.isEmpty())
- nick = QString(dc->model);
-
- if (nick.isEmpty())
- nick = tr("unknown divecomputer");
-
gc.leftx = 0; gc.rightx = 1.0;
gc.topy = 0; gc.bottomy = 1.0;
diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h
index 2e4f0d596..a4d943233 100644
--- a/qt-ui/profilegraphics.h
+++ b/qt-ui/profilegraphics.h
@@ -68,6 +68,8 @@ class ProfileGraphicsView : public QGraphicsView
{
Q_OBJECT
public:
+ enum Mode{DIVE, PLAN};
+
ProfileGraphicsView(QWidget* parent = 0);
void plot(struct dive *d, bool forceRedraw = FALSE);
bool eventFilter(QObject* obj, QEvent* event);
@@ -117,6 +119,8 @@ private:
QGraphicsItem* timeMarkers;
QGraphicsItem* depthMarkers;
QGraphicsItem* diveComputer;
+
+ enum Mode mode;
};
#endif