Splashscreen now displays correctly (Fully) (#1367)
* Splashscreen now displays correctly on retina devices * Remove devicePixelRatio instances
This commit is contained in:
parent
a1ef547918
commit
01eeb59af6
@ -5,15 +5,14 @@
|
|||||||
|
|
||||||
#include "splashscreen.h"
|
#include "splashscreen.h"
|
||||||
|
|
||||||
|
#include "guiutil.h"
|
||||||
#include "networkstyle.h"
|
#include "networkstyle.h"
|
||||||
|
|
||||||
#include "clientversion.h"
|
#include "clientversion.h"
|
||||||
#include "guiutil.h"
|
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "ui_interface.h"
|
#include "ui_interface.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
#include "wallet/wallet.h"
|
#include "wallet/wallet.h"
|
||||||
#endif
|
#endif
|
||||||
@ -26,6 +25,14 @@
|
|||||||
SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle) :
|
SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle) :
|
||||||
QWidget(0, f), curAlignment(0)
|
QWidget(0, f), curAlignment(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// transparent background
|
||||||
|
setAttribute(Qt::WA_TranslucentBackground);
|
||||||
|
setStyleSheet("background:transparent;");
|
||||||
|
|
||||||
|
// no window decorations
|
||||||
|
setWindowFlags(Qt::FramelessWindowHint);
|
||||||
|
|
||||||
// set reference point, paddings
|
// set reference point, paddings
|
||||||
int paddingLeft = 14;
|
int paddingLeft = 14;
|
||||||
int paddingTop = 470;
|
int paddingTop = 470;
|
||||||
@ -33,10 +40,6 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle)
|
|||||||
int titleCopyrightVSpace = 32;
|
int titleCopyrightVSpace = 32;
|
||||||
|
|
||||||
float fontFactor = 1.0;
|
float fontFactor = 1.0;
|
||||||
float devicePixelRatio = 1.0;
|
|
||||||
#if QT_VERSION > 0x050100
|
|
||||||
devicePixelRatio = ((QGuiApplication*)QCoreApplication::instance())->devicePixelRatio();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// define text to place
|
// define text to place
|
||||||
QString titleText = tr("Dash Core");
|
QString titleText = tr("Dash Core");
|
||||||
@ -44,9 +47,6 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle)
|
|||||||
QString copyrightTextBtc = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin Core developers"));
|
QString copyrightTextBtc = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin Core developers"));
|
||||||
QString copyrightTextDash = QChar(0xA9)+QString(" 2014-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Dash Core developers"));
|
QString copyrightTextDash = QChar(0xA9)+QString(" 2014-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Dash Core developers"));
|
||||||
QString titleAddText = networkStyle->getTitleAddText();
|
QString titleAddText = networkStyle->getTitleAddText();
|
||||||
|
|
||||||
QString font = QApplication::font().toString();
|
|
||||||
|
|
||||||
// networkstyle.cpp can't (yet) read themes, so we do it here to get the correct Splash-screen
|
// networkstyle.cpp can't (yet) read themes, so we do it here to get the correct Splash-screen
|
||||||
QString splashScreenPath = ":/images/" + GUIUtil::getThemeName() + "/splash";
|
QString splashScreenPath = ":/images/" + GUIUtil::getThemeName() + "/splash";
|
||||||
if(GetBoolArg("-regtest", false))
|
if(GetBoolArg("-regtest", false))
|
||||||
@ -54,6 +54,8 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle)
|
|||||||
if(GetBoolArg("-testnet", false))
|
if(GetBoolArg("-testnet", false))
|
||||||
splashScreenPath = ":/images/" + GUIUtil::getThemeName() + "/splash_testnet";
|
splashScreenPath = ":/images/" + GUIUtil::getThemeName() + "/splash_testnet";
|
||||||
|
|
||||||
|
QString font = QApplication::font().toString();
|
||||||
|
|
||||||
// load the bitmap for writing some text over it
|
// load the bitmap for writing some text over it
|
||||||
pixmap = QPixmap(splashScreenPath);
|
pixmap = QPixmap(splashScreenPath);
|
||||||
|
|
||||||
@ -94,11 +96,8 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle)
|
|||||||
|
|
||||||
pixPaint.end();
|
pixPaint.end();
|
||||||
|
|
||||||
// Set window title
|
|
||||||
setWindowTitle(titleText + " " + titleAddText);
|
|
||||||
|
|
||||||
// Resize window and move to center of desktop, disallow resizing
|
// Resize window and move to center of desktop, disallow resizing
|
||||||
QRect r(QPoint(), QSize(pixmap.size().width()/devicePixelRatio,pixmap.size().height()/devicePixelRatio));
|
QRect r(QPoint(), pixmap.size());
|
||||||
resize(r.size());
|
resize(r.size());
|
||||||
setFixedSize(r.size());
|
setFixedSize(r.size());
|
||||||
move(QApplication::desktop()->screenGeometry().center() - r.center());
|
move(QApplication::desktop()->screenGeometry().center() - r.center());
|
||||||
|
Loading…
Reference in New Issue
Block a user