mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-04 00:25:17 +00:00
Show emoji status in chats list / top bar.
This commit is contained in:
@@ -122,6 +122,7 @@ struct InnerWidget::PeerSearchResult {
|
||||
}
|
||||
not_null<PeerData*> peer;
|
||||
mutable Ui::Text::String name;
|
||||
mutable Ui::PeerBadge badge;
|
||||
BasicRow row;
|
||||
};
|
||||
|
||||
@@ -614,7 +615,14 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
||||
const auto selected = (from == (isPressed()
|
||||
? _peerSearchPressed
|
||||
: _peerSearchSelected));
|
||||
paintPeerSearchResult(p, result.get(), fullWidth, active, selected);
|
||||
paintPeerSearchResult(
|
||||
p,
|
||||
result.get(),
|
||||
fullWidth,
|
||||
active,
|
||||
selected,
|
||||
ms,
|
||||
videoPaused);
|
||||
p.translate(0, st::dialogsRowHeight);
|
||||
}
|
||||
}
|
||||
@@ -767,7 +775,9 @@ void InnerWidget::paintPeerSearchResult(
|
||||
not_null<const PeerSearchResult*> result,
|
||||
int fullWidth,
|
||||
bool active,
|
||||
bool selected) const {
|
||||
bool selected,
|
||||
crl::time now,
|
||||
bool paused) {
|
||||
QRect fullRect(0, 0, fullWidth, st::dialogsRowHeight);
|
||||
p.fillRect(fullRect, active ? st::dialogsBgActive : (selected ? st::dialogsBgOver : st::dialogsBg));
|
||||
if (!active) {
|
||||
@@ -794,29 +804,37 @@ void InnerWidget::paintPeerSearchResult(
|
||||
chatTypeIcon->paint(p, rectForName.topLeft(), fullWidth);
|
||||
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
|
||||
}
|
||||
const auto badgeStyle = Ui::PeerBadgeStyle{
|
||||
(active
|
||||
? &st::dialogsVerifiedIconActive
|
||||
: selected
|
||||
? &st::dialogsVerifiedIconOver
|
||||
: &st::dialogsVerifiedIcon),
|
||||
(active
|
||||
? &st::dialogsPremiumIconActive
|
||||
: selected
|
||||
? &st::dialogsPremiumIconOver
|
||||
: &st::dialogsPremiumIcon),
|
||||
(active
|
||||
? &st::dialogsScamFgActive
|
||||
: selected
|
||||
? &st::dialogsScamFgOver
|
||||
: &st::dialogsScamFg) };
|
||||
const auto badgeWidth = Ui::DrawPeerBadgeGetWidth(
|
||||
peer,
|
||||
const auto badgeWidth = result->badge.drawGetWidth(
|
||||
p,
|
||||
rectForName,
|
||||
result->name.maxWidth(),
|
||||
fullWidth,
|
||||
badgeStyle);
|
||||
{
|
||||
.peer = peer,
|
||||
.verified = (active
|
||||
? &st::dialogsVerifiedIconActive
|
||||
: selected
|
||||
? &st::dialogsVerifiedIconOver
|
||||
: &st::dialogsVerifiedIcon),
|
||||
.premium = (active
|
||||
? &st::dialogsPremiumIconActive
|
||||
: selected
|
||||
? &st::dialogsPremiumIconOver
|
||||
: &st::dialogsPremiumIcon),
|
||||
.scam = (active
|
||||
? &st::dialogsScamFgActive
|
||||
: selected
|
||||
? &st::dialogsScamFgOver
|
||||
: &st::dialogsScamFg),
|
||||
.preview = (active
|
||||
? st::dialogsScamFgActive
|
||||
: selected
|
||||
? st::windowBgRipple
|
||||
: st::windowBgOver)->c,
|
||||
.customEmojiRepaint = [=] { updateSearchResult(peer); },
|
||||
.now = now,
|
||||
.paused = paused,
|
||||
});
|
||||
rectForName.setWidth(rectForName.width() - badgeWidth);
|
||||
|
||||
QRect tr(nameleft, st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip, namewidth, st::dialogsTextFont->height);
|
||||
@@ -1119,9 +1137,7 @@ void InnerWidget::mousePressEvent(QMouseEvent *e) {
|
||||
[this, peer = result->peer] { updateSearchResult(peer); });
|
||||
} else if (base::in_range(_searchedPressed, 0, _searchResults.size())) {
|
||||
auto &row = _searchResults[_searchedPressed];
|
||||
row->addRipple(e->pos() - QPoint(0, searchedOffset() + _searchedPressed * st::dialogsRowHeight), QSize(width(), st::dialogsRowHeight), [this, index = _searchedPressed] {
|
||||
rtlupdate(0, searchedOffset() + index * st::dialogsRowHeight, width(), st::dialogsRowHeight);
|
||||
});
|
||||
row->addRipple(e->pos() - QPoint(0, searchedOffset() + _searchedPressed * st::dialogsRowHeight), QSize(width(), st::dialogsRowHeight), row->repaint());
|
||||
}
|
||||
if (anim::Disabled()
|
||||
&& (!_pressed || !_pressed->entry()->isPinnedDialog(_filterId))) {
|
||||
@@ -2122,10 +2138,12 @@ bool InnerWidget::searchReceived(
|
||||
&& (!_searchInChat
|
||||
|| inject->history() == _searchInChat.history())) {
|
||||
Assert(_searchResults.empty());
|
||||
const auto index = int(_searchResults.size());
|
||||
_searchResults.push_back(
|
||||
std::make_unique<FakeRow>(
|
||||
_searchInChat,
|
||||
inject));
|
||||
inject,
|
||||
[=] { repaintSearchResult(index); }));
|
||||
++fullCount;
|
||||
}
|
||||
for (const auto &message : messages) {
|
||||
@@ -2140,10 +2158,12 @@ bool InnerWidget::searchReceived(
|
||||
NewMessageType::Existing);
|
||||
const auto history = item->history();
|
||||
if (!uniquePeers || !hasHistoryInResults(history)) {
|
||||
const auto index = int(_searchResults.size());
|
||||
_searchResults.push_back(
|
||||
std::make_unique<FakeRow>(
|
||||
_searchInChat,
|
||||
item));
|
||||
item,
|
||||
[=] { repaintSearchResult(index); }));
|
||||
if (uniquePeers && !history->unreadCountKnown()) {
|
||||
history->owner().histories().requestDialogEntry(history);
|
||||
}
|
||||
@@ -2459,6 +2479,14 @@ void InnerWidget::refreshSearchInChatLabel() {
|
||||
}
|
||||
}
|
||||
|
||||
void InnerWidget::repaintSearchResult(int index) {
|
||||
rtlupdate(
|
||||
0,
|
||||
searchedOffset() + index * st::dialogsRowHeight,
|
||||
|
||||
width(), st::dialogsRowHeight);
|
||||
}
|
||||
|
||||
void InnerWidget::clearFilter() {
|
||||
if (_state == WidgetState::Filtered || _searchInChat) {
|
||||
if (_searchInChat) {
|
||||
|
Reference in New Issue
Block a user