summaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/diveprofileitem.cpp26
-rw-r--r--profile-widget/profilewidget2.cpp6
-rw-r--r--profile-widget/tankitem.cpp2
3 files changed, 17 insertions, 17 deletions
diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp
index bc74f7f40..3d0ba2e7a 100644
--- a/profile-widget/diveprofileitem.cpp
+++ b/profile-widget/diveprofileitem.cpp
@@ -659,17 +659,17 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
if (!shouldCalculateStuff(topLeft, bottomRight))
return;
- std::vector<int> plotted_cyl(MAX_CYLINDERS, false);
- std::vector<int> last_plotted(MAX_CYLINDERS, 0);
- std::vector<QPolygonF> poly(MAX_CYLINDERS);
+ const struct plot_info *pInfo = &dataModel->data();
+ std::vector<int> plotted_cyl(pInfo->nr_cylinders, false);
+ std::vector<int> last_plotted(pInfo->nr_cylinders, 0);
+ std::vector<QPolygonF> poly(pInfo->nr_cylinders);
QPolygonF boundingPoly;
polygons.clear();
- const struct plot_info *pInfo = &dataModel->data();
for (int i = 0, count = dataModel->rowCount(); i < count; i++) {
const struct plot_data *entry = pInfo->entry + i;
- for (int cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
+ for (int cyl = 0; cyl < pInfo->nr_cylinders; cyl++) {
int mbar = get_plot_pressure(pInfo, i, cyl);
int time = entry->sec;
@@ -698,7 +698,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
}
}
- for (int cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
+ for (int cyl = 0; cyl < pInfo->nr_cylinders; cyl++) {
if (!plotted_cyl[cyl])
continue;
polygons.append(poly[cyl]);
@@ -708,9 +708,9 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
qDeleteAll(texts);
texts.clear();
- std::vector<int> seen_cyl(MAX_CYLINDERS, false);
- std::vector<int> last_pressure(MAX_CYLINDERS, 0);
- std::vector<int> last_time(MAX_CYLINDERS, 0);
+ std::vector<int> seen_cyl(pInfo->nr_cylinders, false);
+ std::vector<int> last_pressure(pInfo->nr_cylinders, 0);
+ std::vector<int> last_time(pInfo->nr_cylinders, 0);
// These are offset values used to print the gas lables and pressures on a
// dive profile at appropriate Y-coordinates. We alternate aligning the
@@ -721,7 +721,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
// pressures.
QFlags<Qt::AlignmentFlag> alignVar = Qt::AlignTop;
- std::vector<QFlags<Qt::AlignmentFlag>> align(MAX_CYLINDERS);
+ std::vector<QFlags<Qt::AlignmentFlag>> align(pInfo->nr_cylinders);
double axisRange = (vAxis->maximum() - vAxis->minimum())/1000; // Convert axis pressure range to bar
double axisLog = log10(log10(axisRange));
@@ -729,7 +729,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
for (int i = 0, count = dataModel->rowCount(); i < count; i++) {
const struct plot_data *entry = pInfo->entry + i;
- for (int cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
+ for (int cyl = 0; cyl < pInfo->nr_cylinders; cyl++) {
int mbar = get_plot_pressure(pInfo, i, cyl);
if (!mbar)
@@ -748,7 +748,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
label_y_offset = -7 * axisLog;
}
plotPressureValue(mbar, entry->sec, alignVar, value_y_offset);
- plotGasValue(mbar, entry->sec, displayed_dive.cylinder[cyl].gasmix, alignVar, label_y_offset);
+ plotGasValue(mbar, entry->sec, displayed_dive.cylinders.cylinders[cyl].gasmix, alignVar, label_y_offset);
seen_cyl[cyl] = true;
/* Alternate alignment as we see cylinder use.. */
@@ -761,7 +761,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
}
// For each cylinder, on right hand side of profile, write cylinder pressure
- for (int cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
+ for (int cyl = 0; cyl < pInfo->nr_cylinders; cyl++) {
if (last_time[cyl]) {
double value_y_offset = -0.5;
plotPressureValue(last_pressure[cyl], last_time[cyl], align[cyl] | Qt::AlignLeft, value_y_offset);
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index e065361d3..01cd733be 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -1536,7 +1536,7 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
int newGasIdx = gasChangeIdx + 1;
const struct plot_data &newGasEntry = plotInfo.entry[newGasIdx];
qDebug() << "after gas change at " << newGasEntry->sec << ": sensor pressure" << newGasEntry->pressure[0] << "interpolated" << newGasEntry->pressure[1];
- if (get_plot_sensor_pressure(&plotInfo, gasChangeIdx) == 0 || displayed_dive.cylinder[gasChangeEntry->sensor[0]].sample_start.mbar == 0) {
+ if (get_plot_sensor_pressure(&plotInfo, gasChangeIdx) == 0 || displayed_dive.cylinders.cylinders[gasChangeEntry->sensor[0]].sample_start.mbar == 0) {
// if we have no sensorpressure or if we have no pressure from samples we can assume that
// we only have interpolated pressure (the pressure in the entry may be stored in the sensor
// pressure field if this is the first or last entry for this tank... see details in gaspressures.c
@@ -1545,7 +1545,7 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
QAction *adjustOldPressure = m.addAction(tr("Adjust pressure of cyl. %1 (currently interpolated as %2)")
.arg(gasChangeEntry->sensor[0] + 1).arg(get_pressure_string(pressure)));
}
- if (get_plot_sensor_pressure(&plotInfo, newGasIdx) == 0 || displayed_dive.cylinder[newGasEntry->sensor[0]].sample_start.mbar == 0) {
+ if (get_plot_sensor_pressure(&plotInfo, newGasIdx) == 0 || displayed_dive.cylinders.cylinders[newGasEntry->sensor[0]].sample_start.mbar == 0) {
// we only have interpolated press -- see commend above
pressure_t pressure;
pressure.mbar = get_plot_interpolated_pressure(&plotInfo, newGasIdx) ? : get_plot_sensor_pressure(&plotInfo, newGasIdx);
@@ -1882,7 +1882,7 @@ void ProfileWidget2::repositionDiveHandlers()
QLineF line(p1, p2);
QPointF pos = line.pointAt(0.5);
gases[i]->setPos(pos);
- gases[i]->setText(get_gas_string(displayed_dive.cylinder[datapoint.cylinderid].gasmix));
+ gases[i]->setText(get_gas_string(displayed_dive.cylinders.cylinders[datapoint.cylinderid].gasmix));
gases[i]->setVisible(datapoint.entered &&
(i == 0 || gases[i]->text() != gases[i-1]->text()));
}
diff --git a/profile-widget/tankitem.cpp b/profile-widget/tankitem.cpp
index f40baa357..8cd53b5d4 100644
--- a/profile-widget/tankitem.cpp
+++ b/profile-widget/tankitem.cpp
@@ -98,7 +98,7 @@ void TankItem::modelDataChanged(const QModelIndex&, const QModelIndex&)
// start with the first gasmix and at the start of the dive
int cyl = explicit_first_cylinder(&displayed_dive, dc);
- struct gasmix gasmix = displayed_dive.cylinder[cyl].gasmix;
+ struct gasmix gasmix = displayed_dive.cylinders.cylinders[cyl].gasmix;
int startTime = 0;
// work through all the gas changes and add the rectangle for each gas while it was used