diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.qt.include | 2 | ||||
-rw-r--r-- | src/qt/addressbookpage.cpp | 6 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 52 | ||||
-rw-r--r-- | src/qt/coincontroldialog.cpp | 5 | ||||
-rw-r--r-- | src/qt/intro.cpp | 3 | ||||
-rw-r--r-- | src/qt/networkstyle.cpp | 1 | ||||
-rw-r--r-- | src/qt/overviewpage.cpp | 4 | ||||
-rw-r--r-- | src/qt/receivecoinsdialog.cpp | 6 | ||||
-rw-r--r-- | src/qt/rpcconsole.cpp | 6 | ||||
-rw-r--r-- | src/qt/scicon.cpp | 84 | ||||
-rw-r--r-- | src/qt/scicon.h | 24 | ||||
-rw-r--r-- | src/qt/sendcoinsdialog.cpp | 5 | ||||
-rw-r--r-- | src/qt/sendcoinsentry.cpp | 7 | ||||
-rw-r--r-- | src/qt/signverifymessagedialog.cpp | 10 | ||||
-rw-r--r-- | src/qt/transactiontablemodel.cpp | 8 | ||||
-rw-r--r-- | src/qt/transactiontablemodel.h | 4 | ||||
-rw-r--r-- | src/qt/transactionview.cpp | 5 | ||||
-rw-r--r-- | src/qt/walletview.cpp | 3 |
18 files changed, 198 insertions, 37 deletions
diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 25d76c146b..8b782b2ad5 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -191,6 +191,7 @@ BITCOIN_QT_H = \ qt/receiverequestdialog.h \ qt/recentrequeststablemodel.h \ qt/rpcconsole.h \ + qt/scicon.h \ qt/sendcoinsdialog.h \ qt/sendcoinsentry.h \ qt/signverifymessagedialog.h \ @@ -277,6 +278,7 @@ BITCOIN_QT_CPP = \ qt/qvalidatedlineedit.cpp \ qt/qvaluecombobox.cpp \ qt/rpcconsole.cpp \ + qt/scicon.cpp \ qt/splashscreen.cpp \ qt/trafficgraphwidget.cpp \ qt/utilitydialog.cpp \ diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index fd3c1f2c0d..5485d89f3e 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -14,6 +14,7 @@ #include "csvmodelwriter.h" #include "editaddressdialog.h" #include "guiutil.h" +#include "scicon.h" #include <QIcon> #include <QMenu> @@ -34,6 +35,11 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) : ui->copyAddress->setIcon(QIcon()); ui->deleteAddress->setIcon(QIcon()); ui->exportButton->setIcon(QIcon()); +#else + ui->newAddress->setIcon(SingleColorIcon(":/icons/add")); + ui->copyAddress->setIcon(SingleColorIcon(":/icons/editcopy")); + ui->deleteAddress->setIcon(SingleColorIcon(":/icons/remove")); + ui->exportButton->setIcon(SingleColorIcon(":/icons/export")); #endif switch(mode) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 4eef185855..3b8fd985a0 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -14,6 +14,7 @@ #include "optionsdialog.h" #include "optionsmodel.h" #include "rpcconsole.h" +#include "scicon.h" #include "utilitydialog.h" #ifdef ENABLE_WALLET @@ -36,7 +37,6 @@ #include <QDateTime> #include <QDesktopWidget> #include <QDragEnterEvent> -#include <QIcon> #include <QListWidget> #include <QMenuBar> #include <QMessageBox> @@ -242,28 +242,28 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle) { QActionGroup *tabGroup = new QActionGroup(this); - overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this); + overviewAction = new QAction(SingleColorIcon(":/icons/overview"), tr("&Overview"), this); overviewAction->setStatusTip(tr("Show general overview of wallet")); overviewAction->setToolTip(overviewAction->statusTip()); overviewAction->setCheckable(true); overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); tabGroup->addAction(overviewAction); - sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send"), this); + sendCoinsAction = new QAction(SingleColorIcon(":/icons/send"), tr("&Send"), this); sendCoinsAction->setStatusTip(tr("Send coins to a Bitcoin address")); sendCoinsAction->setToolTip(sendCoinsAction->statusTip()); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(sendCoinsAction); - receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive"), this); + receiveCoinsAction = new QAction(SingleColorIcon(":/icons/receiving_addresses"), tr("&Receive"), this); receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and bitcoin: URIs)")); receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip()); receiveCoinsAction->setCheckable(true); receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); tabGroup->addAction(receiveCoinsAction); - historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this); + historyAction = new QAction(SingleColorIcon(":/icons/history"), tr("&Transactions"), this); historyAction->setStatusTip(tr("Browse transaction history")); historyAction->setToolTip(historyAction->statusTip()); historyAction->setCheckable(true); @@ -283,46 +283,46 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle) connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); #endif // ENABLE_WALLET - quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); + quitAction = new QAction(TextColorIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setStatusTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); - aboutAction = new QAction(QIcon(":/icons/about"), tr("&About Bitcoin Core"), this); + aboutAction = new QAction(TextColorIcon(":/icons/about"), tr("&About Bitcoin Core"), this); aboutAction->setStatusTip(tr("Show information about Bitcoin Core")); aboutAction->setMenuRole(QAction::AboutRole); - aboutQtAction = new QAction(QIcon(":/icons/about_qt"), tr("About &Qt"), this); + aboutQtAction = new QAction(TextColorIcon(":/icons/about_qt"), tr("About &Qt"), this); aboutQtAction->setStatusTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); - optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this); + optionsAction = new QAction(TextColorIcon(":/icons/options"), tr("&Options..."), this); optionsAction->setStatusTip(tr("Modify configuration options for Bitcoin Core")); optionsAction->setMenuRole(QAction::PreferencesRole); - toggleHideAction = new QAction(QIcon(":/icons/about"), tr("&Show / Hide"), this); + toggleHideAction = new QAction(TextColorIcon(":/icons/about"), tr("&Show / Hide"), this); toggleHideAction->setStatusTip(tr("Show or hide the main Window")); - encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this); + encryptWalletAction = new QAction(TextColorIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this); encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet")); encryptWalletAction->setCheckable(true); - backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this); + backupWalletAction = new QAction(TextColorIcon(":/icons/filesave"), tr("&Backup Wallet..."), this); backupWalletAction->setStatusTip(tr("Backup wallet to another location")); - changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this); + changePassphraseAction = new QAction(TextColorIcon(":/icons/key"), tr("&Change Passphrase..."), this); changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption")); - signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this); + signMessageAction = new QAction(TextColorIcon(":/icons/edit"), tr("Sign &message..."), this); signMessageAction->setStatusTip(tr("Sign messages with your Bitcoin addresses to prove you own them")); - verifyMessageAction = new QAction(QIcon(":/icons/verify"), tr("&Verify message..."), this); + verifyMessageAction = new QAction(TextColorIcon(":/icons/verify"), tr("&Verify message..."), this); verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Bitcoin addresses")); - openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this); + openRPCConsoleAction = new QAction(TextColorIcon(":/icons/debugwindow"), tr("&Debug window"), this); openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console")); - usedSendingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Sending addresses..."), this); + usedSendingAddressesAction = new QAction(TextColorIcon(":/icons/address-book"), tr("&Sending addresses..."), this); usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels")); - usedReceivingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Receiving addresses..."), this); + usedReceivingAddressesAction = new QAction(TextColorIcon(":/icons/address-book"), tr("&Receiving addresses..."), this); usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels")); - openAction = new QAction(QIcon(":/icons/open"), tr("Open &URI..."), this); + openAction = new QAction(TextColorIcon(":/icons/open"), tr("Open &URI..."), this); openAction->setStatusTip(tr("Open a bitcoin: URI or payment request")); - showHelpMessageAction = new QAction(QIcon(":/icons/info"), tr("&Command-line options"), this); + showHelpMessageAction = new QAction(TextColorIcon(":/icons/info"), tr("&Command-line options"), this); showHelpMessageAction->setStatusTip(tr("Show the Bitcoin Core help message to get a list with possible Bitcoin command-line options")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); @@ -629,7 +629,7 @@ void BitcoinGUI::setNumConnections(int count) case 7: case 8: case 9: icon = ":/icons/connect_3"; break; default: icon = ":/icons/connect_4"; break; } - labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); + labelConnectionsIcon->setPixmap(SingleColorIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelConnectionsIcon->setToolTip(tr("%n active connection(s) to Bitcoin network", "", count)); } @@ -671,7 +671,7 @@ void BitcoinGUI::setNumBlocks(int count) if(secs < 90*60) { tooltip = tr("Up to date") + QString(".<br>") + tooltip; - labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); + labelBlocksIcon->setPixmap(SingleColorIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); #ifdef ENABLE_WALLET if(walletFrame) @@ -717,7 +717,7 @@ void BitcoinGUI::setNumBlocks(int count) tooltip = tr("Catching up...") + QString("<br>") + tooltip; if(count != prevBlocks) { - labelBlocksIcon->setPixmap(QIcon(QString( + labelBlocksIcon->setPixmap(SingleColorIcon(QString( ":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0'))) .pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES; @@ -911,7 +911,7 @@ void BitcoinGUI::setEncryptionStatus(int status) break; case WalletModel::Unlocked: labelEncryptionIcon->show(); - labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); + labelEncryptionIcon->setPixmap(SingleColorIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>")); encryptWalletAction->setChecked(true); changePassphraseAction->setEnabled(true); @@ -919,7 +919,7 @@ void BitcoinGUI::setEncryptionStatus(int status) break; case WalletModel::Locked: labelEncryptionIcon->show(); - labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); + labelEncryptionIcon->setPixmap(SingleColorIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>")); encryptWalletAction->setChecked(true); changePassphraseAction->setEnabled(true); @@ -1066,7 +1066,7 @@ void UnitDisplayStatusBarControl::setOptionsModel(OptionsModel *optionsModel) /** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */ void UnitDisplayStatusBarControl::updateDisplayUnit(int newUnits) { - setPixmap(QIcon(":/icons/unit_" + BitcoinUnits::id(newUnits)).pixmap(31,STATUSBAR_ICONSIZE)); + setPixmap(SingleColorIcon(":/icons/unit_" + BitcoinUnits::id(newUnits)).pixmap(31,STATUSBAR_ICONSIZE)); } /** Shows context menu with Display Unit options by the mouse coordinates */ diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index e650e0ffa6..60e7d62a7a 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -10,6 +10,7 @@ #include "guiutil.h" #include "init.h" #include "optionsmodel.h" +#include "scicon.h" #include "walletmodel.h" #include "coincontrol.h" @@ -274,7 +275,7 @@ void CoinControlDialog::lockCoin() COutPoint outpt(uint256(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt()); model->lockCoin(outpt); contextMenuItem->setDisabled(true); - contextMenuItem->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed")); + contextMenuItem->setIcon(COLUMN_CHECKBOX, SingleColorIcon(":/icons/lock_closed")); updateLabelLocked(); } @@ -776,7 +777,7 @@ void CoinControlDialog::updateView() COutPoint outpt(txhash, out.i); coinControl->UnSelect(outpt); // just to be sure itemOutput->setDisabled(true); - itemOutput->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed")); + itemOutput->setIcon(COLUMN_CHECKBOX, SingleColorIcon(":/icons/lock_closed")); } // set checkbox diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index fb7ed15594..9f72602b4d 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -6,6 +6,7 @@ #include "ui_intro.h" #include "guiutil.h" +#include "scicon.h" #include "util.h" @@ -167,7 +168,7 @@ void Intro::pickDataDirectory() /* If current default data directory does not exist, let the user choose one */ Intro intro; intro.setDataDirectory(dataDir); - intro.setWindowIcon(QIcon(":icons/bitcoin")); + intro.setWindowIcon(SingleColorIcon(":icons/bitcoin")); while(true) { diff --git a/src/qt/networkstyle.cpp b/src/qt/networkstyle.cpp index 4541c75886..e28f903b2e 100644 --- a/src/qt/networkstyle.cpp +++ b/src/qt/networkstyle.cpp @@ -5,6 +5,7 @@ #include "networkstyle.h" #include "guiconstants.h" +#include "scicon.h" #include <QApplication> diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 01b4036f85..4fa15db9c6 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -10,6 +10,7 @@ #include "guiconstants.h" #include "guiutil.h" #include "optionsmodel.h" +#include "scicon.h" #include "transactionfilterproxy.h" #include "transactiontablemodel.h" #include "walletmodel.h" @@ -34,7 +35,7 @@ public: { painter->save(); - QIcon icon = qvariant_cast<QIcon>(index.data(Qt::DecorationRole)); + QIcon icon = qvariant_cast<QIcon>(index.data(TransactionTableModel::RawDecorationRole)); QRect mainRect = option.rect; QRect decorationRect(mainRect.topLeft(), QSize(DECORATION_SIZE, DECORATION_SIZE)); int xspace = DECORATION_SIZE + 8; @@ -42,6 +43,7 @@ public: int halfheight = (mainRect.height() - 2*ypad)/2; QRect amountRect(mainRect.left() + xspace, mainRect.top()+ypad, mainRect.width() - xspace, halfheight); QRect addressRect(mainRect.left() + xspace, mainRect.top()+ypad+halfheight, mainRect.width() - xspace, halfheight); + icon = SingleColorIcon(icon, SingleColor()); icon.paint(painter, decorationRect); QDateTime date = index.data(TransactionTableModel::DateRole).toDateTime(); diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index aa1440e2c6..28cbd3abed 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -12,6 +12,7 @@ #include "optionsmodel.h" #include "receiverequestdialog.h" #include "recentrequeststablemodel.h" +#include "scicon.h" #include "walletmodel.h" #include <QAction> @@ -33,6 +34,11 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget *parent) : ui->receiveButton->setIcon(QIcon()); ui->showRequestButton->setIcon(QIcon()); ui->removeRequestButton->setIcon(QIcon()); +#else + ui->clearButton->setIcon(SingleColorIcon(":/icons/remove")); + ui->receiveButton->setIcon(SingleColorIcon(":/icons/receiving_addresses")); + ui->showRequestButton->setIcon(SingleColorIcon(":/icons/edit")); + ui->removeRequestButton->setIcon(SingleColorIcon(":/icons/remove")); #endif // context menu actions diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 271315b8c5..a5e3ae2b35 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -8,6 +8,7 @@ #include "clientmodel.h" #include "guiutil.h" #include "peertablemodel.h" +#include "scicon.h" #include "main.h" #include "chainparams.h" @@ -210,8 +211,9 @@ RPCConsole::RPCConsole(QWidget *parent) : GUIUtil::restoreWindowGeometry("nRPCConsoleWindow", this->size(), this); #ifndef Q_OS_MAC - ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export")); + ui->openDebugLogfileButton->setIcon(SingleColorIcon(":/icons/export")); #endif + ui->clearButton->setIcon(SingleColorIcon(":/icons/remove")); // Install event filter for up and down arrow ui->lineEdit->installEventFilter(this); @@ -348,7 +350,7 @@ void RPCConsole::clear() ui->messagesWidget->document()->addResource( QTextDocument::ImageResource, QUrl(ICON_MAPPING[i].url), - QImage(ICON_MAPPING[i].source).scaled(ICON_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); + SingleColorImage(ICON_MAPPING[i].source, SingleColor()).scaled(ICON_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); } // Set default style sheet diff --git a/src/qt/scicon.cpp b/src/qt/scicon.cpp new file mode 100644 index 0000000000..a0ffcd82a9 --- /dev/null +++ b/src/qt/scicon.cpp @@ -0,0 +1,84 @@ +// Copyright (c) 2014 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "scicon.h" + +#include <QApplication> +#include <QColor> +#include <QIcon> +#include <QImage> +#include <QPalette> +#include <QPixmap> + +static 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))); + } + } +} + +QImage SingleColorImage(const QString& filename, const QColor& colorbase) +{ + QImage img(filename); + MakeSingleColorImage(img, colorbase); + return img; +} + +QIcon SingleColorIcon(const QIcon& ico, const QColor& colorbase) +{ + QIcon new_ico; + QSize sz; + Q_FOREACH(sz, ico.availableSizes()) + { + QImage img(ico.pixmap(sz).toImage()); + MakeSingleColorImage(img, colorbase); + new_ico.addPixmap(QPixmap::fromImage(img)); + } + return new_ico; +} + +QIcon SingleColorIcon(const QString& filename, const QColor& colorbase) +{ + return QIcon(QPixmap::fromImage(SingleColorImage(filename, colorbase))); +} + +QColor SingleColor() +{ + 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; + return colorbase; +} + +QIcon SingleColorIcon(const QString& filename) +{ + return SingleColorIcon(filename, SingleColor()); +} + +static QColor TextColor() +{ + return QColor(QApplication::palette().color(QPalette::WindowText)); +} + +QIcon TextColorIcon(const QString& filename) +{ + return SingleColorIcon(filename, TextColor()); +} + +QIcon TextColorIcon(const QIcon& ico) +{ + return SingleColorIcon(ico, TextColor()); +} diff --git a/src/qt/scicon.h b/src/qt/scicon.h new file mode 100644 index 0000000000..1388069ddb --- /dev/null +++ b/src/qt/scicon.h @@ -0,0 +1,24 @@ +// Copyright (c) 2014 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_QT_SCICON_H +#define BITCOIN_QT_SCICON_H + +#include <QtCore> + +QT_BEGIN_NAMESPACE +class QColor; +class QIcon; +class QString; +QT_END_NAMESPACE + +QImage SingleColorImage(const QString& filename, const QColor&); +QIcon SingleColorIcon(const QIcon&, const QColor&); +QIcon SingleColorIcon(const QString& filename, const QColor&); +QColor SingleColor(); +QIcon SingleColorIcon(const QString& filename); +QIcon TextColorIcon(const QIcon&); +QIcon TextColorIcon(const QString& filename); + +#endif // BITCOIN_QT_SCICON_H diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index cde77a5d44..ffee56131d 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -11,6 +11,7 @@ #include "coincontroldialog.h" #include "guiutil.h" #include "optionsmodel.h" +#include "scicon.h" #include "sendcoinsentry.h" #include "walletmodel.h" @@ -38,6 +39,10 @@ SendCoinsDialog::SendCoinsDialog(QWidget *parent) : ui->addButton->setIcon(QIcon()); ui->clearButton->setIcon(QIcon()); ui->sendButton->setIcon(QIcon()); +#else + ui->addButton->setIcon(SingleColorIcon(":/icons/add")); + ui->clearButton->setIcon(SingleColorIcon(":/icons/remove")); + ui->sendButton->setIcon(SingleColorIcon(":/icons/send")); #endif GUIUtil::setupAddressWidget(ui->lineEditCoinControlChange, this); diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index ad9189d20a..6db6eee75b 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -9,6 +9,7 @@ #include "addresstablemodel.h" #include "guiutil.h" #include "optionsmodel.h" +#include "scicon.h" #include "walletmodel.h" #include <QApplication> @@ -21,6 +22,12 @@ SendCoinsEntry::SendCoinsEntry(QWidget *parent) : { ui->setupUi(this); + ui->addressBookButton->setIcon(SingleColorIcon(":/icons/address-book")); + ui->pasteButton->setIcon(SingleColorIcon(":/icons/editpaste")); + ui->deleteButton->setIcon(SingleColorIcon(":/icons/remove")); + ui->deleteButton_is->setIcon(SingleColorIcon(":/icons/remove")); + ui->deleteButton_s->setIcon(SingleColorIcon(":/icons/remove")); + setCurrentWidget(ui->SendCoins); #ifdef Q_OS_MAC diff --git a/src/qt/signverifymessagedialog.cpp b/src/qt/signverifymessagedialog.cpp index e16e245b63..970f6a520d 100644 --- a/src/qt/signverifymessagedialog.cpp +++ b/src/qt/signverifymessagedialog.cpp @@ -7,6 +7,7 @@ #include "addressbookpage.h" #include "guiutil.h" +#include "scicon.h" #include "walletmodel.h" #include "base58.h" @@ -25,6 +26,15 @@ SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) : { ui->setupUi(this); + ui->addressBookButton_SM->setIcon(SingleColorIcon(":/icons/address-book")); + ui->pasteButton_SM->setIcon(SingleColorIcon(":/icons/editpaste")); + ui->copySignatureButton_SM->setIcon(SingleColorIcon(":/icons/editcopy")); + ui->signMessageButton_SM->setIcon(SingleColorIcon(":/icons/edit")); + ui->clearButton_SM->setIcon(SingleColorIcon(":/icons/remove")); + ui->addressBookButton_VM->setIcon(SingleColorIcon(":/icons/address-book")); + ui->verifyMessageButton_VM->setIcon(SingleColorIcon(":/icons/transaction_0")); + ui->clearButton_VM->setIcon(SingleColorIcon(":/icons/remove")); + #if QT_VERSION >= 0x040700 ui->signatureOut_SM->setPlaceholderText(tr("Click \"Sign Message\" to generate signature")); #endif diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 1dea5cdad9..6771e77180 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -8,6 +8,7 @@ #include "guiconstants.h" #include "guiutil.h" #include "optionsmodel.h" +#include "scicon.h" #include "transactiondesc.h" #include "transactionrecord.h" #include "walletmodel.h" @@ -504,7 +505,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const switch(role) { - case Qt::DecorationRole: + case RawDecorationRole: switch(index.column()) { case Status: @@ -515,6 +516,11 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const return txAddressDecoration(rec); } break; + case Qt::DecorationRole: + { + QIcon icon = qvariant_cast<QIcon>(index.data(RawDecorationRole)); + return TextColorIcon(icon); + } case Qt::DisplayRole: switch(index.column()) { diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h index 5eaccad064..30a15df9e6 100644 --- a/src/qt/transactiontablemodel.h +++ b/src/qt/transactiontablemodel.h @@ -64,7 +64,9 @@ public: /** Formatted amount, without brackets when unconfirmed */ FormattedAmountRole, /** Transaction status (TransactionRecord::Status) */ - StatusRole + StatusRole, + /** Unprocessed icon */ + RawDecorationRole, }; int rowCount(const QModelIndex &parent) const; diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 00fd209c9f..526940632e 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -10,6 +10,7 @@ #include "editaddressdialog.h" #include "guiutil.h" #include "optionsmodel.h" +#include "scicon.h" #include "transactiondescdialog.h" #include "transactionfilterproxy.h" #include "transactionrecord.h" @@ -54,8 +55,8 @@ TransactionView::TransactionView(QWidget *parent) : watchOnlyWidget = new QComboBox(this); watchOnlyWidget->setFixedWidth(24); watchOnlyWidget->addItem("", TransactionFilterProxy::WatchOnlyFilter_All); - watchOnlyWidget->addItem(QIcon(":/icons/eye_plus"), "", TransactionFilterProxy::WatchOnlyFilter_Yes); - watchOnlyWidget->addItem(QIcon(":/icons/eye_minus"), "", TransactionFilterProxy::WatchOnlyFilter_No); + watchOnlyWidget->addItem(SingleColorIcon(":/icons/eye_plus"), "", TransactionFilterProxy::WatchOnlyFilter_Yes); + watchOnlyWidget->addItem(SingleColorIcon(":/icons/eye_minus"), "", TransactionFilterProxy::WatchOnlyFilter_No); hlayout->addWidget(watchOnlyWidget); dateWidget = new QComboBox(this); diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 28b9c3b569..9d6a060194 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -12,6 +12,7 @@ #include "optionsmodel.h" #include "overviewpage.h" #include "receivecoinsdialog.h" +#include "scicon.h" #include "sendcoinsdialog.h" #include "signverifymessagedialog.h" #include "transactiontablemodel.h" @@ -44,7 +45,7 @@ WalletView::WalletView(QWidget *parent): QPushButton *exportButton = new QPushButton(tr("&Export"), this); exportButton->setToolTip(tr("Export the data in the current tab to a file")); #ifndef Q_OS_MAC // Icons on push buttons are very uncommon on Mac - exportButton->setIcon(QIcon(":/icons/export")); + exportButton->setIcon(SingleColorIcon(":/icons/export")); #endif hbox_buttons->addStretch(); hbox_buttons->addWidget(exportButton); |