summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/diveprofileitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile/diveprofileitem.cpp')
-rw-r--r--qt-ui/profile/diveprofileitem.cpp39
1 files changed, 16 insertions, 23 deletions
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index 1615be87f..2a6d5ac2f 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -18,10 +18,10 @@
AbstractProfilePolygonItem::AbstractProfilePolygonItem() : QObject(), QGraphicsPolygonItem(), hAxis(NULL), vAxis(NULL), dataModel(NULL), hDataColumn(-1), vDataColumn(-1)
{
- connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(preferencesChanged()));
+ connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
}
-void AbstractProfilePolygonItem::preferencesChanged()
+void AbstractProfilePolygonItem::settingsChanged()
{
}
@@ -156,10 +156,8 @@ void DiveProfileItem::modelDataChanged(const QModelIndex &topLeft, const QModelI
if (!entry->in_deco) {
/* not in deco implies this is a safety stop, no ceiling */
p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(0)));
- } else if (entry->stopdepth < entry->depth) {
- p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(entry->stopdepth)));
} else {
- p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(entry->depth)));
+ p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(qMin(entry->stopdepth, entry->depth))));
}
}
setPolygon(p);
@@ -194,7 +192,7 @@ void DiveProfileItem::modelDataChanged(const QModelIndex &topLeft, const QModelI
}
}
-void DiveProfileItem::preferencesChanged()
+void DiveProfileItem::settingsChanged()
{
//TODO: Only modelDataChanged() here if we need to rebuild the graph ( for instance,
// if the prefs.dcceiling are enabled, but prefs.redceiling is disabled
@@ -298,7 +296,7 @@ void DiveHeartrateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
painter->drawPolyline(polygon());
}
-void DiveHeartrateItem::preferencesChanged()
+void DiveHeartrateItem::settingsChanged()
{
QSettings s;
s.beginGroup("TecDetails");
@@ -427,7 +425,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
int last_pressure[MAX_CYLINDERS] = { 0, };
int last_time[MAX_CYLINDERS] = { 0, };
struct plot_data *entry;
- struct dive *dive = get_dive_by_diveid(dataModel->id());
+ struct dive *dive = get_dive_by_uniq_id(dataModel->id());
cyl = -1;
for (int i = 0, count = dataModel->rowCount(); i < count; i++) {
@@ -489,9 +487,9 @@ void DiveGasPressureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
QPen pen;
pen.setCosmetic(true);
pen.setWidth(2);
- struct dive *d = get_dive_by_diveid(dataModel->id());
+ struct dive *d = get_dive_by_uniq_id(dataModel->id());
struct plot_data *entry = dataModel->data().entry;
- Q_FOREACH(const QPolygonF & poly, polygons) {
+ Q_FOREACH (const QPolygonF &poly, polygons) {
for (int i = 1, count = poly.count(); i < count; i++, entry++) {
pen.setBrush(getSacColor(entry->sac, d->sac));
painter->setPen(pen);
@@ -505,7 +503,7 @@ DiveCalculatedCeiling::DiveCalculatedCeiling() : is3mIncrement(false), gradientF
gradientFactor->setY(0);
gradientFactor->setBrush(getColor(PRESSURE_TEXT));
gradientFactor->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
- preferencesChanged();
+ settingsChanged();
}
void DiveCalculatedCeiling::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
@@ -544,10 +542,10 @@ void DiveCalculatedCeiling::paint(QPainter *painter, const QStyleOptionGraphicsI
DiveCalculatedTissue::DiveCalculatedTissue()
{
- preferencesChanged();
+ settingsChanged();
}
-void DiveCalculatedTissue::preferencesChanged()
+void DiveCalculatedTissue::settingsChanged()
{
setVisible(prefs.calcalltissues && prefs.calcceiling);
}
@@ -562,11 +560,7 @@ void DiveReportedCeiling::modelDataChanged(const QModelIndex &topLeft, const QMo
plot_data *entry = dataModel->data().entry;
for (int i = 0, count = dataModel->rowCount(); i < count; i++, entry++) {
if (entry->in_deco && entry->stopdepth) {
- if (entry->stopdepth < entry->depth) {
- p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(entry->stopdepth)));
- } else {
- p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(entry->depth)));
- }
+ p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(qMin(entry->stopdepth, entry->depth))));
} else {
p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(0)));
}
@@ -585,7 +579,7 @@ void DiveReportedCeiling::modelDataChanged(const QModelIndex &topLeft, const QMo
setBrush(pat);
}
-void DiveCalculatedCeiling::preferencesChanged()
+void DiveCalculatedCeiling::settingsChanged()
{
if (dataModel && is3mIncrement != prefs.calcceiling3m) {
// recalculate that part.
@@ -595,7 +589,7 @@ void DiveCalculatedCeiling::preferencesChanged()
setVisible(prefs.calcceiling);
}
-void DiveReportedCeiling::preferencesChanged()
+void DiveReportedCeiling::settingsChanged()
{
setVisible(prefs.dcceiling);
}
@@ -688,9 +682,8 @@ void PartialPressureGasItem::paint(QPainter *painter, const QStyleOptionGraphics
QPolygonF poly;
painter->setPen(QPen(alertColor, pWidth));
- Q_FOREACH(const QPolygonF & poly, alertPolygons)
+ Q_FOREACH (const QPolygonF &poly, alertPolygons)
painter->drawPolyline(poly);
-
}
void PartialPressureGasItem::setThreshouldSettingsKey(const QString &threshouldSettingsKey)
@@ -702,7 +695,7 @@ PartialPressureGasItem::PartialPressureGasItem()
{
}
-void PartialPressureGasItem::preferencesChanged()
+void PartialPressureGasItem::settingsChanged()
{
QSettings s;
s.beginGroup("TecDetails");