mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
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 "guiutil.h"
|
||||
#include "networkstyle.h"
|
||||
|
||||
#include "clientversion.h"
|
||||
#include "guiutil.h"
|
||||
#include "init.h"
|
||||
#include "util.h"
|
||||
#include "ui_interface.h"
|
||||
#include "version.h"
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
#include "wallet/wallet.h"
|
||||
#endif
|
||||
@ -26,6 +25,14 @@
|
||||
SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle) :
|
||||
QWidget(0, f), curAlignment(0)
|
||||
{
|
||||
|
||||
// transparent background
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
setStyleSheet("background:transparent;");
|
||||
|
||||
// no window decorations
|
||||
setWindowFlags(Qt::FramelessWindowHint);
|
||||
|
||||
// set reference point, paddings
|
||||
int paddingLeft = 14;
|
||||
int paddingTop = 470;
|
||||
@ -33,10 +40,6 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle)
|
||||
int titleCopyrightVSpace = 32;
|
||||
|
||||
float fontFactor = 1.0;
|
||||
float devicePixelRatio = 1.0;
|
||||
#if QT_VERSION > 0x050100
|
||||
devicePixelRatio = ((QGuiApplication*)QCoreApplication::instance())->devicePixelRatio();
|
||||
#endif
|
||||
|
||||
// define text to place
|
||||
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 copyrightTextDash = QChar(0xA9)+QString(" 2014-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Dash Core developers"));
|
||||
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
|
||||
QString splashScreenPath = ":/images/" + GUIUtil::getThemeName() + "/splash";
|
||||
if(GetBoolArg("-regtest", false))
|
||||
@ -54,6 +54,8 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle)
|
||||
if(GetBoolArg("-testnet", false))
|
||||
splashScreenPath = ":/images/" + GUIUtil::getThemeName() + "/splash_testnet";
|
||||
|
||||
QString font = QApplication::font().toString();
|
||||
|
||||
// load the bitmap for writing some text over it
|
||||
pixmap = QPixmap(splashScreenPath);
|
||||
|
||||
@ -94,11 +96,8 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle)
|
||||
|
||||
pixPaint.end();
|
||||
|
||||
// Set window title
|
||||
setWindowTitle(titleText + " " + titleAddText);
|
||||
|
||||
// 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());
|
||||
setFixedSize(r.size());
|
||||
move(QApplication::desktop()->screenGeometry().center() - r.center());
|
||||
|
Loading…
Reference in New Issue
Block a user