diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index ef76c7aa7a6c..7e67ea6c4f3b 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -55,6 +56,7 @@ #include #include #include +#include #include #include @@ -118,6 +120,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle * rpcConsole(0), helpMessageDialog(0), modalOverlay(0), + tabGroup(0), prevBlocks(0), spinnerFrame(0), platformStyle(_platformStyle) @@ -279,13 +282,15 @@ BitcoinGUI::~BitcoinGUI() #endif delete rpcConsole; + delete tabGroup; } void BitcoinGUI::createActions() { - QActionGroup *tabGroup = new QActionGroup(this); + tabGroup = new QButtonGroup(this); - overviewAction = new QAction(tr("&Overview"), this); + overviewAction = new QToolButton(this); + overviewAction->setText(tr("&Overview")); overviewAction->setStatusTip(tr("Show general overview of wallet")); overviewAction->setToolTip(overviewAction->statusTip()); overviewAction->setCheckable(true); @@ -294,9 +299,10 @@ void BitcoinGUI::createActions() #else overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); #endif - tabGroup->addAction(overviewAction); + tabGroup->addButton(overviewAction); - sendCoinsAction = new QAction(tr("&Send"), this); + sendCoinsAction = new QToolButton(this); + sendCoinsAction->setText(tr("&Send")); sendCoinsAction->setStatusTip(tr("Send coins to a Dash address")); sendCoinsAction->setToolTip(sendCoinsAction->statusTip()); sendCoinsAction->setCheckable(true); @@ -305,13 +311,14 @@ void BitcoinGUI::createActions() #else sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); #endif - tabGroup->addAction(sendCoinsAction); + tabGroup->addButton(sendCoinsAction); sendCoinsMenuAction = new QAction(QIcon(":/icons/send"), sendCoinsAction->text(), this); sendCoinsMenuAction->setStatusTip(sendCoinsAction->statusTip()); sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip()); - privateSendCoinsAction = new QAction(tr("&PrivateSend"), this); + privateSendCoinsAction = new QToolButton(this); + privateSendCoinsAction->setText(tr("&PrivateSend")); privateSendCoinsAction->setStatusTip(tr("PrivateSend coins to a Dash address")); privateSendCoinsAction->setToolTip(privateSendCoinsAction->statusTip()); privateSendCoinsAction->setCheckable(true); @@ -320,13 +327,14 @@ void BitcoinGUI::createActions() #else privateSendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); #endif - tabGroup->addAction(privateSendCoinsAction); + tabGroup->addButton(privateSendCoinsAction); privateSendCoinsMenuAction = new QAction(QIcon(":/icons/send"), privateSendCoinsAction->text(), this); privateSendCoinsMenuAction->setStatusTip(privateSendCoinsAction->statusTip()); privateSendCoinsMenuAction->setToolTip(privateSendCoinsMenuAction->statusTip()); - receiveCoinsAction = new QAction(tr("&Receive"), this); + receiveCoinsAction = new QToolButton(this); + receiveCoinsAction->setText(tr("&Receive")); receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and dash: URIs)")); receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip()); receiveCoinsAction->setCheckable(true); @@ -335,13 +343,14 @@ void BitcoinGUI::createActions() #else receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); #endif - tabGroup->addAction(receiveCoinsAction); + tabGroup->addButton(receiveCoinsAction); receiveCoinsMenuAction = new QAction(QIcon(":/icons/receiving_addresses"), receiveCoinsAction->text(), this); receiveCoinsMenuAction->setStatusTip(receiveCoinsAction->statusTip()); receiveCoinsMenuAction->setToolTip(receiveCoinsMenuAction->statusTip()); - historyAction = new QAction(tr("&Transactions"), this); + historyAction = new QToolButton(this); + historyAction->setText(tr("&Transactions")); historyAction->setStatusTip(tr("Browse transaction history")); historyAction->setToolTip(historyAction->statusTip()); historyAction->setCheckable(true); @@ -350,12 +359,13 @@ void BitcoinGUI::createActions() #else historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5)); #endif - tabGroup->addAction(historyAction); + tabGroup->addButton(historyAction); #ifdef ENABLE_WALLET QSettings settings; if (settings.value("fShowMasternodesTab").toBool()) { - masternodeAction = new QAction(tr("&Masternodes"), this); + masternodeAction = new QToolButton(this); + masternodeAction->setText(tr("&Masternodes")); masternodeAction->setStatusTip(tr("Browse masternodes")); masternodeAction->setToolTip(masternodeAction->statusTip()); masternodeAction->setCheckable(true); @@ -364,29 +374,32 @@ void BitcoinGUI::createActions() #else masternodeAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6)); #endif - tabGroup->addAction(masternodeAction); - connect(masternodeAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(masternodeAction, SIGNAL(triggered()), this, SLOT(gotoMasternodePage())); + tabGroup->addButton(masternodeAction); + connect(masternodeAction, SIGNAL(clicked()), this, SLOT(showNormalIfMinimized())); + connect(masternodeAction, SIGNAL(clicked()), this, SLOT(gotoMasternodePage())); } // These showNormalIfMinimized are needed because Send Coins and Receive Coins // can be triggered from the tray menu, and need to show the GUI to be useful. - connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); - connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); + connect(overviewAction, SIGNAL(clicked()), this, SLOT(showNormalIfMinimized())); + connect(overviewAction, SIGNAL(clicked()), this, SLOT(gotoOverviewPage())); + connect(sendCoinsAction, SIGNAL(clicked()), this, SLOT(showNormalIfMinimized())); + connect(sendCoinsAction, SIGNAL(clicked()), this, SLOT(gotoSendCoinsPage())); connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); - connect(privateSendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(privateSendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoPrivateSendCoinsPage())); + connect(privateSendCoinsAction, SIGNAL(clicked()), this, SLOT(showNormalIfMinimized())); + connect(privateSendCoinsAction, SIGNAL(clicked()), this, SLOT(gotoPrivateSendCoinsPage())); connect(privateSendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(privateSendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoPrivateSendCoinsPage())); - connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); + connect(receiveCoinsAction, SIGNAL(clicked()), this, SLOT(showNormalIfMinimized())); + connect(receiveCoinsAction, SIGNAL(clicked()), this, SLOT(gotoReceiveCoinsPage())); connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); - connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); + connect(historyAction, SIGNAL(clicked()), this, SLOT(showNormalIfMinimized())); + connect(historyAction, SIGNAL(clicked()), this, SLOT(gotoHistoryPage())); + + // Give the selected tab button a bolder font. + connect(tabGroup, SIGNAL(buttonToggled(QAbstractButton *, bool)), this, SLOT(highlightTabButton(QAbstractButton *, bool))); #endif // ENABLE_WALLET quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); @@ -575,32 +588,33 @@ void BitcoinGUI::createToolBars() { QToolBar *toolbar = new QToolBar(tr("Tabs toolbar")); toolbar->setContextMenuPolicy(Qt::PreventContextMenu); - toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - toolbar->addAction(overviewAction); - toolbar->addAction(sendCoinsAction); - toolbar->addAction(privateSendCoinsAction); - toolbar->addAction(receiveCoinsAction); - toolbar->addAction(historyAction); + toolbar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + toolbar->setToolButtonStyle(Qt::ToolButtonTextOnly); + + overviewAction->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + sendCoinsAction->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + privateSendCoinsAction->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + receiveCoinsAction->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + historyAction->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + + toolbar->addWidget(overviewAction); + toolbar->addWidget(sendCoinsAction); + toolbar->addWidget(privateSendCoinsAction); + toolbar->addWidget(receiveCoinsAction); + toolbar->addWidget(historyAction); + QSettings settings; if (settings.value("fShowMasternodesTab").toBool() && masternodeAction) { - toolbar->addAction(masternodeAction); + masternodeAction->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + toolbar->addWidget(masternodeAction); } toolbar->setMovable(false); // remove unused icon in upper left corner overviewAction->setChecked(true); - // Add Dash logo on the right side - QWidget* spacer = new QWidget(); - spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - toolbar->addWidget(spacer); - QLabel *logoLabel = new QLabel(); - QString logoImage = ":/images/dash_logo_toolbar"; - if (!GUIUtil::dashThemeActive()) { - logoImage = ":/images/dash_logo_toolbar_blue"; - } + logoLabel->setObjectName("lblToolbarLogo"); + logoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - QPixmap logoPixmap(logoImage); - logoLabel->setPixmap(logoPixmap); toolbar->addWidget(logoLabel); /** Create additional container for toolbar and walletFrame and make it the central widget. @@ -909,6 +923,13 @@ void BitcoinGUI::openClicked() } } +void BitcoinGUI::highlightTabButton(QAbstractButton *button, bool checked) +{ + QFont font = button->font(); + font.setBold(checked); + button->setFont(font); +} + void BitcoinGUI::gotoOverviewPage() { overviewAction->setChecked(true); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index e927210773ff..4083cf6a654d 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -40,6 +40,7 @@ QT_BEGIN_NAMESPACE class QAction; class QProgressBar; class QProgressDialog; +class QToolButton; QT_END_NAMESPACE /** @@ -95,20 +96,20 @@ class BitcoinGUI : public QMainWindow QProgressDialog *progressDialog; QMenuBar *appMenuBar; - QAction *overviewAction; - QAction *historyAction; - QAction *masternodeAction; + QToolButton *overviewAction; + QToolButton *historyAction; + QToolButton *masternodeAction; QAction *quitAction; - QAction *sendCoinsAction; + QToolButton *sendCoinsAction; QAction *sendCoinsMenuAction; - QAction *privateSendCoinsAction; + QToolButton *privateSendCoinsAction; QAction *privateSendCoinsMenuAction; QAction *usedSendingAddressesAction; QAction *usedReceivingAddressesAction; QAction *signMessageAction; QAction *verifyMessageAction; QAction *aboutAction; - QAction *receiveCoinsAction; + QToolButton *receiveCoinsAction; QAction *receiveCoinsMenuAction; QAction *optionsAction; QAction *toggleHideAction; @@ -136,6 +137,7 @@ class BitcoinGUI : public QMainWindow RPCConsole *rpcConsole; HelpMessageDialog *helpMessageDialog; ModalOverlay *modalOverlay; + QButtonGroup *tabGroup; #ifdef Q_OS_MAC CAppNapInhibitor* m_app_nap_inhibitor = nullptr; @@ -251,6 +253,9 @@ private Q_SLOTS: /** Show open dialog */ void openClicked(); + + /** Highlight checked tab button */ + void highlightTabButton(QAbstractButton *button, bool checked); #endif // ENABLE_WALLET /** Show configuration dialog */ void optionsClicked(); diff --git a/src/qt/res/css/dark.css b/src/qt/res/css/dark.css index 2769c999f27f..724d874b0265 100644 --- a/src/qt/res/css/dark.css +++ b/src/qt/res/css/dark.css @@ -295,7 +295,10 @@ QTextEdit { QToolBar / QToolButton ******************************************************/ -/***** No dark.css specific coloring here yet *****/ +QToolBar > QToolButton:checked { + background-color: #444; + color: #ccc; +} /****************************************************** QTreeWidget diff --git a/src/qt/res/css/general.css b/src/qt/res/css/general.css index ca68b0fe1caa..96492f481634 100644 --- a/src/qt/res/css/general.css +++ b/src/qt/res/css/general.css @@ -626,35 +626,41 @@ QToolBar / QToolButton QToolBar { background-color: #008de4; - border: 0; + border: none; + width: 100%; padding: 0; margin: 0; + spacing: 0; + min-height: 50px; + max-height: 50px; } QToolBar > QToolButton { - background-color: #008de4; - border: 0; - font-size: 14px; - min-width: 70px; - min-height: 48%; - max-height: 48%; - padding: 0 10px; - margin: 0; - color: #f5f5f5; + background-color: transparent; + border: none; + min-height: 50px; + max-height: 50px; + font-size: 16px; + letter-spacing: 3px; + color: #ffffff; + width: 100%; + padding: 1px; + text-align: center; } -QToolBar > QToolButton:checked { - border: 0; - font-weight: bold; +QToolBar > QToolButton:hover:!checked { + background-color: #005e98; + color: #DCDCDC; } QToolBar > QToolButton:disabled { color: #444; } -QToolBar > QLabel { - border: 0; - margin: 10px 0 0 0; +QToolBar QLabel#lblToolbarLogo { + padding: 12px; + image: url(':/images/dash_logo_toolbar'); + height: 2.5em; } /****************************************************** diff --git a/src/qt/res/css/light.css b/src/qt/res/css/light.css index 882d68f1b98c..b8e62b15c46f 100644 --- a/src/qt/res/css/light.css +++ b/src/qt/res/css/light.css @@ -291,7 +291,10 @@ QTextEdit { QToolBar / QToolButton ******************************************************/ -/***** No light.css specific coloring here yet *****/ +QToolBar > QToolButton:checked { + background-color: #f6f6f6; + color: #333333; +} /****************************************************** QTreeWidget diff --git a/src/qt/res/css/trad.css b/src/qt/res/css/trad.css index 49c8152e072c..23d618ff5013 100644 --- a/src/qt/res/css/trad.css +++ b/src/qt/res/css/trad.css @@ -25,6 +25,16 @@ Loaded in GUIUtil::loadStyleSheet() in guitil.cpp. */ +/****************************************************** +QToolBar / QToolButton +******************************************************/ + +QToolBar QLabel#lblToolbarLogo { + padding: 12px; + image: url(':/images/dash_logo_toolbar_blue'); + height: 2.5em; +} + /****************************************************** ModalOverlay ******************************************************/ diff --git a/src/qt/res/images/dash_logo_toolbar.png b/src/qt/res/images/dash_logo_toolbar.png index 2f58e83e7072..46322307b75c 100644 Binary files a/src/qt/res/images/dash_logo_toolbar.png and b/src/qt/res/images/dash_logo_toolbar.png differ diff --git a/src/qt/res/images/dash_logo_toolbar_blue.png b/src/qt/res/images/dash_logo_toolbar_blue.png index 2f7234beb139..3c932d1d69ce 100644 Binary files a/src/qt/res/images/dash_logo_toolbar_blue.png and b/src/qt/res/images/dash_logo_toolbar_blue.png differ