mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 00:49:28 -05:00
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
This commit is contained in:
parent
5b1fae0123
commit
f1da09ad93
@ -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())
|
||||
|
@ -68,6 +68,7 @@ signals:
|
||||
|
||||
private:
|
||||
QString _name; /**< Name associated with this window. */
|
||||
bool m_bSaveStateOnClose; // is set to true in restoreWindowState
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user