aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-22 20:31:27 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-22 20:59:50 -0700
commit775736395363ddfe65387b6e05d37546a4601ab9 (patch)
tree1492b5d608203e52be6831be2ce1393b8c7477ac /qt-ui
parent33135e37a5458419bd33192c0c924a30cbbb180f (diff)
downloadsubsurface-775736395363ddfe65387b6e05d37546a4601ab9.tar.gz
Re-enable dive computer selectiom
This had been disabled by some redraw optimizations in commit 81406b80c6ec ("Fix loading a second dive, after the first file was loaded."). We need to redraw the plot not only if the dive changed but also if the selected divecomputer changed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profilegraphics.cpp15
-rw-r--r--qt-ui/profilegraphics.h1
2 files changed, 9 insertions, 7 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index da18574ec..17217f967 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -114,7 +114,7 @@ extern struct ev_select *ev_namelist;
extern int evn_allocated;
extern int evn_used;
-ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0)
+ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0), diveDC(0)
{
gc.printer = false;
setScene(new QGraphicsScene());
@@ -222,11 +222,17 @@ void ProfileGraphicsView::clear()
void ProfileGraphicsView::plot(struct dive *d)
{
- if (dive == d)
+ struct divecomputer *dc;
+
+ if (d)
+ dc = select_dc(&d->dc);
+
+ if (dive == d && (d && dc == diveDC))
return;
clear();
dive = d;
+ diveDC = d ? dc : NULL;
if(!isVisible() || !dive){
return;
@@ -244,9 +250,6 @@ void ProfileGraphicsView::plot(struct dive *d)
scene()->addItem(toolTip);
- struct divecomputer *dc = &dive->dc;
-
-
// Fix this for printing / screen later.
// plot_set_scale(scale_mode_t);
@@ -283,8 +286,6 @@ void ProfileGraphicsView::plot(struct dive *d)
gc.maxx = (profile_grid_area.width() - 2 * profile_grid_area.x());
gc.maxy = (profile_grid_area.height() - 2 * profile_grid_area.y());
- dc = select_dc(dc);
-
/* This is per-dive-computer. Right now we just do the first one */
gc.pi = *create_plot_info(dive, dc, &gc);
diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h
index 453b8cf03..b8757b09a 100644
--- a/qt-ui/profilegraphics.h
+++ b/qt-ui/profilegraphics.h
@@ -98,6 +98,7 @@ private:
ToolTipItem *toolTip;
graphics_context gc;
struct dive *dive;
+ struct divecomputer *diveDC;
int zoomLevel;
// Top Level Items.