Skip to content

Commit

Permalink
Merge #31: [0.17] [Qt] Backport #29 [Build] Backport #30
Browse files Browse the repository at this point in the history
Backport from master (pre-0.18):
- Merge #29: [Qt]: Redesign GUI wallet, add QSS support
- Merge #30: [Build]: Add rc number and build to package version
  • Loading branch information
velesnetwork authored Mar 5, 2019
2 parents 7660613 + faee516 commit 5771683
Show file tree
Hide file tree
Showing 71 changed files with 2,975 additions and 113 deletions.
7 changes: 4 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 17)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_REVISION, 99)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_CLIENT_VERSION_RC, 0)
define(_CLIENT_VERSION_IS_RELEASE, false)
define(_COPYRIGHT_YEAR, 2019)
dnl VELES BEGIN
define(_CLIENT_VERSION_CODENAME, [Aged Amnesia])
Expand All @@ -14,7 +15,7 @@ define(_FXTC_COPYRIGHT_YEAR, 2019)
dnl VELES END
define(_COPYRIGHT_HOLDERS,[The %s developers])
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Veles Core]])
AC_INIT([Veles Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/velescore/veles/issues],[veles],[https://veles.network/])
AC_INIT([Veles Core],m4_join([.], _CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MINOR, _CLIENT_VERSION_REVISION, m4_if(_CLIENT_VERSION_BUILD, [0], [], _CLIENT_VERSION_BUILD))m4_if(_CLIENT_VERSION_RC, [0], [], [rc]_CLIENT_VERSION_RC),[https://github.com/velescore/veles/issues],[veles],[https://veles.network/])
AC_CONFIG_SRCDIR([src/validation.cpp])
AC_CONFIG_HEADERS([src/config/bitcoin-config.h])
AC_CONFIG_AUX_DIR([build-aux])
Expand Down
11 changes: 8 additions & 3 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,12 @@ endif
RES_IMAGES = \
qt/res/images/splash.png \
qt/res/images/splash_testnet.png \
qt/res/images/splash_prerelease.png
qt/res/images/splash_prerelease.png \
qt/res/images/header_bg.png

RES_CSS = \
qt/res/css/dark.css \
qt/res/css/light.css
# VELES END

RES_MOVIES = $(wildcard $(srcdir)/qt/res/movies/spinner-*.png)
Expand All @@ -404,7 +409,7 @@ qt_libbitcoinqt_a_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
qt_libbitcoinqt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS)

qt_libbitcoinqt_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_MOVIES)
$(QT_QRC) $(QT_QRC_LOCALE) $(QT_TS) $(PROTOBUF_PROTO) $(RES_ICONS) $(RES_IMAGES) $(RES_CSS) $(RES_MOVIES)

nodist_qt_libbitcoinqt_a_SOURCES = $(QT_MOC_CPP) $(QT_MOC) $(PROTOBUF_CC) \
$(PROTOBUF_H) $(QT_QRC_CPP) $(QT_QRC_LOCALE_CPP)
Expand Down Expand Up @@ -467,7 +472,7 @@ $(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM)
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
@rm $(@D)/temp_$(<F)

$(QT_QRC_CPP): $(QT_QRC) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES) $(PROTOBUF_H)
$(QT_QRC_CPP): $(QT_QRC) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_CSS) $(RES_MOVIES) $(PROTOBUF_H)
@test -f $(RCC)
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin $< | \
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
Expand Down
7 changes: 6 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,12 @@ void SetupServerArgs()
std::vector<std::string> hidden_args = {"-rpcssl", "-benchmark", "-h", "-help", "-socks", "-tor", "-debugnet", "-whitelistalwaysrelay",
"-prematurewitness", "-walletprematurewitness", "-promiscuousmempoolflags", "-blockminsize", "-dbcrashratio", "-forcecompactdb", "-usehd",
// GUI args. These will be overwritten by SetupUIArgs for the GUI
"-allowselfsignedrootcertificates", "-choosedatadir", "-lang=<lang>", "-min", "-resetguisettings", "-rootcertificates=<file>", "-splash", "-uiplatform"};
"-allowselfsignedrootcertificates", "-choosedatadir", "-lang=<lang>", "-min", "-resetguisettings", "-rootcertificates=<file>", "-splash", "-uiplatform",
// VELES BEGIN
// GUI args
"-loadcss", "-dumpcss"
// VELES END
};

