diff options
author | Roman Mindalev <r000n@r000n.net> | 2013-03-21 00:03:21 +0400 |
---|---|---|
committer | Roman Mindalev <r000n@r000n.net> | 2013-03-23 08:21:33 +0400 |
commit | e11f1806b6d722e2ae016bba053ac0c91616d800 (patch) | |
tree | bd991214a89ae08c8bccf99525eafd7433d8e9b2 /src/qt/bitcoingui.cpp | |
parent | afee36d379868f81705c960e389aa90d6f546940 (diff) | |
download | bitcoin-e11f1806b6d722e2ae016bba053ac0c91616d800.tar.xz |
Save & restore window size and position
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r-- | src/qt/bitcoingui.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 4f97a4815f..89ce7d4a85 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -54,6 +54,7 @@ #include <QUrl> #include <QMimeData> #include <QStyle> +#include <QSettings> #include <iostream> @@ -69,7 +70,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): rpcConsole(0), prevBlocks(0) { - resize(850, 550); + restoreWindowGeometry(); setWindowTitle(tr("Bitcoin") + " - " + tr("Wallet")); #ifndef Q_OS_MAC qApp->setWindowIcon(QIcon(":icons/bitcoin")); @@ -185,6 +186,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): BitcoinGUI::~BitcoinGUI() { + saveWindowGeometry(); if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu) trayIcon->hide(); #ifdef Q_OS_MAC @@ -466,6 +468,22 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason) } #endif +void BitcoinGUI::saveWindowGeometry() +{ + QSettings settings; + settings.setValue("nWindowPos", pos()); + settings.setValue("nWindowSize", size()); +} + +void BitcoinGUI::restoreWindowGeometry() +{ + QSettings settings; + QPoint pos = settings.value("nWindowPos").toPoint(); + QSize size = settings.value("nWindowSize", QSize(850, 550)).toSize(); + resize(size); + move(pos); +} + void BitcoinGUI::optionsClicked() { if(!clientModel || !clientModel->getOptionsModel()) |