56
56
#include < QToolBar>
57
57
#include < QUrlQuery>
58
58
#include < QVBoxLayout>
59
+ #include < QWindow>
59
60
60
61
#include < boost/bind.hpp>
61
62
@@ -385,9 +386,6 @@ void BitcoinGUI::createMenuBar()
385
386
file->addAction (signMessageAction);
386
387
file->addAction (verifyMessageAction);
387
388
file->addSeparator ();
388
- file->addAction (usedSendingAddressesAction);
389
- file->addAction (usedReceivingAddressesAction);
390
- file->addSeparator ();
391
389
}
392
390
file->addAction (quitAction);
393
391
@@ -400,11 +398,59 @@ void BitcoinGUI::createMenuBar()
400
398
}
401
399
settings->addAction (optionsAction);
402
400
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
+ });
407
451
}
452
+
453
+ QMenu *help = appMenuBar->addMenu (tr (" &Help" ));
408
454
help->addAction (showHelpMessageAction);
409
455
help->addSeparator ();
410
456
help->addAction (aboutAction);
0 commit comments