// Set all of the args and their help
// When adding new options to the categories, please keep and ensure alphabetical ordering.
Expand Down
4 changes: 4 additions & 0 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,10 @@ static void SetupUIArgs()
gArgs.AddArg("-rootcertificates=<file>", "Set SSL root certificates for payment request (default: -system-)", false, OptionsCategory::GUI);
gArgs.AddArg("-splash", strprintf("Show splash screen on startup (default: %u)", DEFAULT_SPLASHSCREEN), false, OptionsCategory::GUI);
gArgs.AddArg("-uiplatform", strprintf("Select platform to customize UI for (one of windows, macosx, other; default: %s)", BitcoinGUI::DEFAULT_UIPLATFORM), true, OptionsCategory::GUI);
// VELES BEGIN
gArgs.AddArg("-loadcss=<file>", "Load theme stylesheet from external file", true, OptionsCategory::GUI);
gArgs.AddArg("-dumpcss=<file>", "Dump built-in theme stylesheet to file", true, OptionsCategory::GUI);
// VELES END
}

#ifndef BITCOIN_QT_TEST
Expand Down
5 changes: 5 additions & 0 deletions src/qt/bitcoin.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
<file alias="splash">res/images/splash.png</file>
<file alias="splash_testnet">res/images/splash_testnet.png</file>
<file alias="splash_prerelease">res/images/splash_prerelease.png</file>
<file alias="header_bg">res/images/header_bg.png</file>
</qresource>
<qresource prefix="/css">
<file alias="dark">res/css/dark.css</file>
<file alias="light">res/css/light.css</file>
</qresource>
<!-- VELES END -->
</RCC>
4 changes: 3 additions & 1 deletion src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
// Veles style upgrade - uncomment to ignore platform style's window color
//QMainWindow *mainWindow = (QMainWindow *)this;
//mainWindow->setStyleSheet("background-color: rgb(56, 56, 56); color: rgb(211, 215, 207); font: 75 12pt 'Uroob';");


/* Dash port: Open CSS when configured */
this->setStyleSheet(GUIUtil::loadStyleSheet());

QString windowTitle = tr(PACKAGE_NAME) + " - ";
#ifdef ENABLE_WALLET
Expand Down
37 changes: 36 additions & 1 deletion src/qt/clientmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include <privatesend.h>
//

// VELES BEGIN
#include <QFileInfo>
// VELES END

#include <stdint.h>

#include <QDebug>
Expand Down Expand Up @@ -175,9 +179,40 @@ enum BlockSource ClientModel::getBlockSource() const
return BlockSource::NONE;
}

// VELES BEGIN
QString ClientModel::appendQtWarnings(QString warnings) const
{
QString loadCssPath = QString::fromStdString(gArgs.GetArg("-loadcss", ""));
QString dumpCssPath = QString::fromStdString(gArgs.GetArg("-dumpcss", ""));

if (loadCssPath != "") {
QFileInfo checkInputFile(loadCssPath);

if (checkInputFile.exists() && checkInputFile.isFile())
warnings += QString(warnings.isEmpty() ? "" : "\n") + "[debug] Loaded stylesheet from file: " + loadCssPath;
else
warnings += QString(warnings.isEmpty() ? "" : "\n") + "[warning] Cannot load stylesheet - file not found: " + loadCssPath;
}

if (dumpCssPath != "") {
QFileInfo checkOutputFile(dumpCssPath);

if (checkOutputFile.exists() && checkOutputFile.isFile())
warnings += QString(warnings.isEmpty() ? "" : "\n") + "[debug] Dumped current stylesheet to file: " + dumpCssPath;
else
warnings += QString(warnings.isEmpty() ? "" : "\n") + "[warning] Cannot dump stylesheet - path not found: " + dumpCssPath;
}

return warnings;
}
// VELES END

