| 77 | ; |
| 78 | |
| 79 | BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) : |
| 80 | QMainWindow(parent), |
| 81 | m_node(node), |
| 82 | trayIconMenu{new QMenu()}, |
| 83 | platformStyle(_platformStyle), |
| 84 | m_network_style(networkStyle) |
| 85 | { |
| 86 | QSettings settings; |
| 87 | if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) { |
| 88 | // Restore failed (perhaps missing setting), center the window |
| 89 | move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center()); |
| 90 | } |
| 91 | |
| 92 | setContextMenuPolicy(Qt::PreventContextMenu); |
| 93 | |
| 94 | #ifdef ENABLE_WALLET |
| 95 | enableWallet = WalletModel::isWalletEnabled(); |
| 96 | #endif // ENABLE_WALLET |
| 97 | QApplication::setWindowIcon(m_network_style->getTrayAndWindowIcon()); |
| 98 | setWindowIcon(m_network_style->getTrayAndWindowIcon()); |
| 99 | updateWindowTitle(); |
| 100 | |
| 101 | rpcConsole = new RPCConsole(node, _platformStyle, nullptr); |
| 102 | helpMessageDialog = new HelpMessageDialog(this, false); |
| 103 | #ifdef ENABLE_WALLET |
| 104 | if(enableWallet) |
| 105 | { |
| 106 | /** Create wallet frame and make it the central widget */ |
| 107 | walletFrame = new WalletFrame(_platformStyle, this); |
| 108 | connect(walletFrame, &WalletFrame::createWalletButtonClicked, [this] { |
| 109 | auto activity = new CreateWalletActivity(getWalletController(), this); |
| 110 | activity->create(); |
| 111 | }); |
| 112 | connect(walletFrame, &WalletFrame::message, [this](const QString& title, const QString& message, unsigned int style) { |
| 113 | this->message(title, message, style); |
| 114 | }); |
| 115 | connect(walletFrame, &WalletFrame::currentWalletSet, [this] { updateWalletStatus(); }); |
| 116 | setCentralWidget(walletFrame); |
| 117 | } else |
| 118 | #endif // ENABLE_WALLET |
| 119 | { |
| 120 | /* When compiled without wallet or -disablewallet is provided, |
| 121 | * the central widget is the rpc console. |
| 122 | */ |
| 123 | setCentralWidget(rpcConsole); |
| 124 | Q_EMIT consoleShown(rpcConsole); |
| 125 | } |
| 126 | |
| 127 | modalOverlay = new ModalOverlay(enableWallet, this->centralWidget()); |
| 128 | |
| 129 | // Accept D&D of URIs |
| 130 | setAcceptDrops(true); |
| 131 | |
| 132 | // Create actions for the toolbar, menu bar and tray/dock icon |
| 133 | // Needs walletFrame to be initialized |
| 134 | createActions(); |
| 135 | |
| 136 | // Create application menu bar |
nothing calls this directly
no test coverage detected