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 "ViewportParams.h"
14#include "RenderState.h"
15
16#include <QPixmap>
17
18namespace Marble
19{
20
21MarbleSplashLayer::MarbleSplashLayer()
22{
23}
24
25QStringList MarbleSplashLayer::renderPosition() const
26{
27 return QStringList(QStringLiteral("SURFACE"));
28}
29
30bool MarbleSplashLayer::render( GeoPainter *painter, ViewportParams *viewport,
31 const QString &renderPos, GeoSceneLayer *layer )
32{
33 Q_UNUSED( renderPos );
34 Q_UNUSED( layer );
35
36 painter->save();
37
38 QPixmap logoPixmap(MarbleDirs::path(QStringLiteral("svg/marble-logo-inverted-72dpi.png")));
39
40 if ( logoPixmap.width() > viewport->width() * 0.7
41 || logoPixmap.height() > viewport->height() * 0.7 )
42 {
43 logoPixmap = logoPixmap.scaled( QSize( viewport->width(), viewport->height() ) * 0.7,
45 }
46
47 QPoint logoPosition( ( viewport->width() - logoPixmap.width() ) / 2,
48 ( viewport->height() - logoPixmap.height() ) / 2 );
49 painter->drawPixmap( logoPosition, logoPixmap );
50
51 QString message; // "Please assign a map theme!";
52
53 painter->setPen( Qt::white );
54
55 int yTop = logoPosition.y() + logoPixmap.height() + 10;
56 QRect textRect( 0, yTop,
57 viewport->width(), viewport->height() - yTop );
58 painter->drawText( textRect, Qt::AlignHCenter | Qt::AlignTop, message );
59
60 painter->restore();
61
62 return true;
63}
64
65RenderState MarbleSplashLayer::renderState() const
66{
67 return RenderState(QStringLiteral("Splash Screen"));
68}
69
70
71}
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 Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.