mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 18:23:23 +00:00
More Profile Itens on the new Settings
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2d96139566
commit
2d3f7f0a90
3 changed files with 23 additions and 30 deletions
|
@ -784,6 +784,8 @@ DiveCalculatedCeiling::DiveCalculatedCeiling(ProfileWidget2 *widget) :
|
|||
profileWidget(widget),
|
||||
is3mIncrement(false)
|
||||
{
|
||||
connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::dcceilingChanged, this, &DiveCalculatedCeiling::setVisible);
|
||||
setVisible(prefs.calcceiling);
|
||||
settingsChanged();
|
||||
}
|
||||
|
||||
|
@ -835,7 +837,7 @@ void DiveCalculatedTissue::setVisible(bool visible)
|
|||
|
||||
void DiveCalculatedTissue::settingsChanged()
|
||||
{
|
||||
setVisible(prefs.calcalltissues && prefs.calcceiling);
|
||||
DiveCalculatedCeiling::setVisible(prefs.calcalltissues && prefs.calcceiling);
|
||||
}
|
||||
|
||||
void DiveReportedCeiling::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||
|
@ -879,12 +881,6 @@ void DiveCalculatedCeiling::settingsChanged()
|
|||
recalc();
|
||||
}
|
||||
is3mIncrement = prefs.calcceiling3m;
|
||||
setVisible(prefs.calcceiling);
|
||||
}
|
||||
|
||||
void DiveReportedCeiling::settingsChanged()
|
||||
{
|
||||
setVisible(prefs.dcceiling);
|
||||
}
|
||||
|
||||
void DiveReportedCeiling::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
|
@ -956,18 +952,6 @@ PartialPressureGasItem::PartialPressureGasItem() :
|
|||
{
|
||||
}
|
||||
|
||||
void PartialPressureGasItem::settingsChanged()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("TecDetails");
|
||||
setVisible(s.value(visibilityKey).toBool());
|
||||
}
|
||||
|
||||
void PartialPressureGasItem::setVisibilitySettingsKey(const QString &key)
|
||||
{
|
||||
visibilityKey = key;
|
||||
}
|
||||
|
||||
void PartialPressureGasItem::setColors(const QColor &normal, const QColor &alert)
|
||||
{
|
||||
normalColor = normal;
|
||||
|
|
|
@ -194,7 +194,6 @@ class DiveReportedCeiling : public AbstractProfilePolygonItem {
|
|||
public:
|
||||
virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
virtual void settingsChanged();
|
||||
};
|
||||
|
||||
class DiveCalculatedTissue : public DiveCalculatedCeiling {
|
||||
|
@ -211,7 +210,6 @@ public:
|
|||
PartialPressureGasItem();
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
|
||||
virtual void settingsChanged();
|
||||
void setThreshouldSettingsKey(double *prefPointer);
|
||||
void setVisibilitySettingsKey(const QString &setVisibilitySettingsKey);
|
||||
void setColors(const QColor &normalColor, const QColor &alertColor);
|
||||
|
|
|
@ -325,21 +325,32 @@ void ProfileWidget2::setupItemOnScene()
|
|||
setupItem(meanDepthItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::INSTANT_MEANDEPTH, DivePlotDataModel::TIME, 1);
|
||||
|
||||
|
||||
#define CREATE_PP_GAS(ITEM, VERTICAL_COLUMN, COLOR, COLOR_ALERT, THRESHOULD_SETTINGS, VISIBILITY_SETTINGS) \
|
||||
#define CREATE_PP_GAS(ITEM, VERTICAL_COLUMN, COLOR, COLOR_ALERT, THRESHOULD_SETTINGS) \
|
||||
setupItem(ITEM, timeAxis, gasYAxis, dataModel, DivePlotDataModel::VERTICAL_COLUMN, DivePlotDataModel::TIME, 0); \
|
||||
ITEM->setThreshouldSettingsKey(THRESHOULD_SETTINGS); \
|
||||
ITEM->setVisibilitySettingsKey(VISIBILITY_SETTINGS); \
|
||||
ITEM->setColors(getColor(COLOR, isGrayscale), getColor(COLOR_ALERT, isGrayscale)); \
|
||||
ITEM->settingsChanged(); \
|
||||
ITEM->setZValue(99);
|
||||
|
||||
CREATE_PP_GAS(pn2GasItem, PN2, PN2, PN2_ALERT, &prefs.pp_graphs.pn2_threshold, "pn2graph");
|
||||
CREATE_PP_GAS(pheGasItem, PHE, PHE, PHE_ALERT, &prefs.pp_graphs.phe_threshold, "phegraph");
|
||||
CREATE_PP_GAS(po2GasItem, PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold, "po2graph");
|
||||
CREATE_PP_GAS(o2SetpointGasItem, O2SETPOINT, PO2_ALERT, PO2_ALERT, &prefs.pp_graphs.po2_threshold, "po2graph");
|
||||
CREATE_PP_GAS(ccrsensor1GasItem, CCRSENSOR1, CCRSENSOR1, PO2_ALERT, &prefs.pp_graphs.po2_threshold, "ccrsensorgraph");
|
||||
CREATE_PP_GAS(ccrsensor2GasItem, CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold, "ccrsensorgraph");
|
||||
CREATE_PP_GAS(ccrsensor3GasItem, CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold, "ccrsensorgraph");
|
||||
CREATE_PP_GAS(pn2GasItem, PN2, PN2, PN2_ALERT, &prefs.pp_graphs.pn2_threshold);
|
||||
CREATE_PP_GAS(pheGasItem, PHE, PHE, PHE_ALERT, &prefs.pp_graphs.phe_threshold);
|
||||
CREATE_PP_GAS(po2GasItem, PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold);
|
||||
CREATE_PP_GAS(o2SetpointGasItem, O2SETPOINT, PO2_ALERT, PO2_ALERT, &prefs.pp_graphs.po2_threshold);
|
||||
CREATE_PP_GAS(ccrsensor1GasItem, CCRSENSOR1, CCRSENSOR1, PO2_ALERT, &prefs.pp_graphs.po2_threshold);
|
||||
CREATE_PP_GAS(ccrsensor2GasItem, CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold);
|
||||
CREATE_PP_GAS(ccrsensor3GasItem, CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold);
|
||||
|
||||
// Visibility Connections
|
||||
connect(SettingsObjectWrapper::instance()->pp_gas, &PartialPressureGasSettings::showPheChanged, pheGasItem, &PartialPressureGasItem::setVisible);
|
||||
connect(SettingsObjectWrapper::instance()->pp_gas, &PartialPressureGasSettings::showPo2Changed, po2GasItem, &PartialPressureGasItem::setVisible);
|
||||
connect(SettingsObjectWrapper::instance()->pp_gas, &PartialPressureGasSettings::showPn2Changed, pn2GasItem, &PartialPressureGasItem::setVisible);
|
||||
connect(SettingsObjectWrapper::instance()->pp_gas, &PartialPressureGasSettings::showPo2Changed, o2SetpointGasItem, &PartialPressureGasItem::setVisible);
|
||||
|
||||
//WARNING: The old code was broken, I'm not sure what should trigger the visibility of those graphs, since the old code didn't triggered them
|
||||
// because it was using a wrong settings.
|
||||
connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::showCCRSensorsChanged, ccrsensor1GasItem, &PartialPressureGasItem::setVisible);
|
||||
connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::showCCRSensorsChanged, ccrsensor2GasItem, &PartialPressureGasItem::setVisible);
|
||||
connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::showCCRSensorsChanged, ccrsensor3GasItem, &PartialPressureGasItem::setVisible);
|
||||
#undef CREATE_PP_GAS
|
||||
|
||||
temperatureAxis->setTextVisible(false);
|
||||
|
|
Loading…
Add table
Reference in a new issue