From 348adec4cd574f1962a618437306fb8968da314a Mon Sep 17 00:00:00 2001 From: random-zebra Date: Fri, 10 Dec 2021 12:23:44 +0100 Subject: [PATCH 1/2] [Cleanup] Remove unused recentRequestsTableModel --- src/Makefile.qt.include | 3 - src/qt/CMakeLists.txt | 1 - src/qt/recentrequeststablemodel.cpp | 233 ---------------------------- src/qt/recentrequeststablemodel.h | 100 ------------ src/qt/walletmodel.cpp | 7 - src/qt/walletmodel.h | 3 - 6 files changed, 347 deletions(-) delete mode 100644 src/qt/recentrequeststablemodel.cpp delete mode 100644 src/qt/recentrequeststablemodel.h diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 1c41ee199db7d..c90155c5630f1 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -94,7 +94,6 @@ QT_MOC_CPP = \ qt/moc_paymentserver.cpp \ qt/moc_qvalidatedlineedit.cpp \ qt/moc_qvaluecombobox.cpp \ - qt/moc_recentrequeststablemodel.cpp \ qt/moc_rpcconsole.cpp \ qt/moc_rpcexecutor.cpp \ qt/moc_trafficgraphwidget.cpp \ @@ -201,7 +200,6 @@ BITCOIN_QT_H = \ qt/platformstyle.h \ qt/qvalidatedlineedit.h \ qt/qvaluecombobox.h \ - qt/recentrequeststablemodel.h \ qt/rpcconsole.h \ qt/rpcexecutor.h \ qt/trafficgraphwidget.h \ @@ -549,7 +547,6 @@ BITCOIN_QT_WALLET_CPP = \ qt/editaddressdialog.cpp \ qt/openuridialog.cpp \ qt/paymentserver.cpp \ - qt/recentrequeststablemodel.cpp \ qt/transactionfilterproxy.cpp \ qt/transactionrecord.cpp \ qt/transactiontablemodel.cpp \ diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index a3b89a3b7e582..a5f7493fb8b2e 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -94,7 +94,6 @@ SET(QT_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/editaddressdialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/openuridialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/paymentserver.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/recentrequeststablemodel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/transactionfilterproxy.cpp ${CMAKE_CURRENT_SOURCE_DIR}/transactionrecord.cpp ${CMAKE_CURRENT_SOURCE_DIR}/transactiontablemodel.cpp diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp deleted file mode 100644 index 1a78955e01c34..0000000000000 --- a/src/qt/recentrequeststablemodel.cpp +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright (c) 2011-2014 The Bitcoin developers -// Copyright (c) 2017-2020 The PIVX developers -// Distributed under the MIT/X11 software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include "recentrequeststablemodel.h" - -#include "bitcoinunits.h" -#include "clientversion.h" -#include "guiutil.h" -#include "optionsmodel.h" -#include "streams.h" - -#include - - -RecentRequestsTableModel::RecentRequestsTableModel(CWallet* wallet, WalletModel* parent) : walletModel(parent) -{ - Q_UNUSED(wallet); - nReceiveRequestsMaxId = 0; - - // Load entries from wallet - std::vector vReceiveRequests; - parent->loadReceiveRequests(vReceiveRequests); - for (const std::string& request : vReceiveRequests) - addNewRequest(request); - - /* These columns must match the indices in the ColumnIndex enumeration */ - columns << tr("Date") << tr("Label") << tr("Address") << tr("Message") << getAmountTitle(); - - connect(walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &RecentRequestsTableModel::updateDisplayUnit); -} - -RecentRequestsTableModel::~RecentRequestsTableModel() -{ - /* Intentionally left empty */ -} - -int RecentRequestsTableModel::rowCount(const QModelIndex& parent) const -{ - Q_UNUSED(parent); - - return list.length(); -} - -int RecentRequestsTableModel::columnCount(const QModelIndex& parent) const -{ - Q_UNUSED(parent); - - return columns.length(); -} - -QVariant RecentRequestsTableModel::data(const QModelIndex& index, int role) const -{ - if (!index.isValid() || index.row() >= list.length()) - return QVariant(); - - const RecentRequestEntry* rec = &list[index.row()]; - - if (role == Qt::DisplayRole || role == Qt::EditRole) { - switch (index.column()) { - case Date: - return GUIUtil::dateTimeStr(rec->date); - case Label: - if (rec->recipient.label.isEmpty() && role == Qt::DisplayRole) { - return tr("(no label)"); - } else { - return rec->recipient.label; - } - case Address: - return rec->recipient.address; - case Message: - if (rec->recipient.message.isEmpty() && role == Qt::DisplayRole) { - return tr("(no message)"); - } else { - return rec->recipient.message; - } - case Amount: - if (rec->recipient.amount == 0 && role == Qt::DisplayRole) - return tr("(no amount)"); - else if (role == Qt::EditRole) - return BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), rec->recipient.amount, false, BitcoinUnits::separatorNever); - else - return BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), rec->recipient.amount); - } - } else if (role == Qt::TextAlignmentRole) { - if (index.column() == Amount) - return (int)(Qt::AlignRight | Qt::AlignVCenter); - } - return QVariant(); -} - -bool RecentRequestsTableModel::setData(const QModelIndex& index, const QVariant& value, int role) -{ - return true; -} - -QVariant RecentRequestsTableModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (orientation == Qt::Horizontal) { - if (role == Qt::DisplayRole && section < columns.size()) { - return columns[section]; - } - } - return QVariant(); -} - -/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */ -void RecentRequestsTableModel::updateAmountColumnTitle() -{ - columns[Amount] = getAmountTitle(); - Q_EMIT headerDataChanged(Qt::Horizontal, Amount, Amount); -} - -/** Gets title for amount column including current display unit if optionsModel reference available. */ -QString RecentRequestsTableModel::getAmountTitle() -{ - QString amountTitle = tr("Amount"); - if (this->walletModel->getOptionsModel() != NULL) { - amountTitle += " (" + BitcoinUnits::name(this->walletModel->getOptionsModel()->getDisplayUnit()) + ")"; - } - return amountTitle; -} - -QModelIndex RecentRequestsTableModel::index(int row, int column, const QModelIndex& parent) const -{ - Q_UNUSED(parent); - - return createIndex(row, column); -} - -bool RecentRequestsTableModel::removeRows(int row, int count, const QModelIndex& parent) -{ - Q_UNUSED(parent); - - if (count > 0 && row >= 0 && (row + count) <= list.size()) { - const RecentRequestEntry* rec; - for (int i = 0; i < count; ++i) { - rec = &list[row + i]; - if (!walletModel->saveReceiveRequest(rec->recipient.address.toStdString(), rec->id, "")) - return false; - } - - beginRemoveRows(parent, row, row + count - 1); - list.erase(list.begin() + row, list.begin() + row + count); - endRemoveRows(); - return true; - } else { - return false; - } -} - -Qt::ItemFlags RecentRequestsTableModel::flags(const QModelIndex& index) const -{ - return Qt::ItemIsSelectable | Qt::ItemIsEnabled; -} - -// called when adding a request from the GUI -void RecentRequestsTableModel::addNewRequest(const SendCoinsRecipient& recipient) -{ - RecentRequestEntry newEntry; - newEntry.id = ++nReceiveRequestsMaxId; - newEntry.date = QDateTime::currentDateTime(); - newEntry.recipient = recipient; - - CDataStream ss(SER_DISK, CLIENT_VERSION); - ss << newEntry; - - if (!walletModel->saveReceiveRequest(recipient.address.toStdString(), newEntry.id, ss.str())) - return; - - addNewRequest(newEntry); -} - -// called from ctor when loading from wallet -void RecentRequestsTableModel::addNewRequest(const std::string& recipient) -{ - std::vector data(recipient.begin(), recipient.end()); - CDataStream ss(data, SER_DISK, CLIENT_VERSION); - - RecentRequestEntry entry; - ss >> entry; - - if (entry.id == 0) // should not happen - return; - - if (entry.id > nReceiveRequestsMaxId) - nReceiveRequestsMaxId = entry.id; - - addNewRequest(entry); -} - -// actually add to table in GUI -void RecentRequestsTableModel::addNewRequest(RecentRequestEntry& recipient) -{ - beginInsertRows(QModelIndex(), 0, 0); - list.prepend(recipient); - endInsertRows(); -} - -void RecentRequestsTableModel::sort(int column, Qt::SortOrder order) -{ - std::sort(list.begin(), list.end(), RecentRequestEntryLessThan(column, order)); - Q_EMIT dataChanged(index(0, 0, QModelIndex()), index(list.size() - 1, NUMBER_OF_COLUMNS - 1, QModelIndex())); -} - -void RecentRequestsTableModel::updateDisplayUnit() -{ - updateAmountColumnTitle(); -} - -bool RecentRequestEntryLessThan::operator()(RecentRequestEntry& left, RecentRequestEntry& right) const -{ - RecentRequestEntry* pLeft = &left; - RecentRequestEntry* pRight = &right; - if (order == Qt::DescendingOrder) - std::swap(pLeft, pRight); - - switch (column) { - case RecentRequestsTableModel::Date: - return pLeft->date.toTime_t() < pRight->date.toTime_t(); - case RecentRequestsTableModel::Label: - return pLeft->recipient.label < pRight->recipient.label; - case RecentRequestsTableModel::Address: - return pLeft->recipient.address < pRight->recipient.address; - case RecentRequestsTableModel::Message: - return pLeft->recipient.message < pRight->recipient.message; - case RecentRequestsTableModel::Amount: - return pLeft->recipient.amount < pRight->recipient.amount; - default: - return pLeft->id < pRight->id; - } -} diff --git a/src/qt/recentrequeststablemodel.h b/src/qt/recentrequeststablemodel.h deleted file mode 100644 index ab90966ef89a8..0000000000000 --- a/src/qt/recentrequeststablemodel.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2011-2014 The Bitcoin developers -// Copyright (c) 2017-2019 The PIVX developers -// Distributed under the MIT/X11 software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H -#define BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H - -#include "walletmodel.h" - -#include -#include -#include - -class CWallet; - -class RecentRequestEntry -{ -public: - RecentRequestEntry() : nVersion(RecentRequestEntry::CURRENT_VERSION), id(0) {} - - static const int CURRENT_VERSION = 1; - int nVersion; - int64_t id; - QDateTime date; - SendCoinsRecipient recipient; - - SERIALIZE_METHODS(RecentRequestEntry, obj) { - unsigned int date_timet; - SER_WRITE(obj, date_timet = obj.date.toTime_t()); - READWRITE(obj.nVersion, obj.id, date_timet, obj.recipient); - SER_READ(obj, obj.date = QDateTime::fromTime_t(date_timet)); - } -}; - -class RecentRequestEntryLessThan -{ -public: - RecentRequestEntryLessThan(int nColumn, Qt::SortOrder fOrder) : column(nColumn), order(fOrder) {} - bool operator()(RecentRequestEntry& left, RecentRequestEntry& right) const; - -private: - int column; - Qt::SortOrder order; -}; - -/** Model for list of recently generated payment requests / pivx: URIs. - * Part of wallet model. - */ -class RecentRequestsTableModel : public QAbstractTableModel -{ - Q_OBJECT - -public: - explicit RecentRequestsTableModel(CWallet* wallet, WalletModel* parent); - ~RecentRequestsTableModel(); - - enum ColumnIndex { - Date = 0, - Label = 1, - Address = 2, - Message = 3, - Amount = 4, - NUMBER_OF_COLUMNS - }; - - /** @name Methods overridden from QAbstractTableModel - @{*/ - int rowCount(const QModelIndex& parent) const; - int columnCount(const QModelIndex& parent) const; - QVariant data(const QModelIndex& index, int role) const; - bool setData(const QModelIndex& index, const QVariant& value, int role); - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - QModelIndex index(int row, int column, const QModelIndex& parent) const; - bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()); - Qt::ItemFlags flags(const QModelIndex& index) const; - /*@}*/ - - const RecentRequestEntry& entry(int row) const { return list[row]; } - void addNewRequest(const SendCoinsRecipient& recipient); - void addNewRequest(const std::string& recipient); - void addNewRequest(RecentRequestEntry& recipient); - -public Q_SLOTS: - void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); - void updateDisplayUnit(); - -private: - WalletModel* walletModel; - QStringList columns; - QList list; - int64_t nReceiveRequestsMaxId; - - /** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */ - void updateAmountColumnTitle(); - /** Gets title for amount column including current display unit if optionsModel reference available. */ - QString getAmountTitle(); -}; - -#endif // BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index e78ca08aa8f51..ce3e4f6b0abf7 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -19,7 +19,6 @@ #include "qt/clientmodel.h" #include "qt/guiconstants.h" #include "qt/optionsmodel.h" -#include "qt/recentrequeststablemodel.h" #include "qt/transactiontablemodel.h" #include "qt/walletmodeltransaction.h" @@ -50,7 +49,6 @@ WalletModel::WalletModel(CWallet* wallet, OptionsModel* optionsModel, QObject* p addressTableModel = new AddressTableModel(wallet, this); transactionTableModel = new TransactionTableModel(wallet, this); - recentRequestsTableModel = new RecentRequestsTableModel(wallet, this); } void WalletModel::init() @@ -698,11 +696,6 @@ TransactionTableModel* WalletModel::getTransactionTableModel() return transactionTableModel; } -RecentRequestsTableModel* WalletModel::getRecentRequestsTableModel() -{ - return recentRequestsTableModel; -} - WalletModel::EncryptionStatus WalletModel::getEncryptionStatus() const { if (!wallet) throw std::runtime_error("Error, cannot get encryption status. Wallet doesn't exist"); diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 22246458daa05..a0a1bcca0bd90 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -28,7 +28,6 @@ class AddressTableModel; class CBudgetProposal; class ClientModel; class OptionsModel; -class RecentRequestsTableModel; class TransactionTableModel; class WalletModelTransaction; @@ -141,7 +140,6 @@ class WalletModel : public QObject OptionsModel* getOptionsModel(); AddressTableModel* getAddressTableModel(); TransactionTableModel* getTransactionTableModel(); - RecentRequestsTableModel* getRecentRequestsTableModel(); void resetWalletOptions(QSettings& settings); bool isTestNetwork() const; @@ -391,7 +389,6 @@ class WalletModel : public QObject AddressTableModel* addressTableModel; TransactionTableModel* transactionTableModel; - RecentRequestsTableModel* recentRequestsTableModel; // Cache balance to be able to detect changes interfaces::WalletBalances m_cached_balances; From 66e45eb72689ec26081dcb97b3047dde8fe47eb5 Mon Sep 17 00:00:00 2001 From: random-zebra Date: Fri, 10 Dec 2021 12:45:02 +0100 Subject: [PATCH 2/2] [Cleanup] Remove unused PlatformStyle --- src/Makefile.qt.include | 2 - src/qt/CMakeLists.txt | 1 - src/qt/pivx/topbar.cpp | 1 - src/qt/platformstyle.cpp | 137 --------------------------------------- src/qt/platformstyle.h | 55 ---------------- 5 files changed, 196 deletions(-) delete mode 100644 src/qt/platformstyle.cpp delete mode 100644 src/qt/platformstyle.h diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index c90155c5630f1..58e9bdd99deb8 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -197,7 +197,6 @@ BITCOIN_QT_H = \ qt/optionsmodel.h \ qt/paymentserver.h \ qt/peertablemodel.h \ - qt/platformstyle.h \ qt/qvalidatedlineedit.h \ qt/qvaluecombobox.h \ qt/rpcconsole.h \ @@ -528,7 +527,6 @@ BITCOIN_QT_BASE_CPP = \ qt/notificator.cpp \ qt/optionsmodel.cpp \ qt/peertablemodel.cpp \ - qt/platformstyle.cpp \ qt/qvalidatedlineedit.cpp \ qt/qvaluecombobox.cpp \ qt/rpcconsole.cpp \ diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index a5f7493fb8b2e..bc64cd3b04429 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -79,7 +79,6 @@ SET(QT_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/notificator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/optionsmodel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/peertablemodel.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platformstyle.cpp ${CMAKE_CURRENT_SOURCE_DIR}/qvalidatedlineedit.cpp ${CMAKE_CURRENT_SOURCE_DIR}/qvaluecombobox.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rpcconsole.cpp diff --git a/src/qt/pivx/topbar.cpp b/src/qt/pivx/topbar.cpp index 043c709877e67..f9562241eaf01 100644 --- a/src/qt/pivx/topbar.cpp +++ b/src/qt/pivx/topbar.cpp @@ -15,7 +15,6 @@ #include "clientmodel.h" #include "qt/guiutil.h" #include "optionsmodel.h" -#include "qt/platformstyle.h" #include "walletmodel.h" #include "addresstablemodel.h" diff --git a/src/qt/platformstyle.cpp b/src/qt/platformstyle.cpp deleted file mode 100644 index 1d8052cf8d5ee..0000000000000 --- a/src/qt/platformstyle.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) 2015 The Bitcoin Core developers -// Copyright (c) 2016-2019 The PIVX developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include "platformstyle.h" - -#include "guiconstants.h" - -#include -#include -#include -#include - -static const struct { - const char* platformId; - /** Show images on push buttons */ - const bool imagesOnButtons; - /** Colorize single-color icons */ - const bool colorizeIcons; - /** Extra padding/spacing in transactionview */ - const bool useExtraSpacing; -} platform_styles[] = { - {"macosx", false, false, true}, - {"windows", true, false, false}, - /* Other: linux, unix, ... */ - {"other", true, false, false}}; -static const unsigned platform_styles_count = sizeof(platform_styles) / sizeof(*platform_styles); - -namespace -{ -/* Local functions for colorizing single-color images */ - -void MakeSingleColorImage(QImage& img, const QColor& colorbase) -{ - 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(colorbase.red(), colorbase.green(), colorbase.blue(), qAlpha(rgb))); - } - } -} - -QIcon ColorizeIcon(const QIcon& ico, const QColor& colorbase) -{ - QIcon new_ico; - for (const QSize sz : ico.availableSizes()) { - QImage img(ico.pixmap(sz).toImage()); - MakeSingleColorImage(img, colorbase); - new_ico.addPixmap(QPixmap::fromImage(img)); - } - return new_ico; -} - -QImage ColorizeImage(const QString& filename, const QColor& colorbase) -{ - QImage img(filename); - MakeSingleColorImage(img, colorbase); - return img; -} - -QIcon ColorizeIcon(const QString& filename, const QColor& colorbase) -{ - return QIcon(QPixmap::fromImage(ColorizeImage(filename, colorbase))); -} -} - - -PlatformStyle::PlatformStyle(const QString& name, bool imagesOnButtons, bool colorizeIcons, bool useExtraSpacing) : name(name), - imagesOnButtons(imagesOnButtons), - colorizeIcons(colorizeIcons), - useExtraSpacing(useExtraSpacing), - singleColor(0, 0, 0), - textColor(0, 0, 0) -{ - // Determine icon highlighting color - if (colorizeIcons) { - const QColor colorHighlightBg(QApplication::palette().color(QPalette::Highlight)); - const QColor colorHighlightFg(QApplication::palette().color(QPalette::HighlightedText)); - const QColor colorText(QApplication::palette().color(QPalette::WindowText)); - const int colorTextLightness = colorText.lightness(); - QColor colorbase; - if (abs(colorHighlightBg.lightness() - colorTextLightness) < abs(colorHighlightFg.lightness() - colorTextLightness)) - colorbase = colorHighlightBg; - else - colorbase = colorHighlightFg; - singleColor = colorbase; - } - // Determine text color - textColor = QColor(QApplication::palette().color(QPalette::WindowText)); -} - -QImage PlatformStyle::SingleColorImage(const QString& filename) const -{ - if (!colorizeIcons) - return QImage(filename); - return ColorizeImage(filename, SingleColor()); -} - -QIcon PlatformStyle::SingleColorIcon(const QString& filename) const -{ - if (!colorizeIcons) - return QIcon(filename); - return ColorizeIcon(filename, SingleColor()); -} - -QIcon PlatformStyle::SingleColorIcon(const QIcon& icon) const -{ - if (!colorizeIcons) - return icon; - return ColorizeIcon(icon, SingleColor()); -} - -QIcon PlatformStyle::TextColorIcon(const QString& filename) const -{ - return ColorizeIcon(filename, TextColor()); -} - -QIcon PlatformStyle::TextColorIcon(const QIcon& icon) const -{ - return ColorizeIcon(icon, TextColor()); -} - -const PlatformStyle* PlatformStyle::instantiate(const QString& platformId) -{ - for (unsigned x = 0; x < platform_styles_count; ++x) { - if (platformId == platform_styles[x].platformId) { - return new PlatformStyle( - platform_styles[x].platformId, - platform_styles[x].imagesOnButtons, - platform_styles[x].colorizeIcons, - platform_styles[x].useExtraSpacing); - } - } - return 0; -} diff --git a/src/qt/platformstyle.h b/src/qt/platformstyle.h deleted file mode 100644 index 34e6f650729c0..0000000000000 --- a/src/qt/platformstyle.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2015 The Bitcoin Core developers -// Copyright (c) 2016-2019 The PIVX developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef BITCOIN_QT_PLATFORMSTYLE_H -#define BITCOIN_QT_PLATFORMSTYLE_H - -#include -#include -#include - -/* Coin network-specific GUI style information */ -class PlatformStyle -{ -public: - /** Get style associated with provided platform name, or 0 if not known */ - static const PlatformStyle* instantiate(const QString& platformId); - - const QString& getName() const { return name; } - - bool getImagesOnButtons() const { return imagesOnButtons; } - bool getUseExtraSpacing() const { return useExtraSpacing; } - - QColor TextColor() const { return textColor; } - QColor SingleColor() const { return singleColor; } - - /** Colorize an image (given filename) with the icon color */ - QImage SingleColorImage(const QString& filename) const; - - /** Colorize an icon (given filename) with the icon color */ - QIcon SingleColorIcon(const QString& filename) const; - - /** Colorize an icon (given object) with the icon color */ - QIcon SingleColorIcon(const QIcon& icon) const; - - /** Colorize an icon (given filename) with the text color */ - QIcon TextColorIcon(const QString& filename) const; - - /** Colorize an icon (given object) with the text color */ - QIcon TextColorIcon(const QIcon& icon) const; - -private: - PlatformStyle(const QString& name, bool imagesOnButtons, bool colorizeIcons, bool useExtraSpacing); - - QString name; - bool imagesOnButtons; - bool colorizeIcons; - bool useExtraSpacing; - QColor singleColor; - QColor textColor; - /* ... more to come later */ -}; - -#endif // BITCOIN_QT_PLATFORMSTYLE_H