mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
Merge bitcoin-core/gui#194: Save/restore RPCConsole geometry only for window
01d9586ae8
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: tACK01d9586ae8
, tested on Debian Sid with Qt 5.15.2. I've managed to reproduce issue using https://github.com/bitcoin-core/gui/pull/194#issuecomment-782822663 instructions, and I see that this PR does detach main window and information window sizes. Built with `--enable-wallet` and `--disable-wallet`. jarolrod: ACK01d9586ae8
, tested on macOS 11.2 Qt 5.15.2 promag: Code review ACK01d9586ae8
. Tree-SHA512: 9934cf04d4d5070dfc4671ea950e225cda9988858227e5481dad1baafa14af477bdbf4f91307ca687fde0cad6e4e605a3a99377e70d67eb115a19955ce2516f5
This commit is contained in:
commit
a2bdbdb358
1 changed files with 25 additions and 7 deletions
|
@ -454,12 +454,20 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
|
|||
{
|
||||
ui->setupUi(this);
|
||||
QSettings settings;
|
||||
#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("PeersTabSplitterSizes").toByteArray());
|
||||
ui->splitter->restoreState(settings.value("RPCConsoleWindowPeersTabSplitterSizes").toByteArray());
|
||||
} else
|
||||
#endif // ENABLE_WALLET
|
||||
{
|
||||
// RPCConsole is a child widget.
|
||||
ui->splitter->restoreState(settings.value("RPCConsoleWidgetPeersTabSplitterSizes").toByteArray());
|
||||
}
|
||||
|
||||
constexpr QChar nonbreaking_hyphen(8209);
|
||||
const std::vector<QString> CONNECTION_TYPE_DOC{
|
||||
|
@ -522,8 +530,18 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
|
|||
RPCConsole::~RPCConsole()
|
||||
{
|
||||
QSettings settings;
|
||||
#ifdef ENABLE_WALLET
|
||||
if (WalletModel::isWalletEnabled()) {
|
||||
// RPCConsole widget is a window.
|
||||
settings.setValue("RPCConsoleWindowGeometry", saveGeometry());
|
||||
settings.setValue("PeersTabSplitterSizes", ui->splitter->saveState());
|
||||
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue