diff options
-rw-r--r-- | icons/poster1.jpg | bin | 0 -> 198308 bytes | |||
-rw-r--r-- | icons/poster2.jpg | bin | 0 -> 196033 bytes | |||
-rw-r--r-- | icons/poster3.jpg | bin | 0 -> 109219 bytes | |||
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 58 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.h | 11 | ||||
-rw-r--r-- | subsurface.qrc | 4 |
6 files changed, 61 insertions, 12 deletions
diff --git a/icons/poster1.jpg b/icons/poster1.jpg Binary files differnew file mode 100644 index 000000000..455e85071 --- /dev/null +++ b/icons/poster1.jpg diff --git a/icons/poster2.jpg b/icons/poster2.jpg Binary files differnew file mode 100644 index 000000000..a06304ec2 --- /dev/null +++ b/icons/poster2.jpg diff --git a/icons/poster3.jpg b/icons/poster3.jpg Binary files differnew file mode 100644 index 000000000..1c9f73ef4 --- /dev/null +++ b/icons/poster3.jpg diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 061beefb0..8bef3f184 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -9,6 +9,7 @@ #include "diveeventitem.h" #include "divetextitem.h" #include "divetooltipitem.h" +#include "animationfunctions.h" #include <QStateMachine> #include <QSignalTransition> #include <QPropertyAnimation> @@ -76,8 +77,9 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : setupItemSizes(); setupItemOnScene(); addItemsToScene(); - scene()->installEventFilter(this); + setEmptyState(); + #ifndef QT_NO_DEBUG QTableView *diveDepthTableView = new QTableView(); diveDepthTableView->setModel(dataModel); @@ -112,6 +114,7 @@ void ProfileWidget2::addItemsToScene() void ProfileWidget2::setupItemOnScene() { + background->setZValue(9999); toolTipItem->setTimeAxis(timeAxis); gasYAxis->setOrientation(DiveCartesianAxis::BottomToTop); @@ -296,16 +299,17 @@ void ProfileWidget2::settingsChanged() void ProfileWidget2::resizeEvent(QResizeEvent* event) { QGraphicsView::resizeEvent(event); DiveRectItem *depthController; - DiveRectItem *timeController; - fitInView(sceneRect(), Qt::IgnoreAspectRatio); + fixBackgroundPos(); } void ProfileWidget2::fixBackgroundPos() { - QPixmap toBeScaled(":background"); - if (toBeScaled.isNull()) - return; + QPixmap toBeScaled; + if (!backgrounds.keys().contains(backgroundFile)){ + backgrounds[backgroundFile] = QPixmap(backgroundFile); + } + toBeScaled = backgrounds[backgroundFile]; QPixmap p = toBeScaled.scaledToHeight(viewport()->height()); int x = viewport()->width() / 2 - p.width() / 2; background->setPixmap(p); @@ -363,3 +367,45 @@ bool ProfileWidget2::eventFilter(QObject *object, QEvent *event) } return QGraphicsView::eventFilter(object, event); } + +void ProfileWidget2::setEmptyState() +{ + // Then starting Empty State, move the background up. + if (currentState == EMPTY) + return; + + backgroundFile = QString(":poster%1").arg( rand()%3 +1); + currentState = EMPTY; + fixBackgroundPos(); + background->setVisible(true); + Animations::moveTo(background, background->x(), 0); + + toolTipItem->setVisible(false); + profileYAxis->setVisible(false); + gasYAxis->setVisible(false); + temperatureAxis->setVisible(false); + timeAxis->setVisible(false); + diveProfileItem->setVisible(false); + cylinderPressureAxis->setVisible(false); + temperatureItem->setVisible(false); + gasPressureItem->setVisible(false); + cartesianPlane->setVisible(false); + meanDepth->setVisible(false); + diveComputerText->setVisible(false); + diveCeiling->setVisible(false); + reportedCeiling->setVisible(false); + pn2GasItem->setVisible(false); + pheGasItem->setVisible(false); + po2GasItem->setVisible(false); + Q_FOREACH(DiveCalculatedTissue *tissue, allTissues){ + tissue->setVisible(false); + } + Q_FOREACH(DiveEventItem *event, eventItems){ + event->setVisible(false); + } +} + +void ProfileWidget2::setProfileState() +{ + +} diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h index b837376d3..ebc45f48a 100644 --- a/qt-ui/profile/profilewidget2.h +++ b/qt-ui/profile/profilewidget2.h @@ -55,14 +55,13 @@ public: public slots: // Necessary to call from QAction's signals. void settingsChanged(); + void setEmptyState(); + void setProfileState(); + protected: virtual void resizeEvent(QResizeEvent* event); virtual void wheelEvent(QWheelEvent* event); virtual void mouseMoveEvent(QMouseEvent* event); - -signals: - void startProfileState(); - void startEmptyState(); private: /*methods*/ void fixBackgroundPos(); void scrollViewTo(const QPoint& pos); @@ -74,7 +73,9 @@ private: DivePlotDataModel *dataModel; State currentState; int zoomLevel; - DivePixmapItem *background ; + QHash<QString, QPixmap> backgrounds; + DivePixmapItem *background; + QString backgroundFile; ToolTipItem *toolTipItem; // All those here should probably be merged into one structure, // So it's esyer to replicate for more dives later. diff --git a/subsurface.qrc b/subsurface.qrc index 7e9e03ec2..b4d59060d 100644 --- a/subsurface.qrc +++ b/subsurface.qrc @@ -19,7 +19,9 @@ <file alias="scale">icons/scale.png</file> <!-- <file alias="ruler">icons/ruler.svg</file> --> <file alias="ruler">icons/ruler.png</file> - <file alias="flag">icons/flag.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="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> |