2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add "Reaction button in messages" setting.

This commit is contained in:
John Preston
2022-09-13 07:44:22 +04:00
parent 20a5950f99
commit 1363faddbf
8 changed files with 63 additions and 2 deletions

View File

@@ -153,7 +153,7 @@ QByteArray Settings::serialize() const {
+ Serialize::stringSize(_customDeviceModel.current())
+ sizeof(qint32) * 4
+ (_accountsOrder.size() * sizeof(quint64))
+ sizeof(qint32) * 4;
+ sizeof(qint32) * 5;
auto result = QByteArray();
result.reserve(size);
@@ -266,7 +266,8 @@ QByteArray Settings::serialize() const {
<< qint32(0) // old hardwareAcceleratedVideo
<< qint32(_chatQuickAction)
<< qint32(_hardwareAcceleratedVideo ? 1 : 0)
<< qint32(_suggestAnimatedEmoji ? 1 : 0);
<< qint32(_suggestAnimatedEmoji ? 1 : 0)
<< qint32(_cornerReaction.current() ? 1 : 0);
}
return result;
}
@@ -359,6 +360,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
qint32 hardwareAcceleratedVideo = _hardwareAcceleratedVideo ? 1 : 0;
qint32 chatQuickAction = static_cast<qint32>(_chatQuickAction);
qint32 suggestAnimatedEmoji = _suggestAnimatedEmoji ? 1 : 0;
qint32 cornerReaction = _cornerReaction.current() ? 1 : 0;
stream >> themesAccentColors;
if (!stream.atEnd()) {
@@ -553,6 +555,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
if (!stream.atEnd()) {
stream >> suggestAnimatedEmoji;
}
if (!stream.atEnd()) {
stream >> cornerReaction;
}
if (stream.status() != QDataStream::Ok) {
LOG(("App Error: "
"Bad data for Core::Settings::constructFromSerialized()"));
@@ -721,6 +726,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
}
}
_suggestAnimatedEmoji = (suggestAnimatedEmoji == 1);
_cornerReaction = (cornerReaction == 1);
}
QString Settings::getSoundPath(const QString &key) const {

View File

@@ -410,6 +410,18 @@ public:
void setSuggestAnimatedEmoji(bool value) {
_suggestAnimatedEmoji = value;
}
void setCornerReaction(bool value) {
_cornerReaction = value;
}
[[nodiscard]] bool cornerReaction() const {
return _cornerReaction.current();
}
[[nodiscard]] rpl::producer<bool> cornerReactionValue() const {
return _cornerReaction.value();
}
[[nodiscard]] rpl::producer<bool> cornerReactionChanges() const {
return _cornerReaction.changes();
}
void setSpellcheckerEnabled(bool value) {
_spellcheckerEnabled = value;
@@ -782,6 +794,7 @@ private:
bool _suggestEmoji = true;
bool _suggestStickersByEmoji = true;
bool _suggestAnimatedEmoji = true;
rpl::variable<bool> _cornerReaction = true;
rpl::variable<bool> _spellcheckerEnabled = true;
rpl::variable<float64> _videoPlaybackSpeed = 1.;
float64 _voicePlaybackSpeed = 2.;