diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-07-02 14:14:09 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-07-02 14:14:09 -0300 |
commit | 6e6a1c08c3c62eac6a809559fc55485b564de3e0 (patch) | |
tree | dece258bd0001fe6935ed88b8048918296f9a997 /qt-ui | |
parent | a7506848b31a3bde21096cf34caacce8a7509f44 (diff) | |
download | subsurface-6e6a1c08c3c62eac6a809559fc55485b564de3e0.tar.gz |
Make the 'increase depth' button to work.
Make the increase depth button to work, it also adds
a 'safety' stop at 150m, I know that this is deep, and
maybe we need to adjust this to a better safety stop.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/diveplanner.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 146484a49..7c355a64a 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -14,6 +14,9 @@ #define TIME_INITIAL_MAX 30 +#define MAX_DEEPNESS 150 +#define MIN_DEEPNESS 40 + DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent), activeDraggedHandler(0), lastValidPos(0.0, 0.0) { @@ -92,13 +95,15 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent) plusDepth = new Button(); plusDepth->setPixmap(QPixmap(":plus")); - plusDepth->setPos(0, 1); + plusDepth->setPos(fromPercent(5, Qt::Horizontal), fromPercent(5, Qt::Vertical)); + plusDepth->setToolTip("Increase maximum depth by 10m"); scene()->addItem(plusDepth); connect(plusDepth, SIGNAL(clicked()), this, SLOT(increaseDepth())); plusTime = new Button(); plusTime->setPixmap(QPixmap(":plus")); - plusTime->setPos(180, 190); + plusTime->setPos(fromPercent(90, Qt::Horizontal), fromPercent(95, Qt::Vertical)); + plusTime->setToolTip("Increase minimum dive time by 10m"); scene()->addItem(plusTime); connect(plusTime, SIGNAL(clicked()), this, SLOT(increaseTime())); @@ -137,7 +142,11 @@ void DivePlannerGraphics::okClicked() void DivePlannerGraphics::increaseDepth() { - qDebug() << "Increase Depth Clicked"; + if (depthLine->maximum() + 10 > MAX_DEEPNESS) + return; + depthLine->setMaximum( depthLine->maximum() + 10); + depthLine->updateTicks(); + createDecoStops(); } void DivePlannerGraphics::increaseTime() @@ -515,12 +524,12 @@ Button::Button(QObject* parent): QObject(parent), QGraphicsRectItem() icon->setPos(0,0); text->setPos(0,0); setFlag(ItemIgnoresTransformations); - setPen(QPen(QBrush(Qt::white), 0)); + setPen(QPen(QBrush(), 0)); } void Button::setPixmap(const QPixmap& pixmap) { - icon->setPixmap(pixmap.scaled(20,20)); + icon->setPixmap(pixmap.scaled(20,20, Qt::KeepAspectRatio, Qt::SmoothTransformation)); if(pixmap.isNull()){ icon->hide(); }else{ |