diff options
-rw-r--r-- | icons/poster.png | bin | 0 -> 37876 bytes | |||
-rw-r--r-- | icons/poster1.jpg | bin | 198308 -> 0 bytes | |||
-rw-r--r-- | icons/poster2.jpg | bin | 196033 -> 0 bytes | |||
-rw-r--r-- | icons/poster3.jpg | bin | 109219 -> 0 bytes | |||
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 34 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.h | 1 | ||||
-rw-r--r-- | subsurface.qrc | 4 |
7 files changed, 21 insertions, 18 deletions
diff --git a/icons/poster.png b/icons/poster.png Binary files differnew file mode 100644 index 000000000..bd82ef7b9 --- /dev/null +++ b/icons/poster.png diff --git a/icons/poster1.jpg b/icons/poster1.jpg Binary files differdeleted file mode 100644 index 455e85071..000000000 --- a/icons/poster1.jpg +++ /dev/null diff --git a/icons/poster2.jpg b/icons/poster2.jpg Binary files differdeleted file mode 100644 index a06304ec2..000000000 --- a/icons/poster2.jpg +++ /dev/null diff --git a/icons/poster3.jpg b/icons/poster3.jpg Binary files differdeleted file mode 100644 index 1c9f73ef4..000000000 --- a/icons/poster3.jpg +++ /dev/null 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; diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h index 5d4e98dfc..c6c9adf93 100644 --- a/qt-ui/profile/profilewidget2.h +++ b/qt-ui/profile/profilewidget2.h @@ -93,7 +93,6 @@ private: DivePlotDataModel *dataModel; State currentState; int zoomLevel; - QHash<QString, QPixmap> backgrounds; DivePixmapItem *background; QString backgroundFile; ToolTipItem *toolTipItem; diff --git a/subsurface.qrc b/subsurface.qrc index 4e0cffd72..a1211a66b 100644 --- a/subsurface.qrc +++ b/subsurface.qrc @@ -15,9 +15,7 @@ <file alias="flag">icons/flag.png</file> <file alias="scale">icons/scale.png</file> <file alias="ruler">icons/ruler.png</file> - <file alias="poster1">icons/poster1.jpg</file> - <file alias="poster2">icons/poster2.jpg</file> - <file alias="poster3">icons/poster3.jpg</file> + <file alias="poster">icons/poster.png</file> <file alias="arrow_up">icons/planner/arrow_up.png</file> <file alias="arrow_down">icons/planner/arrow_down.png</file> <file alias="icon_time">icons/planner/icon_time.png</file> |