|
|
@ -73,6 +73,7 @@ UserSettings::load(std::optional<QString> profile) |
|
|
|
markdown_ = settings.value(QStringLiteral("user/markdown_enabled"), true).toBool(); |
|
|
|
markdown_ = settings.value(QStringLiteral("user/markdown_enabled"), true).toBool(); |
|
|
|
bubbles_ = settings.value(QStringLiteral("user/bubbles_enabled"), false).toBool(); |
|
|
|
bubbles_ = settings.value(QStringLiteral("user/bubbles_enabled"), false).toBool(); |
|
|
|
smallAvatars_ = settings.value(QStringLiteral("user/small_avatars_enabled"), false).toBool(); |
|
|
|
smallAvatars_ = settings.value(QStringLiteral("user/small_avatars_enabled"), false).toBool(); |
|
|
|
|
|
|
|
invertEnterKey_ = settings.value(QStringLiteral("user/invert_enter_key"), false).toBool(); |
|
|
|
animateImagesOnHover_ = |
|
|
|
animateImagesOnHover_ = |
|
|
|
settings.value(QStringLiteral("user/animate_images_on_hover"), false).toBool(); |
|
|
|
settings.value(QStringLiteral("user/animate_images_on_hover"), false).toBool(); |
|
|
|
typingNotifications_ = |
|
|
|
typingNotifications_ = |
|
|
@ -309,6 +310,17 @@ UserSettings::setSmallAvatars(bool state) |
|
|
|
save(); |
|
|
|
save(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
|
|
|
UserSettings::setInvertEnterKey(bool state) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (state == invertEnterKey_) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
invertEnterKey_ = state; |
|
|
|
|
|
|
|
emit invertEnterKeyChanged(state); |
|
|
|
|
|
|
|
save(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
|
UserSettings::setAnimateImagesOnHover(bool state) |
|
|
|
UserSettings::setAnimateImagesOnHover(bool state) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -822,6 +834,7 @@ UserSettings::save() |
|
|
|
settings.setValue(QStringLiteral("markdown_enabled"), markdown_); |
|
|
|
settings.setValue(QStringLiteral("markdown_enabled"), markdown_); |
|
|
|
settings.setValue(QStringLiteral("bubbles_enabled"), bubbles_); |
|
|
|
settings.setValue(QStringLiteral("bubbles_enabled"), bubbles_); |
|
|
|
settings.setValue(QStringLiteral("small_avatars_enabled"), smallAvatars_); |
|
|
|
settings.setValue(QStringLiteral("small_avatars_enabled"), smallAvatars_); |
|
|
|
|
|
|
|
settings.setValue(QStringLiteral("invert_enter_key"), invertEnterKey_); |
|
|
|
settings.setValue(QStringLiteral("animate_images_on_hover"), animateImagesOnHover_); |
|
|
|
settings.setValue(QStringLiteral("animate_images_on_hover"), animateImagesOnHover_); |
|
|
|
settings.setValue(QStringLiteral("desktop_notifications"), hasDesktopNotifications_); |
|
|
|
settings.setValue(QStringLiteral("desktop_notifications"), hasDesktopNotifications_); |
|
|
|
settings.setValue(QStringLiteral("alert_on_notification"), hasAlertOnNotification_); |
|
|
|
settings.setValue(QStringLiteral("alert_on_notification"), hasAlertOnNotification_); |
|
|
@ -931,6 +944,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
return tr("Enable message bubbles"); |
|
|
|
return tr("Enable message bubbles"); |
|
|
|
case SmallAvatars: |
|
|
|
case SmallAvatars: |
|
|
|
return tr("Enable small Avatars"); |
|
|
|
return tr("Enable small Avatars"); |
|
|
|
|
|
|
|
case InvertEnterKey: |
|
|
|
|
|
|
|
return tr("Use shift+enter to send and enter to start a new line"); |
|
|
|
case AnimateImagesOnHover: |
|
|
|
case AnimateImagesOnHover: |
|
|
|
return tr("Play animated images only on hover"); |
|
|
|
return tr("Play animated images only on hover"); |
|
|
|
case TypingNotifications: |
|
|
|
case TypingNotifications: |
|
|
@ -1065,6 +1080,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
return i->bubbles(); |
|
|
|
return i->bubbles(); |
|
|
|
case SmallAvatars: |
|
|
|
case SmallAvatars: |
|
|
|
return i->smallAvatars(); |
|
|
|
return i->smallAvatars(); |
|
|
|
|
|
|
|
case InvertEnterKey: |
|
|
|
|
|
|
|
return i->invertEnterKey(); |
|
|
|
case AnimateImagesOnHover: |
|
|
|
case AnimateImagesOnHover: |
|
|
|
return i->animateImagesOnHover(); |
|
|
|
return i->animateImagesOnHover(); |
|
|
|
case TypingNotifications: |
|
|
|
case TypingNotifications: |
|
|
@ -1206,6 +1223,10 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
"Messages get a bubble background. This also triggers some layout changes (WIP)."); |
|
|
|
"Messages get a bubble background. This also triggers some layout changes (WIP)."); |
|
|
|
case SmallAvatars: |
|
|
|
case SmallAvatars: |
|
|
|
return tr("Avatars are resized to fit above the message."); |
|
|
|
return tr("Avatars are resized to fit above the message."); |
|
|
|
|
|
|
|
case InvertEnterKey: |
|
|
|
|
|
|
|
return tr( |
|
|
|
|
|
|
|
"Invert the behavior of the enter key in the text input, making it send the message " |
|
|
|
|
|
|
|
"when shift+enter is pressed and starting a new line when enter is pressed."); |
|
|
|
case AnimateImagesOnHover: |
|
|
|
case AnimateImagesOnHover: |
|
|
|
return tr("Plays media like GIFs or WEBPs only when explicitly hovering over them."); |
|
|
|
return tr("Plays media like GIFs or WEBPs only when explicitly hovering over them."); |
|
|
|
case TypingNotifications: |
|
|
|
case TypingNotifications: |
|
|
@ -1345,6 +1366,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
case Markdown: |
|
|
|
case Markdown: |
|
|
|
case Bubbles: |
|
|
|
case Bubbles: |
|
|
|
case SmallAvatars: |
|
|
|
case SmallAvatars: |
|
|
|
|
|
|
|
case InvertEnterKey: |
|
|
|
case AnimateImagesOnHover: |
|
|
|
case AnimateImagesOnHover: |
|
|
|
case TypingNotifications: |
|
|
|
case TypingNotifications: |
|
|
|
case SortByImportance: |
|
|
|
case SortByImportance: |
|
|
@ -1582,6 +1604,13 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int |
|
|
|
} else |
|
|
|
} else |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case InvertEnterKey: { |
|
|
|
|
|
|
|
if (value.userType() == QMetaType::Bool) { |
|
|
|
|
|
|
|
i->setInvertEnterKey(value.toBool()); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} else |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
case AnimateImagesOnHover: { |
|
|
|
case AnimateImagesOnHover: { |
|
|
|
if (value.userType() == QMetaType::Bool) { |
|
|
|
if (value.userType() == QMetaType::Bool) { |
|
|
|
i->setAnimateImagesOnHover(value.toBool()); |
|
|
|
i->setAnimateImagesOnHover(value.toBool()); |
|
|
@ -1990,6 +2019,9 @@ UserSettingsModel::UserSettingsModel(QObject *p) |
|
|
|
connect(s.get(), &UserSettings::smallAvatarsChanged, this, [this]() { |
|
|
|
connect(s.get(), &UserSettings::smallAvatarsChanged, this, [this]() { |
|
|
|
emit dataChanged(index(SmallAvatars), index(SmallAvatars), {Value}); |
|
|
|
emit dataChanged(index(SmallAvatars), index(SmallAvatars), {Value}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
connect(s.get(), &UserSettings::invertEnterKeyChanged, this, [this]() { |
|
|
|
|
|
|
|
emit dataChanged(index(InvertEnterKey), index(InvertEnterKey), {Value}); |
|
|
|
|
|
|
|
}); |
|
|
|
connect(s.get(), &UserSettings::groupViewStateChanged, this, [this]() { |
|
|
|
connect(s.get(), &UserSettings::groupViewStateChanged, this, [this]() { |
|
|
|
emit dataChanged(index(GroupView), index(GroupView), {Value}); |
|
|
|
emit dataChanged(index(GroupView), index(GroupView), {Value}); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -2002,7 +2034,7 @@ UserSettingsModel::UserSettingsModel(QObject *p) |
|
|
|
connect(s.get(), &UserSettings::decryptNotificationsChanged, this, [this]() { |
|
|
|
connect(s.get(), &UserSettings::decryptNotificationsChanged, this, [this]() { |
|
|
|
emit dataChanged(index(DecryptNotifications), index(DecryptNotifications), {Value}); |
|
|
|
emit dataChanged(index(DecryptNotifications), index(DecryptNotifications), {Value}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
connect(s.get(), &UserSettings::spaceNotificationsChanged, this, [this] { |
|
|
|
connect(s.get(), &UserSettings::spaceNotificationsChanged, this, [this]() { |
|
|
|
emit dataChanged(index(SpaceNotifications), index(SpaceNotifications), {Value}); |
|
|
|
emit dataChanged(index(SpaceNotifications), index(SpaceNotifications), {Value}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
connect(s.get(), &UserSettings::trayChanged, this, [this]() { |
|
|
|
connect(s.get(), &UserSettings::trayChanged, this, [this]() { |
|
|
|