mirror of
https://github.com/dashpay/dash.git
synced 2024-12-30 14:25:53 +01:00
Litecoin: Force splash text to look correct with Win32 font scaling
This commit is contained in:
parent
ba332eed0e
commit
4fdc6ba448
Binary file not shown.
Before Width: | Height: | Size: 301 KiB After Width: | Height: | Size: 306 KiB |
Binary file not shown.
Before Width: | Height: | Size: 302 KiB After Width: | Height: | Size: 311 KiB |
@ -9,9 +9,7 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
|
||||
QSplashScreen(pixmap, f)
|
||||
{
|
||||
// set reference point, paddings
|
||||
int paddingLeftCol1 = 34;
|
||||
int paddingLeftCol2 = 230;
|
||||
int paddingTopCol1 = 396;
|
||||
int paddingTopCol2 = 376;
|
||||
int line1 = 0;
|
||||
int line2 = 13;
|
||||
@ -22,9 +20,8 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
|
||||
// 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 copyrightText1 = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString("The Bitcoin developers");
|
||||
QString copyrightText2 = QChar(0xA9)+QString(" 2011-%1 ").arg(COPYRIGHT_YEAR) + QString("The Litecoin developers");
|
||||
QString testnetAddText = QString(tr("[testnet]")); // define text to place as single text object
|
||||
QString copyrightText1 = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin developers"));
|
||||
QString copyrightText2 = QChar(0xA9)+QString(" 2011-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Litecoin developers"));
|
||||
|
||||
QString font = "Arial";
|
||||
|
||||
@ -40,26 +37,7 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
|
||||
QPainter pixPaint(&newPixmap);
|
||||
pixPaint.setPen(QColor(70,70,70));
|
||||
|
||||
// check font size and drawing with
|
||||
pixPaint.setFont(QFont(font, 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, 28*fontFactor));
|
||||
fm = pixPaint.fontMetrics();
|
||||
titleTextWidth = fm.width(titleText);
|
||||
pixPaint.drawText(paddingLeftCol1,paddingTopCol1,titleText);
|
||||
|
||||
pixPaint.setFont(QFont(font, 9*fontFactor));
|
||||
|
||||
// if the version string is to long, reduce size
|
||||
fm = pixPaint.fontMetrics();
|
||||
int versionTextWidth = fm.width(versionText);
|
||||
|
||||
pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line3,versionText);
|
||||
|
||||
// draw copyright stuff
|
||||
@ -67,17 +45,6 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
|
||||
pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line1,copyrightText1);
|
||||
pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line2,copyrightText2);
|
||||
|
||||
// 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)/2,13,testnetAddText);
|
||||
}
|
||||
|
||||
pixPaint.end();
|
||||
|
||||
this->setPixmap(newPixmap);
|
||||
|
Loading…
Reference in New Issue
Block a user