remember the showAll option through app restarts, closes #63

This commit is contained in:
Hauke Schade 2014-04-11 09:37:15 +02:00
parent 620a1781a6
commit f6c24ccc50
4 changed files with 23 additions and 2 deletions

View file

@ -24,6 +24,7 @@ MenuItem {
var ttrss = rootWindow.getTTRSS()
ttrss.setShowAll(!showAll)
showAll = !showAll
settings.showAll = showAll
}
onShowAllChanged: {
@ -33,8 +34,9 @@ MenuItem {
}
Component.onCompleted: {
showAll = settings.showAll
var ttrss = rootWindow.getTTRSS()
showAll = ttrss.getShowAll()
ttrss.setShowAll(showAll)
notInitialAssignment = true
}

View file

@ -22,6 +22,7 @@ MenuItem {
var ttrss = rootWindow.getTTRSS()
ttrss.setShowAll(!showAll)
showAll = !showAll
settings.showAll = showAll
}
onShowAllChanged: {
@ -31,8 +32,9 @@ MenuItem {
}
Component.onCompleted: {
showAll = settings.showAll
var ttrss = rootWindow.getTTRSS()
showAll = ttrss.getShowAll()
ttrss.setShowAll(showAll)
notInitialAssignment = true
}

View file

@ -142,6 +142,14 @@ void Settings::setWhiteBackgroundOnIcons(bool whiteBackgroundOnIcons) {
}
}
void Settings::setShowAll(bool showAll) {
if (_showAll != showAll) {
_showAll = showAll;
m_settings->setValue("showAll", _showAll);
emit showAllChanged();
}
}
Settings::Settings(QObject *parent) : QObject(parent), m_settings(new QSettings(this)) {
_servername = m_settings->value("servername", "http://").toString();
_username = m_settings->value("username", "").toString();
@ -160,4 +168,5 @@ Settings::Settings(QObject *parent) : QObject(parent), m_settings(new QSettings(
_autoMarkRead = m_settings->value("autoMarkRead", true).toBool();
_useAllFeedsOnStartup = m_settings->value("useAllFeedsOnStartup", false).toBool();
_whiteBackgroundOnIcons = m_settings->value("whiteBackgroundOnIcons", true).toBool();
_showAll = m_settings->value("showAll", false).toBool();
}

View file

@ -28,6 +28,7 @@ class Settings : public QObject
Q_PROPERTY(bool autoMarkRead READ autoMarkRead WRITE setAutoMarkRead NOTIFY autoMarkReadChanged)
Q_PROPERTY(bool useAllFeedsOnStartup READ useAllFeedsOnStartup WRITE setUseAllFeedsOnStartup NOTIFY useAllFeedsOnStartupChanged)
Q_PROPERTY(bool whiteBackgroundOnIcons READ whiteBackgroundOnIcons WRITE setWhiteBackgroundOnIcons NOTIFY whiteBackgroundOnIconsChanged)
Q_PROPERTY(bool showAll READ showAll WRITE setShowAll NOTIFY showAllChanged)
public:
static Settings *instance();
@ -106,6 +107,11 @@ public:
}
void setWhiteBackgroundOnIcons(bool whiteBackgroundOnIcons);
bool showAll() const {
return this->_showAll;
}
void setShowAll(bool showAll);
signals:
void servernameChanged();
void usernameChanged();
@ -124,6 +130,7 @@ signals:
void autoMarkReadChanged();
void useAllFeedsOnStartupChanged();
void whiteBackgroundOnIconsChanged();
void showAllChanged();
private:
static QScopedPointer<Settings> m_instance;
@ -150,5 +157,6 @@ private:
bool _autoMarkRead;
bool _useAllFeedsOnStartup;
bool _whiteBackgroundOnIcons;
bool _showAll;
};
#endif // SETTINGS_HH