1 /***************************************************************************
2                           kstartuplogo.cpp
3                              -------------------
4     copyright            : (C) 2000 by Michael Edwardes <mte@users.sourceforge.net>
5                            (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
6 
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #include "kstartuplogo.h"
19 
20 
21 // ----------------------------------------------------------------------------
22 // QT Includes
23 
24 #include <QPainter>
25 #include <QCoreApplication>
26 #include <QSplashScreen>
27 
28 // ----------------------------------------------------------------------------
29 // KDE Includes
30 
31 #include <KColorScheme>
32 #include <KLocalizedString>
33 
34 // ----------------------------------------------------------------------------
35 // Project Includes
36 
37 
createStartupLogo()38 std::unique_ptr<QSplashScreen> createStartupLogo()
39 {
40   KColorScheme scheme(QPalette::Active, KColorScheme::Selection);
41   QPixmap logoOverlay(KLocalizedString::localizedFilePath(
42                         QStandardPaths::locate(QStandardPaths::DataLocation,
43                                                QStringLiteral("pics/startlogo.png"))));
44   QPixmap logoPixmap(logoOverlay.size());
45   logoPixmap.fill(scheme.background(KColorScheme::NormalBackground).color());
46   QPainter pixmapPainter(&logoPixmap);
47   pixmapPainter.drawPixmap(0, 0, logoOverlay, 0, 0, logoOverlay.width(), logoOverlay.height());
48   std::unique_ptr<QSplashScreen> splash(new QSplashScreen(logoPixmap, Qt::WindowStaysOnTopHint));
49   splash->showMessage(i18n("Loading %1...", QCoreApplication::applicationVersion()),  //krazy:exclude=qmethods
50                       Qt::AlignLeft | Qt::AlignBottom,
51                       scheme.foreground(KColorScheme::NormalText).color());
52   splash->show();
53   return splash;
54 }
55