Skip to content

Commit 63355db

Browse files
authored
qt: Drop PlatformStyle (#3573)
* 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. * qt: Disable all PlatformStyle related changes * qt: Drop PlatformStyle
1 parent b3be0ba commit 63355db

35 files changed

+114
-458
lines changed

src/Makefile.qt.include

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ BITCOIN_QT_H = \
158158
qt/paymentrequestplus.h \
159159
qt/paymentserver.h \
160160
qt/peertablemodel.h \
161-
qt/platformstyle.h \
162161
qt/qrdialog.h \
163162
qt/qvalidatedlineedit.h \
164163
qt/qvaluecombobox.h \
@@ -257,7 +256,6 @@ BITCOIN_QT_BASE_CPP = \
257256
qt/optionsdialog.cpp \
258257
qt/optionsmodel.cpp \
259258
qt/peertablemodel.cpp \
260-
qt/platformstyle.cpp \
261259
qt/qvalidatedlineedit.cpp \
262260
qt/qvaluecombobox.cpp \
263261
qt/rpcconsole.cpp \

src/qt/addressbookpage.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <qt/editaddressdialog.h>
1717
#include <qt/guiutil.h>
1818
#include <qt/optionsmodel.h>
19-
#include <qt/platformstyle.h>
2019
#include <qt/qrdialog.h>
2120

2221
#include <QIcon>
@@ -59,25 +58,15 @@ class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
5958
}
6059
};
6160

62-
AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, Tabs _tab, QWidget *parent) :
61+
AddressBookPage::AddressBookPage(Mode _mode, Tabs _tab, QWidget* parent) :
6362
QDialog(parent),
6463
ui(new Ui::AddressBookPage),
6564
model(0),
6665
mode(_mode),
6766
tab(_tab)
6867
{
6968
ui->setupUi(this);
70-
if (!platformStyle->getImagesOnButtons()) {
71-
ui->newAddress->setIcon(QIcon());
72-
ui->copyAddress->setIcon(QIcon());
73-
ui->deleteAddress->setIcon(QIcon());
74-
ui->exportButton->setIcon(QIcon());
75-
} else {
76-
ui->newAddress->setIcon(QIcon(":/icons/add"));
77-
ui->copyAddress->setIcon(QIcon(":/icons/editcopy"));
78-
ui->deleteAddress->setIcon(QIcon(":/icons/remove"));
79-
ui->exportButton->setIcon(QIcon(":/icons/export"));
80-
}
69+
8170
ui->showAddressQRCode->setIcon(QIcon());
8271

8372
switch(mode)

src/qt/addressbookpage.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
class AddressBookSortFilterProxyModel;
1111
class AddressTableModel;
12-
class PlatformStyle;
1312

1413
namespace Ui {
1514
class AddressBookPage;
@@ -38,7 +37,7 @@ class AddressBookPage : public QDialog
3837
ForEditing /**< Open address book for editing */
3938
};
4039

41-
explicit AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent);
40+
explicit AddressBookPage(Mode mode, Tabs tab, QWidget* parent);
4241
~AddressBookPage();
4342

4443
void setModel(AddressTableModel *model);

src/qt/bitcoingui.cpp

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <qt/openuridialog.h>
1616
#include <qt/optionsdialog.h>
1717
#include <qt/optionsmodel.h>
18-
#include <qt/platformstyle.h>
1918
#include <qt/rpcconsole.h>
2019
#include <qt/utilitydialog.h>
2120

@@ -72,7 +71,7 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
7271
#endif
7372
;
7473

75-
BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
74+
BitcoinGUI::BitcoinGUI(const NetworkStyle* networkStyle, QWidget* parent) :
7675
QMainWindow(parent),
7776
enableWallet(false),
7877
clientModel(0),
@@ -122,8 +121,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
122121
modalOverlay(0),
123122
tabGroup(0),
124123
prevBlocks(0),
125-
spinnerFrame(0),
126-
platformStyle(_platformStyle)
124+
spinnerFrame(0)
127125
{
128126
QSettings settings;
129127
if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) {
@@ -148,13 +146,13 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
148146
setWindowIcon(networkStyle->getTrayAndWindowIcon());
149147
setWindowTitle(windowTitle);
150148

151-
rpcConsole = new RPCConsole(_platformStyle, this);
149+
rpcConsole = new RPCConsole(this);
152150
helpMessageDialog = new HelpMessageDialog(this, HelpMessageDialog::cmdline);
153151
#ifdef ENABLE_WALLET
154152
if(enableWallet)
155153
{
156154
/** Create wallet frame*/
157-
walletFrame = new WalletFrame(_platformStyle, this);
155+
walletFrame = new WalletFrame(this);
158156
} else
159157
#endif // ENABLE_WALLET
160158
{
@@ -193,7 +191,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
193191
QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
194192
frameBlocksLayout->setContentsMargins(3,0,3,0);
195193
frameBlocksLayout->setSpacing(3);
196-
unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle);
194+
unitDisplayControl = new UnitDisplayStatusBarControl();
197195
labelWalletEncryptionIcon = new QLabel();
198196
labelWalletHDStatusIcon = new QLabel();
199197
labelConnectionsIcon = new GUIUtil::ClickableLabel();
@@ -311,7 +309,7 @@ void BitcoinGUI::createActions()
311309
#endif
312310
tabGroup->addButton(sendCoinsAction);
313311

314-
sendCoinsMenuAction = new QAction(QIcon(":/icons/send"), sendCoinsAction->text(), this);
312+
sendCoinsMenuAction = new QAction(sendCoinsAction->text(), this);
315313
sendCoinsMenuAction->setStatusTip(sendCoinsAction->statusTip());
316314
sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip());
317315

