diff options
author | Jonas Schnelli <jonasschnelli@Jonass-MacBook-Pro.local> | 2013-04-14 11:35:37 +0200 |
---|---|---|
committer | Jonas Schnelli <jonas.schnelli@include7.ch> | 2013-04-17 01:14:53 -0700 |
commit | f9124587ccea723dbd743e3877a7071fbb6c5732 (patch) | |
tree | d1124d0dbab0f523811815034d1b61ee01401ed1 /src/qt/splashscreen.cpp | |
parent | ac89a1ebe7110051bd35fbbcdb706030f07d561e (diff) |
new splash screen
why:
- the current splash-screen has no referring to official images on - https://en.bitcoin.it/wiki/Promotional_graphics
- the current splash screen only exists in a low res jpg
- current splash screen looks dark and "hackish"
- new splash screen should generate positive, "trust-emotions".
- new splash screen gives the user infos about the running client.
- new splash screen can handle long messages (in a lot of - languages the text is cropped in current release)
- new size (x2) 400x312
- contains textual information about the client
- textinfos are dynamicly written to the pixmap
when -testnet is switch on, the splashscreen will show the bitcoin logo in testnet-color (as well as a text [testnet])
example: https://dl.dropbox.com/u/7383846/new_bitcoin_splash.png
Diffstat (limited to 'src/qt/splashscreen.cpp')
-rw-r--r-- | src/qt/splashscreen.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp new file mode 100644 index 0000000000..f8d16699ca --- /dev/null +++ b/src/qt/splashscreen.cpp @@ -0,0 +1,82 @@ +#include "splashscreen.h" +#include "clientversion.h" +#include "util.h" + +#include <QPainter> +#include <QApplication> + +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(GetBoolArg("-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); +} |