aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-04-18 00:05:21 -0700
committerWladimir J. van der Laan <laanwj@gmail.com>2013-04-18 00:05:21 -0700
commit52ae314b5e8082729e9c7f5914eba48aa6993a13 (patch)
tree3d59643ebd7524a03beddc0fd2113ea6d056ab83
parent8b1d72be3225648a7e2a1067eed528690ed047f4 (diff)
parentf9124587ccea723dbd743e3877a7071fbb6c5732 (diff)
Merge pull request #2524 from jonasschnelli/new_splashscreen_fresh
new splash screen
-rw-r--r--bitcoin-qt.pro6
-rw-r--r--doc/assets-attribution.txt8
-rw-r--r--src/qt/bitcoin.cpp8
-rw-r--r--src/qt/bitcoin.qrc3
-rw-r--r--src/qt/res/images/splash.pngbin0 -> 49338 bytes
-rw-r--r--src/qt/res/images/splash2.jpgbin5816 -> 0 bytes
-rw-r--r--src/qt/res/images/splash_testnet.pngbin0 -> 45370 bytes
-rw-r--r--src/qt/splashscreen.cpp82
-rw-r--r--src/qt/splashscreen.h16
9 files changed, 110 insertions, 13 deletions
diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro
index cf809866c6..d938c07c45 100644
--- a/bitcoin-qt.pro
+++ b/bitcoin-qt.pro
@@ -210,7 +210,8 @@ HEADERS += src/qt/bitcoingui.h \
src/txdb.h \
src/leveldb.h \
src/threadsafety.h \
- src/limitedmap.h
+ src/limitedmap.h \
+ src/qt/splashscreen.h
SOURCES += src/qt/bitcoin.cpp \
src/qt/bitcoingui.cpp \
@@ -277,7 +278,8 @@ SOURCES += src/qt/bitcoin.cpp \
src/qt/rpcconsole.cpp \
src/noui.cpp \
src/leveldb.cpp \
- src/txdb.cpp
+ src/txdb.cpp \
+ src/qt/splashscreen.cpp
RESOURCES += src/qt/bitcoin.qrc
diff --git a/doc/assets-attribution.txt b/doc/assets-attribution.txt
index efd5c65a29..2069c5d6e0 100644
--- a/doc/assets-attribution.txt
+++ b/doc/assets-attribution.txt
@@ -44,11 +44,6 @@ Designer: Everaldo (Everaldo Coelho)
License: GNU/GPL
Site: http://findicons.com/icon/17102/reload?id=17102
-Image: src/qt/res/images/splash2.jpg (Wallet image)
-Designer: Crobbo (forum)
-Site: https://bitcointalk.org/index.php?topic=32273.0
-License: Public domain
-
Icon: src/qt/res/icons/debugwindow.png
Designer: Vignoni David
Site: http://www.oxygen-icons.org/
@@ -57,6 +52,7 @@ License: Oxygen icon theme is dual licensed. You may copy it under the Creative
Icon: src/qt/res/icons/bitcoin.icns, src/qt/res/src/bitcoin.svg,
src/qt/res/src/bitcoin.ico, src/qt/res/src/bitcoin.png,
src/qt/res/src/bitcoin_testnet.png, docs/bitcoin_logo_doxygen.png,
- src/qt/res/icons/toolbar.png, src/qt/res/icons/toolbar_testnet.png
+ src/qt/res/icons/toolbar.png, src/qt/res/icons/toolbar_testnet.png,
+ src/qt/res/images/splash.png, src/qt/res/images/splash_testnet.png
Designer: Jonas Schnelli (based on the original bitcoin logo from Bitboy)
License: MIT
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index f079f3b0e9..9131f8250b 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -14,13 +14,13 @@
#include "util.h"
#include "ui_interface.h"
#include "paymentserver.h"
+#include "splashscreen.h"
#include <QMessageBox>
#include <QTextCodec>
#include <QLocale>
#include <QTimer>
#include <QTranslator>
-#include <QSplashScreen>
#include <QLibraryInfo>
#if defined(BITCOIN_NEED_QT_PLUGINS) && !defined(_BITCOIN_QT_PLUGINS_INCLUDED)
@@ -36,7 +36,7 @@ Q_IMPORT_PLUGIN(qtaccessiblewidgets)
// Need a global reference for the notifications to find the GUI
static BitcoinGUI *guiref;
-static QSplashScreen *splashref;
+static SplashScreen *splashref;
static bool ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
{
@@ -82,7 +82,7 @@ static void InitMessage(const std::string &message)
{
if(splashref)
{
- splashref->showMessage(QString::fromStdString(message), Qt::AlignBottom|Qt::AlignHCenter, QColor(255,255,200));
+ splashref->showMessage(QString::fromStdString(message), Qt::AlignBottom|Qt::AlignHCenter, QColor(55,55,55));
qApp->processEvents();
}
printf("init message: %s\n", message.c_str());
@@ -192,7 +192,7 @@ int main(int argc, char *argv[])
return 1;
}
- QSplashScreen splash(QPixmap(":/images/splash"), 0);
+ SplashScreen splash(QPixmap(), 0);
if (GetBoolArg("-splash", true) && !GetBoolArg("-min"))
{
splash.show();
diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc
index fd5f3b523c..c0e0124d7c 100644
--- a/src/qt/bitcoin.qrc
+++ b/src/qt/bitcoin.qrc
@@ -43,7 +43,8 @@
</qresource>
<qresource prefix="/images">
<file alias="about">res/images/about.png</file>
- <file alias="splash">res/images/splash2.jpg</file>
+ <file alias="splash">res/images/splash.png</file>
+ <file alias="splash_testnet">res/images/splash_testnet.png</file>
</qresource>
<qresource prefix="/movies">
<file alias="update_spinner">res/movies/update_spinner.mng</file>
diff --git a/src/qt/res/images/splash.png b/src/qt/res/images/splash.png
new file mode 100644
index 0000000000..376c274a8d
--- /dev/null
+++ b/src/qt/res/images/splash.png
Binary files differ
diff --git a/src/qt/res/images/splash2.jpg b/src/qt/res/images/splash2.jpg
deleted file mode 100644
index 3846e6f68d..0000000000
--- a/src/qt/res/images/splash2.jpg
+++ /dev/null
Binary files differ
diff --git a/src/qt/res/images/splash_testnet.png b/src/qt/res/images/splash_testnet.png
new file mode 100644
index 0000000000..2520e76e62
--- /dev/null
+++ b/src/qt/res/images/splash_testnet.png
Binary files differ
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);
+}
diff --git a/src/qt/splashscreen.h b/src/qt/splashscreen.h
new file mode 100644
index 0000000000..6a6249d80c
--- /dev/null
+++ b/src/qt/splashscreen.h
@@ -0,0 +1,16 @@
+#ifndef SPLASHSCREEN_H
+#define SPLASHSCREEN_H
+
+#include <QSplashScreen>
+
+/** class for the splashscreen with information of the running client
+ */
+class SplashScreen : public QSplashScreen
+{
+ Q_OBJECT
+
+public:
+ explicit SplashScreen(const QPixmap &pixmap = QPixmap(), Qt::WindowFlags f = 0);
+};
+
+#endif // SPLASHSCREEN_H