diff --git a/src/appsettings.cpp b/src/appsettings.cpp index 858e768..3c3049e 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -22,6 +22,7 @@ namespace { const QString KEY_SEND_BY_ENTER("sendByEnter"); + const QString KEY_SHOW_STICKERS_AS_IMAGES("showStickersAsImages"); } AppSettings::AppSettings(QObject *parent) : QObject(parent), settings("harbour-fernschreiber", "settings") @@ -41,3 +42,17 @@ void AppSettings::setSendByEnter(bool sendByEnter) emit sendByEnterChanged(); } } + +bool AppSettings::showStickersAsImages() const +{ + return settings.value(KEY_SHOW_STICKERS_AS_IMAGES, true).toBool(); +} + +void AppSettings::setShowStickersAsImages(bool showAsImages) +{ + if (showStickersAsImages() != showAsImages) { + LOG(KEY_SHOW_STICKERS_AS_IMAGES << showAsImages); + settings.setValue(KEY_SHOW_STICKERS_AS_IMAGES, showAsImages); + emit showStickersAsImagesChanged(); + } +} diff --git a/src/appsettings.h b/src/appsettings.h index 96124c5..08af6eb 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -24,6 +24,7 @@ class AppSettings : public QObject { Q_OBJECT Q_PROPERTY(bool sendByEnter READ getSendByEnter WRITE setSendByEnter NOTIFY sendByEnterChanged) + Q_PROPERTY(bool showStickersAsImages READ showStickersAsImages WRITE setShowStickersAsImages NOTIFY showStickersAsImagesChanged) public: AppSettings(QObject *parent = Q_NULLPTR); @@ -31,8 +32,12 @@ public: bool getSendByEnter() const; void setSendByEnter(bool sendByEnter); + bool showStickersAsImages() const; + void setShowStickersAsImages(bool showAsImages); + signals: void sendByEnterChanged(); + void showStickersAsImagesChanged(); private: QSettings settings;