mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: remove ProfileWidget2::setupItem()
The only thing left that this function did, was setting the Z-value of the item. This can be done directly on construction. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e3ea74e079
commit
991a94d14c
2 changed files with 15 additions and 34 deletions
|
@ -97,10 +97,11 @@ static const double thumbnailBaseZValue = 100.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<typename T, class... Args>
|
template<typename T, class... Args>
|
||||||
T *ProfileWidget2::createItem(const DiveCartesianAxis &vAxis, int vColumn, Args&&... args)
|
T *ProfileWidget2::createItem(const DiveCartesianAxis &vAxis, int vColumn, int z, Args&&... args)
|
||||||
{
|
{
|
||||||
T *res = new T(*dataModel, *timeAxis, DivePlotDataModel::TIME, vAxis, vColumn,
|
T *res = new T(*dataModel, *timeAxis, DivePlotDataModel::TIME, vAxis, vColumn,
|
||||||
std::forward<Args>(args)...);
|
std::forward<Args>(args)...);
|
||||||
|
res->setZValue(static_cast<double>(z));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,13 +122,13 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
||||||
gasYAxis(new PartialGasPressureAxis(this)),
|
gasYAxis(new PartialGasPressureAxis(this)),
|
||||||
temperatureAxis(new TemperatureAxis(this)),
|
temperatureAxis(new TemperatureAxis(this)),
|
||||||
timeAxis(new TimeAxis(this)),
|
timeAxis(new TimeAxis(this)),
|
||||||
diveProfileItem(createItem<DiveProfileItem>(*profileYAxis, DivePlotDataModel::DEPTH)),
|
diveProfileItem(createItem<DiveProfileItem>(*profileYAxis, DivePlotDataModel::DEPTH, 0)),
|
||||||
temperatureItem(createItem<DiveTemperatureItem>(*temperatureAxis, DivePlotDataModel::TEMPERATURE)),
|
temperatureItem(createItem<DiveTemperatureItem>(*temperatureAxis, DivePlotDataModel::TEMPERATURE, 1)),
|
||||||
meanDepthItem(createItem<DiveMeanDepthItem>(*profileYAxis, DivePlotDataModel::INSTANT_MEANDEPTH)),
|
meanDepthItem(createItem<DiveMeanDepthItem>(*profileYAxis, DivePlotDataModel::INSTANT_MEANDEPTH, 1)),
|
||||||
cylinderPressureAxis(new DiveCartesianAxis(this)),
|
cylinderPressureAxis(new DiveCartesianAxis(this)),
|
||||||
gasPressureItem(createItem<DiveGasPressureItem>(*cylinderPressureAxis, DivePlotDataModel::TEMPERATURE)),
|
gasPressureItem(createItem<DiveGasPressureItem>(*cylinderPressureAxis, DivePlotDataModel::TEMPERATURE, 1)),
|
||||||
diveComputerText(new DiveTextItem()),
|
diveComputerText(new DiveTextItem()),
|
||||||
reportedCeiling(createItem<DiveReportedCeiling>(*profileYAxis, DivePlotDataModel::CEILING)),
|
reportedCeiling(createItem<DiveReportedCeiling>(*profileYAxis, DivePlotDataModel::CEILING, 1)),
|
||||||
pn2GasItem(createPPGas(DivePlotDataModel::PN2, PN2, PN2_ALERT, NULL, &prefs.pp_graphs.pn2_threshold)),
|
pn2GasItem(createPPGas(DivePlotDataModel::PN2, PN2, PN2_ALERT, NULL, &prefs.pp_graphs.pn2_threshold)),
|
||||||
pheGasItem(createPPGas(DivePlotDataModel::PHE, PHE, PHE_ALERT, NULL, &prefs.pp_graphs.phe_threshold)),
|
pheGasItem(createPPGas(DivePlotDataModel::PHE, PHE, PHE_ALERT, NULL, &prefs.pp_graphs.phe_threshold)),
|
||||||
po2GasItem(createPPGas(DivePlotDataModel::PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
po2GasItem(createPPGas(DivePlotDataModel::PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
||||||
|
@ -136,15 +137,14 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
||||||
ccrsensor2GasItem(createPPGas(DivePlotDataModel::CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
ccrsensor2GasItem(createPPGas(DivePlotDataModel::CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
||||||
ccrsensor3GasItem(createPPGas(DivePlotDataModel::CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
ccrsensor3GasItem(createPPGas(DivePlotDataModel::CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
||||||
ocpo2GasItem(createPPGas(DivePlotDataModel::SCR_OC_PO2, SCR_OCPO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
ocpo2GasItem(createPPGas(DivePlotDataModel::SCR_OC_PO2, SCR_OCPO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
||||||
|
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
diveCeiling(createItem<DiveCalculatedCeiling>(*profileYAxis, DivePlotDataModel::CEILING, this)),
|
diveCeiling(createItem<DiveCalculatedCeiling>(*profileYAxis, DivePlotDataModel::CEILING, 1, this)),
|
||||||
decoModelParameters(new DiveTextItem()),
|
decoModelParameters(new DiveTextItem()),
|
||||||
heartBeatAxis(new DiveCartesianAxis(this)),
|
heartBeatAxis(new DiveCartesianAxis(this)),
|
||||||
heartBeatItem(createItem<DiveHeartrateItem>(*heartBeatAxis, DivePlotDataModel::HEARTBEAT)),
|
heartBeatItem(createItem<DiveHeartrateItem>(*heartBeatAxis, DivePlotDataModel::HEARTBEAT, 1)),
|
||||||
percentageAxis(new DiveCartesianAxis(this)),
|
percentageAxis(new DiveCartesianAxis(this)),
|
||||||
ambPressureItem(createItem<DiveAmbPressureItem>(*percentageAxis, DivePlotDataModel::AMBPRESSURE)),
|
ambPressureItem(createItem<DiveAmbPressureItem>(*percentageAxis, DivePlotDataModel::AMBPRESSURE, 1)),
|
||||||
gflineItem(createItem<DiveGFLineItem>(*percentageAxis, DivePlotDataModel::GFLINE)),
|
gflineItem(createItem<DiveGFLineItem>(*percentageAxis, DivePlotDataModel::GFLINE, 1)),
|
||||||
mouseFollowerVertical(new DiveLineItem()),
|
mouseFollowerVertical(new DiveLineItem()),
|
||||||
mouseFollowerHorizontal(new DiveLineItem()),
|
mouseFollowerHorizontal(new DiveLineItem()),
|
||||||
rulerItem(new RulerItem2()),
|
rulerItem(new RulerItem2()),
|
||||||
|
@ -349,24 +349,13 @@ void ProfileWidget2::setupItemOnScene()
|
||||||
decoModelParameters->setX(50);
|
decoModelParameters->setX(50);
|
||||||
decoModelParameters->setBrush(getColor(PRESSURE_TEXT));
|
decoModelParameters->setBrush(getColor(PRESSURE_TEXT));
|
||||||
decoModelParameters->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
|
decoModelParameters->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
|
||||||
setupItem(diveCeiling, 1);
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
DiveCalculatedTissue *tissueItem = createItem<DiveCalculatedTissue>(*profileYAxis, DivePlotDataModel::TISSUE_1 + i, this);
|
DiveCalculatedTissue *tissueItem = createItem<DiveCalculatedTissue>(*profileYAxis, DivePlotDataModel::TISSUE_1 + i, i + 1, this);
|
||||||
setupItem(tissueItem, 1 + i);
|
|
||||||
allTissues.append(tissueItem);
|
allTissues.append(tissueItem);
|
||||||
DivePercentageItem *percentageItem = createItem<DivePercentageItem>(*percentageAxis, DivePlotDataModel::PERCENTAGE_1 + i, i);
|
DivePercentageItem *percentageItem = createItem<DivePercentageItem>(*percentageAxis, DivePlotDataModel::PERCENTAGE_1 + i, i + 1, i);
|
||||||
setupItem(percentageItem, 1 + i);
|
|
||||||
allPercentages.append(percentageItem);
|
allPercentages.append(percentageItem);
|
||||||
}
|
}
|
||||||
setupItem(heartBeatItem, 1);
|
|
||||||
setupItem(ambPressureItem, 1);
|
|
||||||
setupItem(gflineItem, 1);
|
|
||||||
#endif
|
#endif
|
||||||
setupItem(reportedCeiling, 1);
|
|
||||||
setupItem(gasPressureItem, 1);
|
|
||||||
setupItem(temperatureItem, 1);
|
|
||||||
setupItem(diveProfileItem, 0);
|
|
||||||
setupItem(meanDepthItem, 1);
|
|
||||||
|
|
||||||
#undef CREATE_PP_GAS
|
#undef CREATE_PP_GAS
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
|
@ -405,12 +394,10 @@ void ProfileWidget2::replot()
|
||||||
PartialPressureGasItem *ProfileWidget2::createPPGas(int column, color_index_t color, color_index_t colorAlert,
|
PartialPressureGasItem *ProfileWidget2::createPPGas(int column, color_index_t color, color_index_t colorAlert,
|
||||||
const double *thresholdSettingsMin, const double *thresholdSettingsMax)
|
const double *thresholdSettingsMin, const double *thresholdSettingsMax)
|
||||||
{
|
{
|
||||||
PartialPressureGasItem *item = createItem<PartialPressureGasItem>(*gasYAxis, column);
|
PartialPressureGasItem *item = createItem<PartialPressureGasItem>(*gasYAxis, column, 99);
|
||||||
setupItem(item, 0);
|
|
||||||
item->setThresholdSettingsKey(thresholdSettingsMin, thresholdSettingsMax);
|
item->setThresholdSettingsKey(thresholdSettingsMin, thresholdSettingsMax);
|
||||||
item->setColors(getColor(color, isGrayscale), getColor(colorAlert, isGrayscale));
|
item->setColors(getColor(color, isGrayscale), getColor(colorAlert, isGrayscale));
|
||||||
item->settingsChanged();
|
item->settingsChanged();
|
||||||
item->setZValue(99);
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,11 +526,6 @@ void ProfileWidget2::setupItemSizes()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileWidget2::setupItem(AbstractProfilePolygonItem *item, int zValue)
|
|
||||||
{
|
|
||||||
item->setZValue(zValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProfileWidget2::setupSceneAndFlags()
|
void ProfileWidget2::setupSceneAndFlags()
|
||||||
{
|
{
|
||||||
setScene(new QGraphicsScene(this));
|
setScene(new QGraphicsScene(this));
|
||||||
|
|
|
@ -78,7 +78,6 @@ public:
|
||||||
void resetZoom();
|
void resetZoom();
|
||||||
void scale(qreal sx, qreal sy);
|
void scale(qreal sx, qreal sy);
|
||||||
void plotDive(const struct dive *d, bool force = false, bool clearPictures = false, bool instant = false);
|
void plotDive(const struct dive *d, bool force = false, bool clearPictures = false, bool instant = false);
|
||||||
void setupItem(AbstractProfilePolygonItem *item, int zValue);
|
|
||||||
void setPrintMode(bool mode, bool grayscale = false);
|
void setPrintMode(bool mode, bool grayscale = false);
|
||||||
bool getPrintMode();
|
bool getPrintMode();
|
||||||
bool isPointOutOfBoundaries(const QPointF &point) const;
|
bool isPointOutOfBoundaries(const QPointF &point) const;
|
||||||
|
@ -152,7 +151,7 @@ private:
|
||||||
void fixBackgroundPos();
|
void fixBackgroundPos();
|
||||||
void scrollViewTo(const QPoint &pos);
|
void scrollViewTo(const QPoint &pos);
|
||||||
void setupSceneAndFlags();
|
void setupSceneAndFlags();
|
||||||
template<typename T, class... Args> T *createItem(const DiveCartesianAxis &vAxis, int vColumn, Args&&... args);
|
template<typename T, class... Args> T *createItem(const DiveCartesianAxis &vAxis, int vColumn, int z, Args&&... args);
|
||||||
void setupItemSizes();
|
void setupItemSizes();
|
||||||
void addItemsToScene();
|
void addItemsToScene();
|
||||||
void setupItemOnScene();
|
void setupItemOnScene();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue