mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
5bead467d7
commit
cc012c1fa6
3 changed files with 14 additions and 9 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue