diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2014-03-10 17:59:01 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-03-10 09:02:25 -0700 |
commit | 324b8cbff1a5ee9ab0fe2ec04183bb9c0c821dc1 (patch) | |
tree | f818aa38113efa1738084bfd5757ab9c1fa662dd /qt-ui/profile/profilewidget2.cpp | |
parent | 7d9849cfed6da3d00366b849456194c6ade66a70 (diff) | |
download | subsurface-324b8cbff1a5ee9ab0fe2ec04183bb9c0c821dc1.tar.gz |
Profile2: use a different image when no profile is visible
This patch adds a new image resource named poster.png which,
is shown instead of the 3 posters. The main reason for that
is due to the poster text not being visible. This new image
is pretty much the Subsurface logo only.
It also removes the grid lines, while the poster is visible.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/profilewidget2.cpp')
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 88f93785b..d7a2228f4 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -464,19 +464,19 @@ void ProfileWidget2::fixBackgroundPos() { if (currentState != EMPTY) return; - QPixmap toBeScaled; - if (!backgrounds.keys().contains(backgroundFile)) { - backgrounds[backgroundFile] = QPixmap(backgroundFile); - } - toBeScaled = backgrounds[backgroundFile]; - QPixmap p = toBeScaled.scaledToHeight(viewport()->height()); + QPixmap toBeScaled = QPixmap(backgroundFile); + QPixmap p = toBeScaled.scaledToHeight(viewport()->height() - 40, Qt::SmoothTransformation); int x = viewport()->width() / 2 - p.width() / 2; + int y = viewport()->height() / 2 - p.height() / 2; background->setPixmap(p); background->setX(mapToScene(x, 0).x()); + background->setY(mapToScene(y, 20).y()); } void ProfileWidget2::wheelEvent(QWheelEvent *event) { + if (currentState == EMPTY) + return; QPoint toolTipPos = mapFromScene(toolTipItem->pos()); double scaleFactor = 1.15; if (event->delta() > 0 && zoomLevel < 20) { @@ -495,7 +495,7 @@ void ProfileWidget2::scrollViewTo(const QPoint &pos) { /* since we cannot use translate() directly on the scene we hack on * the scroll bars (hidden) functionality */ - if (!zoomLevel) + if (!zoomLevel || currentState == EMPTY) return; QScrollBar *vs = verticalScrollBar(); QScrollBar *hs = horizontalScrollBar(); @@ -534,17 +534,18 @@ void ProfileWidget2::setEmptyState() return; dataModel->clear(); - backgroundFile = QString(":poster%1").arg(rand() % 3 + 1); currentState = EMPTY; + + backgroundFile = QString(":poster"); fixBackgroundPos(); - profileYAxis->setPos(itemPos.depth.pos.off); - gasYAxis->setPos(itemPos.partialPressure.pos.off); - timeAxis->setPos(itemPos.time.pos.off); - background->setY(itemPos.background.on.y()); background->setVisible(true); + + profileYAxis->setVisible(false); + gasYAxis->setVisible(false); + timeAxis->setVisible(false); + temperatureAxis->setVisible(false); + cylinderPressureAxis->setVisible(false); toolTipItem->setVisible(false); - temperatureAxis->setPos(itemPos.temperature.pos.off); - cylinderPressureAxis->setPos(itemPos.cylinder.pos.off); meanDepth->setVisible(false); diveComputerText->setVisible(false); diveCeiling->setVisible(false); @@ -572,6 +573,11 @@ void ProfileWidget2::setProfileState() background->setVisible(false); toolTipItem->setVisible(true); + profileYAxis->setVisible(true); + gasYAxis->setVisible(true); + timeAxis->setVisible(true); + temperatureAxis->setVisible(true); + cylinderPressureAxis->setVisible(true); profileYAxis->setPos(itemPos.depth.pos.on); QSettings s; |