5656#include < QToolBar>
5757#include < QUrlQuery>
5858#include < QVBoxLayout>
59+ #include < QWindow>
5960
6061#include < boost/bind.hpp>
6162
@@ -385,9 +386,6 @@ void BitcoinGUI::createMenuBar()
385386 file->addAction (signMessageAction);
386387 file->addAction (verifyMessageAction);
387388 file->addSeparator ();
388- file->addAction (usedSendingAddressesAction);
389- file->addAction (usedReceivingAddressesAction);
390- file->addSeparator ();
391389 }
392390 file->addAction (quitAction);
393391
@@ -400,11 +398,59 @@ void BitcoinGUI::createMenuBar()
400398 }
401399 settings->addAction (optionsAction);
402400
403- QMenu *help = appMenuBar->addMenu (tr (" &Help" ));
404- if (walletFrame)
405- {
406- help->addAction (openRPCConsoleAction);
401+ QMenu* window_menu = appMenuBar->addMenu (tr (" &Window" ));
402+
403+ QAction* minimize_action = window_menu->addAction (tr (" Minimize" ), [] {
404+ qApp->focusWindow ()->showMinimized ();
405+ }, QKeySequence (Qt::CTRL + Qt::Key_M));
406+
407+ connect (qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) {
408+ minimize_action->setEnabled (window != nullptr && (window->flags () & Qt::Dialog) != Qt::Dialog && window->windowState () != Qt::WindowMinimized);
409+ });
410+
411+ #ifdef Q_OS_MAC
412+ QAction* zoom_action = window_menu->addAction (tr (" Zoom" ), [] {
413+ QWindow* window = qApp->focusWindow ();
414+ if (window->windowState () != Qt::WindowMaximized) {
415+ window->showMaximized ();
416+ } else {
417+ window->showNormal ();
418+ }
419+ });
420+
421+ connect (qApp, &QApplication::focusWindowChanged, [zoom_action] (QWindow* window) {
422+ zoom_action->setEnabled (window != nullptr );
423+ });
424+ #else
425+ QAction* restore_action = window_menu->addAction (tr (" Restore" ), [] {
426+ qApp->focusWindow ()->showNormal ();
427+ });
428+
429+ connect (qApp, &QApplication::focusWindowChanged, [restore_action] (QWindow* window) {
430+ restore_action->setEnabled (window != nullptr );
431+ });
432+ #endif
433+
434+ if (walletFrame) {
435+ window_menu->addSeparator ();
436+ window_menu->addAction (tr (" Main Window" ), [this ] {
437+ GUIUtil::bringToFront (this );
438+ });
439+
440+ window_menu->addSeparator ();
441+ window_menu->addAction (usedSendingAddressesAction);
442+ window_menu->addAction (usedReceivingAddressesAction);
443+ }
444+
445+ window_menu->addSeparator ();
446+ for (RPCConsole::TabTypes tab_type : rpcConsole->tabs ()) {
447+ window_menu->addAction (rpcConsole->tabTitle (tab_type), [this , tab_type] {
448+ rpcConsole->setTabFocus (tab_type);
449+ showDebugWindow ();
450+ });
407451 }
452+
453+ QMenu *help = appMenuBar->addMenu (tr (" &Help" ));
408454 help->addAction (showHelpMessageAction);
409455 help->addSeparator ();
410456 help->addAction (aboutAction);
0 commit comments