mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
a7506848b3
commit
6e6a1c08c3
1 changed files with 14 additions and 5 deletions
|
|
@ -14,6 +14,9 @@
|
||||||
|
|
||||||
#define TIME_INITIAL_MAX 30
|
#define TIME_INITIAL_MAX 30
|
||||||
|
|
||||||
|
#define MAX_DEEPNESS 150
|
||||||
|
#define MIN_DEEPNESS 40
|
||||||
|
|
||||||
DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent), activeDraggedHandler(0),
|
DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent), activeDraggedHandler(0),
|
||||||
lastValidPos(0.0, 0.0)
|
lastValidPos(0.0, 0.0)
|
||||||
{
|
{
|
||||||
|
|
@ -92,13 +95,15 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
|
||||||
|
|
||||||
plusDepth = new Button();
|
plusDepth = new Button();
|
||||||
plusDepth->setPixmap(QPixmap(":plus"));
|
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);
|
scene()->addItem(plusDepth);
|
||||||
connect(plusDepth, SIGNAL(clicked()), this, SLOT(increaseDepth()));
|
connect(plusDepth, SIGNAL(clicked()), this, SLOT(increaseDepth()));
|
||||||
|
|
||||||
plusTime = new Button();
|
plusTime = new Button();
|
||||||
plusTime->setPixmap(QPixmap(":plus"));
|
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);
|
scene()->addItem(plusTime);
|
||||||
connect(plusTime, SIGNAL(clicked()), this, SLOT(increaseTime()));
|
connect(plusTime, SIGNAL(clicked()), this, SLOT(increaseTime()));
|
||||||
|
|
||||||
|
|
@ -137,7 +142,11 @@ void DivePlannerGraphics::okClicked()
|
||||||
|
|
||||||
void DivePlannerGraphics::increaseDepth()
|
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()
|
void DivePlannerGraphics::increaseTime()
|
||||||
|
|
@ -515,12 +524,12 @@ Button::Button(QObject* parent): QObject(parent), QGraphicsRectItem()
|
||||||
icon->setPos(0,0);
|
icon->setPos(0,0);
|
||||||
text->setPos(0,0);
|
text->setPos(0,0);
|
||||||
setFlag(ItemIgnoresTransformations);
|
setFlag(ItemIgnoresTransformations);
|
||||||
setPen(QPen(QBrush(Qt::white), 0));
|
setPen(QPen(QBrush(), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::setPixmap(const QPixmap& pixmap)
|
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()){
|
if(pixmap.isNull()){
|
||||||
icon->hide();
|
icon->hide();
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue