aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-10-11 10:21:04 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-10-11 10:21:04 -0300
commit1b9a4f2bf8e9de9144133a435f3470fd77975945 (patch)
tree74aa1d0972296d3d7f7b327fbabd523d91cb8aeb /qt-ui/diveplanner.cpp
parent9ed933d033889ac841c5f38afcdd40fa588a8cb9 (diff)
downloadsubsurface-1b9a4f2bf8e9de9144133a435f3470fd77975945.tar.gz
Good deal of whitespace fixes and code cleanup.
I just went thru all of subsurface code removing some whitespaces issues and trying to make the code prettyer, I also removed a few QString issues.d Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp33
1 files changed, 10 insertions, 23 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 452d1c848..7c7957e67 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -211,17 +211,15 @@ void DivePlannerGraphics::pointInserted(const QModelIndex& parent, int start , i
void DivePlannerGraphics::keyDownAction()
{
- if (scene()->selectedItems().count()) {
- Q_FOREACH(QGraphicsItem *i, scene()->selectedItems()) {
- if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler*>(i)) {
- int row = handles.indexOf(handler);
- divedatapoint dp = plannerModel->at(row);
- if (dp.depth >= depthLine->maximum())
- continue;
+ Q_FOREACH(QGraphicsItem *i, scene()->selectedItems()) {
+ if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler*>(i)) {
+ int row = handles.indexOf(handler);
+ divedatapoint dp = plannerModel->at(row);
+ if (dp.depth >= depthLine->maximum())
+ continue;
- dp.depth += M_OR_FT(1,5);
- plannerModel->editStop(row, dp);
- }
+ dp.depth += M_OR_FT(1,5);
+ plannerModel->editStop(row, dp);
}
}
}
@@ -397,13 +395,9 @@ void DivePlannerGraphics::decreaseDepth()
void DivePlannerGraphics::decreaseTime()
{
- if (timeLine->maximum() - 10 < TIME_INITIAL_MAX) {
+ if (timeLine->maximum() - 10 < TIME_INITIAL_MAX || timeLine->maximum() - 10 < dpMaxTime)
return;
- }
- if (timeLine->maximum() - 10 < dpMaxTime) {
- qDebug() << timeLine->maximum() << dpMaxTime;
- return;
- }
+
minMinutes -= 10;
timeLine->setMaximum(timeLine->maximum() - 10);
timeLine->updateTicks();
@@ -575,7 +569,6 @@ void DivePlannerGraphics::moveActiveHandler(const QPointF& mappedPos, const int
maxtime = plannerModel->at(pos + 1).time;
int minutes = rint(timeLine->valueAt(mappedPos));
-
if (minutes * 60 <= mintime || minutes * 60 >= maxtime)
return;
@@ -591,10 +584,7 @@ void DivePlannerGraphics::moveActiveHandler(const QPointF& mappedPos, const int
activeDraggedHandler->setPos(QPointF(xpos, ypos));
qDeleteAll(lines);
lines.clear();
-
drawProfile();
-
-
}
bool DivePlannerGraphics::isPointOutOfBoundaries(const QPointF& point)
@@ -758,7 +748,6 @@ void Ruler::setTickSize(qreal size)
tickSize = size;
}
-
void Ruler::setTickInterval(double i)
{
interval = i;
@@ -796,7 +785,6 @@ qreal Ruler::percentAt(const QPointF& p)
return percent;
}
-
double Ruler::maximum() const
{
return max;
@@ -1228,6 +1216,5 @@ void DivePlannerPointsModel::createPlan()
beginRemoveRows(QModelIndex(), 0, rowCount() -1 );
divepoints.clear();
endRemoveRows();
-
planCreated();
}