mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Replace CREATE_PP_GAS macro by member function in profilewidget2.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
05974d17c9
commit
d9ac716162
2 changed files with 20 additions and 15 deletions
|
@ -308,20 +308,13 @@ void ProfileWidget2::setupItemOnScene()
|
||||||
setupItem(diveProfileItem, profileYAxis, DivePlotDataModel::DEPTH, DivePlotDataModel::TIME, 0);
|
setupItem(diveProfileItem, profileYAxis, DivePlotDataModel::DEPTH, DivePlotDataModel::TIME, 0);
|
||||||
setupItem(meanDepthItem, profileYAxis, DivePlotDataModel::INSTANT_MEANDEPTH, DivePlotDataModel::TIME, 1);
|
setupItem(meanDepthItem, profileYAxis, DivePlotDataModel::INSTANT_MEANDEPTH, DivePlotDataModel::TIME, 1);
|
||||||
|
|
||||||
#define CREATE_PP_GAS(ITEM, VERTICAL_COLUMN, COLOR, COLOR_ALERT, THRESHOULD_SETTINGS_MIN, THRESHOULD_SETTINGS_MAX) \
|
createPPGas(pn2GasItem, DivePlotDataModel::PN2, PN2, PN2_ALERT, NULL, &prefs.pp_graphs.pn2_threshold);
|
||||||
setupItem(ITEM, gasYAxis, DivePlotDataModel::VERTICAL_COLUMN, DivePlotDataModel::TIME, 0); \
|
createPPGas(pheGasItem, DivePlotDataModel::PHE, PHE, PHE_ALERT, NULL, &prefs.pp_graphs.phe_threshold);
|
||||||
ITEM->setThreshouldSettingsKey(THRESHOULD_SETTINGS_MIN, THRESHOULD_SETTINGS_MAX); \
|
createPPGas(po2GasItem, DivePlotDataModel::PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
|
||||||
ITEM->setColors(getColor(COLOR, isGrayscale), getColor(COLOR_ALERT, isGrayscale)); \
|
createPPGas(o2SetpointGasItem, DivePlotDataModel::O2SETPOINT, PO2_ALERT, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
|
||||||
ITEM->settingsChanged(); \
|
createPPGas(ccrsensor1GasItem, DivePlotDataModel::CCRSENSOR1, CCRSENSOR1, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
|
||||||
ITEM->setZValue(99);
|
createPPGas(ccrsensor2GasItem, DivePlotDataModel::CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
|
||||||
|
createPPGas(ccrsensor3GasItem, DivePlotDataModel::CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
|
||||||
CREATE_PP_GAS(pn2GasItem, PN2, PN2, PN2_ALERT, NULL, &prefs.pp_graphs.pn2_threshold);
|
|
||||||
CREATE_PP_GAS(pheGasItem, PHE, PHE, PHE_ALERT, NULL, &prefs.pp_graphs.phe_threshold);
|
|
||||||
CREATE_PP_GAS(po2GasItem, PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
|
|
||||||
CREATE_PP_GAS(o2SetpointGasItem, O2SETPOINT, PO2_ALERT, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
|
|
||||||
CREATE_PP_GAS(ccrsensor1GasItem, CCRSENSOR1, CCRSENSOR1, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
|
|
||||||
CREATE_PP_GAS(ccrsensor2GasItem, CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
|
|
||||||
CREATE_PP_GAS(ccrsensor3GasItem, CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
|
|
||||||
|
|
||||||
#undef CREATE_PP_GAS
|
#undef CREATE_PP_GAS
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
|
@ -362,6 +355,16 @@ void ProfileWidget2::replot(struct dive *d)
|
||||||
plotDive(d, true);
|
plotDive(d, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileWidget2::createPPGas(PartialPressureGasItem *item, int verticalColumn, color_indice_t color, color_indice_t colorAlert,
|
||||||
|
double *thresholdSettingsMin, double *thresholdSettingsMax)
|
||||||
|
{
|
||||||
|
setupItem(item, gasYAxis, verticalColumn, DivePlotDataModel::TIME, 0);
|
||||||
|
item->setThreshouldSettingsKey(thresholdSettingsMin, thresholdSettingsMax);
|
||||||
|
item->setColors(getColor(color, isGrayscale), getColor(colorAlert, isGrayscale));
|
||||||
|
item->settingsChanged();
|
||||||
|
item->setZValue(99);
|
||||||
|
}
|
||||||
|
|
||||||
void ProfileWidget2::setupItemSizes()
|
void ProfileWidget2::setupItemSizes()
|
||||||
{
|
{
|
||||||
// Scene is *always* (double) 100 / 100.
|
// Scene is *always* (double) 100 / 100.
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "profile-widget/divelineitem.h"
|
#include "profile-widget/divelineitem.h"
|
||||||
#include "profile-widget/diveprofileitem.h"
|
#include "profile-widget/diveprofileitem.h"
|
||||||
#include "core/display.h"
|
#include "core/display.h"
|
||||||
|
#include "core/color.h"
|
||||||
|
|
||||||
class RulerItem2;
|
class RulerItem2;
|
||||||
struct dive;
|
struct dive;
|
||||||
|
@ -161,7 +162,8 @@ private: /*methods*/
|
||||||
void disconnectTemporaryConnections();
|
void disconnectTemporaryConnections();
|
||||||
struct plot_data *getEntryFromPos(QPointF pos);
|
struct plot_data *getEntryFromPos(QPointF pos);
|
||||||
void addActionShortcut(const Qt::Key shortcut, void (ProfileWidget2::*slot)());
|
void addActionShortcut(const Qt::Key shortcut, void (ProfileWidget2::*slot)());
|
||||||
|
void createPPGas(PartialPressureGasItem *item, int verticalColumn, color_indice_t color, color_indice_t colorAlert,
|
||||||
|
double *thresholdSettingsMin, double *thresholdSettingsMax);
|
||||||
private:
|
private:
|
||||||
DivePlotDataModel *dataModel;
|
DivePlotDataModel *dataModel;
|
||||||
int zoomLevel;
|
int zoomLevel;
|
||||||
|
|
Loading…
Add table
Reference in a new issue