summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp16
-rw-r--r--qt-ui/profile/profilewidget2.cpp6
2 files changed, 10 insertions, 12 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 1c6c05702..830848987 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -89,14 +89,13 @@ void DivePlannerPointsModel::loadFromDive(dive *d)
CylindersModel::instance()->setDive(stagingDive);
int lasttime = 0;
// we start with the first gas and see if it was changed
- int o2 = get_o2(&backupDive.cylinder[0].gasmix);
- int he = get_he(&backupDive.cylinder[0].gasmix);
+ struct gasmix gas = backupDive.cylinder[0].gasmix;
for (int i = 0; i < backupDive.dc.samples - 1; i++) {
const sample &s = backupDive.dc.sample[i];
if (s.time.seconds == 0)
continue;
- get_gas_from_events(&backupDive.dc, lasttime, &o2, &he);
- plannerModel->addStop(s.depth.mm, s.time.seconds, o2, he, 0, true);
+ get_gas_from_events(&backupDive.dc, lasttime, &gas);
+ plannerModel->addStop(s.depth.mm, s.time.seconds, get_o2(&gas), get_he(&gas), 0, true);
lasttime = s.time.seconds;
}
}
@@ -390,8 +389,7 @@ QVariant DivePlannerPointsModel::data(const QModelIndex &index, int role) const
bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
- int o2 = 0;
- int he = 0;
+ struct gasmix gas = { 0 };
int i, shift;
if (role == Qt::EditRole) {
divedatapoint &p = divepoints[index.row()];
@@ -419,9 +417,9 @@ bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &v
} break;
case GAS:
QByteArray gasv = value.toByteArray();
- if (validate_gas(gasv.data(), &o2, &he)) {
- p.o2 = o2;
- p.he = he;
+ if (validate_gas(gasv.data(), &gas)) {
+ p.o2 = get_o2(&gas);
+ p.he = get_he(&gas);
}
break;
}
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 73df4f99d..4cfd295f8 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -992,12 +992,12 @@ void ProfileWidget2::changeGas()
// backup the things on the dataModel, since we will clear that out.
unsigned int diveComputer = dataModel->dcShown();
int diveId = dataModel->id();
- int o2, he;
+ struct gasmix gasmix;
int seconds = timeAxis->valueAt(scenePos);
struct dive *d = get_dive_by_uniq_id(diveId);
- validate_gas(gas.toUtf8().constData(), &o2, &he);
- add_gas_switch_event(d, get_dive_dc(d, diveComputer), seconds, get_gasidx(d, o2, he));
+ validate_gas(gas.toUtf8().constData(), &gasmix);
+ add_gas_switch_event(d, get_dive_dc(d, diveComputer), seconds, get_gasidx(d, &gasmix));
// this means we potentially have a new tank that is being used and needs to be shown
fixup_dive(d);
MainWindow::instance()->information()->updateDiveInfo(selected_dive);