From 2258e4d5ed620744989ad2fc7d67ba7da8dce9af Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 27 Oct 2015 16:45:11 +0800 Subject: [PATCH] Fix automatedrssdownloader position --- src/base/preferences.cpp | 10 ++++------ src/base/preferences.h | 7 +++---- src/gui/rss/automatedrssdownloader.cpp | 6 ++---- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/base/preferences.cpp b/src/base/preferences.cpp index 74d433543..0d4574a6f 100644 --- a/src/base/preferences.cpp +++ b/src/base/preferences.cpp @@ -1127,7 +1127,6 @@ void Preferences::setMainLastDir(const QString &path) setValue("MainWindowLastDir", path); } -#ifndef DISABLE_GUI QSize Preferences::getPrefSize(const QSize& defaultSize) const { return value("Preferences/State/size", defaultSize).toSize(); @@ -1137,7 +1136,6 @@ void Preferences::setPrefSize(const QSize &size) { setValue("Preferences/State/size", size); } -#endif QStringList Preferences::getPrefHSplitterSizes() const { @@ -1209,14 +1207,14 @@ void Preferences::setPropTrackerListState(const QByteArray &state) setValue("TorrentProperties/Trackers/qt5/TrackerListState", state); } -QByteArray Preferences::getRssGeometry() const +QSize Preferences::getRssGeometrySize(const QSize &defaultSize) const { - return value("RssFeedDownloader/geometry").toByteArray(); + return value("RssFeedDownloader/geometrySize", defaultSize).toSize(); } -void Preferences::setRssGeometry(const QByteArray &geometry) +void Preferences::setRssGeometrySize(const QSize &geometry) { - setValue("RssFeedDownloader/geometry", geometry); + setValue("RssFeedDownloader/geometrySize", geometry); } QByteArray Preferences::getRssHSplitterSizes() const diff --git a/src/base/preferences.h b/src/base/preferences.h index f34d6a6f3..0620f5f48 100644 --- a/src/base/preferences.h +++ b/src/base/preferences.h @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -274,10 +275,8 @@ public: void setMainVSplitterState(const QByteArray &state); QString getMainLastDir() const; void setMainLastDir(const QString &path); -#ifndef DISABLE_GUI QSize getPrefSize(const QSize &defaultSize) const; void setPrefSize(const QSize &size); -#endif QStringList getPrefHSplitterSizes() const; void setPrefHSplitterSizes(const QStringList &sizes); QByteArray getPeerListState() const; @@ -292,8 +291,8 @@ public: void setPropVisible(const bool visible); QByteArray getPropTrackerListState() const; void setPropTrackerListState(const QByteArray &state); - QByteArray getRssGeometry() const; - void setRssGeometry(const QByteArray &geometry); + QSize getRssGeometrySize(const QSize &defaultSize) const; + void setRssGeometrySize(const QSize &geometry); QByteArray getRssHSplitterSizes() const; void setRssHSplitterSizes(const QByteArray &sizes); QStringList getRssOpenFolders() const; diff --git a/src/gui/rss/automatedrssdownloader.cpp b/src/gui/rss/automatedrssdownloader.cpp index 31db14a84..4b54cb96d 100644 --- a/src/gui/rss/automatedrssdownloader.cpp +++ b/src/gui/rss/automatedrssdownloader.cpp @@ -149,17 +149,15 @@ AutomatedRssDownloader::~AutomatedRssDownloader() void AutomatedRssDownloader::loadSettings() { - // load dialog geometry const Preferences *const pref = Preferences::instance(); - restoreGeometry(pref->getRssGeometry()); + resize(pref->getRssGeometrySize(this->size())); m_ui->hsplitter->restoreState(pref->getRssHSplitterSizes()); } void AutomatedRssDownloader::saveSettings() { - // Save dialog geometry Preferences *const pref = Preferences::instance(); - pref->setRssGeometry(saveGeometry()); + pref->setRssGeometrySize(this->size()); pref->setRssHSplitterSizes(m_ui->hsplitter->saveState()); }