summaryrefslogtreecommitdiffstats
path: root/qt-ui/profilegraphics.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-29 15:32:31 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-29 15:32:31 +0900
commitda52ff56b2cc2b4aecda03b4f21f94ce3ff0ce22 (patch)
treefaf2bd2a5fc72f4f017f5b7a02285d8b835c6579 /qt-ui/profilegraphics.cpp
parentc78d0ad51b2495b4807ae999667b44432a05cb3b (diff)
downloadsubsurface-da52ff56b2cc2b4aecda03b4f21f94ce3ff0ce22.tar.gz
Correct the ceiling preference handling
Added the red dc ceiling as preference option. Hooked them all up together so the sub-preferences are enabled when the master preference is set (for 3m and red ceiling). Use the options in the profile plotting functions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profilegraphics.cpp')
-rw-r--r--qt-ui/profilegraphics.cpp57
1 files changed, 28 insertions, 29 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 060c36b51..663aefe25 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -1000,14 +1000,16 @@ void ProfileGraphicsView::plot_depth_profile()
p.append(QPointF(SCALEGC(entry->sec, entry->depth)));
/* Show any ceiling we may have encountered */
- for (i = gc.pi.nr - 1; i >= 0; i--, entry--) {
- if (entry->ndl) {
- /* non-zero NDL implies this is a safety stop, no ceiling */
- p.append(QPointF(SCALEGC(entry->sec, 0)));
- } else if (entry->stopdepth < entry->depth) {
- p.append(QPointF(SCALEGC(entry->sec, entry->stopdepth)));
- } else {
- p.append(QPointF(SCALEGC(entry->sec, entry->depth)));
+ if (prefs.profile_dc_ceiling) {
+ for (i = gc.pi.nr - 1; i >= 0; i--, entry--) {
+ if (entry->ndl) {
+ /* non-zero NDL implies this is a safety stop, no ceiling */
+ p.append(QPointF(SCALEGC(entry->sec, 0)));
+ } else if (entry->stopdepth < entry->depth) {
+ p.append(QPointF(SCALEGC(entry->sec, entry->stopdepth)));
+ } else {
+ p.append(QPointF(SCALEGC(entry->sec, entry->depth)));
+ }
}
}
pat.setColorAt(1, profile_color[DEPTH_BOTTOM].first());
@@ -1023,9 +1025,7 @@ void ProfileGraphicsView::plot_depth_profile()
/* if the user wants the deco ceiling more visible, do that here (this
* basically draws over the background that we had allowed to shine
* through so far) */
- // TODO: port the prefs.profile_red_ceiling to QSettings
-
- //if (prefs.profile_red_ceiling) {
+ if (prefs.profile_dc_ceiling && prefs.profile_red_ceiling) {
p.clear();
pat.setColorAt(0, profile_color[CEILING_SHALLOW].first());
pat.setColorAt(1, profile_color[CEILING_DEEP].first());
@@ -1049,12 +1049,10 @@ void ProfileGraphicsView::plot_depth_profile()
neatFill->setPolygon(p);
neatFill->setPen(QPen(QBrush(Qt::NoBrush),0));
scene()->addItem(neatFill);
- //}
+ }
/* finally, plot the calculated ceiling over all this */
- // TODO: Port the profile_calc_ceiling to QSettings
- // if (prefs.profile_calc_ceiling) {
-
+ if (prefs.profile_calc_ceiling) {
pat.setColorAt(0, profile_color[CALC_CEILING_SHALLOW].first());
pat.setColorAt(1, profile_color[CALC_CEILING_DEEP].first());
@@ -1073,25 +1071,26 @@ void ProfileGraphicsView::plot_depth_profile()
neatFill->setPen(QPen(QBrush(Qt::NoBrush),0));
neatFill->setBrush(pat);
scene()->addItem(neatFill);
- //}
+ }
/* next show where we have been bad and crossed the dc's ceiling */
- pat.setColorAt(0, profile_color[CEILING_SHALLOW].first());
- pat.setColorAt(1, profile_color[CEILING_DEEP].first());
-
- entry = gc.pi.entry;
- p.clear();
- p.append(QPointF(SCALEGC(0, 0)));
- for (i = 0; i < gc.pi.nr; i++, entry++)
- p.append(QPointF(SCALEGC(entry->sec, entry->depth)));
+ if (prefs.profile_dc_ceiling) {
+ pat.setColorAt(0, profile_color[CEILING_SHALLOW].first());
+ pat.setColorAt(1, profile_color[CEILING_DEEP].first());
- for (i = gc.pi.nr - 1; i >= 0; i--, entry--) {
- if (entry->ndl == 0 && entry->stopdepth > entry->depth) {
- p.append(QPointF(SCALEGC(entry->sec, entry->stopdepth)));
- } else {
+ entry = gc.pi.entry;
+ p.clear();
+ p.append(QPointF(SCALEGC(0, 0)));
+ for (i = 0; i < gc.pi.nr; i++, entry++)
p.append(QPointF(SCALEGC(entry->sec, entry->depth)));
+
+ for (i = gc.pi.nr - 1; i >= 0; i--, entry--) {
+ if (entry->ndl == 0 && entry->stopdepth > entry->depth) {
+ p.append(QPointF(SCALEGC(entry->sec, entry->stopdepth)));
+ } else {
+ p.append(QPointF(SCALEGC(entry->sec, entry->depth)));
+ }
}
}
-
neatFill = new QGraphicsPolygonItem();
neatFill->setPolygon(p);
neatFill->setPen(QPen(QBrush(Qt::NoBrush),0));