mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: constify DivePlannerPoints model accessor functions
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
216a910f56
commit
5196ea6149
2 changed files with 25 additions and 25 deletions
|
@ -244,7 +244,7 @@ void DivePlannerPointsModel::setPlanMode(Mode m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivePlannerPointsModel::isPlanner()
|
bool DivePlannerPointsModel::isPlanner() const
|
||||||
{
|
{
|
||||||
return mode == PLAN;
|
return mode == PLAN;
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ bool DivePlannerPointsModel::setRecalc(bool rec)
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivePlannerPointsModel::recalcQ()
|
bool DivePlannerPointsModel::recalcQ() const
|
||||||
{
|
{
|
||||||
return recalc;
|
return recalc;
|
||||||
}
|
}
|
||||||
|
@ -568,7 +568,7 @@ void DivePlannerPointsModel::setSalinity(int salinity)
|
||||||
emitDataChanged();
|
emitDataChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivePlannerPointsModel::getSurfacePressure()
|
int DivePlannerPointsModel::getSurfacePressure() const
|
||||||
{
|
{
|
||||||
return diveplan.surface_pressure;
|
return diveplan.surface_pressure;
|
||||||
}
|
}
|
||||||
|
@ -584,7 +584,7 @@ void DivePlannerPointsModel::setAscrate75Display(int rate)
|
||||||
qPrefDivePlanner::set_ascrate75(lrint(rate * UNIT_FACTOR));
|
qPrefDivePlanner::set_ascrate75(lrint(rate * UNIT_FACTOR));
|
||||||
emitDataChanged();
|
emitDataChanged();
|
||||||
}
|
}
|
||||||
int DivePlannerPointsModel::ascrate75Display()
|
int DivePlannerPointsModel::ascrate75Display() const
|
||||||
{
|
{
|
||||||
return lrint((float)prefs.ascrate75 / UNIT_FACTOR);
|
return lrint((float)prefs.ascrate75 / UNIT_FACTOR);
|
||||||
}
|
}
|
||||||
|
@ -594,7 +594,7 @@ void DivePlannerPointsModel::setAscrate50Display(int rate)
|
||||||
qPrefDivePlanner::set_ascrate50(lrint(rate * UNIT_FACTOR));
|
qPrefDivePlanner::set_ascrate50(lrint(rate * UNIT_FACTOR));
|
||||||
emitDataChanged();
|
emitDataChanged();
|
||||||
}
|
}
|
||||||
int DivePlannerPointsModel::ascrate50Display()
|
int DivePlannerPointsModel::ascrate50Display() const
|
||||||
{
|
{
|
||||||
return lrint((float)prefs.ascrate50 / UNIT_FACTOR);
|
return lrint((float)prefs.ascrate50 / UNIT_FACTOR);
|
||||||
}
|
}
|
||||||
|
@ -604,7 +604,7 @@ void DivePlannerPointsModel::setAscratestopsDisplay(int rate)
|
||||||
qPrefDivePlanner::set_ascratestops(lrint(rate * UNIT_FACTOR));
|
qPrefDivePlanner::set_ascratestops(lrint(rate * UNIT_FACTOR));
|
||||||
emitDataChanged();
|
emitDataChanged();
|
||||||
}
|
}
|
||||||
int DivePlannerPointsModel::ascratestopsDisplay()
|
int DivePlannerPointsModel::ascratestopsDisplay() const
|
||||||
{
|
{
|
||||||
return lrint((float)prefs.ascratestops / UNIT_FACTOR);
|
return lrint((float)prefs.ascratestops / UNIT_FACTOR);
|
||||||
}
|
}
|
||||||
|
@ -614,7 +614,7 @@ void DivePlannerPointsModel::setAscratelast6mDisplay(int rate)
|
||||||
qPrefDivePlanner::set_ascratelast6m(lrint(rate * UNIT_FACTOR));
|
qPrefDivePlanner::set_ascratelast6m(lrint(rate * UNIT_FACTOR));
|
||||||
emitDataChanged();
|
emitDataChanged();
|
||||||
}
|
}
|
||||||
int DivePlannerPointsModel::ascratelast6mDisplay()
|
int DivePlannerPointsModel::ascratelast6mDisplay() const
|
||||||
{
|
{
|
||||||
return lrint((float)prefs.ascratelast6m / UNIT_FACTOR);
|
return lrint((float)prefs.ascratelast6m / UNIT_FACTOR);
|
||||||
}
|
}
|
||||||
|
@ -624,7 +624,7 @@ void DivePlannerPointsModel::setDescrateDisplay(int rate)
|
||||||
qPrefDivePlanner::set_descrate(lrint(rate * UNIT_FACTOR));
|
qPrefDivePlanner::set_descrate(lrint(rate * UNIT_FACTOR));
|
||||||
emitDataChanged();
|
emitDataChanged();
|
||||||
}
|
}
|
||||||
int DivePlannerPointsModel::descrateDisplay()
|
int DivePlannerPointsModel::descrateDisplay() const
|
||||||
{
|
{
|
||||||
return lrint((float)prefs.descrate / UNIT_FACTOR);
|
return lrint((float)prefs.descrate / UNIT_FACTOR);
|
||||||
}
|
}
|
||||||
|
@ -742,7 +742,7 @@ bool divePointsLessThan(const divedatapoint &p1, const divedatapoint &p2)
|
||||||
return p1.time < p2.time;
|
return p1.time < p2.time;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivePlannerPointsModel::lastEnteredPoint()
|
int DivePlannerPointsModel::lastEnteredPoint() const
|
||||||
{
|
{
|
||||||
for (int i = divepoints.count() - 1; i >= 0; i--)
|
for (int i = divepoints.count() - 1; i >= 0; i--)
|
||||||
if (divepoints.at(i).entered)
|
if (divepoints.at(i).entered)
|
||||||
|
@ -845,12 +845,12 @@ void DivePlannerPointsModel::editStop(int row, divedatapoint newData)
|
||||||
emitDataChanged();
|
emitDataChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivePlannerPointsModel::size()
|
int DivePlannerPointsModel::size() const
|
||||||
{
|
{
|
||||||
return divepoints.size();
|
return divepoints.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
divedatapoint DivePlannerPointsModel::at(int row)
|
divedatapoint DivePlannerPointsModel::at(int row) const
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* When moving divepoints rigorously, we might end up with index
|
* When moving divepoints rigorously, we might end up with index
|
||||||
|
@ -932,10 +932,10 @@ DivePlannerPointsModel::Mode DivePlannerPointsModel::currentMode() const
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivePlannerPointsModel::tankInUse(int cylinderid)
|
bool DivePlannerPointsModel::tankInUse(int cylinderid) const
|
||||||
{
|
{
|
||||||
for (int j = 0; j < rowCount(); j++) {
|
for (int j = 0; j < rowCount(); j++) {
|
||||||
divedatapoint &p = divepoints[j];
|
const divedatapoint &p = divepoints[j];
|
||||||
if (p.time == 0) // special entries that hold the available gases
|
if (p.time == 0) // special entries that hold the available gases
|
||||||
continue;
|
continue;
|
||||||
if (!p.entered) // removing deco gases is ok
|
if (!p.entered) // removing deco gases is ok
|
||||||
|
|
|
@ -38,28 +38,28 @@ public:
|
||||||
void cylinderRenumber(int mapping[]);
|
void cylinderRenumber(int mapping[]);
|
||||||
void removeSelectedPoints(const QVector<int> &rows);
|
void removeSelectedPoints(const QVector<int> &rows);
|
||||||
void setPlanMode(Mode mode);
|
void setPlanMode(Mode mode);
|
||||||
bool isPlanner();
|
bool isPlanner() const;
|
||||||
void createSimpleDive();
|
void createSimpleDive();
|
||||||
void clear();
|
void clear();
|
||||||
Mode currentMode() const;
|
Mode currentMode() const;
|
||||||
bool setRecalc(bool recalc);
|
bool setRecalc(bool recalc);
|
||||||
bool recalcQ();
|
bool recalcQ() const;
|
||||||
bool tankInUse(int cylinderid);
|
bool tankInUse(int cylinderid) const;
|
||||||
CylindersModel *cylindersModel();
|
CylindersModel *cylindersModel();
|
||||||
|
|
||||||
int ascrate75Display();
|
int ascrate75Display() const;
|
||||||
int ascrate50Display();
|
int ascrate50Display() const;
|
||||||
int ascratestopsDisplay();
|
int ascratestopsDisplay() const;
|
||||||
int ascratelast6mDisplay();
|
int ascratelast6mDisplay() const;
|
||||||
int descrateDisplay();
|
int descrateDisplay() const;
|
||||||
int getSurfacePressure();
|
int getSurfacePressure() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the row number.
|
* @return the row number.
|
||||||
*/
|
*/
|
||||||
void editStop(int row, divedatapoint newData);
|
void editStop(int row, divedatapoint newData);
|
||||||
divedatapoint at(int row);
|
divedatapoint at(int row) const;
|
||||||
int size();
|
int size() const;
|
||||||
struct diveplan &getDiveplan();
|
struct diveplan &getDiveplan();
|
||||||
void removeDeco();
|
void removeDeco();
|
||||||
static bool addingDeco;
|
static bool addingDeco;
|
||||||
|
@ -120,7 +120,7 @@ private:
|
||||||
explicit DivePlannerPointsModel(QObject *parent = 0);
|
explicit DivePlannerPointsModel(QObject *parent = 0);
|
||||||
void setupStartTime();
|
void setupStartTime();
|
||||||
void setupCylinders();
|
void setupCylinders();
|
||||||
int lastEnteredPoint();
|
int lastEnteredPoint() const;
|
||||||
bool updateMaxDepth();
|
bool updateMaxDepth();
|
||||||
void createPlan(bool replanCopy);
|
void createPlan(bool replanCopy);
|
||||||
struct diveplan diveplan;
|
struct diveplan diveplan;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue