Skip to content

Commit

Permalink
gui: toggle network via menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors committed Aug 31, 2021
1 parent a9c3cfa commit 13bbc6d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,27 @@ void BitcoinGUI::createActions()
}
#endif // ENABLE_WALLET

// TOOD: network submenu
// TODO: disable active network
m_signet_action = new QAction(tr("Signet"), this);
m_signet_action->setStatusTip(tr("Restart with the Signet chain"));

connect(m_signet_action, &QAction::triggered, [this] {
// confirmation dialog
QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm chain"),
tr("Client restart required to switch chain.") + "<br><br>" + tr("Client will be shut down. Do you want to proceed?"),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);

if(btnRetVal == QMessageBox::Cancel)
return;

gArgs.SoftSetArg("-chain", "signet");
gArgs.WriteChainGUI();

QApplication::quit();

});

connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this), &QShortcut::activated, this, &BitcoinGUI::showDebugWindowActivateConsole);
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D), this), &QShortcut::activated, this, &BitcoinGUI::showDebugWindow);
}
Expand Down Expand Up @@ -472,6 +493,8 @@ void BitcoinGUI::createMenuBar()
file->addAction(m_load_psbt_clipboard_action);
file->addSeparator();
}
file->addAction(m_signet_action);
file->addSeparator();
file->addAction(quitAction);

QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
Expand Down
2 changes: 2 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ class BitcoinGUI : public QMainWindow
QAction* m_wallet_selector_action = nullptr;
QAction* m_mask_values_action{nullptr};

QAction* m_signet_action{nullptr};

QLabel *m_wallet_selector_label = nullptr;
QComboBox* m_wallet_selector = nullptr;

Expand Down

0 comments on commit 13bbc6d

Please sign in to comment.