From f1da09ad93414bfba61b7dd43133944c13b5f5b3 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Mon, 14 Jun 2010 20:15:51 +0000 Subject: [PATCH] save the window state only when the window was visible and the state was loaded the problem was: the state of the windows was set to the initial state on close, when it wasn't visible. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3136 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/common/rwindow.cpp | 8 ++++++++ retroshare-gui/src/gui/common/rwindow.h | 1 + 2 files changed, 9 insertions(+) diff --git a/retroshare-gui/src/gui/common/rwindow.cpp b/retroshare-gui/src/gui/common/rwindow.cpp index 481acc6cc..94ec711e7 100644 --- a/retroshare-gui/src/gui/common/rwindow.cpp +++ b/retroshare-gui/src/gui/common/rwindow.cpp @@ -36,6 +36,7 @@ RWindow::RWindow(QString name, QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { _name = name; + m_bSaveStateOnClose = false; } /** Destructor. */ @@ -55,6 +56,11 @@ RWindow::setShortcut(QString shortcut, const char *slot) void RWindow::saveWindowState() { + if (m_bSaveStateOnClose == false) { + // nothing to save + return; + } + #if QT_VERSION >= 0x040200 saveSetting("Geometry", saveGeometry()); #else @@ -67,6 +73,8 @@ RWindow::saveWindowState() void RWindow::restoreWindowState() { + m_bSaveStateOnClose = true; // now we save the window state on close + #if QT_VERSION >= 0x040200 QByteArray geometry = getSetting("Geometry", QByteArray()).toByteArray(); if (geometry.isEmpty()) diff --git a/retroshare-gui/src/gui/common/rwindow.h b/retroshare-gui/src/gui/common/rwindow.h index d3d6eeeba..5811809f4 100644 --- a/retroshare-gui/src/gui/common/rwindow.h +++ b/retroshare-gui/src/gui/common/rwindow.h @@ -68,6 +68,7 @@ signals: private: QString _name; /**< Name associated with this window. */ + bool m_bSaveStateOnClose; // is set to true in restoreWindowState }; #endif