mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-11 03:21:29 +00:00
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>
This commit is contained in:
parent
7d9849cfed
commit
324b8cbff1
7 changed files with 21 additions and 18 deletions
BIN
icons/poster.png
Normal file
BIN
icons/poster.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
Binary file not shown.
Before Width: | Height: | Size: 194 KiB |
Binary file not shown.
Before Width: | Height: | Size: 191 KiB |
Binary file not shown.
Before Width: | Height: | Size: 107 KiB |
|
@ -464,19 +464,19 @@ void ProfileWidget2::fixBackgroundPos()
|
||||||
{
|
{
|
||||||
if (currentState != EMPTY)
|
if (currentState != EMPTY)
|
||||||
return;
|
return;
|
||||||
QPixmap toBeScaled;
|
QPixmap toBeScaled = QPixmap(backgroundFile);
|
||||||
if (!backgrounds.keys().contains(backgroundFile)) {
|
QPixmap p = toBeScaled.scaledToHeight(viewport()->height() - 40, Qt::SmoothTransformation);
|
||||||
backgrounds[backgroundFile] = QPixmap(backgroundFile);
|
|
||||||
}
|
|
||||||
toBeScaled = backgrounds[backgroundFile];
|
|
||||||
QPixmap p = toBeScaled.scaledToHeight(viewport()->height());
|
|
||||||
int x = viewport()->width() / 2 - p.width() / 2;
|
int x = viewport()->width() / 2 - p.width() / 2;
|
||||||
|
int y = viewport()->height() / 2 - p.height() / 2;
|
||||||
background->setPixmap(p);
|
background->setPixmap(p);
|
||||||
background->setX(mapToScene(x, 0).x());
|
background->setX(mapToScene(x, 0).x());
|
||||||
|
background->setY(mapToScene(y, 20).y());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileWidget2::wheelEvent(QWheelEvent *event)
|
void ProfileWidget2::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
|
if (currentState == EMPTY)
|
||||||
|
return;
|
||||||
QPoint toolTipPos = mapFromScene(toolTipItem->pos());
|
QPoint toolTipPos = mapFromScene(toolTipItem->pos());
|
||||||
double scaleFactor = 1.15;
|
double scaleFactor = 1.15;
|
||||||
if (event->delta() > 0 && zoomLevel < 20) {
|
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
|
/* since we cannot use translate() directly on the scene we hack on
|
||||||
* the scroll bars (hidden) functionality */
|
* the scroll bars (hidden) functionality */
|
||||||
if (!zoomLevel)
|
if (!zoomLevel || currentState == EMPTY)
|
||||||
return;
|
return;
|
||||||
QScrollBar *vs = verticalScrollBar();
|
QScrollBar *vs = verticalScrollBar();
|
||||||
QScrollBar *hs = horizontalScrollBar();
|
QScrollBar *hs = horizontalScrollBar();
|
||||||
|
@ -534,17 +534,18 @@ void ProfileWidget2::setEmptyState()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dataModel->clear();
|
dataModel->clear();
|
||||||
backgroundFile = QString(":poster%1").arg(rand() % 3 + 1);
|
|
||||||
currentState = EMPTY;
|
currentState = EMPTY;
|
||||||
|
|
||||||
|
backgroundFile = QString(":poster");
|
||||||
fixBackgroundPos();
|
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);
|
background->setVisible(true);
|
||||||
|
|
||||||
|
profileYAxis->setVisible(false);
|
||||||
|
gasYAxis->setVisible(false);
|
||||||
|
timeAxis->setVisible(false);
|
||||||
|
temperatureAxis->setVisible(false);
|
||||||
|
cylinderPressureAxis->setVisible(false);
|
||||||
toolTipItem->setVisible(false);
|
toolTipItem->setVisible(false);
|
||||||
temperatureAxis->setPos(itemPos.temperature.pos.off);
|
|
||||||
cylinderPressureAxis->setPos(itemPos.cylinder.pos.off);
|
|
||||||
meanDepth->setVisible(false);
|
meanDepth->setVisible(false);
|
||||||
diveComputerText->setVisible(false);
|
diveComputerText->setVisible(false);
|
||||||
diveCeiling->setVisible(false);
|
diveCeiling->setVisible(false);
|
||||||
|
@ -572,6 +573,11 @@ void ProfileWidget2::setProfileState()
|
||||||
|
|
||||||
background->setVisible(false);
|
background->setVisible(false);
|
||||||
toolTipItem->setVisible(true);
|
toolTipItem->setVisible(true);
|
||||||
|
profileYAxis->setVisible(true);
|
||||||
|
gasYAxis->setVisible(true);
|
||||||
|
timeAxis->setVisible(true);
|
||||||
|
temperatureAxis->setVisible(true);
|
||||||
|
cylinderPressureAxis->setVisible(true);
|
||||||
|
|
||||||
profileYAxis->setPos(itemPos.depth.pos.on);
|
profileYAxis->setPos(itemPos.depth.pos.on);
|
||||||
QSettings s;
|
QSettings s;
|
||||||
|
|
|
@ -93,7 +93,6 @@ private:
|
||||||
DivePlotDataModel *dataModel;
|
DivePlotDataModel *dataModel;
|
||||||
State currentState;
|
State currentState;
|
||||||
int zoomLevel;
|
int zoomLevel;
|
||||||
QHash<QString, QPixmap> backgrounds;
|
|
||||||
DivePixmapItem *background;
|
DivePixmapItem *background;
|
||||||
QString backgroundFile;
|
QString backgroundFile;
|
||||||
ToolTipItem *toolTipItem;
|
ToolTipItem *toolTipItem;
|
||||||
|
|
|
@ -15,9 +15,7 @@
|
||||||
<file alias="flag">icons/flag.png</file>
|
<file alias="flag">icons/flag.png</file>
|
||||||
<file alias="scale">icons/scale.png</file>
|
<file alias="scale">icons/scale.png</file>
|
||||||
<file alias="ruler">icons/ruler.png</file>
|
<file alias="ruler">icons/ruler.png</file>
|
||||||
<file alias="poster1">icons/poster1.jpg</file>
|
<file alias="poster">icons/poster.png</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…
Reference in a new issue