qt: Add Window menu
This commit is contained in:
parent
9ea38d0222
commit
a96c0df35e
1 changed files with 53 additions and 7 deletions
|
@ -56,6 +56,7 @@
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QWindow>
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
|
@ -385,9 +386,6 @@ void BitcoinGUI::createMenuBar()
|
||||||
file->addAction(signMessageAction);
|
file->addAction(signMessageAction);
|
||||||
file->addAction(verifyMessageAction);
|
file->addAction(verifyMessageAction);
|
||||||
file->addSeparator();
|
file->addSeparator();
|
||||||
file->addAction(usedSendingAddressesAction);
|
|
||||||
file->addAction(usedReceivingAddressesAction);
|
|
||||||
file->addSeparator();
|
|
||||||
}
|
}
|
||||||
file->addAction(quitAction);
|
file->addAction(quitAction);
|
||||||
|
|
||||||
|
@ -400,11 +398,59 @@ void BitcoinGUI::createMenuBar()
|
||||||
}
|
}
|
||||||
settings->addAction(optionsAction);
|
settings->addAction(optionsAction);
|
||||||
|
|
||||||
QMenu *help = appMenuBar->addMenu(tr("&Help"));
|
QMenu* window_menu = appMenuBar->addMenu(tr("&Window"));
|
||||||
if(walletFrame)
|
|
||||||
{
|
QAction* minimize_action = window_menu->addAction(tr("Minimize"), [] {
|
||||||
help->addAction(openRPCConsoleAction);
|
qApp->focusWindow()->showMinimized();
|
||||||
|
}, QKeySequence(Qt::CTRL + Qt::Key_M));
|
||||||
|
|
||||||
|
connect(qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) {
|
||||||
|
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);
|
||||||
|
});
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
QAction* zoom_action = window_menu->addAction(tr("Zoom"), [] {
|
||||||
|
QWindow* window = qApp->focusWindow();
|
||||||
|
if (window->windowState() != Qt::WindowMaximized) {
|
||||||
|
window->showMaximized();
|
||||||
|
} else {
|
||||||
|
window->showNormal();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(qApp, &QApplication::focusWindowChanged, [zoom_action] (QWindow* window) {
|
||||||
|
zoom_action->setEnabled(window != nullptr);
|
||||||
|
});
|
||||||
|
#else
|
||||||
|
QAction* restore_action = window_menu->addAction(tr("Restore"), [] {
|
||||||
|
qApp->focusWindow()->showNormal();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(qApp, &QApplication::focusWindowChanged, [restore_action] (QWindow* window) {
|
||||||
|
restore_action->setEnabled(window != nullptr);
|
||||||
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (walletFrame) {
|
||||||
|
window_menu->addSeparator();
|
||||||
|
window_menu->addAction(tr("Main Window"), [this] {
|
||||||
|
GUIUtil::bringToFront(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
window_menu->addSeparator();
|
||||||
|
window_menu->addAction(usedSendingAddressesAction);
|
||||||
|
window_menu->addAction(usedReceivingAddressesAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
window_menu->addSeparator();
|
||||||
|
for (RPCConsole::TabTypes tab_type : rpcConsole->tabs()) {
|
||||||
|
window_menu->addAction(rpcConsole->tabTitle(tab_type), [this, tab_type] {
|
||||||
|
rpcConsole->setTabFocus(tab_type);
|
||||||
|
showDebugWindow();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu *help = appMenuBar->addMenu(tr("&Help"));
|
||||||
help->addAction(showHelpMessageAction);
|
help->addAction(showHelpMessageAction);
|
||||||
help->addSeparator();
|
help->addSeparator();
|
||||||
help->addAction(aboutAction);
|
help->addAction(aboutAction);
|
||||||
|
|
Loading…
Reference in a new issue