Cleanup minor issues with ceilings for individualy tissues

In commit b8d31d8534b ("Show ceilings for individual tissues") Robert
inadvertently broke the connection from dc_ceilings to red_ceilings and
also didn't correctly enable the checkbox for all_tissues when
calc_ceilings was already set in the preferences before the dialog was
created (and therefore the connection in the .ui file isn't run).

There's also a simplification / cleanup to the code deciding whether to
show all the tissues.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-05-31 05:28:24 +09:00
parent 344a429e48
commit 32d8051404
3 changed files with 81 additions and 67 deletions

View file

@ -41,7 +41,7 @@ PreferencesDialog::PreferencesDialog(QWidget* parent, Qt::WindowFlags f) : QDial
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->all_tissues->setEnabled(ui->all_tissues->isChecked());
ui->all_tissues->setEnabled(ui->calculated_ceiling->isChecked());
ui->all_tissues->setChecked(B(calcalltissues, calc_all_tissues));
ui->gflow->setValue((int)(I(gflow, gflow)));

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>604</width>
<height>490</height>
<width>698</width>
<height>521</height>
</rect>
</property>
<property name="windowTitle">
@ -731,8 +731,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>226</x>
<y>522</y>
<x>235</x>
<y>511</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
@ -747,8 +747,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>294</x>
<y>522</y>
<x>303</x>
<y>511</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
@ -767,8 +767,8 @@
<y>97</y>
</hint>
<hint type="destinationlabel">
<x>186</x>
<y>8</y>
<x>282</x>
<y>18</y>
</hint>
</hints>
</connection>
@ -779,12 +779,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>288</x>
<y>179</y>
<x>187</x>
<y>77</y>
</hint>
<hint type="destinationlabel">
<x>681</x>
<y>194</y>
<x>581</x>
<y>80</y>
</hint>
</hints>
</connection>
@ -795,12 +795,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>301</x>
<y>179</y>
<x>187</x>
<y>77</y>
</hint>
<hint type="destinationlabel">
<x>742</x>
<y>184</y>
<x>668</x>
<y>80</y>
</hint>
</hints>
</connection>
@ -811,12 +811,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>295</x>
<y>208</y>
<x>186</x>
<y>121</y>
</hint>
<hint type="destinationlabel">
<x>673</x>
<y>216</y>
<x>581</x>
<y>124</y>
</hint>
</hints>
</connection>
@ -827,12 +827,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>301</x>
<y>206</y>
<x>186</x>
<y>121</y>
</hint>
<hint type="destinationlabel">
<x>740</x>
<y>216</y>
<x>668</x>
<y>124</y>
</hint>
</hints>
</connection>
@ -843,12 +843,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>296</x>
<y>240</y>
<x>184</x>
<y>165</y>
</hint>
<hint type="destinationlabel">
<x>683</x>
<y>242</y>
<x>581</x>
<y>168</y>
</hint>
</hints>
</connection>
@ -859,12 +859,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>304</x>
<y>232</y>
<x>184</x>
<y>165</y>
</hint>
<hint type="destinationlabel">
<x>760</x>
<y>236</y>
<x>668</x>
<y>168</y>
</hint>
</hints>
</connection>
@ -875,12 +875,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>294</x>
<y>267</y>
<x>195</x>
<y>209</y>
</hint>
<hint type="destinationlabel">
<x>692</x>
<y>271</y>
<x>591</x>
<y>212</y>
</hint>
</hints>
</connection>
@ -891,12 +891,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>286</x>
<y>261</y>
<x>195</x>
<y>209</y>
</hint>
<hint type="destinationlabel">
<x>760</x>
<y>269</y>
<x>668</x>
<y>212</y>
</hint>
</hints>
</connection>
@ -907,12 +907,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>288</x>
<y>344</y>
<x>298</x>
<y>327</y>
</hint>
<hint type="destinationlabel">
<x>555</x>
<y>351</y>
<x>512</x>
<y>327</y>
</hint>
</hints>
</connection>
@ -923,12 +923,28 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>198</x>
<y>286</y>
<x>298</x>
<y>327</y>
</hint>
<hint type="destinationlabel">
<x>503</x>
<y>286</y>
<x>668</x>
<y>327</y>
</hint>
</hints>
</connection>
<connection>
<sender>dc_reported_ceiling</sender>
<signal>clicked(bool)</signal>
<receiver>red_ceiling</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>362</x>
<y>275</y>
</hint>
<hint type="destinationlabel">
<x>586</x>
<y>270</y>
</hint>
</hints>
</connection>

View file

@ -1074,28 +1074,26 @@ void ProfileGraphicsView::plot_depth_profile()
}
/* plot the calculated ceiling for all tissues */
if (prefs.calc_all_tissues){
if (prefs.profile_calc_ceiling && prefs.calc_all_tissues){
int k;
for (k=0; k<16; k++){
if (prefs.profile_calc_ceiling) {
pat.setColorAt(0, profile_color[CALC_CEILING_SHALLOW].first());
pat.setColorAt(1, QColor(100, 100, 100, 50));
pat.setColorAt(0, profile_color[CALC_CEILING_SHALLOW].first());
pat.setColorAt(1, QColor(100, 100, 100, 50));
entry = gc.pi.entry;
p.clear();
p.append(QPointF(SCALEGC(0, 0)));
for (i = 0; i < gc.pi.nr; i++, entry++) {
if ((entry->ceilings)[k])
p.append(QPointF(SCALEGC(entry->sec, (entry->ceilings)[k])));
else
p.append(QPointF(SCALEGC(entry->sec, 0)));
}
p.append(QPointF(SCALEGC((entry-1)->sec, 0)));
neatFill = new QGraphicsPolygonItem();
neatFill->setPolygon(p);
neatFill->setBrush(pat);
scene()->addItem(neatFill);
entry = gc.pi.entry;
p.clear();
p.append(QPointF(SCALEGC(0, 0)));
for (i = 0; i < gc.pi.nr; i++, entry++) {
if ((entry->ceilings)[k])
p.append(QPointF(SCALEGC(entry->sec, (entry->ceilings)[k])));
else
p.append(QPointF(SCALEGC(entry->sec, 0)));
}
p.append(QPointF(SCALEGC((entry-1)->sec, 0)));
neatFill = new QGraphicsPolygonItem();
neatFill->setPolygon(p);
neatFill->setBrush(pat);
scene()->addItem(neatFill);
}
}
/* next show where we have been bad and crossed the dc's ceiling */