Skip to content

Commit a2bdbdb

Browse files
committed
Merge bitcoin-core#194: Save/restore RPCConsole geometry only for window
01d9586 qt: Save/restore RPCConsole geometry only for window (Hennadii Stepanov) Pull request description: After using the GUI with `-disablewallet` the "Node window" inherits the geometry of the main window, that could be unexpected for users. This PR provides independent geometry settings for `RPCConsole` in both modes: - window sizes and `QSplitter` sizes when `-disablewallet=0` - only `QSplitter` sizes when `-disablewallet=1` ACKs for top commit: Talkless: tACK 01d9586, tested on Debian Sid with Qt 5.15.2. I've managed to reproduce issue using bitcoin-core#194 (comment) instructions, and I see that this PR does detach main window and information window sizes. Built with `--enable-wallet` and `--disable-wallet`. jarolrod: ACK 01d9586, tested on macOS 11.2 Qt 5.15.2 promag: Code review ACK 01d9586. Tree-SHA512: 9934cf04d4d5070dfc4671ea950e225cda9988858227e5481dad1baafa14af477bdbf4f91307ca687fde0cad6e4e605a3a99377e70d67eb115a19955ce2516f5
2 parents 8d7125f + 01d9586 commit a2bdbdb

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

src/qt/rpcconsole.cpp

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -454,13 +454,21 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
454454
{
455455
ui->setupUi(this);
456456
QSettings settings;
457-
if (!restoreGeometry(settings.value("RPCConsoleWindowGeometry").toByteArray())) {
458-
// Restore failed (perhaps missing setting), center the window
459-
move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
457+
#ifdef ENABLE_WALLET
458+
if (WalletModel::isWalletEnabled()) {
459+
// RPCConsole widget is a window.
460+
if (!restoreGeometry(settings.value("RPCConsoleWindowGeometry").toByteArray())) {
461+
// Restore failed (perhaps missing setting), center the window
462+
move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
463+
}
464+
ui->splitter->restoreState(settings.value("RPCConsoleWindowPeersTabSplitterSizes").toByteArray());
465+
} else
466+
#endif // ENABLE_WALLET
467+
{
468+
// RPCConsole is a child widget.
469+
ui->splitter->restoreState(settings.value("RPCConsoleWidgetPeersTabSplitterSizes").toByteArray());
460470
}
461471

462-
ui->splitter->restoreState(settings.value("PeersTabSplitterSizes").toByteArray());
463-
464472
constexpr QChar nonbreaking_hyphen(8209);
465473
const std::vector<QString> CONNECTION_TYPE_DOC{
466474
tr("Inbound: initiated by peer"),
@@ -522,8 +530,18 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
522530
RPCConsole::~RPCConsole()
523531
{
524532
QSettings settings;
525-
settings.setValue("RPCConsoleWindowGeometry", saveGeometry());
526-
settings.setValue("PeersTabSplitterSizes", ui->splitter->saveState());
533+
#ifdef ENABLE_WALLET
534+
if (WalletModel::isWalletEnabled()) {
535+
// RPCConsole widget is a window.
536+
settings.setValue("RPCConsoleWindowGeometry", saveGeometry());
537+
settings.setValue("RPCConsoleWindowPeersTabSplitterSizes", ui->splitter->saveState());
538+
} else
539+
#endif // ENABLE_WALLET
540+
{
541+
// RPCConsole is a child widget.
542+
settings.setValue("RPCConsoleWidgetPeersTabSplitterSizes", ui->splitter->saveState());
543+
}
544+
527545
m_node.rpcUnsetTimerInterface(rpcTimerInterface);
528546
delete rpcTimerInterface;
529547
delete ui;

0 commit comments

Comments
 (0)