UI/color tweaks from SD
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 19 KiB |
@@ -88,6 +88,7 @@ SOURCES += \
|
||||
src/Crypto/passwd.cpp
|
||||
|
||||
HEADERS += \
|
||||
src/guiconstants.h \
|
||||
src/firsttimewizard.h \
|
||||
src/mainwindow.h \
|
||||
src/precompiled.h \
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
20
src/guiconstants.h
Normal file
20
src/guiconstants.h
Normal file
@@ -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
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,11 +55,11 @@
|
||||
<normaloff>:/icons/res/icon.ico</normaloff>:/icons/res/icon.ico</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>5</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_6">
|
||||
<attribute name="title">
|
||||
@@ -1493,432 +1493,447 @@
|
||||
<attribute name="title">
|
||||
<string>Information about Hush</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<item>
|
||||
<widget class="FilledIconLabel" name="hushdlogo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>650</width>
|
||||
<height>650</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<widget class="FilledIconLabel" name="hushdlogo">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>300</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>336</x>
|
||||
<y>12</y>
|
||||
<width>1001</width>
|
||||
<height>650</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>650</width>
|
||||
<height>650</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center"><span style=" font-weight:600;">Hush Blockchain Information</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center"><span style=" font-weight:600;">Hush Blockchain Information</span></p></body></html></string>
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QLabel" name="supply_total">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="label_38">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_32">
|
||||
<property name="text">
|
||||
<string>Next Halving</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QLabel" name="supply_taddr">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="blockHeight">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Vendor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="halvingTime">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="Vendor">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLabel" name="last_notarized">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QLabel" name="difficulty">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="label_34">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_33">
|
||||
<property name="text">
|
||||
<string>Difficulty</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>Last Notarized Block</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="Version">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_37">
|
||||
<property name="text">
|
||||
<string>Total Supply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="current_server_label">
|
||||
<property name="text">
|
||||
<string>Current Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="2">
|
||||
<widget class="QLabel" name="current_server">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="sticky_server_label">
|
||||
<property name="text">
|
||||
<string>Sticky Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<widget class="QLabel" name="sticky_server">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string>Longestchain</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Version hushlightd</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
<string>BlockHeight</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_35">
|
||||
<property name="text">
|
||||
<string>Supply zAddr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QLabel" name="supply_zaddr">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLabel" name="longestchain">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_36">
|
||||
<property name="text">
|
||||
<string>Supply tAddr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<item row="9" column="2">
|
||||
<widget class="QLabel" name="supply_total">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center"><span style=" font-weight:600;">Hush Market Information</span></p></body></html></string>
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="marketcapTab">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_31">
|
||||
<property name="text">
|
||||
<string>Market Cap</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="volumeExchange">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Volume on Exchanges</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="label_38">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center"> </p></body></html></string>
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_32">
|
||||
<property name="text">
|
||||
<string>Next Halving</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QLabel" name="supply_taddr">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="blockHeight">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Vendor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="halvingTime">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="Vendor">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLabel" name="last_notarized">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QLabel" name="difficulty">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="label_34">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_33">
|
||||
<property name="text">
|
||||
<string>Difficulty</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>Last Notarized Block</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="Version">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_37">
|
||||
<property name="text">
|
||||
<string>Total Supply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="current_server_label">
|
||||
<property name="text">
|
||||
<string>Current Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="2">
|
||||
<widget class="QLabel" name="current_server">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="sticky_server_label">
|
||||
<property name="text">
|
||||
<string>Sticky Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<widget class="QLabel" name="sticky_server">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string>Longestchain</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Version hushlightd</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
<string>BlockHeight</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_35">
|
||||
<property name="text">
|
||||
<string>Supply zAddr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QLabel" name="supply_zaddr">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLabel" name="longestchain">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_36">
|
||||
<property name="text">
|
||||
<string>Supply tAddr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center"><span style=" font-weight:600;">Hush Market Information</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="marketcapTab">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_31">
|
||||
<property name="text">
|
||||
<string>Market Cap</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="volumeExchange">
|
||||
<property name="text">
|
||||
<string>Loading...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Volume on Exchanges</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center">|</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center"> </p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user