Marble

MarbleSplashLayer.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2008-2009 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2009 Jens-Michael Hoffmann <jensmh@gmx.de>
5// SPDX-FileCopyrightText: 2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
6//
7
8// Own
9#include "MarbleSplashLayer.h"
10
11#include "GeoPainter.h"
12#include "MarbleDirs.h"
13#include "RenderState.h"
14#include "ViewportParams.h"
15
16#include <QPixmap>
17
18namespace Marble
19{
20
21MarbleSplashLayer::MarbleSplashLayer() = default;
22
23QStringList MarbleSplashLayer::renderPosition() const
24{
25 return QStringList(QStringLiteral("SURFACE"));
26}
27
28bool MarbleSplashLayer::render(GeoPainter *painter, ViewportParams *viewport, const QString &renderPos, GeoSceneLayer *layer)
29{
30 Q_UNUSED(renderPos);
31 Q_UNUSED(layer);
32
33 painter->save();
34
35 QPixmap logoPixmap(MarbleDirs::path(QStringLiteral("svg/marble-logo-inverted-72dpi.png")));
36
37 if (logoPixmap.width() > viewport->width() * 0.7 || logoPixmap.height() > viewport->height() * 0.7) {
38 logoPixmap = logoPixmap.scaled(QSize(viewport->width(), viewport->height()) * 0.7, Qt::KeepAspectRatio, Qt::SmoothTransformation);
39 }
40
41 QPoint logoPosition((viewport->width() - logoPixmap.width()) / 2, (viewport->height() - logoPixmap.height()) / 2);
42 painter->drawPixmap(logoPosition, logoPixmap);
43
44 QString message; // "Please assign a map theme!";
45
46 painter->setPen(Qt::white);
47
48 int yTop = logoPosition.y() + logoPixmap.height() + 10;
49 QRect textRect(0, yTop, viewport->width(), viewport->height() - yTop);
50 painter->drawText(textRect, Qt::AlignHCenter | Qt::AlignTop, message);
51
52 painter->restore();
53
54 return true;
55}
56
57RenderState MarbleSplashLayer::renderState() const
58{
59 return RenderState(QStringLiteral("Splash Screen"));
60}
61
62}
This file contains the headers for ViewportParams.
Binds a QML item to a specific geodetic location in screen coordinates.
AlignHCenter
KeepAspectRatio
SmoothTransformation
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.