diff --git a/res/hushdlogo.png b/res/hushdlogo.png
index e14e702..e3bdfc0 100644
Binary files a/res/hushdlogo.png and b/res/hushdlogo.png differ
diff --git a/silentdragon-lite.pro b/silentdragon-lite.pro
index e769a81..3056c1c 100644
--- a/silentdragon-lite.pro
+++ b/silentdragon-lite.pro
@@ -88,6 +88,7 @@ SOURCES += \
src/Crypto/passwd.cpp
HEADERS += \
+ src/guiconstants.h \
src/firsttimewizard.h \
src/mainwindow.h \
src/precompiled.h \
diff --git a/src/balancestablemodel.cpp b/src/balancestablemodel.cpp
index 9878b4c..91f80b1 100644
--- a/src/balancestablemodel.cpp
+++ b/src/balancestablemodel.cpp
@@ -4,6 +4,7 @@
#include "addressbook.h"
#include "settings.h"
#include "camount.h"
+#include "guiconstants.h"
BalancesTableModel::BalancesTableModel(QObject *parent): QAbstractTableModel(parent)
{}
@@ -100,9 +101,16 @@ QVariant BalancesTableModel::data(const QModelIndex &index, int role) const
}
- // Else, just return the default brush
- QBrush b;
- b.setColor(Qt::black);
+ // Get current theme name
+ QString theme_name = Settings::getInstance()->get_theme_name();
+ QBrush b;
+ QColor color;
+ if (theme_name == "Dark" || theme_name == "Midnight") {
+ color = COLOR_WHITE;
+ }else{
+ color = COLOR_BLACK;
+ }
+ b.setColor(color);
return b;
}
diff --git a/src/fillediconlabel.cpp b/src/fillediconlabel.cpp
index d75b599..894f97f 100644
--- a/src/fillediconlabel.cpp
+++ b/src/fillediconlabel.cpp
@@ -1,6 +1,8 @@
-// Copyright 2019-2023 The Hush developers
+// Copyright 2019-2022 The Hush developers
// Released under the GPLv3
#include "fillediconlabel.h"
+#include "settings.h"
+#include "guiconstants.h"
FilledIconLabel::FilledIconLabel(QWidget* parent) :
QLabel(parent) {
@@ -20,8 +22,25 @@ void FilledIconLabel::resizeEvent(QResizeEvent*) {
QPixmap scaled = basePm.scaled(sz, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ QString theme_name = Settings::getInstance()->get_theme_name();
+ QColor color;
+ if (theme_name == "Blue"){
+ color = COLOR_BLUE_BG;
+ }else if(theme_name == "Light"){
+ color = COLOR_LIGHT_BG;
+ }else if(theme_name == "Dark"){
+ color = COLOR_DARK_BG;
+ }else if(theme_name =="Midnight"){
+ color = COLOR_MIDNIGHT_BG;
+ }else if(theme_name =="dragonx"){
+ color = COLOR_DRAGONX_BG;
+ }else{
+ color = COLOR_DEFAULT_BG;
+ }
+
QPixmap p(sz);
- p.fill(Qt::white);
+ p.fill(color);
+
QPainter painter(&p);
painter.drawPixmap((sz.width() - scaled.width()) / 2, (sz.height() - scaled.height()) / 2, scaled);
diff --git a/src/guiconstants.h b/src/guiconstants.h
new file mode 100644
index 0000000..63e5f6f
--- /dev/null
+++ b/src/guiconstants.h
@@ -0,0 +1,20 @@
+// Copyright 2019-2022 The Hush developers
+// Released under the GPLv3
+#ifndef GUICONSTANTS_H
+#define GUICONSTANTS_H
+
+// Generic colors
+#define COLOR_BLACK QColor(0, 0, 0)
+#define COLOR_WHITE QColor(255, 255, 255)
+#define COLOR_UNCONFIRMED_TX QColor(255, 0, 0)
+#define COLOR_DRAGONX_TEXT QColor(145, 164, 184)
+
+// Theme background colors
+#define COLOR_DEFAULT_BG QColor(229, 229, 229)
+#define COLOR_BLUE_BG QColor(229, 229, 229)
+#define COLOR_LIGHT_BG QColor(218, 218, 218)
+#define COLOR_DARK_BG QColor(48, 51, 53)
+#define COLOR_MIDNIGHT_BG QColor(17, 17, 17)
+#define COLOR_DRAGONX_BG QColor(35, 40, 52)
+
+#endif // GUICONSTANTS_H
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 87c4c26..6562979 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -2680,23 +2680,32 @@ void MainWindow::slot_change_currency(const QString& currency_name) {
void MainWindow::slot_change_theme(const QString& theme_name) {
Settings::getInstance()->set_theme_name(theme_name);
+ qDebug() << __func__ << ": theme_name=" << theme_name;
+
+ if (theme_name == "Dark" || theme_name == "Default" || theme_name == "Light" ||
+ theme_name == "Midnight" || theme_name == "Blue" || theme_name == "dragonx") {
+ Settings::getInstance()->set_theme_name(theme_name);
+ } else {
+ qDebug() << __func__ << ": ignoring invalid theme_name=" << theme_name;
+ Settings::getInstance()->set_theme_name("Dark");
+ }
// Include css
QString saved_theme_name;
- try
- {
+ try {
saved_theme_name = Settings::getInstance()->get_theme_name();
- }
- catch (...)
- {
+ } catch (const std::exception& e) {
+ qDebug() << QString("Ignoring theme change Exception! : ");
saved_theme_name = "Dark";
}
- QFile qFile(":/css/res/css/" + saved_theme_name +".css");
+ QString filename = ":/css/res/css/" + saved_theme_name +".css";
+ QFile qFile(filename);
+ qDebug() << __func__ << ": attempting to open filename=" << filename;
if (qFile.open(QFile::ReadOnly))
{
QString styleSheet = QLatin1String(qFile.readAll());
- this->setStyleSheet(""); // resets styles, makes app restart unnecessary
+ this->setStyleSheet(""); // reset styles
this->setStyleSheet(styleSheet);
}
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 5ed6682..0a4b91d 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -55,11 +55,11 @@
:/icons/res/icon.ico:/icons/res/icon.ico
-
- -
+
+
-
- 0
+ 5
@@ -1493,432 +1493,447 @@
Information about Hush
-
-
-
-
-
-
- 0
- 0
-
-
-
-
-
-
- false
-
-
-
- -
-
-
-
- 650
- 650
-
-
-
-
- 16777215
- 16777215
-
-
-
-
-
-
-
-
-
-
- Qt::Vertical
+
+
+ true
+
+
+
+ 20
+ 20
+ 300
+ 300
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 300
+ 300
+
+
+
+
+ 300
+ 300
+
+
+
+
+
+
+ false
+
+
+ Qt::AlignHCenter|Qt::AlignTop
+
+
+
+
+
+ 336
+ 12
+ 1001
+ 650
+
+
+
+
+ 650
+ 650
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+
+
+
+
-
+
+
+
+ 15
+
+
+
+ <html><head/><body><p align="center"><span style=" font-weight:600;">Hush Blockchain Information</span></p></body></html>
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
-
+
+
+ <html><head/><body><p align="center">|</p></body></html>
-
-
- 20
- 40
-
+
+
+ -
+
+
+ Loading...
-
+
- -
-
-
-
- 15
-
+
-
+
+
+ <html><head/><body><p align="center">|</p></body></html>
+
+
+ -
+
- <html><head/><body><p align="center"><span style=" font-weight:600;">Hush Blockchain Information</span></p></body></html>
+ Next Halving
- -
-
-
- Qt::Horizontal
+
-
+
+
+ Loading...
- -
-
-
-
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- Next Halving
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- Vendor
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- Difficulty
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- Last Notarized Block
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- Total Supply
-
-
-
- -
-
-
- Current Server
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- Sticky Server
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- Longestchain
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- Version hushlightd
-
-
-
- -
-
-
- BlockHeight
-
-
-
- -
-
-
- Supply zAddr
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- Supply tAddr
-
-
-
-
+ -
+
+
+ <html><head/><body><p align="center">|</p></body></html>
+
+
- -
-
-
- Qt::Horizontal
+
-
+
+
+ Loading...
- -
-
-
-
- 15
-
+
-
+
+
+ Vendor
+
+
+ -
+
- <html><head/><body><p align="center"><span style=" font-weight:600;">Hush Market Information</span></p></body></html>
+ Loading...
- -
-
-
- Qt::Horizontal
+
-
+
+
+ Loading...
- -
-
-
-
-
-
- Loading...
-
-
-
- -
-
-
- Market Cap
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- Volume on Exchanges
-
-
-
- -
-
-
- <html><head/><body><p align="center">|</p></body></html>
-
-
-
-
+ -
+
+
+ Loading...
+
+
- -
-
-
- Qt::Horizontal
+
-
+
+
+ Loading...
- -
-
+
-
+
- <html><head/><body><p align="center"> </p></body></html>
+ <html><head/><body><p align="center">|</p></body></html>
- -
-
-
- Qt::Vertical
+
-
+
+
+ <html><head/><body><p align="center">|</p></body></html>
-
-
- 20
- 40
-
+
+
+ -
+
+
+ Difficulty
-
+
+
+ -
+
+
+ <html><head/><body><p align="center">|</p></body></html>
+
+
+
+ -
+
+
+ Last Notarized Block
+
+
+
+ -
+
+
+ Loading...
+
+
+
+ -
+
+
+ <html><head/><body><p align="center">|</p></body></html>
+
+
+
+ -
+
+
+ Total Supply
+
+
+
+ -
+
+
+ Current Server
+
+
+
+ -
+
+
+ <html><head/><body><p align="center">|</p></body></html>
+
+
+
+ -
+
+
+ Loading...
+
+
+
+ -
+
+
+ Sticky Server
+
+
+
+ -
+
+
+ <html><head/><body><p align="center">|</p></body></html>
+
+
+
+ -
+
+
+ Loading...
+
+
+
+ -
+
+
+ <html><head/><body><p align="center">|</p></body></html>
+
+
+
+ -
+
+
+ Longestchain
+
+
+
+ -
+
+
+ <html><head/><body><p align="center">|</p></body></html>
+
+
+
+ -
+
+
+ Version hushlightd
+
+
+
+ -
+
+
+ BlockHeight
+
+
+
+ -
+
+
+ Supply zAddr
+
+
+
+ -
+
+
+ <html><head/><body><p align="center">|</p></body></html>
+
+
+
+ -
+
+
+ Loading...
+
+
+
+ -
+
+
+ Loading...
+
+
+
+ -
+
+
+ Supply tAddr
+
+
-
-
-
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 15
+
+
+
+ <html><head/><body><p align="center"><span style=" font-weight:600;">Hush Market Information</span></p></body></html>
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
-
+
+
+ Loading...
+
+
+
+ -
+
+
+ Market Cap
+
+
+
+ -
+
+
+ <html><head/><body><p align="center">|</p></body></html>
+
+
+
+ -
+
+
+ Loading...
+
+
+
+ -
+
+
+ Volume on Exchanges
+
+
+
+ -
+
+
+ <html><head/><body><p align="center">|</p></body></html>
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ <html><head/><body><p align="center"> </p></body></html>
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
diff --git a/src/txtablemodel.cpp b/src/txtablemodel.cpp
index 6e786e9..633145c 100644
--- a/src/txtablemodel.cpp
+++ b/src/txtablemodel.cpp
@@ -3,6 +3,7 @@
#include "txtablemodel.h"
#include "settings.h"
#include "controller.h"
+#include "guiconstants.h"
TxTableModel::TxTableModel(QObject *parent)
: QAbstractTableModel(parent) {
@@ -87,6 +88,17 @@ QString TxTableModel::concatMultipleMemos(const TransactionItem& dat) const {
};
QVariant TxTableModel::data(const QModelIndex &index, int role) const {
+
+ // Get current theme name
+ QString theme_name = Settings::getInstance()->get_theme_name();
+ QBrush b;
+ QColor color;
+ if (theme_name == "Dark" || theme_name == "Midnight") {
+ color = COLOR_WHITE;
+ }else{
+ color = COLOR_BLACK;
+ }
+
// Align numeric columns (confirmations, amount) right
if (role == Qt::TextAlignmentRole &&
(index.column() == Column::Confirmations || index.column() == Column::Amount))
@@ -95,15 +107,11 @@ QVariant TxTableModel::data(const QModelIndex &index, int role) const {
auto dat = modeldata->at(index.row());
if (role == Qt::ForegroundRole) {
if (dat.confirmations <= 0) {
- QBrush b;
b.setColor(Qt::red);
return b;
}
-
- // Else, just return the default brush
- QBrush b;
- b.setColor(Qt::black);
- return b;
+ b.setColor(color);
+ return b;
}
if (role == Qt::DisplayRole) {
@@ -195,29 +203,30 @@ QVariant TxTableModel::data(const QModelIndex &index, int role) const {
hasMemo = true;
}
}
-
+
// If the memo is a Payment URI, then show a payment request icon
if (dat.items.length() == 1 && dat.items[0].memo.startsWith("hush:")) {
- QIcon icon(":/icons/res/paymentreq.gif");
+ QImage image = colorizeIcon(QIcon(":/icons/res/paymentreq.gif"), color);
+ QIcon icon;
+ icon.addPixmap(QPixmap::fromImage(image));
return QVariant(icon.pixmap(16, 16));
} else if (hasMemo) {
// Return the info pixmap to indicate memo
QIcon icon(":/icons/res/mail.png");
return QVariant(icon.pixmap(16, 16));
} else {
-
- if (dat.type == "Receive"){
- // Empty pixmap to make it align
- QPixmap p(16, 16);
- QIcon icon = QApplication::style()->standardIcon(QStyle::SP_ArrowLeft);
- return QVariant(icon.pixmap(16, 16));
- }
+ if (dat.type == "Receive"){
+ QImage image = colorizeIcon(QIcon(":/icons/res/tx_input.png"), color);
+ QIcon icon;
+ icon.addPixmap(QPixmap::fromImage(image));
+ return QVariant(icon.pixmap(16, 16));
+ }
if (dat.type == "send"){
- // Empty pixmap to make it align
- QPixmap p(16, 16);
- QIcon icon = QApplication::style()->standardIcon(QStyle::SP_ArrowForward);
- return QVariant(icon.pixmap(16, 16));
- }
+ QImage image = colorizeIcon(QIcon(":/icons/res/tx_output.png"), color);
+ QIcon icon;
+ icon.addPixmap(QPixmap::fromImage(image));
+ return QVariant(icon.pixmap(16, 16));
+ }
}
}
@@ -278,3 +287,17 @@ QString TxTableModel::getAmt(int row) const {
}
return total.toDecimalString();
}
+
+QImage TxTableModel::colorizeIcon(QIcon icon, QColor color) const{
+ QImage img(icon.pixmap(16, 16).toImage());
+ img = img.convertToFormat(QImage::Format_ARGB32);
+ for (int x = img.width(); x--; )
+ {
+ for (int y = img.height(); y--; )
+ {
+ const QRgb rgb = img.pixel(x, y);
+ img.setPixel(x, y, qRgba(color.red(), color.green(), color.blue(), qAlpha(rgb)));
+ }
+ }
+ return img;
+}
\ No newline at end of file
diff --git a/src/txtablemodel.h b/src/txtablemodel.h
index 48d4ee5..0479518 100644
--- a/src/txtablemodel.h
+++ b/src/txtablemodel.h
@@ -38,6 +38,7 @@ public:
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ QImage colorizeIcon(const QIcon icon, const QColor color) const;
private:
QString concatMultipleMemos(const TransactionItem&) const;