aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoingui.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2013-07-13 13:14:23 +0200
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2013-07-29 16:22:46 +0200
commitc431e9f1f03023d216db0ff48d3d598e705c97f9 (patch)
tree6132628aa34888e6e9af93982c77d8afcff2f045 /src/qt/bitcoingui.cpp
parentc4316fefa5f56d62eeceb710ee18313bd9be1128 (diff)
Bitcoin-Qt: save and restore position of debug window
- move the code for saving and restoring window positions from BitcoinGUI to GUIUtil, make it more generic and also use it for saving/restoring debug window positions
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r--src/qt/bitcoingui.cpp28
1 files changed, 2 insertions, 26 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 11767cf312..15541f914d 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -49,8 +49,6 @@
#endif
#include <QMimeData>
#include <QStyle>
-#include <QSettings>
-#include <QDesktopWidget>
#include <QListWidget>
#include <iostream>
@@ -68,7 +66,7 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
rpcConsole(0),
prevBlocks(0)
{
- restoreWindowGeometry();
+ GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);
#ifndef Q_OS_MAC
if (!fIsTestnet)
@@ -166,7 +164,7 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
BitcoinGUI::~BitcoinGUI()
{
- saveWindowGeometry();
+ GUIUtil::saveWindowGeometry("nWindow", this);
if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
trayIcon->hide();
#ifdef Q_OS_MAC
@@ -425,28 +423,6 @@ 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();
- if (!pos.x() && !pos.y())
- {
- QRect screen = QApplication::desktop()->screenGeometry();
- pos.setX((screen.width()-size.width())/2);
- pos.setY((screen.height()-size.height())/2);
- }
- resize(size);
- move(pos);
-}
-
void BitcoinGUI::optionsClicked()
{
if(!clientModel || !clientModel->getOptionsModel())