forked from ciphrex/mSIGNA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsplashscreen.cpp
59 lines (45 loc) · 1.42 KB
/
splashscreen.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
///////////////////////////////////////////////////////////////////////////////
//
// mSIGNA
//
// splashscreen.cpp
//
// Copyright (c) 2013 Eric Lombrozo
//
// All Rights Reserved.
#include "versioninfo.h"
#include "copyrightinfo.h"
#include "splashscreen.h"
#include <QPainter>
const QString SPLASHSCREENFILENAME(":/images/splash.png");
const QColor TEXTCOLOR(225, 225, 225);
const int VERSIONPADDINGRIGHT = 20;
const int VERSIONPADDINGBOTTOM = 50;
const int COPYRIGHTPADDINGRIGHT = 20;
const int COPYRIGHTPADDINGBOTTOM = 30;
SplashScreen::SplashScreen()
: QSplashScreen()
{
QPixmap pixmap(SPLASHSCREENFILENAME);
QPainter painter(&pixmap);
QFontMetrics metrics = painter.fontMetrics();
painter.setPen(QPen(TEXTCOLOR));
QString fullVersionText = "(" + getShortCommitHash() + ") ";
fullVersionText += getVersionText();
painter.drawText(
pixmap.width() - metrics.width(fullVersionText) - VERSIONPADDINGRIGHT,
pixmap.height() - metrics.height() - VERSIONPADDINGBOTTOM,
fullVersionText
);
painter.drawText(
pixmap.width() - metrics.width(getCopyrightText()) - COPYRIGHTPADDINGRIGHT,
pixmap.height() - metrics.height() - COPYRIGHTPADDINGBOTTOM,
getCopyrightText()
);
painter.end();
setPixmap(pixmap);
}
void SplashScreen::showProgressMessage(const QString& message)
{
showMessage(QString("\n ") + message, Qt::AlignLeft, TEXTCOLOR);
}