mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix the 'Empty' profile state that was broken for ages.
Show a nice poster that Luisa did for Subsurface ( we have a few other options that I'm waiting her to send. ) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
86bc3bd58f
commit
d66e4b5236
6 changed files with 61 additions and 12 deletions
BIN
icons/poster1.jpg
Normal file
BIN
icons/poster1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 194 KiB |
BIN
icons/poster2.jpg
Normal file
BIN
icons/poster2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 191 KiB |
BIN
icons/poster3.jpg
Normal file
BIN
icons/poster3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 107 KiB |
|
@ -9,6 +9,7 @@
|
||||||
#include "diveeventitem.h"
|
#include "diveeventitem.h"
|
||||||
#include "divetextitem.h"
|
#include "divetextitem.h"
|
||||||
#include "divetooltipitem.h"
|
#include "divetooltipitem.h"
|
||||||
|
#include "animationfunctions.h"
|
||||||
#include <QStateMachine>
|
#include <QStateMachine>
|
||||||
#include <QSignalTransition>
|
#include <QSignalTransition>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
|
@ -76,8 +77,9 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
|
||||||
setupItemSizes();
|
setupItemSizes();
|
||||||
setupItemOnScene();
|
setupItemOnScene();
|
||||||
addItemsToScene();
|
addItemsToScene();
|
||||||
|
|
||||||
scene()->installEventFilter(this);
|
scene()->installEventFilter(this);
|
||||||
|
setEmptyState();
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
QTableView *diveDepthTableView = new QTableView();
|
QTableView *diveDepthTableView = new QTableView();
|
||||||
diveDepthTableView->setModel(dataModel);
|
diveDepthTableView->setModel(dataModel);
|
||||||
|
@ -112,6 +114,7 @@ void ProfileWidget2::addItemsToScene()
|
||||||
|
|
||||||
void ProfileWidget2::setupItemOnScene()
|
void ProfileWidget2::setupItemOnScene()
|
||||||
{
|
{
|
||||||
|
background->setZValue(9999);
|
||||||
toolTipItem->setTimeAxis(timeAxis);
|
toolTipItem->setTimeAxis(timeAxis);
|
||||||
|
|
||||||
gasYAxis->setOrientation(DiveCartesianAxis::BottomToTop);
|
gasYAxis->setOrientation(DiveCartesianAxis::BottomToTop);
|
||||||
|
@ -296,16 +299,17 @@ void ProfileWidget2::settingsChanged()
|
||||||
void ProfileWidget2::resizeEvent(QResizeEvent* event)
|
void ProfileWidget2::resizeEvent(QResizeEvent* event)
|
||||||
{
|
{
|
||||||
QGraphicsView::resizeEvent(event); DiveRectItem *depthController;
|
QGraphicsView::resizeEvent(event); DiveRectItem *depthController;
|
||||||
DiveRectItem *timeController;
|
|
||||||
|
|
||||||
fitInView(sceneRect(), Qt::IgnoreAspectRatio);
|
fitInView(sceneRect(), Qt::IgnoreAspectRatio);
|
||||||
|
fixBackgroundPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileWidget2::fixBackgroundPos()
|
void ProfileWidget2::fixBackgroundPos()
|
||||||
{
|
{
|
||||||
QPixmap toBeScaled(":background");
|
QPixmap toBeScaled;
|
||||||
if (toBeScaled.isNull())
|
if (!backgrounds.keys().contains(backgroundFile)){
|
||||||
return;
|
backgrounds[backgroundFile] = QPixmap(backgroundFile);
|
||||||
|
}
|
||||||
|
toBeScaled = backgrounds[backgroundFile];
|
||||||
QPixmap p = toBeScaled.scaledToHeight(viewport()->height());
|
QPixmap p = toBeScaled.scaledToHeight(viewport()->height());
|
||||||
int x = viewport()->width() / 2 - p.width() / 2;
|
int x = viewport()->width() / 2 - p.width() / 2;
|
||||||
background->setPixmap(p);
|
background->setPixmap(p);
|
||||||
|
@ -363,3 +367,45 @@ bool ProfileWidget2::eventFilter(QObject *object, QEvent *event)
|
||||||
}
|
}
|
||||||
return QGraphicsView::eventFilter(object, 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()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -55,14 +55,13 @@ public:
|
||||||
|
|
||||||
public slots: // Necessary to call from QAction's signals.
|
public slots: // Necessary to call from QAction's signals.
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
|
void setEmptyState();
|
||||||
|
void setProfileState();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent* event);
|
virtual void resizeEvent(QResizeEvent* event);
|
||||||
virtual void wheelEvent(QWheelEvent* event);
|
virtual void wheelEvent(QWheelEvent* event);
|
||||||
virtual void mouseMoveEvent(QMouseEvent* event);
|
virtual void mouseMoveEvent(QMouseEvent* event);
|
||||||
|
|
||||||
signals:
|
|
||||||
void startProfileState();
|
|
||||||
void startEmptyState();
|
|
||||||
private: /*methods*/
|
private: /*methods*/
|
||||||
void fixBackgroundPos();
|
void fixBackgroundPos();
|
||||||
void scrollViewTo(const QPoint& pos);
|
void scrollViewTo(const QPoint& pos);
|
||||||
|
@ -74,7 +73,9 @@ private:
|
||||||
DivePlotDataModel *dataModel;
|
DivePlotDataModel *dataModel;
|
||||||
State currentState;
|
State currentState;
|
||||||
int zoomLevel;
|
int zoomLevel;
|
||||||
DivePixmapItem *background ;
|
QHash<QString, QPixmap> backgrounds;
|
||||||
|
DivePixmapItem *background;
|
||||||
|
QString backgroundFile;
|
||||||
ToolTipItem *toolTipItem;
|
ToolTipItem *toolTipItem;
|
||||||
// All those here should probably be merged into one structure,
|
// All those here should probably be merged into one structure,
|
||||||
// So it's esyer to replicate for more dives later.
|
// So it's esyer to replicate for more dives later.
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
<file alias="scale">icons/scale.png</file>
|
<file alias="scale">icons/scale.png</file>
|
||||||
<!-- <file alias="ruler">icons/ruler.svg</file> -->
|
<!-- <file alias="ruler">icons/ruler.svg</file> -->
|
||||||
<file alias="ruler">icons/ruler.png</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_up">icons/planner/arrow_up.png</file>
|
||||||
<file alias="arrow_down">icons/planner/arrow_down.png</file>
|
<file alias="arrow_down">icons/planner/arrow_down.png</file>
|
||||||
<file alias="icon_time">icons/planner/icon_time.png</file>
|
<file alias="icon_time">icons/planner/icon_time.png</file>
|
||||||
|
|
Loading…
Add table
Reference in a new issue