Skip to content

Commit

Permalink
Merge pull request #44 from UltraStar-Deluxe/dynamic_splashscreen
Browse files Browse the repository at this point in the history
Dynamically add the major and minor version number to splashscreen.
  • Loading branch information
bohning authored Oct 1, 2024
2 parents 0ad072e + bcac880 commit 260062e
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 5 deletions.
25 changes: 24 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
#include "QUMessageBox.h"

#include <QApplication>
#include <QColor>
#include <QDateTime>
#include <QFont>
#include <QFontDatabase>
#include <QTranslator>
#include <QSettings>
#include <QSplashScreen>
#include <QPainter>
#include <QPixmap>
#include <QString>
#include <QFile>
Expand All @@ -29,7 +33,26 @@ int main(int argc, char *argv[]) {
QTranslator trContent;
QTranslator trQt;

QSplashScreen splash(QPixmap(":/icons/splash2.png"));
// create splash screen with major and minor version number
QPixmap canvas(":/splash/splash.png");

QPainter painter(&canvas);
painter.setPen(QColor(0, 174, 239)); // light blue

int fontId = QFontDatabase::addApplicationFont(":/splash/KozGoPro-ExtraLight.otf");
QString fontFamily = QFontDatabase::applicationFontFamilies(fontId).at(0);
QFont versionFont(fontFamily);
versionFont.setPixelSize(24);
painter.setFont(versionFont);

painter.drawText(
0, 0, 418, 130,
Qt::AlignRight | Qt::AlignBottom,
QString("%1.%2").arg(MAJOR_VERSION).arg(MINOR_VERSION)
);

painter.end();
QSplashScreen splash(canvas);
splash.show();

initLanguage(app, trContent, trQt, splash);
Expand Down
4 changes: 2 additions & 2 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define MAIN_H_

#define MAJOR_VERSION 0x0001
#define MINOR_VERSION 0x0008
#define PATCH_VERSION 0x0004
#define MINOR_VERSION 0x0009
#define PATCH_VERSION 0x0000

#define WIP_TEXT "" //" *work in progress* -> Please do not distribute."
//#define WIP_VERSION
Expand Down
Binary file added src/resources/KozGoPro-ExtraLight.otf
Binary file not shown.
6 changes: 4 additions & 2 deletions src/resources/UltraStar-Manager.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@
<file>mediumVideoQuality.png</file>
</qresource>
<qresource prefix="/icons">
<file>splash.png</file>
<file>splash2.png</file>
<file>cup.png</file>
<file>UltraStar-Manager128.png</file>
<file>UltraStar-Manager32.png</file>
Expand Down Expand Up @@ -282,4 +280,8 @@
<file>user_big.png</file>
<file>cover_big.png</file>
</qresource>
<qresource prefix="/splash">
<file>splash.png</file>
<file>KozGoPro-ExtraLight.otf</file>
</qresource>
</RCC>
Binary file modified src/resources/about_bgr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/resources/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/resources/splash.psd
Binary file not shown.
Binary file removed src/resources/splash2.png
Binary file not shown.
Binary file removed src/resources/splash2.psd
Binary file not shown.

0 comments on commit 260062e

Please sign in to comment.