Made sticker animation configurable

This commit is contained in:
Slava Monich 2020-11-11 03:10:34 +02:00
parent 449784883e
commit 8ca5956722
4 changed files with 30 additions and 1 deletions

View file

@ -24,7 +24,7 @@ Item {
property ListItem messageListItem
readonly property var stickerData: messageListItem.myMessage.content.sticker;
readonly property bool animated: stickerData.is_animated
readonly property bool animated: stickerData.is_animated && appSettings.animateStickers
readonly property bool stickerVisible: staticStickerLoader.item ? staticStickerLoader.item.visible :
animatedStickerLoader.item ? animatedStickerLoader.item.visible : false

View file

@ -117,6 +117,15 @@ Page {
text: qsTr("Appearance")
}
TextSwitch {
checked: appSettings.animateStickers
text: qsTr("Animate stickers")
automaticCheck: false
onClicked: {
appSettings.animateStickers = !checked
}
}
TextSwitch {
checked: appSettings.showStickersAsImages
text: qsTr("Show stickers as images")

View file

@ -24,6 +24,7 @@ namespace {
const QString KEY_SEND_BY_ENTER("sendByEnter");
const QString KEY_USE_OPEN_WITH("useOpenWith");
const QString KEY_SHOW_STICKERS_AS_IMAGES("showStickersAsImages");
const QString KEY_ANIMATE_STICKERS("animateStickers");
const QString KEY_NOTIFICATION_FEEDBACK("notificationFeedback");
}
@ -73,6 +74,20 @@ void AppSettings::setShowStickersAsImages(bool showAsImages)
}
}
bool AppSettings::animateStickers() const
{
return settings.value(KEY_ANIMATE_STICKERS, true).toBool();
}
void AppSettings::setAnimateStickers(bool animate)
{
if (animateStickers() != animate) {
LOG(KEY_ANIMATE_STICKERS << animate);
settings.setValue(KEY_ANIMATE_STICKERS, animate);
emit animateStickersChanged();
}
}
AppSettings::NotificationFeedback AppSettings::notificationFeedback() const
{
return (NotificationFeedback) settings.value(KEY_NOTIFICATION_FEEDBACK, (int) NotificationFeedbackAll).toInt();

View file

@ -26,6 +26,7 @@ class AppSettings : public QObject {
Q_PROPERTY(bool sendByEnter READ getSendByEnter WRITE setSendByEnter NOTIFY sendByEnterChanged)
Q_PROPERTY(bool useOpenWith READ getUseOpenWith WRITE setUseOpenWith NOTIFY useOpenWithChanged)
Q_PROPERTY(bool showStickersAsImages READ showStickersAsImages WRITE setShowStickersAsImages NOTIFY showStickersAsImagesChanged)
Q_PROPERTY(bool animateStickers READ animateStickers WRITE setAnimateStickers NOTIFY animateStickersChanged)
Q_PROPERTY(NotificationFeedback notificationFeedback READ notificationFeedback WRITE setNotificationFeedback NOTIFY notificationFeedbackChanged)
public:
@ -48,6 +49,9 @@ public:
bool showStickersAsImages() const;
void setShowStickersAsImages(bool showAsImages);
bool animateStickers() const;
void setAnimateStickers(bool animate);
NotificationFeedback notificationFeedback() const;
void setNotificationFeedback(NotificationFeedback feedback);
@ -55,6 +59,7 @@ signals:
void sendByEnterChanged();
void useOpenWithChanged();
void showStickersAsImagesChanged();
void animateStickersChanged();
void notificationFeedbackChanged();
private: