aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-23 11:28:19 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-04-02 13:53:23 -0700
commit5196ea6149a3c98a7c4e2db9aad8944fec825928 (patch)
tree28072507af512a02c0372a3d56d35d181a2f3651 /qt-models
parent216a910f56687dfcbb7f806237cb563bd9441ccb (diff)
downloadsubsurface-5196ea6149a3c98a7c4e2db9aad8944fec825928.tar.gz
cleanup: constify DivePlannerPoints model accessor functions
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/diveplannermodel.cpp26
-rw-r--r--qt-models/diveplannermodel.h24
2 files changed, 25 insertions, 25 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index 7301e8d07..945118b54 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -244,7 +244,7 @@ void DivePlannerPointsModel::setPlanMode(Mode m)
}
}
-bool DivePlannerPointsModel::isPlanner()
+bool DivePlannerPointsModel::isPlanner() const
{
return mode == PLAN;
}
@@ -259,7 +259,7 @@ bool DivePlannerPointsModel::setRecalc(bool rec)
return old;
}
-bool DivePlannerPointsModel::recalcQ()
+bool DivePlannerPointsModel::recalcQ() const
{
return recalc;
}
@@ -568,7 +568,7 @@ void DivePlannerPointsModel::setSalinity(int salinity)
emitDataChanged();
}
-int DivePlannerPointsModel::getSurfacePressure()
+int DivePlannerPointsModel::getSurfacePressure() const
{
return diveplan.surface_pressure;
}
@@ -584,7 +584,7 @@ void DivePlannerPointsModel::setAscrate75Display(int rate)
qPrefDivePlanner::set_ascrate75(lrint(rate * UNIT_FACTOR));
emitDataChanged();
}
-int DivePlannerPointsModel::ascrate75Display()
+int DivePlannerPointsModel::ascrate75Display() const
{
return lrint((float)prefs.ascrate75 / UNIT_FACTOR);
}
@@ -594,7 +594,7 @@ void DivePlannerPointsModel::setAscrate50Display(int rate)
qPrefDivePlanner::set_ascrate50(lrint(rate * UNIT_FACTOR));
emitDataChanged();
}
-int DivePlannerPointsModel::ascrate50Display()
+int DivePlannerPointsModel::ascrate50Display() const
{
return lrint((float)prefs.ascrate50 / UNIT_FACTOR);
}
@@ -604,7 +604,7 @@ void DivePlannerPointsModel::setAscratestopsDisplay(int rate)
qPrefDivePlanner::set_ascratestops(lrint(rate * UNIT_FACTOR));
emitDataChanged();
}
-int DivePlannerPointsModel::ascratestopsDisplay()
+int DivePlannerPointsModel::ascratestopsDisplay() const
{
return lrint((float)prefs.ascratestops / UNIT_FACTOR);
}
@@ -614,7 +614,7 @@ void DivePlannerPointsModel::setAscratelast6mDisplay(int rate)
qPrefDivePlanner::set_ascratelast6m(lrint(rate * UNIT_FACTOR));
emitDataChanged();
}
-int DivePlannerPointsModel::ascratelast6mDisplay()
+int DivePlannerPointsModel::ascratelast6mDisplay() const
{
return lrint((float)prefs.ascratelast6m / UNIT_FACTOR);
}
@@ -624,7 +624,7 @@ void DivePlannerPointsModel::setDescrateDisplay(int rate)
qPrefDivePlanner::set_descrate(lrint(rate * UNIT_FACTOR));
emitDataChanged();
}
-int DivePlannerPointsModel::descrateDisplay()
+int DivePlannerPointsModel::descrateDisplay() const
{
return lrint((float)prefs.descrate / UNIT_FACTOR);
}
@@ -742,7 +742,7 @@ bool divePointsLessThan(const divedatapoint &p1, const divedatapoint &p2)
return p1.time < p2.time;
}
-int DivePlannerPointsModel::lastEnteredPoint()
+int DivePlannerPointsModel::lastEnteredPoint() const
{
for (int i = divepoints.count() - 1; i >= 0; i--)
if (divepoints.at(i).entered)
@@ -845,12 +845,12 @@ void DivePlannerPointsModel::editStop(int row, divedatapoint newData)
emitDataChanged();
}
-int DivePlannerPointsModel::size()
+int DivePlannerPointsModel::size() const
{
return divepoints.size();
}
-divedatapoint DivePlannerPointsModel::at(int row)
+divedatapoint DivePlannerPointsModel::at(int row) const
{
/*
* When moving divepoints rigorously, we might end up with index
@@ -932,10 +932,10 @@ DivePlannerPointsModel::Mode DivePlannerPointsModel::currentMode() const
return mode;
}
-bool DivePlannerPointsModel::tankInUse(int cylinderid)
+bool DivePlannerPointsModel::tankInUse(int cylinderid) const
{
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
continue;
if (!p.entered) // removing deco gases is ok
diff --git a/qt-models/diveplannermodel.h b/qt-models/diveplannermodel.h
index 57c64f045..978ce818d 100644
--- a/qt-models/diveplannermodel.h
+++ b/qt-models/diveplannermodel.h
@@ -38,28 +38,28 @@ public:
void cylinderRenumber(int mapping[]);
void removeSelectedPoints(const QVector<int> &rows);
void setPlanMode(Mode mode);
- bool isPlanner();
+ bool isPlanner() const;
void createSimpleDive();
void clear();
Mode currentMode() const;
bool setRecalc(bool recalc);
- bool recalcQ();
- bool tankInUse(int cylinderid);
+ bool recalcQ() const;
+ bool tankInUse(int cylinderid) const;
CylindersModel *cylindersModel();
- int ascrate75Display();
- int ascrate50Display();
- int ascratestopsDisplay();
- int ascratelast6mDisplay();
- int descrateDisplay();
- int getSurfacePressure();
+ int ascrate75Display() const;
+ int ascrate50Display() const;
+ int ascratestopsDisplay() const;
+ int ascratelast6mDisplay() const;
+ int descrateDisplay() const;
+ int getSurfacePressure() const;
/**
* @return the row number.
*/
void editStop(int row, divedatapoint newData);
- divedatapoint at(int row);
- int size();
+ divedatapoint at(int row) const;
+ int size() const;
struct diveplan &getDiveplan();
void removeDeco();
static bool addingDeco;
@@ -120,7 +120,7 @@ private:
explicit DivePlannerPointsModel(QObject *parent = 0);
void setupStartTime();
void setupCylinders();
- int lastEnteredPoint();
+ int lastEnteredPoint() const;
bool updateMaxDepth();
void createPlan(bool replanCopy);
struct diveplan diveplan;