mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Deco mode for plannining is not deco mode for showing
We had (in the wrong place, imo) a new feature that should differentiate the different deco_modes, you could plan your dive in buelhman and see it in vpm-b, for instance but both of them accessed the same pref. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c110b4a238
commit
37e3e7e69a
6 changed files with 34 additions and 9 deletions
|
@ -107,6 +107,7 @@ struct preferences {
|
||||||
int descrate;
|
int descrate;
|
||||||
int bottompo2;
|
int bottompo2;
|
||||||
int decopo2;
|
int decopo2;
|
||||||
|
enum deco_mode display_deco_mode;
|
||||||
depth_t bestmixend;
|
depth_t bestmixend;
|
||||||
int proxy_type;
|
int proxy_type;
|
||||||
char *proxy_host;
|
char *proxy_host;
|
||||||
|
|
|
@ -259,6 +259,24 @@ TechnicalDetailsSettings::TechnicalDetailsSettings(QObject* parent): QObject(par
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deco_mode TechnicalDetailsSettings::deco() const
|
||||||
|
{
|
||||||
|
|
||||||
|
return prefs.display_deco_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TechnicalDetailsSettings::setDecoMode(deco_mode d)
|
||||||
|
{
|
||||||
|
if (prefs.display_deco_mode == d)
|
||||||
|
return;
|
||||||
|
|
||||||
|
prefs.display_deco_mode = d;
|
||||||
|
QSettings s;
|
||||||
|
s.beginGroup(group);
|
||||||
|
s.setValue("display_deco_mode", d);
|
||||||
|
emit decoModeChanged(d);
|
||||||
|
}
|
||||||
|
|
||||||
double TechnicalDetailsSettings:: modp02() const
|
double TechnicalDetailsSettings:: modp02() const
|
||||||
{
|
{
|
||||||
return prefs.modpO2;
|
return prefs.modpO2;
|
||||||
|
@ -2131,11 +2149,6 @@ void SettingsObjectWrapper::load()
|
||||||
GET_BOOL("tankbar", tankbar);
|
GET_BOOL("tankbar", tankbar);
|
||||||
GET_BOOL("RulerBar", rulergraph);
|
GET_BOOL("RulerBar", rulergraph);
|
||||||
GET_BOOL("percentagegraph", percentagegraph);
|
GET_BOOL("percentagegraph", percentagegraph);
|
||||||
v = s.value("buehlmann");
|
|
||||||
if (v.isValid())
|
|
||||||
prefs.deco_mode = v.toBool() ? BUEHLMANN : VPMB;
|
|
||||||
else
|
|
||||||
prefs.deco_mode = BUEHLMANN;
|
|
||||||
GET_INT("gflow", gflow);
|
GET_INT("gflow", gflow);
|
||||||
GET_INT("gfhigh", gfhigh);
|
GET_INT("gfhigh", gfhigh);
|
||||||
GET_INT("vpmb_conservatism", vpmb_conservatism);
|
GET_INT("vpmb_conservatism", vpmb_conservatism);
|
||||||
|
@ -2149,6 +2162,7 @@ void SettingsObjectWrapper::load()
|
||||||
GET_BOOL("display_unused_tanks", display_unused_tanks);
|
GET_BOOL("display_unused_tanks", display_unused_tanks);
|
||||||
GET_BOOL("show_average_depth", show_average_depth);
|
GET_BOOL("show_average_depth", show_average_depth);
|
||||||
GET_BOOL("show_pictures_in_profile", show_pictures_in_profile);
|
GET_BOOL("show_pictures_in_profile", show_pictures_in_profile);
|
||||||
|
prefs.display_deco_mode = (deco_mode) s.value("display_deco_mode").toInt();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("GeneralSettings");
|
s.beginGroup("GeneralSettings");
|
||||||
|
|
|
@ -132,6 +132,8 @@ class TechnicalDetailsSettings : public QObject {
|
||||||
Q_PROPERTY(bool display_unused_tanks READ displayUnusedTanks WRITE setDisplayUnusedTanks NOTIFY displayUnusedTanksChanged)
|
Q_PROPERTY(bool display_unused_tanks READ displayUnusedTanks WRITE setDisplayUnusedTanks NOTIFY displayUnusedTanksChanged)
|
||||||
Q_PROPERTY(bool show_average_depth READ showAverageDepth WRITE setShowAverageDepth NOTIFY showAverageDepthChanged)
|
Q_PROPERTY(bool show_average_depth READ showAverageDepth WRITE setShowAverageDepth NOTIFY showAverageDepthChanged)
|
||||||
Q_PROPERTY(bool show_pictures_in_profile READ showPicturesInProfile WRITE setShowPicturesInProfile NOTIFY showPicturesInProfileChanged)
|
Q_PROPERTY(bool show_pictures_in_profile READ showPicturesInProfile WRITE setShowPicturesInProfile NOTIFY showPicturesInProfileChanged)
|
||||||
|
Q_PROPERTY(deco_mode deco READ deco WRITE setDecoMode NOTIFY decoModeChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TechnicalDetailsSettings(QObject *parent);
|
TechnicalDetailsSettings(QObject *parent);
|
||||||
|
|
||||||
|
@ -160,6 +162,7 @@ public:
|
||||||
bool displayUnusedTanks() const;
|
bool displayUnusedTanks() const;
|
||||||
bool showAverageDepth() const;
|
bool showAverageDepth() const;
|
||||||
bool showPicturesInProfile() const;
|
bool showPicturesInProfile() const;
|
||||||
|
deco_mode deco() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setMod(bool value);
|
void setMod(bool value);
|
||||||
|
@ -187,6 +190,7 @@ public slots:
|
||||||
void setDisplayUnusedTanks(bool value);
|
void setDisplayUnusedTanks(bool value);
|
||||||
void setShowAverageDepth(bool value);
|
void setShowAverageDepth(bool value);
|
||||||
void setShowPicturesInProfile(bool value);
|
void setShowPicturesInProfile(bool value);
|
||||||
|
void setDecoMode(deco_mode d);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void modpO2Changed(double value);
|
void modpO2Changed(double value);
|
||||||
|
@ -214,6 +218,7 @@ signals:
|
||||||
void displayUnusedTanksChanged(bool value);
|
void displayUnusedTanksChanged(bool value);
|
||||||
void showAverageDepthChanged(bool value);
|
void showAverageDepthChanged(bool value);
|
||||||
void showPicturesInProfileChanged(bool value);
|
void showPicturesInProfileChanged(bool value);
|
||||||
|
void decoModeChanged(deco_mode m);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString group = QStringLiteral("TecDetails");
|
const QString group = QStringLiteral("TecDetails");
|
||||||
|
|
|
@ -25,13 +25,14 @@ void PreferencesGraph::refreshSettings()
|
||||||
ui->maxpo2->setValue(prefs.modpO2);
|
ui->maxpo2->setValue(prefs.modpO2);
|
||||||
ui->red_ceiling->setChecked(prefs.redceiling);
|
ui->red_ceiling->setChecked(prefs.redceiling);
|
||||||
|
|
||||||
if (prefs.deco_mode == BUEHLMANN) {
|
if (prefs.display_deco_mode == BUEHLMANN) {
|
||||||
ui->buehlmann->setChecked(true);
|
ui->buehlmann->setChecked(true);
|
||||||
ui->vpmb->setChecked(false);
|
ui->vpmb->setChecked(false);
|
||||||
} else {
|
} else {
|
||||||
ui->buehlmann->setChecked(false);
|
ui->buehlmann->setChecked(false);
|
||||||
ui->vpmb->setChecked(false);
|
ui->vpmb->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->gflow->setValue(prefs.gflow);
|
ui->gflow->setValue(prefs.gflow);
|
||||||
ui->gfhigh->setValue(prefs.gfhigh);
|
ui->gfhigh->setValue(prefs.gfhigh);
|
||||||
ui->vpmb_conservatism->setValue(prefs.vpmb_conservatism);
|
ui->vpmb_conservatism->setValue(prefs.vpmb_conservatism);
|
||||||
|
@ -70,6 +71,7 @@ void PreferencesGraph::syncSettings()
|
||||||
tech->setShowCCRSensors(ui->show_ccr_sensors->isChecked());
|
tech->setShowCCRSensors(ui->show_ccr_sensors->isChecked());
|
||||||
tech->setDisplayUnusedTanks(ui->display_unused_tanks->isChecked());
|
tech->setDisplayUnusedTanks(ui->display_unused_tanks->isChecked());
|
||||||
tech->setShowAverageDepth(ui->show_average_depth->isChecked());
|
tech->setShowAverageDepth(ui->show_average_depth->isChecked());
|
||||||
|
tech->setDecoMode(ui->vpmb->isChecked() ? VPMB : BUEHLMANN);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DANGER_GF (gf > 100) ? "* { color: red; }" : ""
|
#define DANGER_GF (gf > 100) ? "* { color: red; }" : ""
|
||||||
|
|
|
@ -263,8 +263,11 @@ void ToolTipItem::refresh(const QPointF &pos)
|
||||||
painter.setBrush(QColor(Qt::red));
|
painter.setBrush(QColor(Qt::red));
|
||||||
painter.drawRect(0,0,16,10);
|
painter.drawRect(0,0,16,10);
|
||||||
if (entry) {
|
if (entry) {
|
||||||
|
ProfileWidget2 *view = qobject_cast<ProfileWidget2*>(scene()->views().first());
|
||||||
|
Q_ASSERT(view);
|
||||||
|
|
||||||
painter.setPen(QColor(0, 0, 0, 255));
|
painter.setPen(QColor(0, 0, 0, 255));
|
||||||
if (prefs.deco_mode == BUEHLMANN)
|
if ((view->currentState == ProfileWidget2::PLAN && prefs.deco_mode == BUEHLMANN) || prefs.display_deco_mode == BUEHLMANN)
|
||||||
painter.drawLine(0, 60 - entry->gfline / 2, 16, 60 - entry->gfline / 2);
|
painter.drawLine(0, 60 - entry->gfline / 2, 16, 60 - entry->gfline / 2);
|
||||||
painter.drawLine(0, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure / 2,
|
painter.drawLine(0, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure / 2,
|
||||||
16, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure /2);
|
16, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure /2);
|
||||||
|
|
|
@ -558,7 +558,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
|
||||||
// this copies the dive and makes copies of all the relevant additional data
|
// this copies the dive and makes copies of all the relevant additional data
|
||||||
copy_dive(d, &displayed_dive);
|
copy_dive(d, &displayed_dive);
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
if (prefs.deco_mode == VPMB)
|
if ((currentState == PLAN && prefs.deco_mode == VPMB) || prefs.display_deco_mode == VPMB)
|
||||||
decoModelParameters->setText(QString("VPM-B +%1").arg(prefs.vpmb_conservatism));
|
decoModelParameters->setText(QString("VPM-B +%1").arg(prefs.vpmb_conservatism));
|
||||||
else
|
else
|
||||||
decoModelParameters->setText(QString("GF %1/%2").arg(prefs.gflow).arg(prefs.gfhigh));
|
decoModelParameters->setText(QString("GF %1/%2").arg(prefs.gflow).arg(prefs.gfhigh));
|
||||||
|
@ -570,7 +570,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
|
||||||
plannerModel->deleteTemporaryPlan();
|
plannerModel->deleteTemporaryPlan();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (prefs.deco_mode == VPMB)
|
if ((currentState == PLAN && prefs.deco_mode == VPMB) || prefs.display_deco_mode == VPMB)
|
||||||
decoModelParameters->setText(QString("VPM-B +%1").arg(diveplan.vpmb_conservatism));
|
decoModelParameters->setText(QString("VPM-B +%1").arg(diveplan.vpmb_conservatism));
|
||||||
else
|
else
|
||||||
decoModelParameters->setText(QString("GF %1/%2").arg(diveplan.gflow).arg(diveplan.gfhigh));
|
decoModelParameters->setText(QString("GF %1/%2").arg(diveplan.gflow).arg(diveplan.gfhigh));
|
||||||
|
|
Loading…
Add table
Reference in a new issue