mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +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/chat_style.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/history_message.h"
|
||||
|
@ -283,18 +284,24 @@ void BottomInfo::layoutReactionsText() {
|
|||
}) | ranges::to_vector;
|
||||
ranges::sort(sorted, std::greater<>(), &std::pair<QString, int>::second);
|
||||
|
||||
auto fullCount = 0;
|
||||
auto text = QString();
|
||||
auto text = TextWithEntities();
|
||||
for (const auto &[string, count] : sorted) {
|
||||
//for (auto i = 0, n = rand_value<uint8>() % 8 + 1; i != n; ++i) {
|
||||
// text.append(string);
|
||||
//}
|
||||
if (!text.text.isEmpty()) {
|
||||
text.append(" - ");
|
||||
}
|
||||
const auto chosen = (_data.chosenReaction == 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() {
|
||||
|
@ -327,6 +334,7 @@ BottomInfo::Data BottomInfoDataFromMessage(not_null<Message*> message) {
|
|||
const auto item = message->message();
|
||||
result.date = message->dateTime();
|
||||
result.reactions = item->reactions();
|
||||
result.chosenReaction = item->chosenReaction();
|
||||
if (message->hasOutLayout()) {
|
||||
result.flags |= Flag::OutLayout;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
QDateTime date;
|
||||
QString author;
|
||||
base::flat_map<QString, int> reactions;
|
||||
QString chosenReaction;
|
||||
std::optional<int> views;
|
||||
std::optional<int> replies;
|
||||
Flags flags;
|
||||
|
|
Loading…
Add table
Reference in a new issue