From d121954c46313ac33ab4ea8661d5a1b737c53913 Mon Sep 17 00:00:00 2001 From: zathrasc Date: Thu, 25 May 2017 17:22:29 +1000 Subject: [PATCH] Use platformStyle to color the Send page icons & also to hide the icons on OSX --- src/qt/sendmpdialog.cpp | 21 +++++++++++++++------ src/qt/sendmpdialog.h | 3 ++- src/qt/walletview.cpp | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/qt/sendmpdialog.cpp b/src/qt/sendmpdialog.cpp index c70f645c57b26..55ae574237f0f 100644 --- a/src/qt/sendmpdialog.cpp +++ b/src/qt/sendmpdialog.cpp @@ -10,6 +10,8 @@ #include "clientmodel.h" #include "walletmodel.h" +#include "platformstyle.h" + #include "omnicore/createpayload.h" #include "omnicore/errors.h" #include "omnicore/omnicore.h" @@ -45,18 +47,25 @@ using std::string; using namespace mastercore; -SendMPDialog::SendMPDialog(QWidget *parent) : +SendMPDialog::SendMPDialog(const PlatformStyle *platformStyle, QWidget *parent) : QDialog(parent), ui(new Ui::SendMPDialog), clientModel(0), - walletModel(0) + walletModel(0), + platformStyle(platformStyle) { ui->setupUi(this); -#ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac - ui->clearButton->setIcon(QIcon()); - ui->sendButton->setIcon(QIcon()); -#endif + // Use platformStyle instead of ifdef Q_OS_MAC to hide icons on Mac + if (!platformStyle->getImagesOnButtons()) { + ui->clearButton->setIcon(QIcon()); + ui->sendButton->setIcon(QIcon()); + } else { + // Use platformStyle to color the icons to match the rest of the UI + ui->clearButton->setIcon(platformStyle->SingleColorIcon(":/icons/remove")); + ui->sendButton->setIcon(platformStyle->SingleColorIcon(":/icons/send")); + } + #if QT_VERSION >= 0x040700 // populate placeholder text ui->sendToLineEdit->setPlaceholderText("Enter an Omni Layer address (e.g. 1oMn1LaYeRADDreSShef77z6A5S4P)"); ui->amountLineEdit->setPlaceholderText("Enter Amount"); diff --git a/src/qt/sendmpdialog.h b/src/qt/sendmpdialog.h index e84c9cc373c95..01693cae016db 100644 --- a/src/qt/sendmpdialog.h +++ b/src/qt/sendmpdialog.h @@ -26,7 +26,7 @@ class SendMPDialog : public QDialog Q_OBJECT public: - explicit SendMPDialog(QWidget *parent = 0); + explicit SendMPDialog(const PlatformStyle *platformStyle, QWidget *parent = 0); ~SendMPDialog(); void setClientModel(ClientModel *model); @@ -49,6 +49,7 @@ public Q_SLOTS: Ui::SendMPDialog *ui; ClientModel *clientModel; WalletModel *walletModel; + const PlatformStyle *platformStyle; Q_SIGNALS: // Fired when a message should be reported to the user diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index f9d5dbd05ce08..bb7abcc214c07 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -86,7 +86,7 @@ WalletView::WalletView(const PlatformStyle *platformStyle, QWidget *parent): sendCoinsPage = new QWidget(this); QVBoxLayout *svbox = new QVBoxLayout(); sendCoinsTab = new SendCoinsDialog(platformStyle); - sendMPTab = new SendMPDialog(); + sendMPTab = new SendMPDialog(platformStyle); sendTabHolder = new QTabWidget(); sendTabHolder->addTab(sendMPTab,tr("Omni Layer")); sendTabHolder->addTab(sendCoinsTab,tr("Bitcoin"));