Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically add the major and minor version number to splashscreen. #44

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.