aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-02 12:36:05 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-02 12:40:36 -0700
commitcc012c1fa6ffca2c5c93fb79415b9a806cb3632c (patch)
tree11e22c7c28ad2d90a81c174c96a0d3e63c286041 /qt-ui
parent5bead467d7bf5d2249b3fc37647f8ff420d70792 (diff)
downloadsubsurface-cc012c1fa6ffca2c5c93fb79415b9a806cb3632c.tar.gz
Fix addStop to work as slot again
In order to call this as slot it needs to have defaults for all arguments. So we need to change the gasmix into a pointer - which is actually better as this allows to easily pass a NULL pointer when we want to continue to use the previous gas. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp18
-rw-r--r--qt-ui/diveplanner.h2
-rw-r--r--qt-ui/profile/profilewidget2.cpp3
3 files changed, 14 insertions, 9 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 66bad705f..abe1c3a62 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -67,11 +67,11 @@ void DivePlannerPointsModel::createSimpleDive()
// let's use the gas from the first cylinder
gas = stagingDive->cylinder[0].gasmix;
- plannerModel->addStop(M_OR_FT(15, 45), 1 * 60, gas, 0, true);
- plannerModel->addStop(M_OR_FT(15, 45), 40 * 60, gas, 0, true);
+ plannerModel->addStop(M_OR_FT(15, 45), 1 * 60, &gas, 0, true);
+ plannerModel->addStop(M_OR_FT(15, 45), 40 * 60, &gas, 0, true);
if (!isPlanner()) {
- plannerModel->addStop(M_OR_FT(5, 15), 42 * 60, gas, 0, true);
- plannerModel->addStop(M_OR_FT(5, 15), 45 * 60, gas, 0, true);
+ plannerModel->addStop(M_OR_FT(5, 15), 42 * 60, &gas, 0, true);
+ plannerModel->addStop(M_OR_FT(5, 15), 45 * 60, &gas, 0, true);
}
}
@@ -92,7 +92,7 @@ void DivePlannerPointsModel::loadFromDive(dive *d)
if (s.time.seconds == 0)
continue;
get_gas_from_events(&backupDive.dc, lasttime, &gas);
- plannerModel->addStop(s.depth.mm, s.time.seconds, gas, 0, true);
+ plannerModel->addStop(s.depth.mm, s.time.seconds, &gas, 0, true);
lasttime = s.time.seconds;
}
}
@@ -548,9 +548,15 @@ int DivePlannerPointsModel::lastEnteredPoint()
return -1;
}
-int DivePlannerPointsModel::addStop(int milimeters, int seconds, struct gasmix gas, int ccpoint, bool entered, bool usePrevious)
+int DivePlannerPointsModel::addStop(int milimeters, int seconds, gasmix *gas_in, int ccpoint, bool entered)
{
struct gasmix air = { 0 };
+ struct gasmix gas = { 0 };
+ bool usePrevious = false;
+ if (gas_in)
+ gas = *gas_in;
+ else
+ usePrevious = true;
if (recalcQ())
removeDeco();
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index 526e1c5fd..a26038b2f 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -64,7 +64,7 @@ public:
public
slots:
- int addStop(int millimeters, int seconds, struct gasmix gas, int ccpoint, bool entered, bool usePrevious = false);
+ int addStop(int millimeters = 0, int seconds = 0, struct gasmix *gas = 0, int ccpoint = 0, bool entered = true);
void addCylinder_clicked();
void setGFHigh(const int gfhigh);
void setGFLow(const int ghflow);
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 3d740ca1b..ccdbe1888 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -605,8 +605,7 @@ void ProfileWidget2::mouseDoubleClickEvent(QMouseEvent *event)
int minutes = rint(timeAxis->valueAt(mappedPos) / 60);
int milimeters = rint(profileYAxis->valueAt(mappedPos) / M_OR_FT(1, 1)) * M_OR_FT(1, 1);
- struct gasmix ignore = { 0 };
- plannerModel->addStop(milimeters, minutes * 60, ignore, 0, true, true);
+ plannerModel->addStop(milimeters, minutes * 60, 0, 0, true);
}
}