summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-11-17 21:20:07 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-17 15:38:48 -0800
commit5945c18c8aeb5ae2c27c00f7409fddf8048b6ec0 (patch)
treed4e75185bc66a18d5ff93de909d2461c12146050 /qt-ui/diveplanner.cpp
parenta2d6bd5c1df74734ec43a58cda120587ef28a0bd (diff)
downloadsubsurface-5945c18c8aeb5ae2c27c00f7409fddf8048b6ec0.tar.gz
Removed the ugly icons on the visual profile editor
Removed the ugly icons on the visual profile editor and replaced them with the much better looking ones that Luisa designed. This was not a simple search and replace since Luisa's design was a bit more sophisticated. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp88
1 files changed, 69 insertions, 19 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index fad3080fd..643f35a2d 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -87,9 +87,9 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
timeLine->setColor(getColor(TIME_GRID));
timeLine->setLine(
fromPercent(10, Qt::Horizontal),
- fromPercent(90, Qt::Vertical),
+ fromPercent(85, Qt::Vertical),
fromPercent(90, Qt::Horizontal),
- fromPercent(90, Qt::Vertical)
+ fromPercent(85, Qt::Vertical)
);
timeLine->setOrientation(Qt::Horizontal);
timeLine->setTickSize(fromPercent(1, Qt::Vertical));
@@ -105,7 +105,7 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
fromPercent(10, Qt::Horizontal),
fromPercent(10, Qt::Vertical),
fromPercent(10, Qt::Horizontal),
- fromPercent(90, Qt::Vertical)
+ fromPercent(85, Qt::Vertical)
);
depthLine->setOrientation(Qt::Vertical);
depthLine->setTickSize(fromPercent(1, Qt::Horizontal));
@@ -128,26 +128,33 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
diveBg->setPen(QPen(QBrush(),0));
scene()->addItem(diveBg);
-#define ADDBTN(obj, icon, text, horizontal, vertical, tooltip, value, slot) \
- obj = new Button(); \
- obj->setPixmap(QPixmap(icon)); \
- obj->setPos(fromPercent(horizontal, Qt::Horizontal), fromPercent(vertical, Qt::Vertical)); \
- obj->setToolTip(QString(tooltip.arg(value))); \
- scene()->addItem(obj); \
- connect(obj, SIGNAL(clicked()), this, SLOT(slot));
-
QString incrText;
if (prefs.units.length == units::METERS)
incrText = tr("10m");
else
incrText = tr("30ft");
- ADDBTN(plusDepth, ":plus", "" , 5, 5, tr("Increase maximum depth by %1"), incrText, increaseDepth());
- ADDBTN(lessDepth, ":minimum","" , 2, 5, tr("Decreases maximum depth by %1"), incrText, decreaseDepth());
- ADDBTN(plusTime, ":plus", "" , 95, 95, tr("Increase minimum time by %1"), tr("10min"), increaseTime());
- ADDBTN(lessTime, ":minimum","" , 92, 95, tr("Decreases minimum time by %1"), tr("10min"), decreaseTime());
-#undef ADDBTN
- minMinutes = TIME_INITIAL_MAX;
+ timeHandler = new ExpanderGraphics();
+ timeHandler->increaseBtn->setPixmap(QString(":plan_plus"));
+ timeHandler->decreaseBtn->setPixmap(QString(":plan_minus"));
+ timeHandler->icon->setPixmap(QString(":icon_time"));
+ connect(timeHandler->increaseBtn, SIGNAL(clicked()), this, SLOT(increaseTime()));
+ connect(timeHandler->decreaseBtn, SIGNAL(clicked()), this, SLOT(decreaseTime()));
+ timeHandler->setPos(fromPercent(83, Qt::Horizontal), fromPercent(85, Qt::Vertical));
+ timeHandler->setZValue(-2);
+ scene()->addItem(timeHandler);
+
+ depthHandler = new ExpanderGraphics();
+ depthHandler->increaseBtn->setPixmap(QString(":arrow_up"));
+ depthHandler->decreaseBtn->setPixmap(QString(":arrow_down"));
+ depthHandler->icon->setPixmap(QString(":icon_depth"));
+ connect(depthHandler->increaseBtn, SIGNAL(clicked()), this, SLOT(increaseDepth()));
+ connect(depthHandler->decreaseBtn, SIGNAL(clicked()), this, SLOT(decreaseDepth()));
+ depthHandler->setPos(fromPercent(0, Qt::Horizontal), fromPercent(85, Qt::Vertical));
+ depthHandler->setZValue(-2);
+ scene()->addItem(depthHandler);
+
+ minMinutes = TIME_INITIAL_MAX;
QAction *action = NULL;
#define ADD_ACTION( SHORTCUT, Slot ) \
@@ -888,7 +895,7 @@ void Ruler::setColor(const QColor& color)
setPen(defaultPen);
}
-Button::Button(QObject* parent): QObject(parent), QGraphicsRectItem()
+Button::Button(QObject* parent, QGraphicsItem *itemParent): QObject(parent), QGraphicsRectItem(itemParent)
{
icon = new QGraphicsPixmapItem(this);
text = new QGraphicsSimpleTextItem(this);
@@ -900,7 +907,7 @@ Button::Button(QObject* parent): QObject(parent), QGraphicsRectItem()
void Button::setPixmap(const QPixmap& pixmap)
{
- icon->setPixmap(pixmap.scaled(20,20, Qt::KeepAspectRatio, Qt::SmoothTransformation));
+ icon->setPixmap(pixmap);
if(pixmap.isNull())
icon->hide();
else
@@ -1455,3 +1462,46 @@ void DivePlannerPointsModel::createPlan()
CylindersModel::instance()->setDive(current_dive);
CylindersModel::instance()->update();
}
+
+ExpanderGraphics::ExpanderGraphics(QGraphicsItem* parent): QGraphicsRectItem(parent)
+{
+ icon = new QGraphicsPixmapItem(this);
+ bg = new QGraphicsPixmapItem(this);
+ leftWing = new QGraphicsPixmapItem(this);
+ rightWing = new QGraphicsPixmapItem(this);
+
+ QPixmap p;
+ #define CREATE(item, pixmap) \
+ p = QPixmap(QString( pixmap ));\
+ item->setPixmap(p); \
+
+ CREATE(icon, ":icon_time");
+ CREATE(bg, ":round_base");
+ CREATE(leftWing, ":left_wing");
+ CREATE(rightWing, ":right_wing");
+ #undef CREATE
+
+ decreaseBtn = new Button(0, this);
+ increaseBtn = new Button(0, this);
+ decreaseBtn->setPixmap(QPixmap(":arrow_down"));
+ increaseBtn->setPixmap(QPixmap(":arrow_up"));
+
+ icon->setFlag(ItemIgnoresTransformations);
+ bg->setFlag(ItemIgnoresTransformations);
+ leftWing->setFlag(ItemIgnoresTransformations);
+ rightWing->setFlag(ItemIgnoresTransformations);
+ decreaseBtn->setFlag(ItemIgnoresTransformations);
+ increaseBtn->setFlag(ItemIgnoresTransformations);
+ setFlag(ItemIgnoresTransformations);
+ leftWing->setZValue(-2);
+ rightWing->setZValue(-2);
+ bg->setZValue(-1);
+
+ leftWing->setPos(0,0);
+ bg->setPos(leftWing->pos().x() + leftWing->boundingRect().width() -60, 5);
+ rightWing->setPos(leftWing->pos().x() + leftWing->boundingRect().width() - 20, 0);
+ decreaseBtn->setPos(leftWing->pos().x(), leftWing->pos().y() );
+ increaseBtn->setPos(rightWing->pos().x(), rightWing->pos().y() );
+ icon->setPos(bg->pos().x(), bg->pos().y() - 5);
+ setTransformOriginPoint(transformOriginPoint().x(), transformOriginPoint().y() - childrenBoundingRect().height());
+}