File indexing completed on 2025-01-05 03:59:18
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2008-2009 Torsten Rahn <tackat@kde.org> 0004 // SPDX-FileCopyrightText: 2009 Jens-Michael Hoffmann <jensmh@gmx.de> 0005 // SPDX-FileCopyrightText: 2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de> 0006 // 0007 0008 // Own 0009 #include "MarbleSplashLayer.h" 0010 0011 #include "GeoPainter.h" 0012 #include "MarbleDirs.h" 0013 #include "ViewportParams.h" 0014 #include "RenderState.h" 0015 0016 #include <QPixmap> 0017 0018 namespace Marble 0019 { 0020 0021 MarbleSplashLayer::MarbleSplashLayer() 0022 { 0023 } 0024 0025 QStringList MarbleSplashLayer::renderPosition() const 0026 { 0027 return QStringList(QStringLiteral("SURFACE")); 0028 } 0029 0030 bool MarbleSplashLayer::render( GeoPainter *painter, ViewportParams *viewport, 0031 const QString &renderPos, GeoSceneLayer *layer ) 0032 { 0033 Q_UNUSED( renderPos ); 0034 Q_UNUSED( layer ); 0035 0036 painter->save(); 0037 0038 QPixmap logoPixmap(MarbleDirs::path(QStringLiteral("svg/marble-logo-inverted-72dpi.png"))); 0039 0040 if ( logoPixmap.width() > viewport->width() * 0.7 0041 || logoPixmap.height() > viewport->height() * 0.7 ) 0042 { 0043 logoPixmap = logoPixmap.scaled( QSize( viewport->width(), viewport->height() ) * 0.7, 0044 Qt::KeepAspectRatio, Qt::SmoothTransformation ); 0045 } 0046 0047 QPoint logoPosition( ( viewport->width() - logoPixmap.width() ) / 2, 0048 ( viewport->height() - logoPixmap.height() ) / 2 ); 0049 painter->drawPixmap( logoPosition, logoPixmap ); 0050 0051 QString message; // "Please assign a map theme!"; 0052 0053 painter->setPen( Qt::white ); 0054 0055 int yTop = logoPosition.y() + logoPixmap.height() + 10; 0056 QRect textRect( 0, yTop, 0057 viewport->width(), viewport->height() - yTop ); 0058 painter->drawText( textRect, Qt::AlignHCenter | Qt::AlignTop, message ); 0059 0060 painter->restore(); 0061 0062 return true; 0063 } 0064 0065 RenderState MarbleSplashLayer::renderState() const 0066 { 0067 return RenderState(QStringLiteral("Splash Screen")); 0068 } 0069 0070 0071 }