mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Added icon for forwarded messages in dialogs list.
This commit is contained in:
@@ -436,6 +436,11 @@ dialogsMiniPreviewSkip: 2px;
|
||||
dialogsMiniPreviewRight: 3px;
|
||||
dialogsMiniPlay: icon{{ "dialogs/dialogs_mini_play", videoPlayIconFg }};
|
||||
|
||||
dialogsMiniForwardIcon: icon {{ "mini_forward", dialogsTextFg, point(0px, 1px) }};
|
||||
dialogsMiniForwardIconOver: icon {{ "mini_forward", dialogsTextFgOver, point(0px, 1px) }};
|
||||
dialogsMiniForwardIconActive: icon {{ "mini_forward", dialogsTextFgActive, point(0px, 1px) }};
|
||||
dialogsMiniForwardIconSkip: 2px;
|
||||
|
||||
dialogsUnreadMention: icon{{ "dialogs/dialogs_mention", dialogsUnreadFg }};
|
||||
dialogsUnreadMentionOver: icon{{ "dialogs/dialogs_mention", dialogsUnreadFgOver }};
|
||||
dialogsUnreadMentionActive: icon{{ "dialogs/dialogs_mention", dialogsUnreadFgActive }};
|
||||
|
@@ -16,7 +16,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/effects/spoiler_mess.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/power_saving.h"
|
||||
#include "core/ui_integration.h"
|
||||
@@ -159,6 +158,7 @@ void MessageView::prepare(
|
||||
options.ignoreTopic = true;
|
||||
options.spoilerLoginCode = true;
|
||||
auto preview = item->toPreview(options);
|
||||
_displayMiniForwardIcon = preview.forwardedMessage;
|
||||
const auto hasImages = !preview.images.empty();
|
||||
const auto history = item->history();
|
||||
const auto context = Core::MarkedTextContext{
|
||||
@@ -169,7 +169,7 @@ void MessageView::prepare(
|
||||
const auto senderTill = (preview.arrowInTextPosition > 0)
|
||||
? preview.arrowInTextPosition
|
||||
: preview.imagesInTextPosition;
|
||||
if (hasImages && senderTill > 0) {
|
||||
if ((hasImages || _displayMiniForwardIcon) && senderTill > 0) {
|
||||
auto sender = Text::Mid(preview.text, 0, senderTill);
|
||||
TextUtilities::Trim(sender);
|
||||
_senderCache.setMarkedText(
|
||||
@@ -314,6 +314,18 @@ void MessageView::paint(
|
||||
rect.setLeft(rect.x() + skip);
|
||||
}
|
||||
}
|
||||
|
||||
if (_displayMiniForwardIcon) {
|
||||
const auto &icon = context.active
|
||||
? st::dialogsMiniForwardIconActive
|
||||
: context.selected
|
||||
? st::dialogsMiniForwardIconOver
|
||||
: st::dialogsMiniForwardIcon;
|
||||
icon.paint(p, rect.topLeft(), rect.width());
|
||||
rect.setLeft(rect.x()
|
||||
+ icon.width()
|
||||
+ st::dialogsMiniForwardIconSkip);
|
||||
}
|
||||
for (const auto &image : _imagesCache) {
|
||||
if (rect.width() < st::dialogsMiniPreview) {
|
||||
break;
|
||||
|
@@ -92,6 +92,7 @@ private:
|
||||
mutable std::vector<ItemPreviewImage> _imagesCache;
|
||||
mutable std::unique_ptr<SpoilerAnimation> _spoiler;
|
||||
mutable std::unique_ptr<LoadingContext> _loadingContext;
|
||||
mutable bool _displayMiniForwardIcon = false;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user