From 0c896542522fce394eb06fb44c89ed6647c168dd Mon Sep 17 00:00:00 2001 From: xdustinface Date: Thu, 18 Jun 2020 11:49:47 +0200 Subject: [PATCH 1/3] qt: Add PlatformStyle::Icon + only show icons on menu if enabled Now icons are disabled everywhere if imagesOnButtons is disabled. There were still buttons on each menu item. --- src/qt/addressbookpage.cpp | 17 ++++------ src/qt/bitcoingui.cpp | 50 +++++++++++++++--------------- src/qt/platformstyle.cpp | 9 ++++++ src/qt/platformstyle.h | 6 ++++ src/qt/receivecoinsdialog.cpp | 15 +++------ src/qt/rpcconsole.cpp | 4 +-- src/qt/sendcoinsdialog.cpp | 12 ++----- src/qt/signverifymessagedialog.cpp | 19 ++++-------- src/qt/walletview.cpp | 4 +-- 9 files changed, 61 insertions(+), 75 deletions(-) diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index 5a5fe1ac3cc9..3432d8419222 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -67,17 +67,12 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, tab(_tab) { ui->setupUi(this); - if (!platformStyle->getImagesOnButtons()) { - ui->newAddress->setIcon(QIcon()); - ui->copyAddress->setIcon(QIcon()); - ui->deleteAddress->setIcon(QIcon()); - ui->exportButton->setIcon(QIcon()); - } else { - ui->newAddress->setIcon(QIcon(":/icons/add")); - ui->copyAddress->setIcon(QIcon(":/icons/editcopy")); - ui->deleteAddress->setIcon(QIcon(":/icons/remove")); - ui->exportButton->setIcon(QIcon(":/icons/export")); - } + + ui->newAddress->setIcon(platformStyle->Icon(":/icons/add")); + ui->copyAddress->setIcon(platformStyle->Icon(":/icons/editcopy")); + ui->deleteAddress->setIcon(platformStyle->Icon(":/icons/remove")); + ui->exportButton->setIcon(platformStyle->Icon(":/icons/export")); + ui->showAddressQRCode->setIcon(QIcon()); switch(mode) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index b872b54fdad4..923660d8a073 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -311,7 +311,7 @@ void BitcoinGUI::createActions() #endif tabGroup->addButton(sendCoinsAction); - sendCoinsMenuAction = new QAction(QIcon(":/icons/send"), sendCoinsAction->text(), this); + sendCoinsMenuAction = new QAction(platformStyle->Icon(":/icons/send"), sendCoinsAction->text(), this); sendCoinsMenuAction->setStatusTip(sendCoinsAction->statusTip()); sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip()); @@ -327,7 +327,7 @@ void BitcoinGUI::createActions() #endif tabGroup->addButton(privateSendCoinsAction); - privateSendCoinsMenuAction = new QAction(QIcon(":/icons/send"), privateSendCoinsAction->text(), this); + privateSendCoinsMenuAction = new QAction(platformStyle->Icon(":/icons/send"), privateSendCoinsAction->text(), this); privateSendCoinsMenuAction->setStatusTip(privateSendCoinsAction->statusTip()); privateSendCoinsMenuAction->setToolTip(privateSendCoinsMenuAction->statusTip()); @@ -343,7 +343,7 @@ void BitcoinGUI::createActions() #endif tabGroup->addButton(receiveCoinsAction); - receiveCoinsMenuAction = new QAction(QIcon(":/icons/receiving_addresses"), receiveCoinsAction->text(), this); + receiveCoinsMenuAction = new QAction(platformStyle->Icon(":/icons/receiving_addresses"), receiveCoinsAction->text(), this); receiveCoinsMenuAction->setStatusTip(receiveCoinsAction->statusTip()); receiveCoinsMenuAction->setToolTip(receiveCoinsMenuAction->statusTip()); @@ -403,54 +403,54 @@ void BitcoinGUI::createActions() connect(tabGroup, SIGNAL(buttonToggled(QAbstractButton *, bool)), this, SLOT(highlightTabButton(QAbstractButton *, bool))); #endif // ENABLE_WALLET - quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); + quitAction = new QAction(platformStyle->Icon(":/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 %1").arg(tr(PACKAGE_NAME)), this); + aboutAction = new QAction(platformStyle->Icon(":/icons/about"), tr("&About %1").arg(tr(PACKAGE_NAME)), this); aboutAction->setStatusTip(tr("Show information about Dash Core")); aboutAction->setMenuRole(QAction::AboutRole); aboutAction->setEnabled(false); - aboutQtAction = new QAction(QIcon(":/icons/about_qt"), tr("About &Qt"), this); + aboutQtAction = new QAction(platformStyle->Icon(":/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(platformStyle->Icon(":/icons/options"), tr("&Options..."), this); optionsAction->setStatusTip(tr("Modify configuration options for %1").arg(tr(PACKAGE_NAME))); optionsAction->setMenuRole(QAction::PreferencesRole); optionsAction->setEnabled(false); - toggleHideAction = new QAction(QIcon(":/icons/about"), tr("&Show / Hide"), this); + toggleHideAction = new QAction(platformStyle->Icon(":/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(platformStyle->Icon(":/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(platformStyle->Icon(":/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(platformStyle->Icon(":/icons/key"), tr("&Change Passphrase..."), this); changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption")); unlockWalletAction = new QAction(tr("&Unlock Wallet..."), this); unlockWalletAction->setToolTip(tr("Unlock wallet")); lockWalletAction = new QAction(tr("&Lock Wallet"), this); - signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this); + signMessageAction = new QAction(platformStyle->Icon(":/icons/edit"), tr("Sign &message..."), this); signMessageAction->setStatusTip(tr("Sign messages with your Dash addresses to prove you own them")); - verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this); + verifyMessageAction = new QAction(platformStyle->Icon(":/icons/transaction_0"), tr("&Verify message..."), this); verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Dash addresses")); - openInfoAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&Information"), this); + openInfoAction = new QAction(platformStyle->Icon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation)), tr("&Information"), this); openInfoAction->setStatusTip(tr("Show diagnostic information")); - openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug console"), this); + openRPCConsoleAction = new QAction(platformStyle->Icon(":/icons/debugwindow"), tr("&Debug console"), this); openRPCConsoleAction->setStatusTip(tr("Open debugging console")); - openGraphAction = new QAction(QIcon(":/icons/connect_4"), tr("&Network Monitor"), this); + openGraphAction = new QAction(platformStyle->Icon(":/icons/connect_4"), tr("&Network Monitor"), this); openGraphAction->setStatusTip(tr("Show network monitor")); - openPeersAction = new QAction(QIcon(":/icons/connect_4"), tr("&Peers list"), this); + openPeersAction = new QAction(platformStyle->Icon(":/icons/connect_4"), tr("&Peers list"), this); openPeersAction->setStatusTip(tr("Show peers info")); - openRepairAction = new QAction(QIcon(":/icons/options"), tr("Wallet &Repair"), this); + openRepairAction = new QAction(platformStyle->Icon(":/icons/options"), tr("Wallet &Repair"), this); openRepairAction->setStatusTip(tr("Show wallet repair options")); - openConfEditorAction = new QAction(QIcon(":/icons/edit"), tr("Open Wallet &Configuration File"), this); + openConfEditorAction = new QAction(platformStyle->Icon(":/icons/edit"), tr("Open Wallet &Configuration File"), this); openConfEditorAction->setStatusTip(tr("Open configuration file")); // override TextHeuristicRole set by default which confuses this action with application settings openConfEditorAction->setMenuRole(QAction::NoRole); - showBackupsAction = new QAction(QIcon(":/icons/browse"), tr("Show Automatic &Backups"), this); + showBackupsAction = new QAction(platformStyle->Icon(":/icons/browse"), tr("Show Automatic &Backups"), this); showBackupsAction->setStatusTip(tr("Show automatically created wallet backups")); // initially disable the debug window menu items openInfoAction->setEnabled(false); @@ -459,19 +459,19 @@ void BitcoinGUI::createActions() openPeersAction->setEnabled(false); openRepairAction->setEnabled(false); - usedSendingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Sending addresses..."), this); + usedSendingAddressesAction = new QAction(platformStyle->Icon(":/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(platformStyle->Icon(":/icons/address-book"), tr("&Receiving addresses..."), this); usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels")); - openAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon), tr("Open &URI..."), this); + openAction = new QAction(platformStyle->Icon(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon)), tr("Open &URI..."), this); openAction->setStatusTip(tr("Open a dash: URI or payment request")); - showHelpMessageAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&Command-line options"), this); + showHelpMessageAction = new QAction(platformStyle->Icon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation)), tr("&Command-line options"), this); showHelpMessageAction->setMenuRole(QAction::NoRole); showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible Dash command-line options").arg(tr(PACKAGE_NAME))); - showPrivateSendHelpAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&PrivateSend information"), this); + showPrivateSendHelpAction = new QAction(platformStyle->Icon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation)), tr("&PrivateSend information"), this); showPrivateSendHelpAction->setMenuRole(QAction::NoRole); showPrivateSendHelpAction->setStatusTip(tr("Show the PrivateSend basic information")); diff --git a/src/qt/platformstyle.cpp b/src/qt/platformstyle.cpp index 810d78805442..500f496c8e2d 100644 --- a/src/qt/platformstyle.cpp +++ b/src/qt/platformstyle.cpp @@ -95,6 +95,15 @@ PlatformStyle::PlatformStyle(const QString &_name, bool _imagesOnButtons, bool _ textColor = QColor(QApplication::palette().color(QPalette::WindowText)); } +QIcon PlatformStyle::Icon(const QIcon &icon) const +{ + return imagesOnButtons ? icon : QIcon(); +} +QIcon PlatformStyle::Icon(const QString &filename) const +{ + return Icon(QIcon(filename)); +} + QImage PlatformStyle::SingleColorImage(const QString& filename) const { if (!colorizeIcons) diff --git a/src/qt/platformstyle.h b/src/qt/platformstyle.h index 4e763e760ea2..3cbd57e957b6 100644 --- a/src/qt/platformstyle.h +++ b/src/qt/platformstyle.h @@ -24,6 +24,12 @@ class PlatformStyle QColor TextColor() const { return textColor; } QColor SingleColor() const { return singleColor; } + /** Return the icon at (given filename) if imagesOnButtons is enabled */ + QIcon Icon(const QString& filename) const; + + /** Return the provided icon or an empty one depending on imagesOnButtons is enabled or not */ + QIcon Icon(const QIcon& icon) const; + /** Colorize an image (given filename) with the icon color */ QImage SingleColorImage(const QString& filename) const; diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index a393e7e19765..48c9f8b27a71 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -34,17 +34,10 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid ui->label_2, ui->label_3}, GUIUtil::FontWeight::Normal, 15); - if (!_platformStyle->getImagesOnButtons()) { - ui->clearButton->setIcon(QIcon()); - ui->receiveButton->setIcon(QIcon()); - ui->showRequestButton->setIcon(QIcon()); - ui->removeRequestButton->setIcon(QIcon()); - } else { - ui->clearButton->setIcon(QIcon(":/icons/remove")); - ui->receiveButton->setIcon(QIcon(":/icons/receiving_addresses")); - ui->showRequestButton->setIcon(QIcon(":/icons/edit")); - ui->removeRequestButton->setIcon(QIcon(":/icons/remove")); - } + ui->clearButton->setIcon(platformStyle->Icon(":/icons/remove")); + ui->receiveButton->setIcon(platformStyle->Icon(":/icons/receiving_addresses")); + ui->showRequestButton->setIcon(platformStyle->Icon(":/icons/edit")); + ui->removeRequestButton->setIcon(platformStyle->Icon(":/icons/remove")); // context menu actions QAction *copyURIAction = new QAction(tr("Copy URI"), this); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 37402e3aa873..591b53f02614 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -480,10 +480,8 @@ RPCConsole::RPCConsole(const PlatformStyle *_platformStyle, QWidget *parent) : } ui->openDebugLogfileButton->setToolTip(ui->openDebugLogfileButton->toolTip().arg(tr(PACKAGE_NAME))); + ui->openDebugLogfileButton->setIcon(platformStyle->Icon(":/icons/export")); - if (platformStyle->getImagesOnButtons()) { - ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export")); - } // Needed on Mac also ui->clearButton->setIcon(QIcon(":/icons/console_remove")); ui->fontBiggerButton->setIcon(QIcon(":/icons/fontbigger")); diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 36316e6abf75..c5060ba98a73 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -84,15 +84,9 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p GUIUtil::setFont({ui->labelCoinControlFeatures }, GUIUtil::FontWeight::Bold, 16); - if (!_platformStyle->getImagesOnButtons()) { - ui->addButton->setIcon(QIcon()); - ui->clearButton->setIcon(QIcon()); - ui->sendButton->setIcon(QIcon()); - } else { - ui->addButton->setIcon(QIcon(":/icons/add")); - ui->clearButton->setIcon(QIcon(":/icons/remove")); - ui->sendButton->setIcon(QIcon(":/icons/send")); - } + ui->addButton->setIcon(platformStyle->Icon(":/icons/add")); + ui->clearButton->setIcon(platformStyle->Icon(":/icons/remove")); + ui->sendButton->setIcon(platformStyle->Icon(":/icons/send")); GUIUtil::setupAddressWidget(ui->lineEditCoinControlChange, this); diff --git a/src/qt/signverifymessagedialog.cpp b/src/qt/signverifymessagedialog.cpp index 512337303569..82b56d1caacd 100644 --- a/src/qt/signverifymessagedialog.cpp +++ b/src/qt/signverifymessagedialog.cpp @@ -35,19 +35,12 @@ SignVerifyMessageDialog::SignVerifyMessageDialog(const PlatformStyle *_platformS ui->signatureOut_SM->setPlaceholderText(tr("Click \"Sign Message\" to generate signature")); -#ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac - ui->signMessageButton_SM->setIcon(QIcon()); - ui->clearButton_SM->setIcon(QIcon()); - ui->verifyMessageButton_VM->setIcon(QIcon()); - ui->clearButton_VM->setIcon(QIcon()); -#else - ui->signMessageButton_SM->setIcon(QIcon(":/icons/edit")); - ui->clearButton_SM->setIcon(QIcon(":/icons/remove")); - ui->verifyMessageButton_VM->setIcon(QIcon(":/icons/transaction_0")); - ui->clearButton_VM->setIcon(QIcon(":/icons/remove")); -#endif - - // These icons are needed on Mac also + ui->signMessageButton_SM->setIcon(platformStyle->Icon(":/icons/edit")); + ui->clearButton_SM->setIcon(platformStyle->Icon(":/icons/remove")); + ui->verifyMessageButton_VM->setIcon(platformStyle->Icon(":/icons/transaction_0")); + ui->clearButton_VM->setIcon(platformStyle->Icon(":/icons/remove")); + + // These icons are needed no matter what platformStyle thinks ui->addressBookButton_SM->setIcon(QIcon(":/icons/address-book")); ui->pasteButton_SM->setIcon(QIcon(":/icons/editpaste")); ui->copySignatureButton_SM->setIcon(QIcon(":/icons/editcopy")); diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 6415198db6df..ebf8d02e2bb4 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -48,9 +48,7 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): vbox->addWidget(transactionView); QPushButton *exportButton = new QPushButton(tr("&Export"), this); exportButton->setToolTip(tr("Export the data in the current tab to a file")); - if (platformStyle->getImagesOnButtons()) { - exportButton->setIcon(QIcon(":/icons/export")); - } + exportButton->setIcon(platformStyle->Icon(":/icons/export")); hbox_buttons->addStretch(); // Sum of selected transactions From 46caa781c2cf139c990ef4b151a898a3d2dfe97f Mon Sep 17 00:00:00 2001 From: xdustinface Date: Sun, 14 Jun 2020 04:25:06 +0200 Subject: [PATCH 2/3] qt: Disable all PlatformStyle related changes --- src/qt/platformstyle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qt/platformstyle.cpp b/src/qt/platformstyle.cpp index 500f496c8e2d..3216e758752a 100644 --- a/src/qt/platformstyle.cpp +++ b/src/qt/platformstyle.cpp @@ -20,10 +20,10 @@ static const struct { /** Extra padding/spacing in transactionview */ const bool useExtraSpacing; } platform_styles[] = { - {"macosx", false, false, true}, - {"windows", true, false, false}, + {"macosx", false, false, false}, + {"windows", false, false, false}, /* Other: linux, unix, ... */ - {"other", true, false, false} + {"other", false, false, false} }; static const unsigned platform_styles_count = sizeof(platform_styles)/sizeof(*platform_styles); From 88c0da0eec5a2d07f52c9a59cf185ecc28ffdc75 Mon Sep 17 00:00:00 2001 From: xdustinface Date: Wed, 22 Jul 2020 02:39:44 +0200 Subject: [PATCH 3/3] qt: Drop PlatformStyle --- src/Makefile.qt.include | 2 - src/qt/addressbookpage.cpp | 8 +- src/qt/addressbookpage.h | 3 +- src/qt/bitcoingui.cpp | 76 +++++++------- src/qt/bitcoingui.h | 7 +- src/qt/coincontroldialog.cpp | 6 +- src/qt/coincontroldialog.h | 5 +- src/qt/dash.cpp | 20 +--- src/qt/masternodelist.cpp | 2 +- src/qt/masternodelist.h | 3 +- src/qt/overviewpage.cpp | 13 +-- src/qt/overviewpage.h | 3 +- src/qt/platformstyle.cpp | 153 ----------------------------- src/qt/platformstyle.h | 61 ------------ src/qt/receivecoinsdialog.cpp | 11 +-- src/qt/receivecoinsdialog.h | 4 +- src/qt/rpcconsole.cpp | 5 +- src/qt/rpcconsole.h | 4 +- src/qt/sendcoinsdialog.cpp | 12 +-- src/qt/sendcoinsdialog.h | 4 +- src/qt/sendcoinsentry.cpp | 11 +-- src/qt/sendcoinsentry.h | 4 +- src/qt/signverifymessagedialog.cpp | 16 +-- src/qt/signverifymessagedialog.h | 4 +- src/qt/test/wallettests.cpp | 12 +-- src/qt/transactiontablemodel.cpp | 14 ++- src/qt/transactiontablemodel.h | 4 +- src/qt/transactionview.cpp | 38 ++----- src/qt/transactionview.h | 3 +- src/qt/walletframe.cpp | 7 +- src/qt/walletframe.h | 5 +- src/qt/walletmodel.cpp | 4 +- src/qt/walletmodel.h | 3 +- src/qt/walletview.cpp | 25 +++-- src/qt/walletview.h | 4 +- 35 files changed, 113 insertions(+), 443 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 b975e8161342..bfc734524818 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -155,7 +155,6 @@ BITCOIN_QT_H = \ qt/paymentrequestplus.h \ qt/paymentserver.h \ qt/peertablemodel.h \ - qt/platformstyle.h \ qt/qrdialog.h \ qt/qvalidatedlineedit.h \ qt/qvaluecombobox.h \ @@ -253,7 +252,6 @@ BITCOIN_QT_BASE_CPP = \ qt/optionsdialog.cpp \ qt/optionsmodel.cpp \ qt/peertablemodel.cpp \ - qt/platformstyle.cpp \ qt/qvalidatedlineedit.cpp \ qt/qvaluecombobox.cpp \ qt/rpcconsole.cpp \ diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index 3432d8419222..e49e77479fc0 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -59,7 +58,7 @@ class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel } }; -AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, Tabs _tab, QWidget *parent) : +AddressBookPage::AddressBookPage(Mode _mode, Tabs _tab, QWidget* parent) : QDialog(parent), ui(new Ui::AddressBookPage), model(0), @@ -68,11 +67,6 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, { ui->setupUi(this); - ui->newAddress->setIcon(platformStyle->Icon(":/icons/add")); - ui->copyAddress->setIcon(platformStyle->Icon(":/icons/editcopy")); - ui->deleteAddress->setIcon(platformStyle->Icon(":/icons/remove")); - ui->exportButton->setIcon(platformStyle->Icon(":/icons/export")); - ui->showAddressQRCode->setIcon(QIcon()); switch(mode) diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h index 699d6f0ff9fe..a8a8242a59a7 100644 --- a/src/qt/addressbookpage.h +++ b/src/qt/addressbookpage.h @@ -9,7 +9,6 @@ class AddressBookSortFilterProxyModel; class AddressTableModel; -class PlatformStyle; namespace Ui { class AddressBookPage; @@ -38,7 +37,7 @@ class AddressBookPage : public QDialog ForEditing /**< Open address book for editing */ }; - explicit AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent); + explicit AddressBookPage(Mode mode, Tabs tab, QWidget* parent); ~AddressBookPage(); void setModel(AddressTableModel *model); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 923660d8a073..835c1ddfb305 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -72,7 +71,7 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM = #endif ; -BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) : +BitcoinGUI::BitcoinGUI(const NetworkStyle* networkStyle, QWidget* parent) : QMainWindow(parent), enableWallet(false), clientModel(0), @@ -122,8 +121,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle * modalOverlay(0), tabGroup(0), prevBlocks(0), - spinnerFrame(0), - platformStyle(_platformStyle) + spinnerFrame(0) { QSettings settings; if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) { @@ -148,13 +146,13 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle * setWindowIcon(networkStyle->getTrayAndWindowIcon()); setWindowTitle(windowTitle); - rpcConsole = new RPCConsole(_platformStyle, this); + rpcConsole = new RPCConsole(this); helpMessageDialog = new HelpMessageDialog(this, HelpMessageDialog::cmdline); #ifdef ENABLE_WALLET if(enableWallet) { /** Create wallet frame*/ - walletFrame = new WalletFrame(_platformStyle, this); + walletFrame = new WalletFrame(this); } else #endif // ENABLE_WALLET { @@ -193,7 +191,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle * QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks); frameBlocksLayout->setContentsMargins(3,0,3,0); frameBlocksLayout->setSpacing(3); - unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle); + unitDisplayControl = new UnitDisplayStatusBarControl(); labelWalletEncryptionIcon = new QLabel(); labelWalletHDStatusIcon = new QLabel(); labelConnectionsIcon = new GUIUtil::ClickableLabel(); @@ -311,7 +309,7 @@ void BitcoinGUI::createActions() #endif tabGroup->addButton(sendCoinsAction); - sendCoinsMenuAction = new QAction(platformStyle->Icon(":/icons/send"), sendCoinsAction->text(), this); + sendCoinsMenuAction = new QAction(sendCoinsAction->text(), this); sendCoinsMenuAction->setStatusTip(sendCoinsAction->statusTip()); sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip()); @@ -327,7 +325,7 @@ void BitcoinGUI::createActions() #endif tabGroup->addButton(privateSendCoinsAction); - privateSendCoinsMenuAction = new QAction(platformStyle->Icon(":/icons/send"), privateSendCoinsAction->text(), this); + privateSendCoinsMenuAction = new QAction(privateSendCoinsAction->text(), this); privateSendCoinsMenuAction->setStatusTip(privateSendCoinsAction->statusTip()); privateSendCoinsMenuAction->setToolTip(privateSendCoinsMenuAction->statusTip()); @@ -343,7 +341,7 @@ void BitcoinGUI::createActions() #endif tabGroup->addButton(receiveCoinsAction); - receiveCoinsMenuAction = new QAction(platformStyle->Icon(":/icons/receiving_addresses"), receiveCoinsAction->text(), this); + receiveCoinsMenuAction = new QAction(receiveCoinsAction->text(), this); receiveCoinsMenuAction->setStatusTip(receiveCoinsAction->statusTip()); receiveCoinsMenuAction->setToolTip(receiveCoinsMenuAction->statusTip()); @@ -403,54 +401,54 @@ void BitcoinGUI::createActions() connect(tabGroup, SIGNAL(buttonToggled(QAbstractButton *, bool)), this, SLOT(highlightTabButton(QAbstractButton *, bool))); #endif // ENABLE_WALLET - quitAction = new QAction(platformStyle->Icon(":/icons/quit"), tr("E&xit"), this); + quitAction = new QAction(tr("E&xit"), this); quitAction->setStatusTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); - aboutAction = new QAction(platformStyle->Icon(":/icons/about"), tr("&About %1").arg(tr(PACKAGE_NAME)), this); + aboutAction = new QAction(tr("&About %1").arg(tr(PACKAGE_NAME)), this); aboutAction->setStatusTip(tr("Show information about Dash Core")); aboutAction->setMenuRole(QAction::AboutRole); aboutAction->setEnabled(false); - aboutQtAction = new QAction(platformStyle->Icon(":/icons/about_qt"), tr("About &Qt"), this); + aboutQtAction = new QAction(tr("About &Qt"), this); aboutQtAction->setStatusTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); - optionsAction = new QAction(platformStyle->Icon(":/icons/options"), tr("&Options..."), this); + optionsAction = new QAction(tr("&Options..."), this); optionsAction->setStatusTip(tr("Modify configuration options for %1").arg(tr(PACKAGE_NAME))); optionsAction->setMenuRole(QAction::PreferencesRole); optionsAction->setEnabled(false); - toggleHideAction = new QAction(platformStyle->Icon(":/icons/about"), tr("&Show / Hide"), this); + toggleHideAction = new QAction(tr("&Show / Hide"), this); toggleHideAction->setStatusTip(tr("Show or hide the main Window")); - encryptWalletAction = new QAction(platformStyle->Icon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this); + encryptWalletAction = new QAction(tr("&Encrypt Wallet..."), this); encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet")); encryptWalletAction->setCheckable(true); - backupWalletAction = new QAction(platformStyle->Icon(":/icons/filesave"), tr("&Backup Wallet..."), this); + backupWalletAction = new QAction(tr("&Backup Wallet..."), this); backupWalletAction->setStatusTip(tr("Backup wallet to another location")); - changePassphraseAction = new QAction(platformStyle->Icon(":/icons/key"), tr("&Change Passphrase..."), this); + changePassphraseAction = new QAction(tr("&Change Passphrase..."), this); changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption")); unlockWalletAction = new QAction(tr("&Unlock Wallet..."), this); unlockWalletAction->setToolTip(tr("Unlock wallet")); lockWalletAction = new QAction(tr("&Lock Wallet"), this); - signMessageAction = new QAction(platformStyle->Icon(":/icons/edit"), tr("Sign &message..."), this); + signMessageAction = new QAction(tr("Sign &message..."), this); signMessageAction->setStatusTip(tr("Sign messages with your Dash addresses to prove you own them")); - verifyMessageAction = new QAction(platformStyle->Icon(":/icons/transaction_0"), tr("&Verify message..."), this); + verifyMessageAction = new QAction(tr("&Verify message..."), this); verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Dash addresses")); - openInfoAction = new QAction(platformStyle->Icon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation)), tr("&Information"), this); + openInfoAction = new QAction(tr("&Information"), this); openInfoAction->setStatusTip(tr("Show diagnostic information")); - openRPCConsoleAction = new QAction(platformStyle->Icon(":/icons/debugwindow"), tr("&Debug console"), this); + openRPCConsoleAction = new QAction(tr("&Debug console"), this); openRPCConsoleAction->setStatusTip(tr("Open debugging console")); - openGraphAction = new QAction(platformStyle->Icon(":/icons/connect_4"), tr("&Network Monitor"), this); + openGraphAction = new QAction(tr("&Network Monitor"), this); openGraphAction->setStatusTip(tr("Show network monitor")); - openPeersAction = new QAction(platformStyle->Icon(":/icons/connect_4"), tr("&Peers list"), this); + openPeersAction = new QAction(tr("&Peers list"), this); openPeersAction->setStatusTip(tr("Show peers info")); - openRepairAction = new QAction(platformStyle->Icon(":/icons/options"), tr("Wallet &Repair"), this); + openRepairAction = new QAction(tr("Wallet &Repair"), this); openRepairAction->setStatusTip(tr("Show wallet repair options")); - openConfEditorAction = new QAction(platformStyle->Icon(":/icons/edit"), tr("Open Wallet &Configuration File"), this); + openConfEditorAction = new QAction(tr("Open Wallet &Configuration File"), this); openConfEditorAction->setStatusTip(tr("Open configuration file")); // override TextHeuristicRole set by default which confuses this action with application settings openConfEditorAction->setMenuRole(QAction::NoRole); - showBackupsAction = new QAction(platformStyle->Icon(":/icons/browse"), tr("Show Automatic &Backups"), this); + showBackupsAction = new QAction(tr("Show Automatic &Backups"), this); showBackupsAction->setStatusTip(tr("Show automatically created wallet backups")); // initially disable the debug window menu items openInfoAction->setEnabled(false); @@ -459,19 +457,19 @@ void BitcoinGUI::createActions() openPeersAction->setEnabled(false); openRepairAction->setEnabled(false); - usedSendingAddressesAction = new QAction(platformStyle->Icon(":/icons/address-book"), tr("&Sending addresses..."), this); + usedSendingAddressesAction = new QAction(tr("&Sending addresses..."), this); usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels")); - usedReceivingAddressesAction = new QAction(platformStyle->Icon(":/icons/address-book"), tr("&Receiving addresses..."), this); + usedReceivingAddressesAction = new QAction(tr("&Receiving addresses..."), this); usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels")); - openAction = new QAction(platformStyle->Icon(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon)), tr("Open &URI..."), this); + openAction = new QAction(tr("Open &URI..."), this); openAction->setStatusTip(tr("Open a dash: URI or payment request")); - showHelpMessageAction = new QAction(platformStyle->Icon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation)), tr("&Command-line options"), this); + showHelpMessageAction = new QAction(tr("&Command-line options"), this); showHelpMessageAction->setMenuRole(QAction::NoRole); showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible Dash command-line options").arg(tr(PACKAGE_NAME))); - showPrivateSendHelpAction = new QAction(platformStyle->Icon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation)), tr("&PrivateSend information"), this); + showPrivateSendHelpAction = new QAction(tr("&PrivateSend information"), this); showPrivateSendHelpAction->setMenuRole(QAction::NoRole); showPrivateSendHelpAction->setStatusTip(tr("Show the PrivateSend basic information")); @@ -697,13 +695,13 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel) } #endif // ENABLE_WALLET unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel()); - + OptionsModel* optionsModel = _clientModel->getOptionsModel(); if(optionsModel) { // be aware of the tray icon disable state change reported by the OptionsModel object. connect(optionsModel,SIGNAL(hideTrayIconChanged(bool)),this,SLOT(setTrayIconVisible(bool))); - + // initialize the disable state of the tray icon with the current value in the model. setTrayIconVisible(optionsModel->getHideTrayIcon()); } @@ -1023,7 +1021,7 @@ void BitcoinGUI::updateNetworkState() icon = ":/icons/network_disabled"; } - labelConnectionsIcon->setPixmap(platformStyle->SingleColorIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); + labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); } void BitcoinGUI::setNumConnections(int count) @@ -1141,7 +1139,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer tooltip = tr("Catching up...") + QString("
") + tooltip; if(count != prevBlocks) { - labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(QString( + labelBlocksIcon->setPixmap(QIcon(QString( ":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0'))) .pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES; @@ -1200,7 +1198,7 @@ void BitcoinGUI::setAdditionalDataSyncProgress(double nSyncProgress) labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); } else { - labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(QString( + labelBlocksIcon->setPixmap(QIcon(QString( ":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0'))) .pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES; @@ -1473,7 +1471,7 @@ bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient) void BitcoinGUI::setHDStatus(int hdEnabled) { - labelWalletHDStatusIcon->setPixmap(platformStyle->SingleColorIcon(hdEnabled ? ":/icons/hd_enabled" : ":/icons/hd_disabled").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); + labelWalletHDStatusIcon->setPixmap(QIcon(hdEnabled ? ":/icons/hd_enabled" : ":/icons/hd_disabled").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); labelWalletHDStatusIcon->setToolTip(hdEnabled ? tr("HD key generation is enabled") : tr("HD key generation is disabled")); // eventually disable the QLabel to set its opacity to 50% @@ -1649,7 +1647,7 @@ void BitcoinGUI::handleRestart(QStringList args) Q_EMIT requestedRestart(args); } -UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) : +UnitDisplayStatusBarControl::UnitDisplayStatusBarControl() : optionsModel(0), menu(0) { diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index f86f1230546f..3ecfb732fea7 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -27,7 +27,6 @@ class ClientModel; class NetworkStyle; class Notificator; class OptionsModel; -class PlatformStyle; class RPCConsole; class SendCoinsRecipient; class UnitDisplayStatusBarControl; @@ -55,7 +54,7 @@ class BitcoinGUI : public QMainWindow public: static const std::string DEFAULT_UIPLATFORM; - explicit BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = 0); + explicit BitcoinGUI(const NetworkStyle* networkStyle, QWidget* parent = 0); ~BitcoinGUI(); /** Set the client model. @@ -151,8 +150,6 @@ class BitcoinGUI : public QMainWindow int prevBlocks; int spinnerFrame; - const PlatformStyle *platformStyle; - struct IncomingTransactionMessage { QString date; int unit; @@ -325,7 +322,7 @@ class UnitDisplayStatusBarControl : public QLabel Q_OBJECT public: - explicit UnitDisplayStatusBarControl(const PlatformStyle *platformStyle); + explicit UnitDisplayStatusBarControl(); /** Lets the control know about the Options Model (and its signals) */ void setOptionsModel(OptionsModel *optionsModel); diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 0779892a584e..c3a4a7a64d02 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -43,11 +42,10 @@ bool CCoinControlWidgetItem::operator<(const QTreeWidgetItem &other) const { return QTreeWidgetItem::operator<(other); } -CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle, QWidget *parent) : +CoinControlDialog::CoinControlDialog(QWidget* parent) : QDialog(parent), ui(new Ui::CoinControlDialog), - model(0), - platformStyle(_platformStyle) + model(0) { ui->setupUi(this); diff --git a/src/qt/coincontroldialog.h b/src/qt/coincontroldialog.h index ca87d97fc4f7..30c3b5bcfbd2 100644 --- a/src/qt/coincontroldialog.h +++ b/src/qt/coincontroldialog.h @@ -16,7 +16,6 @@ #include #include -class PlatformStyle; class WalletModel; class CCoinControl; @@ -43,7 +42,7 @@ class CoinControlDialog : public QDialog Q_OBJECT public: - explicit CoinControlDialog(const PlatformStyle *platformStyle, QWidget *parent = 0); + explicit CoinControlDialog(QWidget* parent = 0); ~CoinControlDialog(); void setModel(WalletModel *model); @@ -67,8 +66,6 @@ class CoinControlDialog : public QDialog QAction *lockAction; QAction *unlockAction; - const PlatformStyle *platformStyle; - void sortView(int, Qt::SortOrder); void updateView(); diff --git a/src/qt/dash.cpp b/src/qt/dash.cpp index 597483d8fb2e..de6a6b6e6fa7 100644 --- a/src/qt/dash.cpp +++ b/src/qt/dash.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -235,7 +234,6 @@ public Q_SLOTS: std::vector m_wallet_models; #endif int returnValue; - const PlatformStyle *platformStyle; std::unique_ptr shutdownWindow; void startThread(); @@ -339,16 +337,6 @@ BitcoinApplication::BitcoinApplication(int &argc, char **argv): returnValue(0) { setQuitOnLastWindowClosed(false); - - // UI per-platform customization - // This must be done inside the BitcoinApplication constructor, or after it, because - // PlatformStyle::instantiate requires a QApplication - std::string platformName; - platformName = gArgs.GetArg("-uiplatform", BitcoinGUI::DEFAULT_UIPLATFORM); - platformStyle = PlatformStyle::instantiate(QString::fromStdString(platformName)); - if (!platformStyle) // Fall back to "other" if specified name not found - platformStyle = PlatformStyle::instantiate("other"); - assert(platformStyle); } BitcoinApplication::~BitcoinApplication() @@ -375,8 +363,6 @@ BitcoinApplication::~BitcoinApplication() } delete optionsModel; optionsModel = 0; - delete platformStyle; - platformStyle = 0; } #ifdef ENABLE_WALLET @@ -393,7 +379,7 @@ void BitcoinApplication::createOptionsModel(bool resetSettings) void BitcoinApplication::createWindow(const NetworkStyle *networkStyle) { - window = new BitcoinGUI(platformStyle, networkStyle, 0); + window = new BitcoinGUI(networkStyle, 0); GUIUtil::loadTheme(window); @@ -483,7 +469,7 @@ void BitcoinApplication::initializeResult(bool success) if(success) { // Log this only after AppInitMain finishes, as then logging setup is guaranteed complete - qWarning() << "Platform customization:" << platformStyle->getName(); + qWarning() << "Platform customization:" << gArgs.GetArg("-uiplatform", BitcoinGUI::DEFAULT_UIPLATFORM).c_str(); #ifdef ENABLE_WALLET PaymentServer::LoadRootCAs(); paymentServer->setOptionsModel(optionsModel); @@ -495,7 +481,7 @@ void BitcoinApplication::initializeResult(bool success) #ifdef ENABLE_WALLET bool fFirstWallet = true; for (CWallet* pwallet : GetWallets()) { - WalletModel * const walletModel = new WalletModel(platformStyle, pwallet, optionsModel); + WalletModel * const walletModel = new WalletModel(pwallet, optionsModel); window->addWallet(walletModel); if (fFirstWallet) { diff --git a/src/qt/masternodelist.cpp b/src/qt/masternodelist.cpp index 4ab9a9fe051c..7ccbaa0721d6 100644 --- a/src/qt/masternodelist.cpp +++ b/src/qt/masternodelist.cpp @@ -29,7 +29,7 @@ int GetOffsetFromUtc() #endif } -MasternodeList::MasternodeList(const PlatformStyle* platformStyle, QWidget* parent) : +MasternodeList::MasternodeList(QWidget* parent) : QWidget(parent), ui(new Ui::MasternodeList), clientModel(0), diff --git a/src/qt/masternodelist.h b/src/qt/masternodelist.h index 83486ac60085..1384b8d99c75 100644 --- a/src/qt/masternodelist.h +++ b/src/qt/masternodelist.h @@ -1,7 +1,6 @@ #ifndef BITCOIN_QT_MASTERNODELIST_H #define BITCOIN_QT_MASTERNODELIST_H -#include #include #include #include @@ -33,7 +32,7 @@ class MasternodeList : public QWidget Q_OBJECT public: - explicit MasternodeList(const PlatformStyle* platformStyle, QWidget* parent = 0); + explicit MasternodeList(QWidget* parent = 0); ~MasternodeList(); void setClientModel(ClientModel* clientModel); diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 53e25962bcb6..654efa1b2c07 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -34,9 +33,8 @@ class TxViewDelegate : public QAbstractItemDelegate { Q_OBJECT public: - explicit TxViewDelegate(const PlatformStyle *_platformStyle, QObject *parent=nullptr): - QAbstractItemDelegate(), unit(BitcoinUnits::DASH), - platformStyle(_platformStyle) + explicit TxViewDelegate(QObject* parent = nullptr) : + QAbstractItemDelegate(), unit(BitcoinUnits::DASH) { } @@ -55,7 +53,7 @@ class TxViewDelegate : public QAbstractItemDelegate int halfheight = (mainRect.height() - 2*ypad)/2; QRect amountRect(mainRect.left() + xspace, mainRect.top()+ypad, mainRect.width() - xspace - ICON_OFFSET, halfheight); QRect addressRect(mainRect.left() + xspace, mainRect.top()+ypad+halfheight, mainRect.width() - xspace, halfheight); - icon = platformStyle->SingleColorIcon(icon); + icon = QIcon(icon); icon.paint(painter, decorationRect); QDateTime date = index.data(TransactionTableModel::DateRole).toDateTime(); @@ -113,12 +111,11 @@ class TxViewDelegate : public QAbstractItemDelegate } int unit; - const PlatformStyle *platformStyle; }; #include -OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) : +OverviewPage::OverviewPage(QWidget* parent) : QWidget(parent), timer(nullptr), ui(new Ui::OverviewPage), @@ -131,7 +128,7 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) currentWatchUnconfBalance(-1), currentWatchImmatureBalance(-1), cachedNumISLocks(-1), - txdelegate(new TxViewDelegate(platformStyle, this)) + txdelegate(new TxViewDelegate(this)) { ui->setupUi(this); diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index ff64edfe501f..38bb2d9f33f1 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -13,7 +13,6 @@ class ClientModel; class TransactionFilterProxy; class TxViewDelegate; -class PlatformStyle; class WalletModel; namespace Ui { @@ -30,7 +29,7 @@ class OverviewPage : public QWidget Q_OBJECT public: - explicit OverviewPage(const PlatformStyle *platformStyle, QWidget *parent = 0); + explicit OverviewPage(QWidget* parent = 0); ~OverviewPage(); void setClientModel(ClientModel *clientModel); diff --git a/src/qt/platformstyle.cpp b/src/qt/platformstyle.cpp deleted file mode 100644 index 3216e758752a..000000000000 --- a/src/qt/platformstyle.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) 2015 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include - -#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, false}, - {"windows", false, false, false}, - /* Other: linux, unix, ... */ - {"other", false, 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)); -} - -QIcon PlatformStyle::Icon(const QIcon &icon) const -{ - return imagesOnButtons ? icon : QIcon(); -} -QIcon PlatformStyle::Icon(const QString &filename) const -{ - return Icon(QIcon(filename)); -} - -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 -#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; } - - /** Return the icon at (given filename) if imagesOnButtons is enabled */ - QIcon Icon(const QString& filename) const; - - /** Return the provided icon or an empty one depending on imagesOnButtons is enabled or not */ - QIcon Icon(const QIcon& icon) const; - - /** 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 - diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 48c9f8b27a71..083ae3c1075d 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -20,12 +19,11 @@ #include #include -ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) : +ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ReceiveCoinsDialog), columnResizingFixer(0), - model(0), - platformStyle(_platformStyle) + model(0) { ui->setupUi(this); @@ -34,11 +32,6 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid ui->label_2, ui->label_3}, GUIUtil::FontWeight::Normal, 15); - ui->clearButton->setIcon(platformStyle->Icon(":/icons/remove")); - ui->receiveButton->setIcon(platformStyle->Icon(":/icons/receiving_addresses")); - ui->showRequestButton->setIcon(platformStyle->Icon(":/icons/edit")); - ui->removeRequestButton->setIcon(platformStyle->Icon(":/icons/remove")); - // context menu actions QAction *copyURIAction = new QAction(tr("Copy URI"), this); QAction *copyLabelAction = new QAction(tr("Copy label"), this); diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h index 44bbb32b69af..b3cbc334628f 100644 --- a/src/qt/receivecoinsdialog.h +++ b/src/qt/receivecoinsdialog.h @@ -15,7 +15,6 @@ #include #include -class PlatformStyle; class WalletModel; namespace Ui { @@ -39,7 +38,7 @@ class ReceiveCoinsDialog : public QDialog MINIMUM_COLUMN_WIDTH = 130 }; - explicit ReceiveCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent = 0); + explicit ReceiveCoinsDialog(QWidget* parent = 0); ~ReceiveCoinsDialog(); void setModel(WalletModel *model); @@ -57,7 +56,6 @@ public Q_SLOTS: GUIUtil::TableViewLastColumnResizingFixer *columnResizingFixer; WalletModel *model; QMenu *contextMenu; - const PlatformStyle *platformStyle; QModelIndex selectedRow(); void copyColumnToClipboard(int column); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 591b53f02614..8b37a391b681 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -12,7 +12,6 @@ #include #include -#include #include #include #include @@ -450,12 +449,11 @@ void RPCExecutor::request(const QString &command, const QString &walletID) } } -RPCConsole::RPCConsole(const PlatformStyle *_platformStyle, QWidget *parent) : +RPCConsole::RPCConsole(QWidget* parent) : QWidget(parent, Qt::Window), ui(new Ui::RPCConsole), clientModel(0), historyPtr(0), - platformStyle(_platformStyle), peersTableContextMenu(0), banTableContextMenu(0), consoleFontSize(0) @@ -480,7 +478,6 @@ RPCConsole::RPCConsole(const PlatformStyle *_platformStyle, QWidget *parent) : } ui->openDebugLogfileButton->setToolTip(ui->openDebugLogfileButton->toolTip().arg(tr(PACKAGE_NAME))); - ui->openDebugLogfileButton->setIcon(platformStyle->Icon(":/icons/export")); // Needed on Mac also ui->clearButton->setIcon(QIcon(":/icons/console_remove")); diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 11a99f86befd..3f7aea19d5d1 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -17,7 +17,6 @@ #include class ClientModel; -class PlatformStyle; class RPCTimerInterface; class WalletModel; @@ -36,7 +35,7 @@ class RPCConsole: public QWidget Q_OBJECT public: - explicit RPCConsole(const PlatformStyle *platformStyle, QWidget *parent); + explicit RPCConsole(QWidget* parent); ~RPCConsole(); static bool RPCParseCommandLine(std::string &strResult, const std::string &strCommand, bool fExecute, std::string * const pstrFilteredOut = nullptr, const std::string *walletID = nullptr); @@ -170,7 +169,6 @@ public Q_SLOTS: int historyPtr; QString cmdBeforeBrowsing; QList cachedNodeids; - const PlatformStyle *platformStyle; RPCTimerInterface *rpcTimerInterface; QMenu *peersTableContextMenu; QMenu *banTableContextMenu; diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index c5060ba98a73..f649bdb736c3 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -52,14 +51,13 @@ int getIndexForConfTarget(int target) { return confTargets.size() - 1; } -SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) : +SendCoinsDialog::SendCoinsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::SendCoinsDialog), clientModel(0), model(0), fNewRecipientAllowed(true), fFeeMinimized(true), - platformStyle(_platformStyle), fPrivateSend(false) { ui->setupUi(this); @@ -84,10 +82,6 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p GUIUtil::setFont({ui->labelCoinControlFeatures }, GUIUtil::FontWeight::Bold, 16); - ui->addButton->setIcon(platformStyle->Icon(":/icons/add")); - ui->clearButton->setIcon(platformStyle->Icon(":/icons/remove")); - ui->sendButton->setIcon(platformStyle->Icon(":/icons/send")); - GUIUtil::setupAddressWidget(ui->lineEditCoinControlChange, this); addEntry(); @@ -503,7 +497,7 @@ void SendCoinsDialog::accept() SendCoinsEntry *SendCoinsDialog::addEntry() { - SendCoinsEntry *entry = new SendCoinsEntry(platformStyle, this); + SendCoinsEntry* entry = new SendCoinsEntry(this); entry->setModel(model); ui->entries->addWidget(entry); connect(entry, SIGNAL(removeEntry(SendCoinsEntry*)), this, SLOT(removeEntry(SendCoinsEntry*))); @@ -896,7 +890,7 @@ void SendCoinsDialog::coinControlFeatureChanged(bool checked) // Coin Control: button inputs -> show actual coin control dialog void SendCoinsDialog::coinControlButtonClicked() { - CoinControlDialog dlg(platformStyle, this); + CoinControlDialog dlg(this); dlg.setModel(model); dlg.exec(); coinControlUpdateLabels(); diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h index 41c28ff8f743..17b667c21294 100644 --- a/src/qt/sendcoinsdialog.h +++ b/src/qt/sendcoinsdialog.h @@ -15,7 +15,6 @@ static const int MAX_SEND_POPUP_ENTRIES = 10; class ClientModel; -class PlatformStyle; class SendCoinsEntry; class SendCoinsRecipient; @@ -33,7 +32,7 @@ class SendCoinsDialog : public QDialog Q_OBJECT public: - explicit SendCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent = 0); + explicit SendCoinsDialog(QWidget* parent = 0); ~SendCoinsDialog(); void setClientModel(ClientModel *clientModel); @@ -67,7 +66,6 @@ public Q_SLOTS: bool fNewRecipientAllowed; void send(QList recipients); bool fFeeMinimized; - const PlatformStyle *platformStyle; bool fPrivateSend; // Process WalletModel::SendCoinsReturn and generate a pair consisting diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 7bb20568917d..3bef035d12b4 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -10,16 +10,14 @@ #include #include #include -#include #include #include -SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *parent) : +SendCoinsEntry::SendCoinsEntry(QWidget* parent) : QStackedWidget(parent), ui(new Ui::SendCoinsEntry), - model(0), - platformStyle(_platformStyle) + model(0) { ui->setupUi(this); @@ -27,11 +25,8 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *par setCurrentWidget(ui->SendCoins); - if (platformStyle->getUseExtraSpacing()) - ui->payToLayout->setSpacing(4); ui->addAsLabel->setPlaceholderText(tr("Enter a label for this address to add it to your address book")); - // These icons are needed on Mac also! ui->addressBookButton->setIcon(QIcon(":/icons/address-book")); ui->pasteButton->setIcon(QIcon(":/icons/editpaste")); ui->deleteButton->setIcon(QIcon(":/icons/remove")); @@ -74,7 +69,7 @@ void SendCoinsEntry::on_addressBookButton_clicked() { if(!model) return; - AddressBookPage dlg(platformStyle, AddressBookPage::ForSelection, AddressBookPage::SendingTab, this); + AddressBookPage dlg(AddressBookPage::ForSelection, AddressBookPage::SendingTab, this); dlg.setModel(model->getAddressTableModel()); if(dlg.exec()) { diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index b470a0d72eb4..2aea38de3aff 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -10,7 +10,6 @@ #include class WalletModel; -class PlatformStyle; namespace Ui { class SendCoinsEntry; @@ -26,7 +25,7 @@ class SendCoinsEntry : public QStackedWidget Q_OBJECT public: - explicit SendCoinsEntry(const PlatformStyle *platformStyle, QWidget *parent = 0); + explicit SendCoinsEntry(QWidget* parent = 0); ~SendCoinsEntry(); void setModel(WalletModel *model); @@ -69,7 +68,6 @@ private Q_SLOTS: SendCoinsRecipient recipient; Ui::SendCoinsEntry *ui; WalletModel *model; - const PlatformStyle *platformStyle; bool updateLabel(const QString &address); }; diff --git a/src/qt/signverifymessagedialog.cpp b/src/qt/signverifymessagedialog.cpp index 82b56d1caacd..5b784a40e4e1 100644 --- a/src/qt/signverifymessagedialog.cpp +++ b/src/qt/signverifymessagedialog.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -21,11 +20,10 @@ #include -SignVerifyMessageDialog::SignVerifyMessageDialog(const PlatformStyle *_platformStyle, QWidget *parent) : +SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget* parent) : QDialog(parent), ui(new Ui::SignVerifyMessageDialog), - model(0), - platformStyle(_platformStyle) + model(0) { ui->setupUi(this); @@ -35,12 +33,6 @@ SignVerifyMessageDialog::SignVerifyMessageDialog(const PlatformStyle *_platformS ui->signatureOut_SM->setPlaceholderText(tr("Click \"Sign Message\" to generate signature")); - ui->signMessageButton_SM->setIcon(platformStyle->Icon(":/icons/edit")); - ui->clearButton_SM->setIcon(platformStyle->Icon(":/icons/remove")); - ui->verifyMessageButton_VM->setIcon(platformStyle->Icon(":/icons/transaction_0")); - ui->clearButton_VM->setIcon(platformStyle->Icon(":/icons/remove")); - - // These icons are needed no matter what platformStyle thinks ui->addressBookButton_SM->setIcon(QIcon(":/icons/address-book")); ui->pasteButton_SM->setIcon(QIcon(":/icons/editpaste")); ui->copySignatureButton_SM->setIcon(QIcon(":/icons/editcopy")); @@ -125,7 +117,7 @@ void SignVerifyMessageDialog::on_addressBookButton_SM_clicked() { if (model && model->getAddressTableModel()) { - AddressBookPage dlg(platformStyle, AddressBookPage::ForSelection, AddressBookPage::ReceivingTab, this); + AddressBookPage dlg(AddressBookPage::ForSelection, AddressBookPage::ReceivingTab, this); dlg.setModel(model->getAddressTableModel()); if (dlg.exec()) { @@ -214,7 +206,7 @@ void SignVerifyMessageDialog::on_addressBookButton_VM_clicked() { if (model && model->getAddressTableModel()) { - AddressBookPage dlg(platformStyle, AddressBookPage::ForSelection, AddressBookPage::SendingTab, this); + AddressBookPage dlg(AddressBookPage::ForSelection, AddressBookPage::SendingTab, this); dlg.setModel(model->getAddressTableModel()); if (dlg.exec()) { diff --git a/src/qt/signverifymessagedialog.h b/src/qt/signverifymessagedialog.h index 0953a3d7d89b..d2b890740b32 100644 --- a/src/qt/signverifymessagedialog.h +++ b/src/qt/signverifymessagedialog.h @@ -8,7 +8,6 @@ #include #include -class PlatformStyle; class WalletModel; namespace Ui { @@ -20,7 +19,7 @@ class SignVerifyMessageDialog : public QDialog Q_OBJECT public: - explicit SignVerifyMessageDialog(const PlatformStyle *platformStyle, QWidget *parent); + explicit SignVerifyMessageDialog(QWidget* parent); ~SignVerifyMessageDialog(); void setModel(WalletModel *model); @@ -36,7 +35,6 @@ class SignVerifyMessageDialog : public QDialog private: Ui::SignVerifyMessageDialog *ui; WalletModel *model; - const PlatformStyle *platformStyle; QButtonGroup pageButtons; private Q_SLOTS: diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index 2e3a537486f1..70bd4d724e07 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -132,11 +131,10 @@ void TestGUI() wallet.SetBroadcastTransactions(true); // Create widgets for sending coins and listing transactions. - std::unique_ptr platformStyle(PlatformStyle::instantiate("other")); - SendCoinsDialog sendCoinsDialog(platformStyle.get()); - TransactionView transactionView(platformStyle.get()); + SendCoinsDialog sendCoinsDialog; + TransactionView transactionView; OptionsModel optionsModel; - WalletModel walletModel(platformStyle.get(), &wallet, &optionsModel); + WalletModel walletModel(&wallet, &optionsModel); sendCoinsDialog.setModel(&walletModel); transactionView.setModel(&walletModel); @@ -150,7 +148,7 @@ void TestGUI() QVERIFY(FindTx(*transactionTableModel, txid2).isValid()); // Check current balance on OverviewPage - OverviewPage overviewPage(platformStyle.get()); + OverviewPage overviewPage; overviewPage.setWalletModel(&walletModel); QLabel* balanceLabel = overviewPage.findChild("labelBalance"); QString balanceText = balanceLabel->text(); @@ -160,7 +158,7 @@ void TestGUI() QCOMPARE(balanceText, balanceComparison); // Check Request Payment button - ReceiveCoinsDialog receiveCoinsDialog(platformStyle.get()); + ReceiveCoinsDialog receiveCoinsDialog; receiveCoinsDialog.setModel(&walletModel); RecentRequestsTableModel* requestTableModel = walletModel.getRecentRequestsTableModel(); diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 386a0037ff34..fe03b13077ae 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -251,13 +250,12 @@ class TransactionTablePriv } }; -TransactionTableModel::TransactionTableModel(const PlatformStyle *_platformStyle, CWallet* _wallet, WalletModel *parent): - QAbstractTableModel(parent), - wallet(_wallet), - walletModel(parent), - priv(new TransactionTablePriv(_wallet, this)), - fProcessingQueuedTransactions(false), - platformStyle(_platformStyle) +TransactionTableModel::TransactionTableModel(CWallet* _wallet, WalletModel* parent) : + QAbstractTableModel(parent), + wallet(_wallet), + walletModel(parent), + priv(new TransactionTablePriv(_wallet, this)), + fProcessingQueuedTransactions(false) { columns << QString() << QString() << QString() << tr("Date") << tr("Type") << tr("Address / Label") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit()); priv->refreshWallet(); diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h index dd4da03c86a2..d1ce4a4920de 100644 --- a/src/qt/transactiontablemodel.h +++ b/src/qt/transactiontablemodel.h @@ -10,7 +10,6 @@ #include #include -class PlatformStyle; class TransactionRecord; class TransactionTablePriv; class WalletModel; @@ -24,7 +23,7 @@ class TransactionTableModel : public QAbstractTableModel Q_OBJECT public: - explicit TransactionTableModel(const PlatformStyle *platformStyle, CWallet* wallet, WalletModel *parent = 0); + explicit TransactionTableModel(CWallet* wallet, WalletModel* parent = 0); ~TransactionTableModel(); enum ColumnIndex { @@ -94,7 +93,6 @@ class TransactionTableModel : public QAbstractTableModel QStringList columns; TransactionTablePriv *priv; bool fProcessingQueuedTransactions; - const PlatformStyle *platformStyle; int cachedChainLockHeight; void subscribeToCoreSignals(); diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 3ef3f3935173..fe4189c3414d 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -42,7 +41,7 @@ /** Date format for persistence */ static const char* PERSISTENCE_DATE_FORMAT = "yyyy-MM-dd"; -TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *parent) : +TransactionView::TransactionView(QWidget* parent) : QWidget(parent), model(0), transactionProxyModel(0), transactionView(0), abandonAction(0), columnResizingFixer(0) { @@ -52,13 +51,9 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa QHBoxLayout *hlayout = new QHBoxLayout(); hlayout->setContentsMargins(0,0,0,0); - if (platformStyle->getUseExtraSpacing()) { - hlayout->setSpacing(0); - hlayout->addSpacing(STATUS_COLUMN_WIDTH - 1); - } else { - hlayout->setSpacing(1); - hlayout->addSpacing(STATUS_COLUMN_WIDTH - 2); - } + hlayout->setSpacing(1); + hlayout->addSpacing(STATUS_COLUMN_WIDTH - 2); + watchOnlyWidget = new QComboBox(this); watchOnlyWidget->setFixedWidth(24); watchOnlyWidget->addItem("", TransactionFilterProxy::WatchOnlyFilter_All); @@ -75,11 +70,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa hlayout->addWidget(instantsendWidget); dateWidget = new QComboBox(this); - if (platformStyle->getUseExtraSpacing()) { - dateWidget->setFixedWidth(120); - } else { - dateWidget->setFixedWidth(120); - } + dateWidget->setFixedWidth(120); dateWidget->addItem(tr("All"), All); dateWidget->addItem(tr("Today"), Today); dateWidget->addItem(tr("This week"), ThisWeek); @@ -91,12 +82,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa hlayout->addWidget(dateWidget); typeWidget = new QComboBox(this); - if (platformStyle->getUseExtraSpacing()) { - typeWidget->setFixedWidth(TYPE_COLUMN_WIDTH); - } else { - typeWidget->setFixedWidth(TYPE_COLUMN_WIDTH-1); - } - + typeWidget->setFixedWidth(TYPE_COLUMN_WIDTH - 1); typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES); typeWidget->addItem(tr("Most Common"), TransactionFilterProxy::COMMON_TYPES); typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) | @@ -122,11 +108,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa amountWidget = new QLineEdit(this); amountWidget->setPlaceholderText(tr("Min amount")); - if (platformStyle->getUseExtraSpacing()) { - amountWidget->setFixedWidth(118); - } else { - amountWidget->setFixedWidth(125); - } + amountWidget->setFixedWidth(125); amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this)); amountWidget->setObjectName("amountWidget"); hlayout->addWidget(amountWidget); @@ -154,11 +136,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa #ifndef Q_OS_MAC int width = view->verticalScrollBar()->sizeHint().width(); // Cover scroll bar width with spacing - if (platformStyle->getUseExtraSpacing()) { - hlayout->addSpacing(width+2); - } else { - hlayout->addSpacing(width); - } + hlayout->addSpacing(width); // Always show scroll bar view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); #endif diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h index 5d4833b24213..465ba14b6f72 100644 --- a/src/qt/transactionview.h +++ b/src/qt/transactionview.h @@ -12,7 +12,6 @@ #include #include -class PlatformStyle; class TransactionFilterProxy; class WalletModel; @@ -36,7 +35,7 @@ class TransactionView : public QWidget Q_OBJECT public: - explicit TransactionView(const PlatformStyle *platformStyle, QWidget *parent = 0); + explicit TransactionView(QWidget* parent = 0); void setModel(WalletModel *model); diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index 0b3806608014..6d4b4c9f85f4 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -14,10 +14,9 @@ #include #include -WalletFrame::WalletFrame(const PlatformStyle *_platformStyle, BitcoinGUI *_gui) : +WalletFrame::WalletFrame(BitcoinGUI* _gui) : QFrame(_gui), - gui(_gui), - platformStyle(_platformStyle) + gui(_gui) { // Leave HBox hook for adding a list view later QHBoxLayout *walletFrameLayout = new QHBoxLayout(this); @@ -51,7 +50,7 @@ bool WalletFrame::addWallet(WalletModel *walletModel) return false; } - WalletView *walletView = new WalletView(platformStyle, this); + WalletView* walletView = new WalletView(this); walletView->setBitcoinGUI(gui); walletView->setClientModel(clientModel); walletView->setWalletModel(walletModel); diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h index 78aff0f166c5..d814fbbe8e94 100644 --- a/src/qt/walletframe.h +++ b/src/qt/walletframe.h @@ -10,7 +10,6 @@ class BitcoinGUI; class ClientModel; -class PlatformStyle; class SendCoinsRecipient; class WalletModel; class WalletView; @@ -31,7 +30,7 @@ class WalletFrame : public QFrame Q_OBJECT public: - explicit WalletFrame(const PlatformStyle *platformStyle, BitcoinGUI *_gui = 0); + explicit WalletFrame(BitcoinGUI* _gui = 0); ~WalletFrame(); void setClientModel(ClientModel *clientModel); @@ -57,8 +56,6 @@ class WalletFrame : public QFrame bool bOutOfSync; - const PlatformStyle *platformStyle; - public: WalletView *currentWalletView(); diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 61d03c10cf57..b2f330dcf8f9 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -36,7 +36,7 @@ #include -WalletModel::WalletModel(const PlatformStyle *platformStyle, CWallet *_wallet, OptionsModel *_optionsModel, QObject *parent) : +WalletModel::WalletModel(CWallet* _wallet, OptionsModel* _optionsModel, QObject* parent) : QObject(parent), wallet(_wallet), optionsModel(_optionsModel), addressTableModel(0), transactionTableModel(0), recentRequestsTableModel(0), @@ -52,7 +52,7 @@ WalletModel::WalletModel(const PlatformStyle *platformStyle, CWallet *_wallet, O fForceCheckBalanceChanged = false; addressTableModel = new AddressTableModel(wallet, this); - transactionTableModel = new TransactionTableModel(platformStyle, wallet, this); + transactionTableModel = new TransactionTableModel(wallet, this); recentRequestsTableModel = new RecentRequestsTableModel(wallet, this); // This timer will be fired repeatedly to update the balance diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 518f0a4cf75b..f18814d20e70 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -20,7 +20,6 @@ class AddressTableModel; class OptionsModel; -class PlatformStyle; class RecentRequestsTableModel; class TransactionTableModel; class WalletModelTransaction; @@ -103,7 +102,7 @@ class WalletModel : public QObject Q_OBJECT public: - explicit WalletModel(const PlatformStyle *platformStyle, CWallet *wallet, OptionsModel *optionsModel, QObject *parent = 0); + explicit WalletModel(CWallet* wallet, OptionsModel* optionsModel, QObject* parent = 0); ~WalletModel(); enum StatusCode // Returned by sendCoins diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index ebf8d02e2bb4..3062bd27b937 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -32,23 +31,21 @@ #include #include -WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): +WalletView::WalletView(QWidget* parent) : QStackedWidget(parent), clientModel(0), - walletModel(0), - platformStyle(_platformStyle) + walletModel(0) { // Create tabs - overviewPage = new OverviewPage(platformStyle); + overviewPage = new OverviewPage(); transactionsPage = new QWidget(this); QVBoxLayout *vbox = new QVBoxLayout(); QHBoxLayout *hbox_buttons = new QHBoxLayout(); - transactionView = new TransactionView(platformStyle, this); + transactionView = new TransactionView(this); vbox->addWidget(transactionView); QPushButton *exportButton = new QPushButton(tr("&Export"), this); exportButton->setToolTip(tr("Export the data in the current tab to a file")); - exportButton->setIcon(platformStyle->Icon(":/icons/export")); hbox_buttons->addStretch(); // Sum of selected transactions @@ -72,11 +69,11 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): vbox->addLayout(hbox_buttons); transactionsPage->setLayout(vbox); - receiveCoinsPage = new ReceiveCoinsDialog(platformStyle); - sendCoinsPage = new SendCoinsDialog(platformStyle); + receiveCoinsPage = new ReceiveCoinsDialog(); + sendCoinsPage = new SendCoinsDialog(); - usedSendingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::SendingTab, this); - usedReceivingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this); + usedSendingAddressesPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab, this); + usedReceivingAddressesPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this); addWidget(overviewPage); addWidget(transactionsPage); @@ -85,7 +82,7 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): QSettings settings; if (settings.value("fShowMasternodesTab").toBool()) { - masternodeListPage = new MasternodeList(platformStyle); + masternodeListPage = new MasternodeList(); addWidget(masternodeListPage); } @@ -268,7 +265,7 @@ void WalletView::gotoPrivateSendCoinsPage(QString addr) void WalletView::gotoSignMessageTab(QString addr) { // calls show() in showTab_SM() - SignVerifyMessageDialog *signVerifyMessageDialog = new SignVerifyMessageDialog(platformStyle, this); + SignVerifyMessageDialog* signVerifyMessageDialog = new SignVerifyMessageDialog(this); signVerifyMessageDialog->setAttribute(Qt::WA_DeleteOnClose); signVerifyMessageDialog->setModel(walletModel); signVerifyMessageDialog->showTab_SM(true); @@ -280,7 +277,7 @@ void WalletView::gotoSignMessageTab(QString addr) void WalletView::gotoVerifyMessageTab(QString addr) { // calls show() in showTab_VM() - SignVerifyMessageDialog *signVerifyMessageDialog = new SignVerifyMessageDialog(platformStyle, this); + SignVerifyMessageDialog* signVerifyMessageDialog = new SignVerifyMessageDialog(this); signVerifyMessageDialog->setAttribute(Qt::WA_DeleteOnClose); signVerifyMessageDialog->setModel(walletModel); signVerifyMessageDialog->showTab_VM(true); diff --git a/src/qt/walletview.h b/src/qt/walletview.h index b40a186d9dfb..9cf04a7cb428 100644 --- a/src/qt/walletview.h +++ b/src/qt/walletview.h @@ -13,7 +13,6 @@ class BitcoinGUI; class ClientModel; class OverviewPage; -class PlatformStyle; class ReceiveCoinsDialog; class SendCoinsDialog; class SendCoinsRecipient; @@ -38,7 +37,7 @@ class WalletView : public QStackedWidget Q_OBJECT public: - explicit WalletView(const PlatformStyle *platformStyle, QWidget *parent); + explicit WalletView(QWidget* parent); ~WalletView(); void setBitcoinGUI(BitcoinGUI *gui); @@ -73,7 +72,6 @@ class WalletView : public QStackedWidget QProgressDialog *progressDialog; QLabel *transactionSum; - const PlatformStyle *platformStyle; public Q_SLOTS: /** Switch to overview (home) page */