Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bitcoingui.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
#include <QShortcut> | #include <QShortcut> | ||||
#include <QStackedWidget> | #include <QStackedWidget> | ||||
#include <QStatusBar> | #include <QStatusBar> | ||||
#include <QStyle> | #include <QStyle> | ||||
#include <QTimer> | #include <QTimer> | ||||
#include <QToolBar> | #include <QToolBar> | ||||
#include <QUrlQuery> | #include <QUrlQuery> | ||||
#include <QVBoxLayout> | #include <QVBoxLayout> | ||||
#include <QWindow> | |||||
const std::string BitcoinGUI::DEFAULT_UIPLATFORM = | const std::string BitcoinGUI::DEFAULT_UIPLATFORM = | ||||
#if defined(Q_OS_MAC) | #if defined(Q_OS_MAC) | ||||
"macosx" | "macosx" | ||||
#elif defined(Q_OS_WIN) | #elif defined(Q_OS_WIN) | ||||
"windows" | "windows" | ||||
#else | #else | ||||
"other" | "other" | ||||
▲ Show 20 Lines • Show All 304 Lines • ▼ Show 20 Lines | #endif // ENABLE_WALLET | ||||
openRPCConsoleAction->setStatusTip( | openRPCConsoleAction->setStatusTip( | ||||
tr("Open debugging and diagnostic console")); | tr("Open debugging and diagnostic console")); | ||||
// initially disable the debug window menu item | // initially disable the debug window menu item | ||||
openRPCConsoleAction->setEnabled(false); | openRPCConsoleAction->setEnabled(false); | ||||
openRPCConsoleAction->setObjectName("openRPCConsoleAction"); | openRPCConsoleAction->setObjectName("openRPCConsoleAction"); | ||||
usedSendingAddressesAction = | usedSendingAddressesAction = | ||||
new QAction(platformStyle->TextColorIcon(":/icons/address-book"), | new QAction(platformStyle->TextColorIcon(":/icons/address-book"), | ||||
tr("&Sending addresses..."), this); | tr("&Sending addresses"), this); | ||||
usedSendingAddressesAction->setStatusTip( | usedSendingAddressesAction->setStatusTip( | ||||
tr("Show the list of used sending addresses and labels")); | tr("Show the list of used sending addresses and labels")); | ||||
usedReceivingAddressesAction = | usedReceivingAddressesAction = | ||||
new QAction(platformStyle->TextColorIcon(":/icons/address-book"), | new QAction(platformStyle->TextColorIcon(":/icons/address-book"), | ||||
tr("&Receiving addresses..."), this); | tr("&Receiving addresses"), this); | ||||
usedReceivingAddressesAction->setStatusTip( | usedReceivingAddressesAction->setStatusTip( | ||||
tr("Show the list of used receiving addresses and labels")); | tr("Show the list of used receiving addresses and labels")); | ||||
openAction = new QAction(platformStyle->TextColorIcon(":/icons/open"), | openAction = new QAction(platformStyle->TextColorIcon(":/icons/open"), | ||||
tr("Open &URI..."), this); | tr("Open &URI..."), this); | ||||
openAction->setStatusTip( | openAction->setStatusTip( | ||||
tr("Open a %1: URI or payment request") | tr("Open a %1: URI or payment request") | ||||
.arg(QString::fromStdString( | .arg(QString::fromStdString( | ||||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | if (walletFrame) { | ||||
file->addAction(m_open_wallet_action); | file->addAction(m_open_wallet_action); | ||||
file->addAction(m_close_wallet_action); | file->addAction(m_close_wallet_action); | ||||
file->addSeparator(); | file->addSeparator(); | ||||
file->addAction(openAction); | file->addAction(openAction); | ||||
file->addAction(backupWalletAction); | file->addAction(backupWalletAction); | ||||
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); | ||||
QMenu *settings = appMenuBar->addMenu(tr("&Settings")); | QMenu *settings = appMenuBar->addMenu(tr("&Settings")); | ||||
if (walletFrame) { | if (walletFrame) { | ||||
settings->addAction(encryptWalletAction); | settings->addAction(encryptWalletAction); | ||||
settings->addAction(changePassphraseAction); | settings->addAction(changePassphraseAction); | ||||
settings->addSeparator(); | settings->addSeparator(); | ||||
} | } | ||||
settings->addAction(optionsAction); | settings->addAction(optionsAction); | ||||
QMenu *help = appMenuBar->addMenu(tr("&Help")); | QMenu *window_menu = appMenuBar->addMenu(tr("&Window")); | ||||
QAction *minimize_action = window_menu->addAction( | |||||
tr("Minimize"), [] { 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) { | if (walletFrame) { | ||||
help->addAction(openRPCConsoleAction); | 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); | ||||
help->addAction(aboutQtAction); | help->addAction(aboutQtAction); | ||||
} | } | ||||
void BitcoinGUI::createToolBars() { | void BitcoinGUI::createToolBars() { | ||||
if (walletFrame) { | if (walletFrame) { | ||||
▲ Show 20 Lines • Show All 1,009 Lines • Show Last 20 Lines |