diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2013-08-05 00:58:05 -0700 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2013-08-05 00:58:05 -0700 |
commit | a4ae02969e6c8fd6f17ac5f2f495149476463344 (patch) | |
tree | f39250736d5f36f722d11fd126a347b2b2189c17 /src/qt/bitcoingui.cpp | |
parent | d687aaa31180a7a81362711608c697b53c2739e6 (diff) | |
parent | c431e9f1f03023d216db0ff48d3d598e705c97f9 (diff) |
Merge pull request #2827 from Diapolo/rpccon_winpos
Bitcoin-Qt: save and restore position of debug window
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r-- | src/qt/bitcoingui.cpp | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 4ed734b9c9..8ec2f03fad 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -48,8 +48,6 @@ #endif #include <QMimeData> #include <QStyle> -#include <QSettings> -#include <QDesktopWidget> #include <QListWidget> #include <iostream> @@ -67,7 +65,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) @@ -165,7 +163,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 @@ -424,28 +422,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()) |