diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtSingleWindow.cpp | 25 | ||||
-rw-r--r-- | Swift/QtUI/QtSingleWindow.h | 11 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 11 |
3 files changed, 40 insertions, 7 deletions
diff --git a/Swift/QtUI/QtSingleWindow.cpp b/Swift/QtUI/QtSingleWindow.cpp index 6a87825..2a19dd4 100644 --- a/Swift/QtUI/QtSingleWindow.cpp +++ b/Swift/QtUI/QtSingleWindow.cpp @@ -6,9 +6,19 @@ #include <Swift/QtUI/QtSingleWindow.h> +#include <Swift/QtUI/QtSettingsProvider.h> + namespace Swift { -QtSingleWindow::QtSingleWindow() : QSplitter() { +static const QString SINGLE_WINDOW_GEOMETRY = QString("SINGLE_WINDOW_GEOMETRY"); + +QtSingleWindow::QtSingleWindow(QtSettingsProvider* settings) : QSplitter() { + settings_ = settings; + QVariant geometryVariant = settings_->getQSettings()->value(SINGLE_WINDOW_GEOMETRY); + if (geometryVariant.isValid()) { + restoreGeometry(geometryVariant.toByteArray()); + } + } @@ -16,4 +26,17 @@ QtSingleWindow::~QtSingleWindow() { } +void QtSingleWindow::handleGeometryChanged() { + settings_->getQSettings()->setValue(SINGLE_WINDOW_GEOMETRY, saveGeometry()); + +} + +void QtSingleWindow::resizeEvent(QResizeEvent*) { + handleGeometryChanged(); +} + +void QtSingleWindow::moveEvent(QMoveEvent*) { + handleGeometryChanged(); +} + } diff --git a/Swift/QtUI/QtSingleWindow.h b/Swift/QtUI/QtSingleWindow.h index 996ab20..861eda7 100644 --- a/Swift/QtUI/QtSingleWindow.h +++ b/Swift/QtUI/QtSingleWindow.h @@ -9,12 +9,21 @@ #include <QSplitter> namespace Swift { + class QtSettingsProvider; class QtSingleWindow : public QSplitter { public: - QtSingleWindow(); + QtSingleWindow(QtSettingsProvider* settings); virtual ~QtSingleWindow(); + protected: + void resizeEvent(QResizeEvent*); + void moveEvent(QMoveEvent*); + private: + void handleGeometryChanged(); + private: + + QtSettingsProvider* settings_; }; } diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index c11c3fe..57386d4 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -124,11 +124,6 @@ QMap<QString, QString> QtSwift::loadEmoticonsFile(const QString& fileName) { } QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMainThreadCaller_), autoUpdater_(NULL), idleDetector_(&idleQuerier_, networkFactories_.getTimerFactory(), 1000) { - if (options.count("netbook-mode")) { - splitter_ = new QtSingleWindow(); - } else { - splitter_ = NULL; - } QCoreApplication::setApplicationName(SWIFT_APPLICATION_NAME); QCoreApplication::setOrganizationName(SWIFT_ORGANIZATION_NAME); QCoreApplication::setOrganizationDomain(SWIFT_ORGANIZATION_DOMAIN); @@ -142,6 +137,12 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa QMap<QString, QString> emoticons = loadEmoticonsFile(P2QSTRING((Paths::getExecutablePath() / "emoticons.txt").string())); + if (options.count("netbook-mode")) { + splitter_ = new QtSingleWindow(qtSettings_); + } else { + splitter_ = NULL; + } + int numberOfAccounts = 1; try { numberOfAccounts = options["multi-account"].as<int>(); |