mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add an icon to who read context menu item.
This commit is contained in:
parent
b4bff83266
commit
79b0bbf6cf
9 changed files with 45 additions and 8 deletions
BIN
Telegram/Resources/icons/chat/seen_checks.png
Normal file
BIN
Telegram/Resources/icons/chat/seen_checks.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 551 B |
BIN
Telegram/Resources/icons/chat/seen_checks@2x.png
Normal file
BIN
Telegram/Resources/icons/chat/seen_checks@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 848 B |
BIN
Telegram/Resources/icons/chat/seen_checks@3x.png
Normal file
BIN
Telegram/Resources/icons/chat/seen_checks@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
Telegram/Resources/icons/chat/seen_played.png
Normal file
BIN
Telegram/Resources/icons/chat/seen_played.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 421 B |
BIN
Telegram/Resources/icons/chat/seen_played@2x.png
Normal file
BIN
Telegram/Resources/icons/chat/seen_played@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 718 B |
BIN
Telegram/Resources/icons/chat/seen_played@3x.png
Normal file
BIN
Telegram/Resources/icons/chat/seen_played@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -324,6 +324,20 @@ rpl::producer<Ui::WhoReadContent> WhoRead(
|
||||||
auto lifetime = rpl::lifetime();
|
auto lifetime = rpl::lifetime();
|
||||||
|
|
||||||
const auto state = lifetime.make_state<State>();
|
const auto state = lifetime.make_state<State>();
|
||||||
|
state->current.type = [&] {
|
||||||
|
if (const auto media = item->media()) {
|
||||||
|
if (!media->webpage()) {
|
||||||
|
if (const auto document = media->document()) {
|
||||||
|
if (document->isVoiceMessage()) {
|
||||||
|
return Ui::WhoReadType::Listened;
|
||||||
|
} else if (document->isVideoMessage()) {
|
||||||
|
return Ui::WhoReadType::Watched;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Ui::WhoReadType::Seen;
|
||||||
|
}();
|
||||||
const auto pushNext = [=] {
|
const auto pushNext = [=] {
|
||||||
consumer.put_next_copy(state->current);
|
consumer.put_next_copy(state->current);
|
||||||
};
|
};
|
||||||
|
@ -334,7 +348,10 @@ rpl::producer<Ui::WhoReadContent> WhoRead(
|
||||||
) | rpl::start_with_next([=](const std::vector<PeerId> &peers) {
|
) | rpl::start_with_next([=](const std::vector<PeerId> &peers) {
|
||||||
if (ListUnknown(peers, item)) {
|
if (ListUnknown(peers, item)) {
|
||||||
state->userpics.clear();
|
state->userpics.clear();
|
||||||
consumer.put_next(Ui::WhoReadContent{ .unknown = true });
|
consumer.put_next(Ui::WhoReadContent{
|
||||||
|
.type = state->current.type,
|
||||||
|
.unknown = true,
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
} else if (UpdateUserpics(state, item, peers)) {
|
} else if (UpdateUserpics(state, item, peers)) {
|
||||||
RegenerateParticipants(state, small, large);
|
RegenerateParticipants(state, small, large);
|
||||||
|
|
|
@ -869,6 +869,7 @@ WhoRead {
|
||||||
photoSize: pixels;
|
photoSize: pixels;
|
||||||
photoSkip: pixels;
|
photoSkip: pixels;
|
||||||
nameLeft: pixels;
|
nameLeft: pixels;
|
||||||
|
iconPosition: point;
|
||||||
itemPadding: margins;
|
itemPadding: margins;
|
||||||
}
|
}
|
||||||
defaultWhoRead: WhoRead {
|
defaultWhoRead: WhoRead {
|
||||||
|
@ -882,7 +883,8 @@ defaultWhoRead: WhoRead {
|
||||||
photoSize: 30px;
|
photoSize: 30px;
|
||||||
photoSkip: 5px;
|
photoSkip: 5px;
|
||||||
nameLeft: 57px;
|
nameLeft: 57px;
|
||||||
itemPadding: margins(17px, 8px, 17px, 6px);
|
iconPosition: point(14px, 9px);
|
||||||
|
itemPadding: margins(38px, 8px, 17px, 6px);
|
||||||
}
|
}
|
||||||
whoReadMenu: PopupMenu(defaultPopupMenu) {
|
whoReadMenu: PopupMenu(defaultPopupMenu) {
|
||||||
scrollPadding: margins(0px, 6px, 0px, 6px);
|
scrollPadding: margins(0px, 6px, 0px, 6px);
|
||||||
|
@ -891,3 +893,9 @@ whoReadMenu: PopupMenu(defaultPopupMenu) {
|
||||||
separatorPadding: margins(0px, 6px, 0px, 8px);
|
separatorPadding: margins(0px, 6px, 0px, 8px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
whoReadChecks: icon{{ "chat/seen_checks", windowFg }};
|
||||||
|
whoReadChecksOver: icon{{ "chat/seen_checks", windowFgOver }};
|
||||||
|
whoReadChecksDisabled: icon{{ "chat/seen_checks", menuFgDisabled }};
|
||||||
|
whoReadPlayed: icon{{ "chat/seen_played", windowFg }};
|
||||||
|
whoReadPlayedOver: icon{{ "chat/seen_played", windowFgOver }};
|
||||||
|
whoReadPlayedDisabled: icon {{ "chat/seen_played", menuFgDisabled }};
|
||||||
|
|
|
@ -251,11 +251,11 @@ void Action::resolveMinWidth() {
|
||||||
width(tr::lng_context_seen_text(tr::now, lt_count, 999)),
|
width(tr::lng_context_seen_text(tr::now, lt_count, 999)),
|
||||||
width(tr::lng_context_seen_listened(tr::now, lt_count, 999)),
|
width(tr::lng_context_seen_listened(tr::now, lt_count, 999)),
|
||||||
width(tr::lng_context_seen_watched(tr::now, lt_count, 999)) });
|
width(tr::lng_context_seen_watched(tr::now, lt_count, 999)) });
|
||||||
const auto maxWidth = _st.itemPadding.left()
|
const auto maxWidth = st::defaultWhoRead.itemPadding.left()
|
||||||
+ maxIconWidth
|
+ maxIconWidth
|
||||||
+ maxTextWidth
|
+ maxTextWidth
|
||||||
+ _userpics->maxWidth()
|
+ _userpics->maxWidth()
|
||||||
+ _st.itemPadding.right();
|
+ st::defaultWhoRead.itemPadding.right();
|
||||||
setMinWidth(maxWidth);
|
setMinWidth(maxWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,6 +330,18 @@ void Action::paint(Painter &p) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
paintRipple(p, 0, 0);
|
paintRipple(p, 0, 0);
|
||||||
}
|
}
|
||||||
|
const auto &icon = (_content.type == WhoReadType::Seen)
|
||||||
|
? (!enabled
|
||||||
|
? st::whoReadChecksDisabled
|
||||||
|
: selected
|
||||||
|
? st::whoReadChecksOver
|
||||||
|
: st::whoReadChecks)
|
||||||
|
: (!enabled
|
||||||
|
? st::whoReadPlayedDisabled
|
||||||
|
: selected
|
||||||
|
? st::whoReadPlayedOver
|
||||||
|
: st::whoReadPlayed);
|
||||||
|
icon.paint(p, st::defaultWhoRead.iconPosition, width());
|
||||||
p.setPen(!enabled
|
p.setPen(!enabled
|
||||||
? _st.itemFgDisabled
|
? _st.itemFgDisabled
|
||||||
: selected
|
: selected
|
||||||
|
@ -337,13 +349,13 @@ void Action::paint(Painter &p) {
|
||||||
: _st.itemFg);
|
: _st.itemFg);
|
||||||
_text.drawLeftElided(
|
_text.drawLeftElided(
|
||||||
p,
|
p,
|
||||||
_st.itemPadding.left(),
|
st::defaultWhoRead.itemPadding.left(),
|
||||||
_st.itemPadding.top(),
|
st::defaultWhoRead.itemPadding.top(),
|
||||||
_textWidth,
|
_textWidth,
|
||||||
width());
|
width());
|
||||||
_userpics->paint(
|
_userpics->paint(
|
||||||
p,
|
p,
|
||||||
width() - _st.itemPadding.right(),
|
width() - st::defaultWhoRead.itemPadding.right(),
|
||||||
(height() - st::defaultWhoRead.userpics.size) / 2,
|
(height() - st::defaultWhoRead.userpics.size) / 2,
|
||||||
st::defaultWhoRead.userpics.size);
|
st::defaultWhoRead.userpics.size);
|
||||||
}
|
}
|
||||||
|
@ -372,7 +384,7 @@ void Action::refreshText() {
|
||||||
|
|
||||||
void Action::refreshDimensions() {
|
void Action::refreshDimensions() {
|
||||||
const auto textWidth = _text.maxWidth();
|
const auto textWidth = _text.maxWidth();
|
||||||
const auto &padding = _st.itemPadding;
|
const auto &padding = st::defaultWhoRead.itemPadding;
|
||||||
|
|
||||||
const auto goodWidth = padding.left()
|
const auto goodWidth = padding.left()
|
||||||
+ textWidth
|
+ textWidth
|
||||||
|
|
Loading…
Add table
Reference in a new issue