@@ -206,23 +206,15 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
206206
207207 signVerifyMessageDialog = new SignVerifyMessageDialog (this );
208208
209- QVBoxLayout *centralVbox = new QVBoxLayout (this );
210- centralVbox->setContentsMargins (0 , 0 , 0 , 0 );
211- centralVbox->setSpacing (0 );
212- centralVbox->addWidget (appMenuBar);
213-
214209 centralWidget = new QStackedWidget (this );
215210 centralWidget->addWidget (overviewPage);
216211 centralWidget->addWidget (transactionsPage);
217212 centralWidget->addWidget (addressBookPage);
218213 centralWidget->addWidget (receiveCoinsPage);
219214 centralWidget->addWidget (sendCoinsPage);
220215 centralWidget->addWidget (votingPage);
221- centralVbox->addWidget (centralWidget);
222216
223- QWidget* centralWidgetWrapper = new QWidget (this );
224- centralWidgetWrapper->setLayout (centralVbox);
225- setCentralWidget (centralWidgetWrapper);
217+ setCentralWidget (centralWidget);
226218
227219 // Create status bar
228220 statusBar ();
@@ -532,13 +524,15 @@ void BitcoinGUI::createMenuBar()
532524#ifdef Q_OS_MAC
533525 // Create a decoupled menu bar on Mac which stays even if the window is closed
534526 appMenuBar = new QMenuBar ();
527+ QMenu *file = appMenuBar->addMenu (tr (" &File" ));
535528#else
536- // Get the main window's menu bar on other platforms
537- appMenuBar = menuBar ();
529+ // Windows and Linux: collapse the main application's menu bar into a menu
530+ // button. On macOS, we'll continue to use the system's separate menu bar.
531+ appMenuBar = new QMenu ();
532+ QMenu *file = appMenuBar;
538533#endif
539534
540535 // Configure the menus
541- QMenu *file = appMenuBar->addMenu (tr (" &File" ));
542536 file->addAction (backupWalletAction);
543537 file->addAction (exportAction);
544538 file->addAction (signMessageAction);
@@ -553,7 +547,9 @@ void BitcoinGUI::createMenuBar()
553547 file->addAction (resetblockchainAction);
554548
555549 file->addSeparator ();
550+ #ifdef Q_OS_MAC
556551 file->addAction (quitAction);
552+ #endif
557553
558554 QMenu *settings = appMenuBar->addMenu (tr (" &Settings" ));
559555 settings->addAction (encryptWalletAction);
@@ -581,20 +577,64 @@ void BitcoinGUI::createMenuBar()
581577 help->addAction (diagnosticsAction);
582578 help->addSeparator ();
583579 help->addAction (aboutAction);
580+
581+ #ifndef Q_OS_MAC
582+ file->addSeparator ();
583+ file->addAction (quitAction);
584+ #endif
584585}
585586
586587void BitcoinGUI::createToolBars ()
587588{
588589 ClickLabel *logoLabel = new ClickLabel ();
589590 logoLabel->setObjectName (" toolbarLogoLabel" );
591+ QSizePolicy logoLabelSizePolicy = logoLabel->sizePolicy ();
592+ logoLabelSizePolicy.setHorizontalStretch (2 );
593+ logoLabel->setSizePolicy (logoLabelSizePolicy);
590594 connect (logoLabel, SIGNAL (clicked ()), this , SLOT (websiteClicked ()));
591595
596+ QHBoxLayout *logoWrapperLayout = new QHBoxLayout ();
597+ logoWrapperLayout->setContentsMargins (2 , 0 , 2 , 0 );
598+ logoWrapperLayout->setSpacing (0 );
599+
600+ QWidget *logoWrapper = new QWidget ();
601+ logoWrapper->setObjectName (" toolbarLogoWrapper" );
602+ logoWrapper->setLayout (logoWrapperLayout);
603+
604+ #ifndef Q_OS_MAC
605+ // Windows and Linux: collapse the main application's menu bar into a menu
606+ // button. On macOS, we'll continue to use the system's separate menu bar.
607+ QPushButton *menuButton = new QPushButton ();
608+ menuButton->setObjectName (" toolbarMenuButton" );
609+ menuButton->setToolTip (tr (" Open menu." ));
610+ menuButton->setMenu (appMenuBar);
611+ QSizePolicy menuButtonSizePolicy = menuButton->sizePolicy ();
612+ menuButtonSizePolicy.setHorizontalStretch (1 );
613+ menuButton->setSizePolicy (menuButtonSizePolicy);
614+ logoWrapperLayout->addWidget (menuButton);
615+ logoWrapperLayout->setAlignment (menuButton, Qt::AlignHCenter | Qt::AlignVCenter);
616+ #else
617+ logoWrapperLayout->addStretch (1 );
618+ #endif
619+
620+ logoWrapperLayout->addWidget (logoLabel);
621+
622+ QPushButton *themeToggleButton = new QPushButton ();
623+ themeToggleButton->setObjectName (" themeToggleButton" );
624+ themeToggleButton->setToolTip (tr (" Toggle light/dark mode." ));
625+ QSizePolicy themeToggleButtonSizePolicy = themeToggleButton->sizePolicy ();
626+ themeToggleButtonSizePolicy.setHorizontalStretch (1 );
627+ themeToggleButton->setSizePolicy (themeToggleButtonSizePolicy);
628+ connect (themeToggleButton, SIGNAL (clicked ()), this , SLOT (themeToggled ()));
629+ logoWrapperLayout->addWidget (themeToggleButton);
630+ logoWrapperLayout->setAlignment (themeToggleButton, Qt::AlignHCenter | Qt::AlignVCenter);
631+
592632 QWidget *boincLabelSpacer = new QWidget ();
593633 boincLabelSpacer->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
594634
595635 ClickLabel *boincLabel = new ClickLabel ();
596636 boincLabel->setObjectName (" toolbarBoincLabel" );
597- connect (logoLabel , SIGNAL (clicked ()), this , SLOT (boincClicked ()));
637+ connect (boincLabel , SIGNAL (clicked ()), this , SLOT (boincClicked ()));
598638
599639 // "Tabs" toolbar (vertical, aligned on left side of overview screen).
600640 QToolBar *toolbar = addToolBar (" Tabs toolbar" );
@@ -607,7 +647,7 @@ void BitcoinGUI::createToolBars()
607647 // Setting a taller height than the rendered icon provides additional
608648 // padding between the icon and the button text:
609649 toolbar->setIconSize (GRC::ScaleSize (this , 16 , 24 ));
610- toolbar->addWidget (logoLabel );
650+ toolbar->addWidget (logoWrapper );
611651 toolbar->addAction (overviewAction);
612652 toolbar->addAction (sendCoinsAction);
613653 toolbar->addAction (receiveCoinsAction);
@@ -635,6 +675,10 @@ void BitcoinGUI::createToolBars()
635675 statusBar ()->addWidget (testnetLabel);
636676 }
637677
678+ statusbarAlertsLabel = new QLabel ();
679+ statusBar ()->addWidget (statusbarAlertsLabel);
680+ statusBar ()->layout ()->setAlignment (statusbarAlertsLabel, Qt::AlignLeft | Qt::AlignVCenter);
681+
638682 frameBlocks->setContentsMargins (0 ,0 ,0 ,0 );
639683
640684 QHBoxLayout *frameBlocksLayout = new QHBoxLayout (frameBlocks);
@@ -844,6 +888,11 @@ void BitcoinGUI::optionsClicked()
844888 dlg.exec ();
845889}
846890
891+ void BitcoinGUI::themeToggled ()
892+ {
893+ clientModel->getOptionsModel ()->setCurrentStyle (sSheet == " light" ? " dark" : " light" );
894+ }
895+
847896void BitcoinGUI::openConfigClicked ()
848897{
849898 boost::filesystem::path pathConfig = GetConfigFile ();
@@ -923,7 +972,6 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
923972 return ;
924973 }
925974
926- QString strStatusBarWarnings = clientModel->getStatusBarWarnings ();
927975 QString tooltip (tr (" Processed %n block(s) of transaction history." , " " , count));
928976
929977 QDateTime lastBlockDate = clientModel->getLastBlockDate ();
@@ -1469,6 +1517,18 @@ void BitcoinGUI::updateGlobalStatus()
14691517 {
14701518 overviewPage->updateGlobalStatus ();
14711519 setNumConnections (clientModel->getNumConnections ());
1520+
1521+ QString warnings = clientModel->getStatusBarWarnings ();
1522+
1523+ if (!warnings.isEmpty ())
1524+ {
1525+ statusbarAlertsLabel->setText (warnings);
1526+ statusbarAlertsLabel->setVisible (true );
1527+ }
1528+ else
1529+ {
1530+ statusbarAlertsLabel->setVisible (false );
1531+ }
14721532 }
14731533 catch (std::runtime_error &e)
14741534 {
0 commit comments