diff options
Diffstat (limited to 'Swift/QtUI/QtLoginWindowFactory.cpp')
-rw-r--r-- | Swift/QtUI/QtLoginWindowFactory.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Swift/QtUI/QtLoginWindowFactory.cpp b/Swift/QtUI/QtLoginWindowFactory.cpp index e351f43..c395c57 100644 --- a/Swift/QtUI/QtLoginWindowFactory.cpp +++ b/Swift/QtUI/QtLoginWindowFactory.cpp @@ -1,19 +1,33 @@ #include "QtLoginWindowFactory.h" #include "QtLoginWindow.h" +#include <QDesktopWidget> + namespace Swift { -QtLoginWindowFactory::QtLoginWindowFactory(QSplitter* splitter, QtSystemTray* systemTray) : QObject() { +QtLoginWindowFactory::QtLoginWindowFactory(QSplitter* splitter, QtSystemTray* systemTray, QtSettingsProvider* settings) : QObject() { + settings_ = settings; splitter_ = splitter; systemTray_ = systemTray; } LoginWindow* QtLoginWindowFactory::createLoginWindow() { - QtLoginWindow* window = new QtLoginWindow(); + window_ = new QtLoginWindow(); if (splitter_) { - splitter_->insertWidget(0, window); + splitter_->insertWidget(0, window_); + return window_; + } + connect(systemTray_, SIGNAL(clicked()), window_, SLOT(bringToFront())); + QVariant loginWindowGeometryVariant = settings_->getQSettings()->value("loginWindowGeometry"); + if (loginWindowGeometryVariant.isValid()) { + window_->restoreGeometry(loginWindowGeometryVariant.toByteArray()); } - connect(systemTray_, SIGNAL(clicked()), window, SLOT(bringToFront())); - return window; + connect(window_, SIGNAL(geometryChanged()), this, SLOT(handleWindowGeometryChanged())); + return window_; } + +void QtLoginWindowFactory::handleWindowGeometryChanged() { + settings_->getQSettings()->setValue("loginWindowGeometry", window_->saveGeometry()); +} + } |