FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bitcoin/src/qt/splashscreen.cpp at master · blaklite/bitcoin · GitHub
blaklite
/
bitcoin
Public
forked from
bitcoin/bitcoin
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
bitcoin
/
src
/
qt
/
splashscreen.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
83 lines (68 loc) · 3 KB
Breadcrumbs
bitcoin
/
src
/
qt
/
splashscreen.cpp
Copy path
File metadata and controls
83 lines (68 loc) · 3 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#
include
"
splashscreen.h
"
#
include
"
clientversion.h
"
#
include
"
util.h
"
#
include
"
chainparams.h
"
#
include
<
QApplication
>
#
include
<
QPainter
>
SplashScreen::SplashScreen
(
const
QPixmap &pixmap, Qt::WindowFlags f) :
QSplashScreen(pixmap, f)
{
//
set reference point, paddings
int
paddingRight =
50
;
int
paddingTop =
50
;
int
titleVersionVSpace =
17
;
int
titleCopyrightVSpace =
40
;
float
fontFactor =
1.0
;
//
define text to place
QString titleText =
QString
(
QApplication::applicationName
()).
replace
(
QString
(
"
-testnet
"
),
QString
(
"
"
), Qt::CaseSensitive);
//
cut of testnet, place it as single object further down
QString versionText =
QString
(
"
Version %1
"
).
arg
(
QString::fromStdString
(
FormatFullVersion
()));
QString copyrightText =
QChar
(
0xA9
)+
QString
(
"
2009-%1
"
).
arg
(
COPYRIGHT_YEAR
) +
QString
(
tr
(
"
The Bitcoin developers
"
));
QString testnetAddText =
QString
(
tr
(
"
[testnet]
"
));
//
define text to place as single text object
QString font =
"
Arial
"
;
//
load the bitmap for writing some text over it
QPixmap newPixmap;
if
(
TestNet
()) {
newPixmap =
QPixmap
(
"
:/images/splash_testnet
"
);
}
else
{
newPixmap =
QPixmap
(
"
:/images/splash
"
);
}
QPainter
pixPaint
(&newPixmap);
pixPaint.
setPen
(
QColor
(
100
,
100
,
100
));
//
check font size and drawing with
pixPaint.
setFont
(
QFont
(font,
33
*fontFactor));
QFontMetrics fm = pixPaint.
fontMetrics
();
int
titleTextWidth = fm.
width
(titleText);
if
(titleTextWidth >
160
) {
//
strange font rendering, Arial probably not found
fontFactor =
0.75
;
}
pixPaint.
setFont
(
QFont
(font,
33
*fontFactor));
fm = pixPaint.
fontMetrics
();
titleTextWidth = fm.
width
(titleText);
pixPaint.
drawText
(newPixmap.
width
()-titleTextWidth-paddingRight,paddingTop,titleText);
pixPaint.
setFont
(
QFont
(font,
15
*fontFactor));
//
if the version string is to long, reduce size
fm = pixPaint.
fontMetrics
();
int
versionTextWidth = fm.
width
(versionText);
if
(versionTextWidth > titleTextWidth+paddingRight-
10
) {
pixPaint.
setFont
(
QFont
(font,
10
*fontFactor));
titleVersionVSpace -=
5
;
}
pixPaint.
drawText
(newPixmap.
width
()-titleTextWidth-paddingRight+
2
,paddingTop+titleVersionVSpace,versionText);
//
draw copyright stuff
pixPaint.
setFont
(
QFont
(font,
10
*fontFactor));
pixPaint.
drawText
(newPixmap.
width
()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText);
//
draw testnet string if -testnet is on
if
(
QApplication::applicationName
().
contains
(
QString
(
"
-testnet
"
))) {
//
draw copyright stuff
QFont boldFont =
QFont
(font,
10
*fontFactor);
boldFont.
setWeight
(QFont::Bold);
pixPaint.
setFont
(boldFont);
fm = pixPaint.
fontMetrics
();
int
testnetAddTextWidth = fm.
width
(testnetAddText);
pixPaint.
drawText
(newPixmap.
width
()-testnetAddTextWidth-
10
,
15
,testnetAddText);
}
pixPaint.
end
();
this
->
setPixmap
(newPixmap);
}
Back
|
FazBrowse Home
|
New Git URL