diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 854257d03cf1..8561587c1fc1 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -355,6 +355,26 @@ RES_CSS = \ qt/res/css/scrollbars.css \ qt/res/css/trad.css +RES_FONTS = \ + qt/res/fonts/Montserrat/Montserrat-Black.otf \ + qt/res/fonts/Montserrat/Montserrat-BlackItalic.otf \ + qt/res/fonts/Montserrat/Montserrat-Bold.otf \ + qt/res/fonts/Montserrat/Montserrat-BoldItalic.otf \ + qt/res/fonts/Montserrat/Montserrat-ExtraBold.otf \ + qt/res/fonts/Montserrat/Montserrat-ExtraBoldItalic.otf \ + qt/res/fonts/Montserrat/Montserrat-ExtraLight.otf \ + qt/res/fonts/Montserrat/Montserrat-ExtraLightItalic.otf \ + qt/res/fonts/Montserrat/Montserrat-Italic.otf \ + qt/res/fonts/Montserrat/Montserrat-Light.otf \ + qt/res/fonts/Montserrat/Montserrat-LightItalic.otf \ + qt/res/fonts/Montserrat/Montserrat-Medium.otf \ + qt/res/fonts/Montserrat/Montserrat-MediumItalic.otf \ + qt/res/fonts/Montserrat/Montserrat-Regular.otf \ + qt/res/fonts/Montserrat/Montserrat-SemiBold.otf \ + qt/res/fonts/Montserrat/Montserrat-SemiBoldItalic.otf \ + qt/res/fonts/Montserrat/Montserrat-Thin.otf \ + qt/res/fonts/Montserrat/Montserrat-ThinItalic.otf + RES_MOVIES = $(wildcard $(srcdir)/qt/res/movies/spinner-*.png) BITCOIN_RC = qt/res/dash-qt-res.rc @@ -367,7 +387,7 @@ qt_libdashqt_a_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) qt_libdashqt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS) qt_libdashqt_a_SOURCES = $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(QT_FORMS_UI) \ - $(QT_QRC) $(QT_QRC_LOCALE) $(QT_TS) $(PROTOBUF_PROTO) $(RES_ICONS) $(RES_IMAGES) $(RES_CSS) $(RES_MOVIES) + $(QT_QRC) $(QT_QRC_LOCALE) $(QT_TS) $(PROTOBUF_PROTO) $(RES_ICONS) $(RES_IMAGES) $(RES_CSS) $(RES_FONTS) $(RES_MOVIES) nodist_qt_libdashqt_a_SOURCES = $(QT_MOC_CPP) $(QT_MOC) $(PROTOBUF_CC) \ $(PROTOBUF_H) $(QT_QRC_CPP) $(QT_QRC_LOCALE_CPP) @@ -430,7 +450,7 @@ $(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM) $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@ @rm $(@D)/temp_$( $@ diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index 34a553540ae2..5a5fe1ac3cc9 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -143,6 +143,8 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(accept())); + + GUIUtil::updateFonts(); } AddressBookPage::~AddressBookPage() diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index edad38b8e6a9..c0dcfb63e8c0 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -28,6 +29,10 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent) : { ui->setupUi(this); + GUIUtil::setFont({ui->capsLabel}, GUIUtil::FontWeight::Bold); + + GUIUtil::updateFonts(); + ui->passEdit1->setMinimumSize(ui->passEdit1->sizeHint()); ui->passEdit2->setMinimumSize(ui->passEdit2->sizeHint()); ui->passEdit3->setMinimumSize(ui->passEdit3->sizeHint()); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 837b574146f7..5cac47942031 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -398,6 +398,9 @@ void BitcoinGUI::createActions() connect(historyAction, SIGNAL(clicked()), this, SLOT(showNormalIfMinimized())); connect(historyAction, SIGNAL(clicked()), this, SLOT(gotoHistoryPage())); + for (auto button : tabGroup->buttons()) { + GUIUtil::setFont({button}, GUIUtil::FontWeight::Normal, 16); + } // Give the selected tab button a bolder font. connect(tabGroup, SIGNAL(buttonToggled(QAbstractButton *, bool)), this, SLOT(highlightTabButton(QAbstractButton *, bool))); #endif // ENABLE_WALLET @@ -925,9 +928,7 @@ void BitcoinGUI::openClicked() void BitcoinGUI::highlightTabButton(QAbstractButton *button, bool checked) { - QFont font = button->font(); - font.setBold(checked); - button->setFont(font); + GUIUtil::setFont({button}, checked ? GUIUtil::FontWeight::Bold : GUIUtil::FontWeight::Normal, 16); } void BitcoinGUI::gotoOverviewPage() @@ -1616,7 +1617,7 @@ UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *pl setToolTip(tr("Unit to show amounts in. Click to select another unit.")); QList units = BitcoinUnits::availableUnits(); int max_width = 0; - const QFontMetrics fm(font()); + const QFontMetrics fm(GUIUtil::getFontNormal()); for (const BitcoinUnits::Unit unit : units) { max_width = qMax(max_width, fm.width(BitcoinUnits::name(unit))); diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 606465b3d1e0..69e4e6ffa095 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -54,6 +54,17 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle, QWidge /* Open CSS when configured */ this->setStyleSheet(GUIUtil::loadStyleSheet()); + GUIUtil::setFont({ui->labelCoinControlQuantityText, + ui->labelCoinControlBytesText, + ui->labelCoinControlAmountText, + ui->labelCoinControlLowOutputText, + ui->labelCoinControlFeeText, + ui->labelCoinControlAfterFeeText, + ui->labelCoinControlChangeText + }, GUIUtil::FontWeight::Bold); + + GUIUtil::updateFonts(); + // context menu actions QAction *copyAddressAction = new QAction(tr("Copy address"), this); QAction *copyLabelAction = new QAction(tr("Copy label"), this); diff --git a/src/qt/dash.cpp b/src/qt/dash.cpp index fee5ad059fa4..e22daa30a4ea 100644 --- a/src/qt/dash.cpp +++ b/src/qt/dash.cpp @@ -272,6 +272,9 @@ bool BitcoinCore::baseInitialize() { return false; } + if (!GUIUtil::loadFonts()) { + return false; + } return true; } @@ -691,6 +694,51 @@ int main(int argc, char *argv[]) // Load GUI settings from QSettings app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false)); + // Validate/set font family + if (gArgs.IsArgSet("-font-family")) { + GUIUtil::FontFamily family; + QString strFamily = gArgs.GetArg("-font-family", GUIUtil::fontFamilyToString(GUIUtil::getFontFamilyDefault()).toStdString()).c_str(); + try { + family = GUIUtil::fontFamilyFromString(strFamily); + } catch (const std::exception& e) { + QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QObject::tr("Error: Specified font-family invalid. Valid values: %1.").arg("SystemDefault, Montserrat")); + return EXIT_FAILURE; + } + GUIUtil::setFontFamily(family); + } + // Validate/set normal font weight + if (gArgs.IsArgSet("-font-weight-normal")) { + QFont::Weight weight; + if (!GUIUtil::weightFromArg(gArgs.GetArg("-font-weight-normal", GUIUtil::weightToArg(GUIUtil::getFontWeightNormal())), weight)) { + QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QObject::tr("Error: Specified font-weight-normal invalid. Valid range %1 to %2.").arg(0).arg(8)); + return EXIT_FAILURE; + } + GUIUtil::setFontWeightNormal(weight); + } + // Validate/set bold font weight + if (gArgs.IsArgSet("-font-weight-bold")) { + QFont::Weight weight; + if (!GUIUtil::weightFromArg(gArgs.GetArg("-font-weight-bold", GUIUtil::weightToArg(GUIUtil::getFontWeightBold())), weight)) { + QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QObject::tr("Error: Specified font-weight-bold invalid. Valid range %1 to %2.").arg(0).arg(8)); + return EXIT_FAILURE; + } + GUIUtil::setFontWeightBold(weight); + } + // Validate/set font scale + if (gArgs.IsArgSet("-font-scale")) { + const int nScaleMin = -100, nScaleMax = 100; + int nScale = gArgs.GetArg("-font-scale", GUIUtil::getFontScale()); + if (nScale < nScaleMin || nScale > nScaleMax) { + QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QObject::tr("Error: Specified font-scale invalid. Valid range %1 to %2.").arg(nScaleMin).arg(nScaleMax)); + return EXIT_FAILURE; + } + GUIUtil::setFontScale(nScale); + } + // Subscribe to global signals from core uiInterface.InitMessage.connect(InitMessage); diff --git a/src/qt/dash.qrc b/src/qt/dash.qrc index b66c470d61ac..2d4ba4a8c4aa 100644 --- a/src/qt/dash.qrc +++ b/src/qt/dash.qrc @@ -58,6 +58,26 @@ res/css/general.css res/css/scrollbars.css + + res/fonts/Montserrat/Montserrat-Black.otf + res/fonts/Montserrat/Montserrat-BlackItalic.otf + res/fonts/Montserrat/Montserrat-Bold.otf + res/fonts/Montserrat/Montserrat-BoldItalic.otf + res/fonts/Montserrat/Montserrat-ExtraBold.otf + res/fonts/Montserrat/Montserrat-ExtraBoldItalic.otf + res/fonts/Montserrat/Montserrat-ExtraLight.otf + res/fonts/Montserrat/Montserrat-ExtraLightItalic.otf + res/fonts/Montserrat/Montserrat-Italic.otf + res/fonts/Montserrat/Montserrat-Light.otf + res/fonts/Montserrat/Montserrat-LightItalic.otf + res/fonts/Montserrat/Montserrat-Medium.otf + res/fonts/Montserrat/Montserrat-MediumItalic.otf + res/fonts/Montserrat/Montserrat-Regular.otf + res/fonts/Montserrat/Montserrat-SemiBold.otf + res/fonts/Montserrat/Montserrat-SemiBoldItalic.otf + res/fonts/Montserrat/Montserrat-Thin.otf + res/fonts/Montserrat/Montserrat-ThinItalic.otf + res/css/dark.css res/css/light.css diff --git a/src/qt/forms/askpassphrasedialog.ui b/src/qt/forms/askpassphrasedialog.ui index 69803989cd13..67fee3cd3dea 100644 --- a/src/qt/forms/askpassphrasedialog.ui +++ b/src/qt/forms/askpassphrasedialog.ui @@ -101,12 +101,6 @@ - - - 75 - true - - diff --git a/src/qt/forms/coincontroldialog.ui b/src/qt/forms/coincontroldialog.ui index e5cf02c62c41..7d226fd6a226 100644 --- a/src/qt/forms/coincontroldialog.ui +++ b/src/qt/forms/coincontroldialog.ui @@ -38,12 +38,6 @@ - - - 75 - true - - Quantity: @@ -67,12 +61,6 @@ - - - 75 - true - - Bytes: @@ -112,12 +100,6 @@ - - - 75 - true - - Amount: @@ -144,12 +126,6 @@ false - - - 75 - true - - Dust: @@ -192,12 +168,6 @@ - - - 75 - true - - Fee: @@ -237,12 +207,6 @@ - - - 75 - true - - After Fee: @@ -269,12 +233,6 @@ false - - - 75 - true - - Change: diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui index ee3f74dbe159..704cc66ad99b 100644 --- a/src/qt/forms/debugwindow.ui +++ b/src/qt/forms/debugwindow.ui @@ -29,12 +29,6 @@ - - - 75 - true - - General @@ -166,12 +160,6 @@ - - - 75 - true - - Network @@ -248,12 +236,6 @@ - - - 75 - true - - Block chain @@ -307,12 +289,6 @@ - - - 75 - true - - Memory Pool @@ -936,11 +912,6 @@ 32 - - - 12 - - IBeamCursor @@ -996,13 +967,6 @@ 32 - - - 10 - 75 - true - - IBeamCursor @@ -1572,12 +1536,6 @@ 41 - - - 50 - false - - The buttons below will restart the wallet with command-line options to repair the wallet, fix issues with corrupt blockhain files or missing/obsolete transactions. @@ -1674,13 +1632,6 @@ 16 - - - 10 - 75 - true - - Wallet repair options. diff --git a/src/qt/forms/modaloverlay.ui b/src/qt/forms/modaloverlay.ui index 7bf5a7a1f853..b39222017986 100644 --- a/src/qt/forms/modaloverlay.ui +++ b/src/qt/forms/modaloverlay.ui @@ -140,12 +140,6 @@ - - - 75 - true - - Attempting to spend Dash that are affected by not-yet-displayed transactions will not be accepted by the network. @@ -203,12 +197,6 @@ - - - 75 - true - - Number of blocks left @@ -223,12 +211,6 @@ - - - 75 - true - - Last block time @@ -249,12 +231,6 @@ - - - 75 - true - - Progress @@ -283,12 +259,6 @@ - - - 75 - true - - Progress increase per hour @@ -303,12 +273,6 @@ - - - 75 - true - - Estimated time left until synced diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 03d446e415cc..4a2c81dba90d 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -908,12 +908,6 @@ https://www.transifex.com/projects/p/dash/ 0 - - - 75 - true - - diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index af5626b88f56..3be30dad4a46 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -56,12 +56,6 @@ - - - 75 - true - - Balances @@ -102,12 +96,6 @@ - - - 75 - true - - IBeamCursor @@ -127,12 +115,6 @@ - - - 75 - true - - IBeamCursor @@ -152,12 +134,6 @@ - - - 75 - true - - IBeamCursor @@ -210,12 +186,6 @@ - - - 75 - true - - IBeamCursor @@ -255,12 +225,6 @@ - - - 75 - true - - IBeamCursor @@ -280,12 +244,6 @@ - - - 75 - true - - IBeamCursor @@ -322,12 +280,6 @@ - - - 75 - true - - IBeamCursor @@ -347,12 +299,6 @@ - - - 75 - true - - IBeamCursor @@ -408,12 +354,6 @@ - - - 75 - true - - PrivateSend @@ -501,12 +441,6 @@ - - - 75 - true - - 0 DASH @@ -608,12 +542,6 @@ - - - 75 - true - - Recent transactions diff --git a/src/qt/forms/qrdialog.ui b/src/qt/forms/qrdialog.ui index 8366b7c857a6..dae494ccc825 100644 --- a/src/qt/forms/qrdialog.ui +++ b/src/qt/forms/qrdialog.ui @@ -13,12 +13,6 @@ - - - 75 - true - - QR-Code Title diff --git a/src/qt/forms/receivecoinsdialog.ui b/src/qt/forms/receivecoinsdialog.ui index 5ee764446afc..fa6c1f182250 100644 --- a/src/qt/forms/receivecoinsdialog.ui +++ b/src/qt/forms/receivecoinsdialog.ui @@ -201,12 +201,6 @@ - - - 75 - true - - Requested payments history diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 4f00c759ad94..b1e08ca05c93 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -77,15 +77,6 @@ 0 - - - 75 - true - - - - font-weight:bold; - Coin Control Features @@ -126,15 +117,6 @@ - - - 75 - true - - - - font-weight:bold; - Insufficient funds! @@ -218,12 +200,6 @@ - - - 75 - true - - Quantity: @@ -253,12 +229,6 @@ - - - 75 - true - - Bytes: @@ -301,12 +271,6 @@ - - - 75 - true - - Amount: @@ -333,12 +297,6 @@ - - - 75 - true - - Dust: @@ -381,12 +339,6 @@ - - - 75 - true - - Fee: @@ -432,12 +384,6 @@ - - - 75 - true - - After Fee: @@ -464,12 +410,6 @@ - - - 75 - true - - Change: @@ -714,15 +654,6 @@ 0 - - - 75 - true - - - - font-weight:bold; - Transaction Fee: @@ -762,12 +693,6 @@ Using the fallbackfee can result in sending a transaction that will take several hours or days (or never) to confirm. Consider choosing your fee manually or wait until you have validated the complete chain. - - - 75 - true - - Note: Not enough data for fee estimation, using the fallback fee instead. diff --git a/src/qt/forms/signverifymessagedialog.ui b/src/qt/forms/signverifymessagedialog.ui index 90446e553dca..c0fa1f717239 100644 --- a/src/qt/forms/signverifymessagedialog.ui +++ b/src/qt/forms/signverifymessagedialog.ui @@ -110,11 +110,6 @@ - - - true - - true @@ -178,12 +173,6 @@ - - - 75 - true - - @@ -309,12 +298,6 @@ - - - 75 - true - - diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 9f69e9dd9835..6d75c56c52a6 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -16,6 +16,7 @@ #include #include