[sailfish] Make it optional to display labels in item list

This commit is contained in:
Michael Käufl 2014-10-02 01:18:51 +02:00
parent 4b7b50c090
commit c57ac0e463
4 changed files with 26 additions and 2 deletions

View file

@ -108,12 +108,12 @@ ListItem {
Grid {
spacing: Theme.paddingSmall
width: parent.width
visible: labels.count > 0
visible: settings.displayLabels ? (labels.count > 0) : false
property var labels: model.labels
Repeater {
model: labels.count
model: settings.displayLabels ? labels.count : 0
LabelLabel {
label: labels.get(index)
}

View file

@ -105,6 +105,12 @@ Dialog {
checked: settings.autoMarkRead
}
TextSwitch {
id: displayLabelsSetting
text: qsTr('Display Labels in Item List')
checked: settings.displayLabels
}
// -- Icons --
Label {
width: parent.width
@ -202,5 +208,6 @@ Dialog {
settings.displayImages = displayImagesSetting.checked
settings.stripInvisibleImg = stripInvisibleImgSetting.checked
settings.webviewFontSize = fontSizeSetting.value
settings.displayLabels = displayLabelsSetting.checked
}
}

View file

@ -175,6 +175,14 @@ void Settings::setStripInvisibleImg(bool stripInvisibleImg) {
}
}
void Settings::setDisplayLabels(bool displayLabels) {
if (_displayLabels != displayLabels) {
_displayLabels = displayLabels;
m_settings->setValue("displayLabels", _displayLabels);
emit displayLabelsChanged();
}
}
Settings::Settings(QObject *parent) : QObject(parent), m_settings(new QSettings(this)) {
_servername = m_settings->value("servername", "http://").toString();
_username = m_settings->value("username", "").toString();
@ -196,4 +204,5 @@ Settings::Settings(QObject *parent) : QObject(parent), m_settings(new QSettings(
_showAll = m_settings->value("showAll", false).toBool();
_displayImages = m_settings->value("displayImages", true).toBool();
_stripInvisibleImg = m_settings->value("stripInvisibleImg", false).toBool();
_displayLabels = m_settings->value("displayLabels", true).toBool();
}

View file

@ -51,6 +51,7 @@ class Settings : public QObject
Q_PROPERTY(bool showAll READ showAll WRITE setShowAll NOTIFY showAllChanged)
Q_PROPERTY(bool displayImages READ displayImages WRITE setDisplayImages NOTIFY displayImagesChanged)
Q_PROPERTY(bool stripInvisibleImg READ stripInvisibleImg WRITE setStripInvisibleImg NOTIFY stripInvisibleImgChanged)
Q_PROPERTY(bool displayLabels READ displayLabels WRITE setDisplayLabels NOTIFY displayLabelsChanged)
public:
static Settings *instance();
@ -144,6 +145,11 @@ public:
}
void setStripInvisibleImg(bool stripInvisibleImg);
bool displayLabels() const {
return this->_displayLabels;
}
void setDisplayLabels(bool displayLabels);
signals:
void servernameChanged();
void usernameChanged();
@ -165,6 +171,7 @@ signals:
void showAllChanged();
void displayImagesChanged();
void stripInvisibleImgChanged();
void displayLabelsChanged();
private:
static QScopedPointer<Settings> m_instance;
@ -194,5 +201,6 @@ private:
bool _showAll;
bool _displayImages;
bool _stripInvisibleImg;
bool _displayLabels;
};
#endif // SETTINGS_HH