mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Moved item preview structs to separated file.
This commit is contained in:
parent
79a09a4510
commit
f2c7237d5f
11 changed files with 53 additions and 32 deletions
|
@ -643,6 +643,7 @@ PRIVATE
|
||||||
history/view/history_view_empty_list_bubble.h
|
history/view/history_view_empty_list_bubble.h
|
||||||
history/view/history_view_group_call_bar.cpp
|
history/view/history_view_group_call_bar.cpp
|
||||||
history/view/history_view_group_call_bar.h
|
history/view/history_view_group_call_bar.h
|
||||||
|
history/view/history_view_item_preview.h
|
||||||
history/view/history_view_list_widget.cpp
|
history/view/history_view_list_widget.cpp
|
||||||
history/view/history_view_list_widget.h
|
history/view/history_view_list_widget.h
|
||||||
history/view/history_view_message.cpp
|
history/view/history_view_message.cpp
|
||||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
#include "history/history_location_manager.h"
|
#include "history/history_location_manager.h"
|
||||||
#include "history/view/history_view_element.h"
|
#include "history/view/history_view_element.h"
|
||||||
|
#include "history/view/history_view_item_preview.h"
|
||||||
#include "history/view/media/history_view_photo.h"
|
#include "history/view/media/history_view_photo.h"
|
||||||
#include "history/view/media/history_view_sticker.h"
|
#include "history/view/media/history_view_sticker.h"
|
||||||
#include "history/view/media/history_view_gif.h"
|
#include "history/view/media/history_view_gif.h"
|
||||||
|
|
|
@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "support/support_helper.h"
|
#include "support/support_helper.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "history/view/history_view_send_action.h"
|
#include "history/view/history_view_send_action.h"
|
||||||
|
#include "history/view/history_view_item_preview.h"
|
||||||
#include "history/history_item_components.h"
|
#include "history/history_item_components.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
|
#include "history/view/history_view_item_preview.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "ui/text/text_options.h"
|
#include "ui/text/text_options.h"
|
||||||
#include "ui/image/image.h"
|
#include "ui/image/image.h"
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
|
|
||||||
#include "history/view/history_view_element.h"
|
#include "history/view/history_view_element.h"
|
||||||
|
#include "history/view/history_view_item_preview.h"
|
||||||
#include "history/history_message.h"
|
#include "history/history_message.h"
|
||||||
#include "history/history_service.h"
|
#include "history/history_service.h"
|
||||||
#include "history/history_item_components.h"
|
#include "history/history_item_components.h"
|
||||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "history/view/history_view_element.h"
|
#include "history/view/history_view_element.h"
|
||||||
|
#include "history/view/history_view_item_preview.h"
|
||||||
#include "history/view/history_view_service_message.h"
|
#include "history/view/history_view_service_message.h"
|
||||||
#include "history/history_item_components.h"
|
#include "history/history_item_components.h"
|
||||||
#include "history/view/media/history_view_media_grouped.h"
|
#include "history/view/media/history_view_media_grouped.h"
|
||||||
|
@ -1077,6 +1078,13 @@ ItemPreview HistoryItem::toPreview(ToPreviewOptions options) const {
|
||||||
return Dialogs::Ui::PreviewWithSender(std::move(result), fromWrapped);
|
return Dialogs::Ui::PreviewWithSender(std::move(result), fromWrapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString HistoryItem::inReplyText() const {
|
||||||
|
return toPreview({
|
||||||
|
.hideSender = true,
|
||||||
|
.generateImages = false,
|
||||||
|
}).text;
|
||||||
|
}
|
||||||
|
|
||||||
Ui::Text::IsolatedEmoji HistoryItem::isolatedEmoji() const {
|
Ui::Text::IsolatedEmoji HistoryItem::isolatedEmoji() const {
|
||||||
return Ui::Text::IsolatedEmoji();
|
return Ui::Text::IsolatedEmoji();
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,38 +51,12 @@ class SessionController;
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
||||||
namespace HistoryView {
|
namespace HistoryView {
|
||||||
|
|
||||||
struct TextState;
|
struct TextState;
|
||||||
struct StateRequest;
|
struct StateRequest;
|
||||||
enum class CursorState : char;
|
enum class CursorState : char;
|
||||||
enum class PointState : char;
|
enum class PointState : char;
|
||||||
enum class Context : char;
|
enum class Context : char;
|
||||||
class ElementDelegate;
|
class ElementDelegate;
|
||||||
|
|
||||||
struct ItemPreviewImage {
|
|
||||||
QImage data;
|
|
||||||
uint64 cacheKey = 0;
|
|
||||||
|
|
||||||
explicit operator bool() const {
|
|
||||||
return !data.isNull();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ItemPreview {
|
|
||||||
QString text;
|
|
||||||
std::vector<ItemPreviewImage> images;
|
|
||||||
int imagesInTextPosition = 0;
|
|
||||||
std::any loadingContext;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ToPreviewOptions {
|
|
||||||
const std::vector<ItemPreviewImage> *existing = nullptr;
|
|
||||||
bool hideSender = false;
|
|
||||||
bool hideCaption = false;
|
|
||||||
bool generateImages = true;
|
|
||||||
bool ignoreGroup = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace HistoryView
|
} // namespace HistoryView
|
||||||
|
|
||||||
struct HiddenSenderInfo;
|
struct HiddenSenderInfo;
|
||||||
|
@ -334,12 +308,7 @@ public:
|
||||||
// Example: "[link1-start]You:[link1-end] [link1-start]Photo,[link1-end] caption text"
|
// Example: "[link1-start]You:[link1-end] [link1-start]Photo,[link1-end] caption text"
|
||||||
[[nodiscard]] virtual ItemPreview toPreview(
|
[[nodiscard]] virtual ItemPreview toPreview(
|
||||||
ToPreviewOptions options) const;
|
ToPreviewOptions options) const;
|
||||||
[[nodiscard]] virtual QString inReplyText() const {
|
[[nodiscard]] virtual QString inReplyText() const;
|
||||||
return toPreview({
|
|
||||||
.hideSender = true,
|
|
||||||
.generateImages = false,
|
|
||||||
}).text;
|
|
||||||
}
|
|
||||||
[[nodiscard]] virtual Ui::Text::IsolatedEmoji isolatedEmoji() const;
|
[[nodiscard]] virtual Ui::Text::IsolatedEmoji isolatedEmoji() const;
|
||||||
[[nodiscard]] virtual TextWithEntities originalText() const {
|
[[nodiscard]] virtual TextWithEntities originalText() const {
|
||||||
return TextWithEntities();
|
return TextWithEntities();
|
||||||
|
|
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "history/history_message.h"
|
#include "history/history_message.h"
|
||||||
#include "history/history_item_components.h"
|
#include "history/history_item_components.h"
|
||||||
#include "history/view/history_view_service_message.h"
|
#include "history/view/history_view_service_message.h"
|
||||||
|
#include "history/view/history_view_item_preview.h"
|
||||||
#include "data/data_folder.h"
|
#include "data/data_folder.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_media_types.h"
|
#include "data/data_media_types.h"
|
||||||
|
|
|
@ -86,6 +86,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "history/view/history_view_pinned_section.h"
|
#include "history/view/history_view_pinned_section.h"
|
||||||
#include "history/view/history_view_pinned_bar.h"
|
#include "history/view/history_view_pinned_bar.h"
|
||||||
#include "history/view/history_view_group_call_bar.h"
|
#include "history/view/history_view_group_call_bar.h"
|
||||||
|
#include "history/view/history_view_item_preview.h"
|
||||||
#include "history/view/history_view_requests_bar.h"
|
#include "history/view/history_view_requests_bar.h"
|
||||||
#include "history/view/media/history_view_media.h"
|
#include "history/view/media/history_view_media.h"
|
||||||
#include "profile/profile_block_group_members.h"
|
#include "profile/profile_block_group_members.h"
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace HistoryView {
|
||||||
|
|
||||||
|
struct ItemPreviewImage {
|
||||||
|
QImage data;
|
||||||
|
uint64 cacheKey = 0;
|
||||||
|
|
||||||
|
explicit operator bool() const {
|
||||||
|
return !data.isNull();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ItemPreview {
|
||||||
|
QString text;
|
||||||
|
std::vector<ItemPreviewImage> images;
|
||||||
|
int imagesInTextPosition = 0;
|
||||||
|
std::any loadingContext;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ToPreviewOptions {
|
||||||
|
const std::vector<ItemPreviewImage> *existing = nullptr;
|
||||||
|
bool hideSender = false;
|
||||||
|
bool hideCaption = false;
|
||||||
|
bool generateImages = true;
|
||||||
|
bool ignoreGroup = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace HistoryView
|
|
@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "main/main_account.h"
|
#include "main/main_account.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
|
#include "history/view/history_view_item_preview.h"
|
||||||
#include "base/platform/base_platform_last_input.h"
|
#include "base/platform/base_platform_last_input.h"
|
||||||
#include "base/call_delayed.h"
|
#include "base/call_delayed.h"
|
||||||
#include "facades.h"
|
#include "facades.h"
|
||||||
|
|
Loading…
Add table
Reference in a new issue