mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
c78d0ad51b
commit
da52ff56b2
4 changed files with 87 additions and 40 deletions
|
@ -392,7 +392,7 @@ void MainWindow::readSettings()
|
|||
prefs.mod_ppO2 = v.toDouble();
|
||||
GET_BOOL(v, "ead", prefs.ead);
|
||||
GET_BOOL(v, "redceiling", prefs.profile_red_ceiling);
|
||||
GET_BOOL(v, "show_dc_reported_ceiling", prefs.profile_dc_ceiling);
|
||||
GET_BOOL(v, "dcceiling", prefs.profile_dc_ceiling);
|
||||
GET_BOOL(v, "calcceiling", prefs.profile_calc_ceiling);
|
||||
GET_BOOL(v, "calcceiling3m", prefs.calc_ceiling_3m_incr);
|
||||
v = settings.value(QString("gflow"));
|
||||
|
@ -471,6 +471,7 @@ void MainWindow::writeSettings()
|
|||
SAVE_VALUE("redceiling", profile_red_ceiling);
|
||||
SAVE_VALUE("calcceiling", profile_calc_ceiling);
|
||||
SAVE_VALUE("calcceiling3m", calc_ceiling_3m_incr);
|
||||
SAVE_VALUE("dcceiling", profile_dc_ceiling);
|
||||
SAVE_VALUE("gflow", gflow);
|
||||
SAVE_VALUE("gfhigh", gfhigh);
|
||||
settings.endGroup();
|
||||
|
|
|
@ -25,7 +25,6 @@ PreferencesDialog::PreferencesDialog(QWidget* parent, Qt::WindowFlags f) : QDial
|
|||
|
||||
// Graph
|
||||
s.beginGroup("TecDetails");
|
||||
ui->calculated_ceiling->setChecked(B(calcceiling, profile_calc_ceiling));
|
||||
ui->phe->setChecked(B(phegraph, pp_graphs.phe));
|
||||
ui->pheThreshold->setEnabled(ui->phe->isChecked());
|
||||
ui->po2->setChecked(B(po2graph, pp_graphs.po2));
|
||||
|
@ -37,8 +36,12 @@ PreferencesDialog::PreferencesDialog(QWidget* parent, Qt::WindowFlags f) : QDial
|
|||
ui->pn2Threshold->setValue(D(pn2threshold, pp_graphs.pn2_threshold));
|
||||
ui->ead_end_eadd->setChecked(B(ead, ead));
|
||||
ui->dc_reported_ceiling->setChecked(B(dcceiling, profile_dc_ceiling));
|
||||
ui->calculated_ceiling->setChecked(B(calceiling, profile_calc_ceiling));
|
||||
ui->red_ceiling->setEnabled(ui->dc_reported_ceiling->isChecked());
|
||||
ui->red_ceiling->setChecked(B(redceiling, profile_red_ceiling));
|
||||
ui->calculated_ceiling->setChecked(B(calcceiling, profile_calc_ceiling));
|
||||
ui->increment_3m->setEnabled(ui->calculated_ceiling->isChecked());
|
||||
ui->increment_3m->setChecked(B(calcceiling3m, calc_ceiling_3m_incr));
|
||||
|
||||
ui->gflow->setValue((int)(I(gflow, gflow)));
|
||||
ui->gfhigh->setValue((int)(I(gfhigh, gfhigh)));
|
||||
s.endGroup();
|
||||
|
@ -98,7 +101,6 @@ void PreferencesDialog::syncSettings()
|
|||
// Graph
|
||||
s.beginGroup("TecDetails");
|
||||
|
||||
SB("calcceiling", ui->calculated_ceiling);
|
||||
SB("phegraph", ui->phe);
|
||||
SB("po2graph", ui->po2);
|
||||
SB("pn2graph", ui->pn2);
|
||||
|
@ -107,7 +109,9 @@ void PreferencesDialog::syncSettings()
|
|||
s.setValue("pn2threshold", ui->pn2Threshold->value());
|
||||
SB("ead", ui->ead_end_eadd);
|
||||
SB("dcceiling", ui->dc_reported_ceiling);
|
||||
SB("calceiling3m", ui->increment_3m);
|
||||
SB("redceiling", ui->red_ceiling);
|
||||
SB("calcceiling", ui->calculated_ceiling);
|
||||
SB("calcceiling3m", ui->increment_3m);
|
||||
s.setValue("gflow", ui->gflow->value());
|
||||
s.setValue("gfhigh", ui->gfhigh->value());
|
||||
s.endGroup();
|
||||
|
|
|
@ -592,6 +592,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10b">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="dc_reported_ceiling">
|
||||
<property name="text">
|
||||
|
@ -599,6 +601,31 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6b">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="red_ceiling">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>draw ceiling red</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
|
@ -863,6 +890,22 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>dc_ceiling</sender>
|
||||
<signal>clicked(bool)</signal>
|
||||
<receiver>red_ceiling</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>288</x>
|
||||
<y>364</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>555</x>
|
||||
<y>371</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>calculated_ceiling</sender>
|
||||
<signal>clicked(bool)</signal>
|
||||
|
|
|
@ -1000,6 +1000,7 @@ void ProfileGraphicsView::plot_depth_profile()
|
|||
p.append(QPointF(SCALEGC(entry->sec, entry->depth)));
|
||||
|
||||
/* Show any ceiling we may have encountered */
|
||||
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 */
|
||||
|
@ -1010,6 +1011,7 @@ void ProfileGraphicsView::plot_depth_profile()
|
|||
p.append(QPointF(SCALEGC(entry->sec, entry->depth)));
|
||||
}
|
||||
}
|
||||
}
|
||||
pat.setColorAt(1, profile_color[DEPTH_BOTTOM].first());
|
||||
pat.setColorAt(0, profile_color[DEPTH_TOP].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,8 +1071,9 @@ 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 */
|
||||
if (prefs.profile_dc_ceiling) {
|
||||
pat.setColorAt(0, profile_color[CEILING_SHALLOW].first());
|
||||
pat.setColorAt(1, profile_color[CEILING_DEEP].first());
|
||||
|
||||
|
@ -1091,7 +1090,7 @@ void ProfileGraphicsView::plot_depth_profile()
|
|||
p.append(QPointF(SCALEGC(entry->sec, entry->depth)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
neatFill = new QGraphicsPolygonItem();
|
||||
neatFill->setPolygon(p);
|
||||
neatFill->setPen(QPen(QBrush(Qt::NoBrush),0));
|
||||
|
|
Loading…
Reference in a new issue