hydrogen 1.2.6
SplashScreen.cpp
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 * Copyright(c) 2008-2025 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5 *
6 * http://www.hydrogen-music.org
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see https://www.gnu.org/licenses
20 *
21 */
22
23#include <core/Version.h>
24#include "SplashScreen.h"
25
26#include <QPainter>
27#include <QApplication>
28#include <QScreen>
29
30#include "Skin.h"
31
33 : QSplashScreen()
34 , Object()
35{
36 //INFOLOG( "SplashScreen" );
37
38 setFixedSize(width, height);
39
40 m_pBackground = new QPixmap( Skin::getImagePath() + "/splash/splash.png" );
41
42 QFont font;
43 font.setPointSize( 10 );
44 font.setBold( true );
45
46 QPainter p;
47 p.begin( m_pBackground );
48 p.setFont( font );
49 p.setPen( QColor( 20, 20, 20 ) );
50
51 QString version = QString( "v%1 (%2)" ).arg( H2Core::get_version().c_str() ).arg( __DATE__ );
52 p.drawText( 5, 5, width - 10, 40, Qt::AlignRight | Qt::AlignTop, version );
53
54 p.end();
55
56 setPixmap( *m_pBackground );
57
58 // Center on screeen
59 QRect rect( QGuiApplication::screens().first()->geometry() );
60 move( rect.center() - this->rect().center() );
61
62 QTimer::singleShot( 5000, this, SLOT( onCloseTimer() ) );
63}
64
65
66
67
69{
70 //INFOLOG( "~SplashScreen" );
71 delete m_pBackground;
72}
73
74
75
77{
78 hide();
79}
static QString getImagePath()
Definition Skin.h:36
static const uint width
void onCloseTimer()
static const uint height
QPixmap * m_pBackground
std::string get_version()
Returns the current Hydrogen version string.
Definition Version.cpp:30