mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Added icon for replies to stories in dialogs list.
This commit is contained in:
parent
9d4b8bb9b0
commit
70e298cfe4
8 changed files with 28 additions and 19 deletions
BIN
Telegram/Resources/icons/mini_reply_story.png
Normal file
BIN
Telegram/Resources/icons/mini_reply_story.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 563 B |
BIN
Telegram/Resources/icons/mini_reply_story@2x.png
Normal file
BIN
Telegram/Resources/icons/mini_reply_story@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
BIN
Telegram/Resources/icons/mini_reply_story@3x.png
Normal file
BIN
Telegram/Resources/icons/mini_reply_story@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -467,7 +467,12 @@ dialogsMiniForwardIcon: ThreeStateIcon {
|
|||
over: icon {{ "mini_forward", dialogsTextFgOver, point(0px, 1px) }};
|
||||
active: icon {{ "mini_forward", dialogsTextFgActive, point(0px, 1px) }};
|
||||
}
|
||||
dialogsMiniForwardIconSkip: 2px;
|
||||
dialogsMiniIconSkip: 2px;
|
||||
dialogsMiniReplyStoryIcon: ThreeStateIcon {
|
||||
icon: icon {{ "mini_reply_story", dialogsTextFg, point(0px, 1px) }};
|
||||
over: icon {{ "mini_reply_story", dialogsTextFgOver, point(0px, 1px) }};
|
||||
active: icon {{ "mini_reply_story", dialogsTextFgActive, point(0px, 1px) }};
|
||||
}
|
||||
|
||||
dialogsUnreadMention: ThreeStateIcon {
|
||||
icon: icon{{ "dialogs/dialogs_mention", dialogsUnreadFg }};
|
||||
|
|
|
@ -159,7 +159,11 @@ void MessageView::prepare(
|
|||
options.ignoreTopic = true;
|
||||
options.spoilerLoginCode = true;
|
||||
auto preview = item->toPreview(options);
|
||||
_displayMiniForwardIcon = preview.forwardedMessage;
|
||||
_leftIcon = (preview.icon == ItemPreview::Icon::ForwardedMessage)
|
||||
? &st::dialogsMiniForwardIcon
|
||||
: (preview.icon == ItemPreview::Icon::ReplyToStory)
|
||||
? &st::dialogsMiniReplyStoryIcon
|
||||
: nullptr;
|
||||
const auto hasImages = !preview.images.empty();
|
||||
const auto history = item->history();
|
||||
const auto context = Core::MarkedTextContext{
|
||||
|
@ -170,7 +174,7 @@ void MessageView::prepare(
|
|||
const auto senderTill = (preview.arrowInTextPosition > 0)
|
||||
? preview.arrowInTextPosition
|
||||
: preview.imagesInTextPosition;
|
||||
if ((hasImages || _displayMiniForwardIcon) && senderTill > 0) {
|
||||
if ((hasImages || _leftIcon) && senderTill > 0) {
|
||||
auto sender = Text::Mid(preview.text, 0, senderTill);
|
||||
TextUtilities::Trim(sender);
|
||||
_senderCache.setMarkedText(
|
||||
|
@ -316,15 +320,13 @@ void MessageView::paint(
|
|||
}
|
||||
}
|
||||
|
||||
if (_displayMiniForwardIcon) {
|
||||
if (_leftIcon) {
|
||||
const auto &icon = ThreeStateIcon(
|
||||
st::dialogsMiniForwardIcon,
|
||||
*_leftIcon,
|
||||
context.active,
|
||||
context.selected);
|
||||
icon.paint(p, rect.topLeft(), rect.width());
|
||||
rect.setLeft(rect.x()
|
||||
+ icon.width()
|
||||
+ st::dialogsMiniForwardIconSkip);
|
||||
rect.setLeft(rect.x() + icon.width() + st::dialogsMiniIconSkip);
|
||||
}
|
||||
for (const auto &image : _imagesCache) {
|
||||
if (rect.width() < st::dialogsMiniPreview) {
|
||||
|
|
|
@ -15,6 +15,7 @@ enum class ImageRoundRadius;
|
|||
|
||||
namespace style {
|
||||
struct DialogRow;
|
||||
struct ThreeStateIcon;
|
||||
} // namespace style
|
||||
|
||||
namespace Ui {
|
||||
|
@ -92,7 +93,7 @@ private:
|
|||
mutable std::vector<ItemPreviewImage> _imagesCache;
|
||||
mutable std::unique_ptr<SpoilerAnimation> _spoiler;
|
||||
mutable std::unique_ptr<LoadingContext> _loadingContext;
|
||||
mutable bool _displayMiniForwardIcon = false;
|
||||
mutable const style::ThreeStateIcon *_leftIcon = nullptr;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -15,17 +15,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/view/history_view_message.h"
|
||||
#include "history/view/history_view_service_message.h"
|
||||
#include "history/view/media/history_view_media_grouped.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/history_item_helpers.h"
|
||||
#include "history/history_unread_things.h"
|
||||
#include "history/history.h"
|
||||
#include "mtproto/mtproto_config.h"
|
||||
#include "media/clip/media_clip_reader.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/text/format_values.h"
|
||||
#include "ui/text/text_isolated_emoji.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "storage/file_upload.h"
|
||||
#include "storage/storage_facade.h"
|
||||
|
@ -41,7 +38,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mainwindow.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "core/crash_reports.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "base/timer_rpl.h"
|
||||
|
@ -72,7 +68,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "chat_helpers/stickers_gift_box_pack.h"
|
||||
#include "payments/payments_checkout_process.h" // CheckoutProcess::Start.
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "styles/style_chat.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -2958,9 +2953,11 @@ ItemPreview HistoryItem::toPreview(ToPreviewOptions options) const {
|
|||
? tr::lng_from_you(tr::now)
|
||||
: sender->shortName();
|
||||
};
|
||||
if (!options.ignoreForwardedMessage) {
|
||||
result.forwardedMessage = Get<HistoryMessageForwarded>() != nullptr;
|
||||
}
|
||||
result.icon = (Get<HistoryMessageForwarded>() != nullptr)
|
||||
? ItemPreview::Icon::ForwardedMessage
|
||||
: replyToStory().valid()
|
||||
? ItemPreview::Icon::ReplyToStory
|
||||
: ItemPreview::Icon::None;
|
||||
const auto fromForwarded = [&]() -> std::optional<QString> {
|
||||
if (const auto forwarded = Get<HistoryMessageForwarded>()) {
|
||||
return forwarded->originalSender
|
||||
|
|
|
@ -23,12 +23,17 @@ struct ItemPreviewImage {
|
|||
};
|
||||
|
||||
struct ItemPreview {
|
||||
enum class Icon {
|
||||
None,
|
||||
ForwardedMessage,
|
||||
ReplyToStory,
|
||||
};
|
||||
TextWithEntities text;
|
||||
std::vector<ItemPreviewImage> images;
|
||||
int arrowInTextPosition = -1;
|
||||
int imagesInTextPosition = 0;
|
||||
std::any loadingContext;
|
||||
bool forwardedMessage = false;
|
||||
Icon icon = Icon::None;
|
||||
};
|
||||
|
||||
struct ToPreviewOptions {
|
||||
|
@ -38,7 +43,6 @@ struct ToPreviewOptions {
|
|||
bool generateImages = true;
|
||||
bool ignoreGroup = false;
|
||||
bool ignoreTopic = true;
|
||||
bool ignoreForwardedMessage = false;
|
||||
bool spoilerLoginCode = false;
|
||||
bool translated = false;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue