summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-07-02 14:36:52 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-07-02 14:36:52 -0300
commit7c8bdf70d5300a0325c7c6cc8872373fc8274063 (patch)
tree3dba6cec7da0ca5e73389f3fbcf3bef4a3ca5487 /qt-ui/diveplanner.cpp
parent6e6a1c08c3c62eac6a809559fc55485b564de3e0 (diff)
downloadsubsurface-7c8bdf70d5300a0325c7c6cc8872373fc8274063.tar.gz
Make the increase time button to work.
Makes the increase time button to work, it will increase the minimum time, not the correct time of the dive. the total time is calculated by the deco, and does not come from this, unless the deco is smaller than the minimum time. This patch also fixes the problem where a button would only click once - I was holding the first clicked button as the 'mouse grabber', bad tomaz. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 7c355a64a..4a8ade9df 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -8,6 +8,7 @@
#include <QGraphicsWidget>
#include <QGraphicsProxyWidget>
#include <QPushButton>
+#include <QGraphicsSceneMouseEvent>
#include "ui_diveplanner.h"
#include "mainwindow.h"
@@ -119,6 +120,7 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
scene()->addItem(cancelBtn);
connect(cancelBtn, SIGNAL(clicked()), this, SLOT(cancelClicked()));
+ minMinutes = TIME_INITIAL_MAX;
setRenderHint(QPainter::Antialiasing);
}
@@ -151,7 +153,10 @@ void DivePlannerGraphics::increaseDepth()
void DivePlannerGraphics::increaseTime()
{
- qDebug() << "Increase Time Clicked";
+ minMinutes += 10;
+ timeLine->setMaximum( minMinutes );
+ timeLine->updateTicks();
+ createDecoStops();
}
void DivePlannerGraphics::mouseDoubleClickEvent(QMouseEvent* event)
@@ -222,7 +227,7 @@ void DivePlannerGraphics::createDecoStops()
if (timeLine->maximum() < dp->time / 60.0 + 5 ||
dp->time / 60.0 + 15 < timeLine->maximum()) {
- double newMax = fmax(dp->time / 60.0 + 5, TIME_INITIAL_MAX);
+ double newMax = fmax(dp->time / 60.0 + 5, minMinutes);
timeLine->setMaximum(newMax);
timeLine->updateTicks();
}
@@ -553,5 +558,6 @@ void Button::setText(const QString& t)
void Button::mousePressEvent(QGraphicsSceneMouseEvent* event)
{
+ event->ignore();
emit clicked();
}