@@ -327,7 +325,7 @@ void BitcoinGUI::createActions()
327325
#endif
328326
tabGroup->addButton(privateSendCoinsAction);
329327

330-
privateSendCoinsMenuAction = new QAction(QIcon(":/icons/send"), privateSendCoinsAction->text(), this);
328+
privateSendCoinsMenuAction = new QAction(privateSendCoinsAction->text(), this);
331329
privateSendCoinsMenuAction->setStatusTip(privateSendCoinsAction->statusTip());
332330
privateSendCoinsMenuAction->setToolTip(privateSendCoinsMenuAction->statusTip());
333331

@@ -343,7 +341,7 @@ void BitcoinGUI::createActions()
343341
#endif
344342
tabGroup->addButton(receiveCoinsAction);
345343

346-
receiveCoinsMenuAction = new QAction(QIcon(":/icons/receiving_addresses"), receiveCoinsAction->text(), this);
344+
receiveCoinsMenuAction = new QAction(receiveCoinsAction->text(), this);
347345
receiveCoinsMenuAction->setStatusTip(receiveCoinsAction->statusTip());
348346
receiveCoinsMenuAction->setToolTip(receiveCoinsMenuAction->statusTip());
349347

@@ -403,54 +401,54 @@ void BitcoinGUI::createActions()
403401
connect(tabGroup, SIGNAL(buttonToggled(QAbstractButton *, bool)), this, SLOT(highlightTabButton(QAbstractButton *, bool)));
404402
#endif // ENABLE_WALLET
405403

406-
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
404+
quitAction = new QAction(tr("E&xit"), this);
407405
quitAction->setStatusTip(tr("Quit application"));
408406
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
409407
quitAction->setMenuRole(QAction::QuitRole);
410-
aboutAction = new QAction(QIcon(":/icons/about"), tr("&About %1").arg(tr(PACKAGE_NAME)), this);
408+
aboutAction = new QAction(tr("&About %1").arg(tr(PACKAGE_NAME)), this);
411409
aboutAction->setStatusTip(tr("Show information about Dash Core"));
412410
aboutAction->setMenuRole(QAction::AboutRole);
413411
aboutAction->setEnabled(false);
414-
aboutQtAction = new QAction(QIcon(":/icons/about_qt"), tr("About &Qt"), this);
412+
aboutQtAction = new QAction(tr("About &Qt"), this);
415413
aboutQtAction->setStatusTip(tr("Show information about Qt"));
416414
aboutQtAction->setMenuRole(QAction::AboutQtRole);
417-
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
415+
optionsAction = new QAction(tr("&Options..."), this);
418416
optionsAction->setStatusTip(tr("Modify configuration options for %1").arg(tr(PACKAGE_NAME)));
419417
optionsAction->setMenuRole(QAction::PreferencesRole);
420418
optionsAction->setEnabled(false);
421-
toggleHideAction = new QAction(QIcon(":/icons/about"), tr("&Show / Hide"), this);
419+
toggleHideAction = new QAction(tr("&Show / Hide"), this);
422420
toggleHideAction->setStatusTip(tr("Show or hide the main Window"));
423421

424-
encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
422+
encryptWalletAction = new QAction(tr("&Encrypt Wallet..."), this);
425423
encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet"));
426424
encryptWalletAction->setCheckable(true);
427-
backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this);
425+
backupWalletAction = new QAction(tr("&Backup Wallet..."), this);
428426
backupWalletAction->setStatusTip(tr("Backup wallet to another location"));
429-
changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this);
427+
changePassphraseAction = new QAction(tr("&Change Passphrase..."), this);
430428
changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption"));
431429
unlockWalletAction = new QAction(tr("&Unlock Wallet..."), this);
432430
unlockWalletAction->setToolTip(tr("Unlock wallet"));
433431
lockWalletAction = new QAction(tr("&Lock Wallet"), this);
434-
signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this);
432+
signMessageAction = new QAction(tr("Sign &message..."), this);
435433
signMessageAction->setStatusTip(tr("Sign messages with your Dash addresses to prove you own them"));
436-
verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this);
434+
verifyMessageAction = new QAction(tr("&Verify message..."), this);
437435
verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Dash addresses"));
438436

