Skip to content

Commit

Permalink
Merge a2bdbdb into merged_master (Bitcoin PR bitcoin-core/gui#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
apoelstra committed Jul 8, 2021
2 parents e820843 + a2bdbdb commit b3ee198
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,21 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
{
ui->setupUi(this);
QSettings settings;
if (!restoreGeometry(settings.value("RPCConsoleWindowGeometry").toByteArray())) {
// Restore failed (perhaps missing setting), center the window
move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
#ifdef ENABLE_WALLET
if (WalletModel::isWalletEnabled()) {
// RPCConsole widget is a window.
if (!restoreGeometry(settings.value("RPCConsoleWindowGeometry").toByteArray())) {
// Restore failed (perhaps missing setting), center the window
move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
}
ui->splitter->restoreState(settings.value("RPCConsoleWindowPeersTabSplitterSizes").toByteArray());
} else
#endif // ENABLE_WALLET
{
// RPCConsole is a child widget.
ui->splitter->restoreState(settings.value("RPCConsoleWidgetPeersTabSplitterSizes").toByteArray());
}

ui->splitter->restoreState(settings.value("PeersTabSplitterSizes").toByteArray());

constexpr QChar nonbreaking_hyphen(8209);
const std::vector<QString> CONNECTION_TYPE_DOC{
tr("Inbound: initiated by peer"),
Expand Down Expand Up @@ -522,8 +530,18 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
RPCConsole::~RPCConsole()
{
QSettings settings;
settings.setValue("RPCConsoleWindowGeometry", saveGeometry());
settings.setValue("PeersTabSplitterSizes", ui->splitter->saveState());
#ifdef ENABLE_WALLET
if (WalletModel::isWalletEnabled()) {
// RPCConsole widget is a window.
settings.setValue("RPCConsoleWindowGeometry", saveGeometry());
settings.setValue("RPCConsoleWindowPeersTabSplitterSizes", ui->splitter->saveState());
} else
#endif // ENABLE_WALLET
{
// RPCConsole is a child widget.
settings.setValue("RPCConsoleWidgetPeersTabSplitterSizes", ui->splitter->saveState());
}

m_node.rpcUnsetTimerInterface(rpcTimerInterface);
delete rpcTimerInterface;
delete ui;
Expand Down

0 comments on commit b3ee198

Please sign in to comment.