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>
This commit is contained in:
Tomaz Canabrava 2013-06-10 17:33:46 -03:00
parent 1baef83791
commit b4835badb6
2 changed files with 17 additions and 7 deletions

View file

@ -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;

View file

@ -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