439-
openInfoAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&Information"), this);
437+
openInfoAction = new QAction(tr("&Information"), this);
440438
openInfoAction->setStatusTip(tr("Show diagnostic information"));
441-
openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug console"), this);
439+
openRPCConsoleAction = new QAction(tr("&Debug console"), this);
442440
openRPCConsoleAction->setStatusTip(tr("Open debugging console"));
443-
openGraphAction = new QAction(QIcon(":/icons/connect_4"), tr("&Network Monitor"), this);
441+
openGraphAction = new QAction(tr("&Network Monitor"), this);
444442
openGraphAction->setStatusTip(tr("Show network monitor"));
445-
openPeersAction = new QAction(QIcon(":/icons/connect_4"), tr("&Peers list"), this);
443+
openPeersAction = new QAction(tr("&Peers list"), this);
446444
openPeersAction->setStatusTip(tr("Show peers info"));
447-
openRepairAction = new QAction(QIcon(":/icons/options"), tr("Wallet &Repair"), this);
445+
openRepairAction = new QAction(tr("Wallet &Repair"), this);
448446
openRepairAction->setStatusTip(tr("Show wallet repair options"));
449-
openConfEditorAction = new QAction(QIcon(":/icons/edit"), tr("Open Wallet &Configuration File"), this);
447+
openConfEditorAction = new QAction(tr("Open Wallet &Configuration File"), this);
450448
openConfEditorAction->setStatusTip(tr("Open configuration file"));
451449
// override TextHeuristicRole set by default which confuses this action with application settings
452450
openConfEditorAction->setMenuRole(QAction::NoRole);
453-
showBackupsAction = new QAction(QIcon(":/icons/browse"), tr("Show Automatic &Backups"), this);
451+
showBackupsAction = new QAction(tr("Show Automatic &Backups"), this);
454452
showBackupsAction->setStatusTip(tr("Show automatically created wallet backups"));
455453
// initially disable the debug window menu items
456454
openInfoAction->setEnabled(false);
@@ -459,19 +457,19 @@ void BitcoinGUI::createActions()
459457
openPeersAction->setEnabled(false);
460458
openRepairAction->setEnabled(false);
461459

462-
usedSendingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Sending addresses..."), this);
460+
usedSendingAddressesAction = new QAction(tr("&Sending addresses..."), this);
463461
usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels"));
464-
usedReceivingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Receiving addresses..."), this);
462+
usedReceivingAddressesAction = new QAction(tr("&Receiving addresses..."), this);
465463
usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels"));
466464

467-
openAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon), tr("Open &URI..."), this);
465+
openAction = new QAction(tr("Open &URI..."), this);
468466
openAction->setStatusTip(tr("Open a dash: URI or payment request"));
469467

470-
showHelpMessageAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&Command-line options"), this);
468+
showHelpMessageAction = new QAction(tr("&Command-line options"), this);
471469
showHelpMessageAction->setMenuRole(QAction::NoRole);
472470
showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible Dash command-line options").arg(tr(PACKAGE_NAME)));
473471

474-
showPrivateSendHelpAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&PrivateSend information"), this);
472+
showPrivateSendHelpAction = new QAction(tr("&PrivateSend information"), this);
475473
showPrivateSendHelpAction->setMenuRole(QAction::NoRole);
476474
showPrivateSendHelpAction->setStatusTip(tr("Show the PrivateSend basic information"));
477475

@@ -697,13 +695,13 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
697695
}
698696
#endif // ENABLE_WALLET
699697
unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel());
700-
698+
701699
OptionsModel* optionsModel = _clientModel->getOptionsModel();
702700
if(optionsModel)
703701
{
704702
// be aware of the tray icon disable state change reported by the OptionsModel object.
705703
connect(optionsModel,SIGNAL(hideTrayIconChanged(bool)),this,SLOT(setTrayIconVisible(bool)));
706-
704+
707705
// initialize the disable state of the tray icon with the current value in the model.
708706
setTrayIconVisible(optionsModel->getHideTrayIcon());
709707
}
@@ -1022,7 +1020,7 @@ void BitcoinGUI::updateNetworkState()
10221020
icon = ":/icons/network_disabled";
10231021
}
10241022

1025-
labelConnectionsIcon->setPixmap(platformStyle->SingleColorIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
1023+
labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
10261024
}
10271025