QString ClientModel::getStatusBarWarnings() const
{
return QString::fromStdString(m_node.getWarnings("gui"));
// VELES BEGIN
// Append Qt wallet development warnings if available
return appendQtWarnings(QString::fromStdString(m_node.getWarnings("gui")));
// VELES END
}

OptionsModel *ClientModel::getOptionsModel()
Expand Down
4 changes: 3 additions & 1 deletion src/qt/clientmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ class ClientModel : public QObject
// Dash
QTimer *pollMnTimer;
//

// VELES BEGIN
QString appendQtWarnings(QString warnings) const;
// VELES END
void subscribeToCoreSignals();
void unsubscribeFromCoreSignals();

Expand Down
46 changes: 46 additions & 0 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2011-2018 The Bitcoin Core developers
// Copyright (c) 2014-2017 The Dash Core developers
// Copyright (c) 2018 FXTC developers
// Copyright (c) 2018-2019 The Veles Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down Expand Up @@ -55,6 +56,9 @@
#include <QLineEdit>
#include <QSettings>
#include <QTextDocument> // for Qt::mightBeRichText
// VELES BEGIN
#include <QTextStream> // for CSS dumping
// VELES END
#include <QThread>
#include <QUrlQuery>
#include <QMouseEvent>
Expand Down Expand Up @@ -794,6 +798,48 @@ bool SetStartOnSystemStartup(bool fAutoStart) { return false; }

#endif

// VELES BEGIN
QString loadStyleSheet()
{
//
// Load the stylesheet according to settings, overrid with -loadcss parameter,
// dump the currently loaded stylesheet with -outcss.
//
QString styleSheet;
QSettings settings;
QString cssName;
QString theme = settings.value("theme", "").toString();
QString customCssPath = QString::fromStdString(gArgs.GetArg("-loadcss", ""));
QString dumpCssPath = QString::fromStdString(gArgs.GetArg("-dumpcss", ""));

if(customCssPath != "") {
cssName = customCssPath; // load custom CSS for dev / testing purposes
} else if(!theme.isEmpty()){
cssName = QString(":/css/") + theme; // custom style from settings
} else {
cssName = QString(":/css/light"); // default style
settings.setValue("theme", "light");
}

// load the css
QFile qFile(cssName);
if (qFile.open(QFile::ReadOnly)) {
styleSheet = QLatin1String(qFile.readAll());
}

// dump the css if rewuired
if(dumpCssPath != "") {
QFile outFile(dumpCssPath);
if (outFile.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&outFile);
out << styleSheet;
}
}

return styleSheet;
}
// VELES END

void setClipboard(const QString& str)
{
QApplication::clipboard()->setText(str, QClipboard::Clipboard);
Expand Down
3 changes: 3 additions & 0 deletions src/qt/guiutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ namespace GUIUtil
/* Convert OS specific boost path to QString through UTF-8 */
QString boostPathToQString(const fs::path &path);

/** Dash port: Load global CSS theme */
QString loadStyleSheet();

/* Convert seconds into a QString with days, hours, mins, secs */
QString formatDurationStr(int secs);

Expand Down
2 changes: 1 addition & 1 deletion src/qt/platformstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static const struct {
{"macosx", false, false, true},
{"windows", true, false, false},
/* Other: linux, unix, ... */
{"other", true, true, false}
{"other", true, false, false} // VELES edit: No special icon colors
};
static const unsigned platform_styles_count = sizeof(platform_styles)/sizeof(*platform_styles);

Expand Down
Loading

0 comments on commit 5771683

Please sign in to comment.