diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp
index 80947950..265e45a6 100644
--- a/src/UserSettingsPage.cpp
+++ b/src/UserSettingsPage.cpp
@@ -71,6 +71,7 @@ UserSettings::load(std::optional<QString> profile)
settings.value(QStringLiteral("user/timeline/enlarge_emoji_only_msg"), false).toBool();
markdown_ = settings.value(QStringLiteral("user/markdown_enabled"), true).toBool();
bubbles_ = settings.value(QStringLiteral("user/bubbles_enabled"), true).toBool();
+ smallAvatars_ = settings.value(QStringLiteral("user/small_avatars_enabled"), true).toBool();
animateImagesOnHover_ =
settings.value(QStringLiteral("user/animate_images_on_hover"), false).toBool();
typingNotifications_ =
@@ -254,6 +255,16 @@ UserSettings::setBubbles(bool state)
}
void
+UserSettings::setSmallAvatars(bool state)
+{
+ if (state == smallAvatars_)
+ return;
+ smallAvatars_ = state;
+ emit smallAvatarsChanged(state);
+ save();
+}
+
+void
UserSettings::setAnimateImagesOnHover(bool state)
{
if (state == animateImagesOnHover_)
@@ -708,6 +719,7 @@ UserSettings::save()
settings.setValue(QStringLiteral("group_view"), groupView_);
settings.setValue(QStringLiteral("markdown_enabled"), markdown_);
settings.setValue(QStringLiteral("bubbles_enabled"), bubbles_);
+ settings.setValue(QStringLiteral("small_avatars_enabled"), smallAvatars_);
settings.setValue(QStringLiteral("animate_images_on_hover"), animateImagesOnHover_);
settings.setValue(QStringLiteral("desktop_notifications"), hasDesktopNotifications_);
settings.setValue(QStringLiteral("alert_on_notification"), hasAlertOnNotification_);
@@ -810,6 +822,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
return tr("Send messages as Markdown");
case Bubbles:
return tr("Enable message bubbles");
+ case SmallAvatars:
+ return tr("Enable small Avatars");
case AnimateImagesOnHover:
return tr("Play animated images only on hover");
case TypingNotifications:
@@ -932,6 +946,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
return i->markdown();
case Bubbles:
return i->bubbles();
+ case SmallAvatars:
+ return i->smallAvatars();
case AnimateImagesOnHover:
return i->animateImagesOnHover();
case TypingNotifications:
@@ -1061,6 +1077,9 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
case Bubbles:
return tr(
"Messages get a bubble background. This also triggers some layout changes (WIP).");
+ case SmallAvatars:
+ return tr(
+ "Avatars are resized to fit above the message.");
case AnimateImagesOnHover:
return tr("Plays media like GIFs or WEBPs only when explicitly hovering over them.");
case TypingNotifications:
@@ -1178,6 +1197,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
case GroupView:
case Markdown:
case Bubbles:
+ case SmallAvatars:
case AnimateImagesOnHover:
case TypingNotifications:
case SortByImportance:
@@ -1402,6 +1422,13 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
} else
return false;
}
+ case SmallAvatars: {
+ if (value.userType() == QMetaType::Bool) {
+ i->setSmallAvatars(value.toBool());
+ return true;
+ } else
+ return false;
+ }
case AnimateImagesOnHover: {
if (value.userType() == QMetaType::Bool) {
i->setAnimateImagesOnHover(value.toBool());
@@ -1767,7 +1794,9 @@ UserSettingsModel::UserSettingsModel(QObject *p)
connect(s.get(), &UserSettings::bubblesChanged, this, [this]() {
emit dataChanged(index(Bubbles), index(Bubbles), {Value});
});
-
+ connect(s.get(), &UserSettings::smallAvatarsChanged, this, [this]() {
+ emit dataChanged(index(SmallAvatars), index(SmallAvatars), {Value});
+ });
connect(s.get(), &UserSettings::groupViewStateChanged, this, [this]() {
emit dataChanged(index(GroupView), index(GroupView), {Value});
});
diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h
index e5d22f6a..8f76c58f 100644
--- a/src/UserSettingsPage.h
+++ b/src/UserSettingsPage.h
@@ -41,6 +41,7 @@ class UserSettings : public QObject
Q_PROPERTY(bool groupView READ groupView WRITE setGroupView NOTIFY groupViewStateChanged)
Q_PROPERTY(bool markdown READ markdown WRITE setMarkdown NOTIFY markdownChanged)
Q_PROPERTY(bool bubbles READ bubbles WRITE setBubbles NOTIFY bubblesChanged)
+ Q_PROPERTY(bool smallAvatars READ smallAvatars WRITE setSmallAvatars NOTIFY smallAvatarsChanged)
Q_PROPERTY(bool animateImagesOnHover READ animateImagesOnHover WRITE setAnimateImagesOnHover
NOTIFY animateImagesOnHoverChanged)
Q_PROPERTY(bool typingNotifications READ typingNotifications WRITE setTypingNotifications NOTIFY
@@ -141,6 +142,7 @@ public:
void setGroupView(bool state);
void setMarkdown(bool state);
void setBubbles(bool state);
+ void setSmallAvatars(bool state);
void setAnimateImagesOnHover(bool state);
void setReadReceipts(bool state);
void setTypingNotifications(bool state);
@@ -193,6 +195,7 @@ public:
int privacyScreenTimeout() const { return privacyScreenTimeout_; }
bool markdown() const { return markdown_; }
bool bubbles() const { return bubbles_; }
+ bool smallAvatars() const { return smallAvatars_; }
bool animateImagesOnHover() const { return animateImagesOnHover_; }
bool typingNotifications() const { return typingNotifications_; }
bool sortByImportance() const { return sortByImportance_; }
@@ -251,6 +254,7 @@ signals:
void startInTrayChanged(bool state);
void markdownChanged(bool state);
void bubblesChanged(bool state);
+ void smallAvatarsChanged(bool state);
void animateImagesOnHoverChanged(bool state);
void typingNotificationsChanged(bool state);
void buttonInTimelineChanged(bool state);
@@ -307,6 +311,7 @@ private:
bool groupView_;
bool markdown_;
bool bubbles_;
+ bool smallAvatars_;
bool animateImagesOnHover_;
bool typingNotifications_;
bool sortByImportance_;
@@ -386,7 +391,7 @@ class UserSettingsModel : public QAbstractListModel
ButtonsInTimeline,
Markdown,
Bubbles,
-
+ SmallAvatars,
SidebarSection,
GroupView,
SortByImportance,
|