10281026
void BitcoinGUI::setNumConnections(int count)
@@ -1140,7 +1138,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
11401138
tooltip = tr("Catching up...") + QString("<br>") + tooltip;
11411139
if(count != prevBlocks)
11421140
{
1143-
labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(QString(
1141+
labelBlocksIcon->setPixmap(QIcon(QString(
11441142
":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0')))
11451143
.pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
11461144
spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES;
@@ -1199,7 +1197,7 @@ void BitcoinGUI::setAdditionalDataSyncProgress(double nSyncProgress)
11991197
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
12001198
} else {
12011199

1202-
labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(QString(
1200+
labelBlocksIcon->setPixmap(QIcon(QString(
12031201
":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0')))
12041202
.pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
12051203
spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES;
@@ -1472,7 +1470,7 @@ bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient)
14721470

14731471
void BitcoinGUI::setHDStatus(int hdEnabled)
14741472
{
1475-
labelWalletHDStatusIcon->setPixmap(platformStyle->SingleColorIcon(hdEnabled ? ":/icons/hd_enabled" : ":/icons/hd_disabled").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
1473+
labelWalletHDStatusIcon->setPixmap(QIcon(hdEnabled ? ":/icons/hd_enabled" : ":/icons/hd_disabled").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
14761474
labelWalletHDStatusIcon->setToolTip(hdEnabled ? tr("HD key generation is <b>enabled</b>") : tr("HD key generation is <b>disabled</b>"));
14771475

14781476
// eventually disable the QLabel to set its opacity to 50%
@@ -1648,7 +1646,7 @@ void BitcoinGUI::handleRestart(QStringList args)
16481646
Q_EMIT requestedRestart(args);
16491647
}
16501648

1651-
UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) :
1649+
UnitDisplayStatusBarControl::UnitDisplayStatusBarControl() :
16521650
optionsModel(0),
16531651
menu(0)
16541652
{

src/qt/bitcoingui.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class ClientModel;
2727
class NetworkStyle;
2828
class Notificator;
2929
class OptionsModel;
30-
class PlatformStyle;
3130
class RPCConsole;
3231
class SendCoinsRecipient;
3332
class UnitDisplayStatusBarControl;
@@ -55,7 +54,7 @@ class BitcoinGUI : public QMainWindow
5554
public:
5655
static const std::string DEFAULT_UIPLATFORM;
5756

58-
explicit BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = 0);
57+
explicit BitcoinGUI(const NetworkStyle* networkStyle, QWidget* parent = 0);
5958
~BitcoinGUI();
6059

6160
/** Set the client model.
@@ -151,8 +150,6 @@ class BitcoinGUI : public QMainWindow
151150
int prevBlocks;
152151
int spinnerFrame;
153152

154-
const PlatformStyle *platformStyle;
155-
156153
struct IncomingTransactionMessage {
157154
QString date;
158155
int unit;
@@ -325,7 +322,7 @@ class UnitDisplayStatusBarControl : public QLabel
325322
Q_OBJECT
326323

327324
public:
328-
explicit UnitDisplayStatusBarControl(const PlatformStyle *platformStyle);
325+
explicit UnitDisplayStatusBarControl();
329326
/** Lets the control know about the Options Model (and its signals) */
330327
void setOptionsModel(OptionsModel *optionsModel);
331328

src/qt/coincontroldialog.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <qt/bitcoinunits.h>
1111
#include <qt/guiutil.h>
1212
#include <qt/optionsmodel.h>
13-
#include <qt/platformstyle.h>
1413
#include <txmempool.h>
1514
#include <qt/walletmodel.h>
1615

@@ -43,11 +42,10 @@ bool CCoinControlWidgetItem::operator<(const QTreeWidgetItem &other) const {
4342
return QTreeWidgetItem::operator<(other);
4443
}
4544

46-
CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
45+
CoinControlDialog::CoinControlDialog(QWidget* parent) :
4746
QDialog(parent),
4847
ui(new Ui::CoinControlDialog),
49-
model(0),
50-
platformStyle(_platformStyle)
48+
model(0)
5149
{
5250
ui->setupUi(this);
5351

src/qt/coincontroldialog.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <QString>
1717
#include <QTreeWidgetItem>
1818

19-
class PlatformStyle;
2019
class WalletModel;
2120

2221
class CCoinControl;
@@ -43,7 +42,7 @@ class CoinControlDialog : public QDialog
4342
Q_OBJECT
4443

4544
public:
46-
explicit CoinControlDialog(const PlatformStyle *platformStyle, QWidget *parent = 0);
45+
explicit CoinControlDialog(QWidget* parent = 0);
4746
~CoinControlDialog();
4847

4948
void setModel(WalletModel *model);
@@ -67,8 +66,6 @@ class CoinControlDialog : public QDialog
6766
QAction *lockAction;
6867
QAction *unlockAction;
6968

70-
const PlatformStyle *platformStyle;
71-
7269
void sortView(int, Qt::SortOrder);
7370
void updateView();
7471

0 commit comments

Comments
 (0)