mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
For testing show self reaction in bold.
This commit is contained in:
parent
b1668afdf1
commit
57cb921bb9
2 changed files with 17 additions and 8 deletions
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/chat/message_bubble.h"
|
#include "ui/chat/message_bubble.h"
|
||||||
#include "ui/chat/chat_style.h"
|
#include "ui/chat/chat_style.h"
|
||||||
#include "ui/text/text_options.h"
|
#include "ui/text/text_options.h"
|
||||||
|
#include "ui/text/text_utilities.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "history/history_item_components.h"
|
#include "history/history_item_components.h"
|
||||||
#include "history/history_message.h"
|
#include "history/history_message.h"
|
||||||
|
@ -283,18 +284,24 @@ void BottomInfo::layoutReactionsText() {
|
||||||
}) | ranges::to_vector;
|
}) | ranges::to_vector;
|
||||||
ranges::sort(sorted, std::greater<>(), &std::pair<QString, int>::second);
|
ranges::sort(sorted, std::greater<>(), &std::pair<QString, int>::second);
|
||||||
|
|
||||||
auto fullCount = 0;
|
auto text = TextWithEntities();
|
||||||
auto text = QString();
|
|
||||||
for (const auto &[string, count] : sorted) {
|
for (const auto &[string, count] : sorted) {
|
||||||
//for (auto i = 0, n = rand_value<uint8>() % 8 + 1; i != n; ++i) {
|
if (!text.text.isEmpty()) {
|
||||||
// text.append(string);
|
text.append(" - ");
|
||||||
//}
|
}
|
||||||
|
const auto chosen = (_data.chosenReaction == string);
|
||||||
text.append(string);
|
text.append(string);
|
||||||
fullCount += count;
|
if (_data.chosenReaction == string) {
|
||||||
|
text.append(Ui::Text::Bold(QString::number(count)));
|
||||||
|
} else {
|
||||||
|
text.append(QString::number(count));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
text += QString::number(fullCount);
|
|
||||||
|
|
||||||
_reactions.setText(st::msgDateTextStyle, text, Ui::NameTextOptions());
|
_reactions.setMarkedText(
|
||||||
|
st::msgDateTextStyle,
|
||||||
|
text,
|
||||||
|
Ui::NameTextOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BottomInfo::countOptimalSize() {
|
void BottomInfo::countOptimalSize() {
|
||||||
|
@ -327,6 +334,7 @@ BottomInfo::Data BottomInfoDataFromMessage(not_null<Message*> message) {
|
||||||
const auto item = message->message();
|
const auto item = message->message();
|
||||||
result.date = message->dateTime();
|
result.date = message->dateTime();
|
||||||
result.reactions = item->reactions();
|
result.reactions = item->reactions();
|
||||||
|
result.chosenReaction = item->chosenReaction();
|
||||||
if (message->hasOutLayout()) {
|
if (message->hasOutLayout()) {
|
||||||
result.flags |= Flag::OutLayout;
|
result.flags |= Flag::OutLayout;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
QDateTime date;
|
QDateTime date;
|
||||||
QString author;
|
QString author;
|
||||||
base::flat_map<QString, int> reactions;
|
base::flat_map<QString, int> reactions;
|
||||||
|
QString chosenReaction;
|
||||||
std::optional<int> views;
|
std::optional<int> views;
|
||||||
std::optional<int> replies;
|
std::optional<int> replies;
|
||||||
Flags flags;
|
Flags flags;
|
||||||
|
|
Loading…
Add table
Reference in a new issue