Implement message bar with animations.

This commit is contained in:
John Preston 2020-10-10 12:15:37 +03:00
parent b9f40e35cd
commit ae298818a8
99 changed files with 626 additions and 187 deletions

View file

@ -41,9 +41,7 @@ set(style_files
boxes/boxes.style
calls/calls.style
chat_helpers/chat_helpers.style
dialogs/dialogs.style
export/view/export.style
history/history.style
info/info.style
intro/intro.style
media/view/media_view.style
@ -53,7 +51,6 @@ set(style_files
profile/profile.style
settings/settings.style
ui/filter_icons.style
window/window.style
)
set(dependent_style_files
@ -1026,6 +1023,8 @@ PRIVATE
ui/filter_icon_panel.h
ui/grouped_layout.cpp
ui/grouped_layout.h
ui/item_text_options.cpp
ui/item_text_options.h
ui/resize_area.h
ui/search_field_controller.cpp
ui/search_field_controller.h
@ -1033,8 +1032,6 @@ PRIVATE
ui/special_buttons.h
ui/special_fields.cpp
ui/special_fields.h
ui/text_options.cpp
ui/text_options.h
ui/unread_badge.cpp
ui/unread_badge.h
window/main_window.cpp

View file

@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history_message.h" // NewMessageFlags.
#include "chat_helpers/message_field.h" // ConvertTextTagsToEntities.
#include "ui/text/text_entity.h" // TextWithEntities.
#include "ui/text_options.h" // Ui::ItemTextOptions.
#include "ui/item_text_options.h" // Ui::ItemTextOptions.
#include "main/main_session.h"
#include "main/main_account.h"
#include "main/main_app_config.h"

View file

@ -64,7 +64,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/themes/window_theme.h"
#include "inline_bots/inline_bot_result.h"
#include "chat_helpers/message_field.h"
#include "ui/text_options.h"
#include "ui/item_text_options.h"
#include "ui/emoji_config.h"
#include "support/support_helper.h"
#include "storage/localimageloader.h"

View file

@ -44,7 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_overview.h"
#include "styles/style_media_view.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_layers.h"
#include <QtCore/QBuffer>

View file

@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/toast/toast.h"
#include "ui/special_buttons.h"
#include "ui/special_fields.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/unread_badge.h"
#include "ui/ui_utility.h"
#include "data/data_channel.h"

View file

@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/background_preview_box.h"
#include "window/window_session_controller.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"

View file

@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/toast/toast.h"
#include "ui/effects/animations.h"
#include "ui/effects/radial_animation.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "facades.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"

View file

@ -48,7 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/checkbox.h"
#include "ui/text/format_values.h"
#include "ui/special_buttons.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "window/window_session_controller.h"
#include "confirm_box.h"
#include "apiwrap.h"
@ -57,7 +57,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include <QtCore/QMimeData>

View file

@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/slide_wrap.h"
#include "ui/effects/ripple_animation.h"
#include "ui/toast/toast.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "storage/localstorage.h"
#include "boxes/confirm_box.h"
#include "mainwidget.h"

View file

@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/ripple_animation.h"
#include "ui/empty_userpic.h"
#include "ui/wrap/slide_wrap.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "lang/lang_keys.h"
#include "storage/file_download.h"
#include "data/data_peer_values.h"

View file

@ -19,7 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/layers/generic_box.h"
#include "ui/toast/toast.h"
#include "ui/text/text_utilities.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/special_buttons.h"
#include "chat_helpers/emoji_suggestions_widget.h"
#include "settings/settings_privacy_security.h"

View file

@ -33,7 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/fade_wrap.h"
#include "ui/text/format_values.h"
#include "ui/grouped_layout.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/special_buttons.h"
#include "lottie/lottie_single_player.h"
#include "data/data_document.h"
@ -44,7 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/core_settings.h"
#include "facades.h" // App::LambdaDelayed.
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"

View file

@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/scroll_area.h"
#include "ui/widgets/input_fields.h"
#include "ui/wrap/slide_wrap.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "chat_helpers/message_field.h"
#include "chat_helpers/send_context_menu.h"
#include "history/history.h"
@ -40,7 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/application.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
class ShareBox::Inner final : public Ui::RpWidget, private base::Subscriber {
public:

View file

@ -42,7 +42,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "app.h"
#include "webrtc/webrtc_video_track.h"
#include "styles/style_calls.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#ifdef Q_OS_WIN
#include "ui/platform/win/ui_window_title_win.h"

View file

@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h"
#include "app.h"
#include "styles/style_widgets.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace {

View file

@ -33,7 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_session_controller.h"
#include "facades.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_widgets.h"
#include "styles/style_chat_helpers.h"

View file

@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include <QtCore/QMimeData>
#include <QtCore/QStack>

View file

@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "chat_helpers/stickers_emoji_image_loader.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace Stickers {

View file

@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/call_delayed.h"
#include "apiwrap.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include <QtCore/QBuffer>

View file

@ -57,7 +57,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history_location_manager.h"
#include "ui/widgets/tooltip.h"
#include "ui/image/image.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/emoji_config.h"
#include "ui/effects/animations.h"
#include "storage/serialize_common.h"

View file

@ -26,7 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/media/history_view_dice.h"
#include "ui/image/image.h"
#include "ui/text/format_values.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/emoji_config.h"
#include "storage/storage_shared_media.h"
#include "storage/localstorage.h"

View file

@ -32,7 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_session_controller.h"
#include "ui/image/image.h"
#include "ui/empty_userpic.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "history/history.h"
#include "history/view/history_view_element.h"
#include "history/history_item.h"

View file

@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/call_delayed.h"
#include "main/main_session.h"
#include "api/api_text_entities.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
namespace {

View file

@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "data/data_session.h"
#include "data/data_changes.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "apiwrap.h"
#include "lang/lang_keys.h"

View file

@ -19,7 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/buttons.h"
#include "ui/widgets/popup_menu.h"
#include "ui/text/text_utilities.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/ui_utility.h"
#include "data/data_drafts.h"
#include "data/data_folder.h"

View file

@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_window.h"
#include "storage/localstorage.h"
#include "ui/empty_userpic.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/unread_badge.h"
#include "lang/lang_keys.h"
#include "support/support_helper.h"

View file

@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "dialogs/dialogs_row.h"
#include "ui/effects/ripple_animation.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "dialogs/dialogs_entry.h"
#include "data/data_folder.h"
#include "data/data_peer_values.h"

View file

@ -45,7 +45,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h"
#include "app.h"
#include "styles/style_dialogs.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_info.h"
#include "styles/style_window.h"

View file

@ -31,8 +31,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history.h"
#include "history/history_item.h"
#include "history/view/media/history_view_media.h"
#include "styles/style_history.h"
#include "data/data_session.h"
#include "styles/style_chat.h"
namespace {

View file

@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "history/admin_log/history_admin_log_inner.h"
#include "styles/style_history.h"
#include "history/history.h"
#include "history/view/media/history_view_media.h"
#include "history/view/media/history_view_web_page.h"
@ -50,6 +49,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_user.h"
#include "facades.h"
#include "app.h"
#include "styles/style_chat.h"
#include <QtWidgets/QApplication>
#include <QtGui/QClipboard>

View file

@ -28,7 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "lang/lang_keys.h"
#include "facades.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_window.h"
#include "styles/style_info.h"

View file

@ -42,7 +42,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
//#include "storage/storage_feed_messages.h" // #feed
#include "support/support_helper.h"
#include "ui/image/image.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "core/crash_reports.h"
#include "core/application.h"
#include "base/unixtime.h"

View file

@ -24,7 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/popup_menu.h"
#include "ui/image/image.h"
#include "ui/toast/toast.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/ui_utility.h"
#include "ui/inactive_press.h"
#include "window/window_session_controller.h"
@ -62,7 +62,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/stickers/data_stickers.h"
#include "facades.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_window.h" // st::windowMinWidth
#include <QtGui/QClipboard>

View file

@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "media/clip/media_clip_reader.h"
#include "ui/effects/ripple_animation.h"
#include "ui/text/text_isolated_emoji.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "storage/file_upload.h"
#include "storage/storage_facade.h"
#include "storage/storage_shared_media.h"
@ -44,7 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_chat.h"
#include "data/data_user.h"
#include "styles/style_dialogs.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace {

View file

@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/ripple_animation.h"
#include "ui/image/image.h"
#include "ui/toast/toast.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "history/history.h"
#include "history/history_message.h"
#include "history/view/history_view_service_message.h"
@ -28,7 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_session_controller.h"
#include "facades.h"
#include "styles/style_widgets.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include <QtGui/QGuiApplication>

View file

@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_groups.h"
#include "data/data_peer.h"
#include "lang/lang_keys.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
TextForMimeData WrapAsReply(
TextForMimeData &&text,

View file

@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_utilities.h"
#include "ui/text/text_isolated_emoji.h"
#include "ui/text/format_values.h"
#include "ui/text_options.h"
#include "ui/item_text_options.h"
#include "core/application.h"
#include "core/ui_integration.h"
#include "window/notifications_manager.h"
@ -44,7 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "app.h"
#include "styles/style_dialogs.h"
#include "styles/style_widgets.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_window.h"
#include <QtGui/QGuiApplication>

View file

@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_session_controller.h"
#include "storage/storage_shared_media.h"
#include "ui/text/format_values.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
namespace {

View file

@ -91,7 +91,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/history_view_pinned_tracker.h"
#include "base/qthelp_regex.h"
#include "ui/widgets/popup_menu.h"
#include "ui/text_options.h"
#include "ui/item_text_options.h"
#include "ui/unread_badge.h"
#include "main/main_session.h"
#include "main/main_session_settings.h"
@ -109,7 +109,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "dialogs/dialogs_key.h"
#include "facades.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_dialogs.h"
#include "styles/style_window.h"
#include "styles/style_boxes.h"

View file

@ -31,9 +31,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "media/audio/media_audio_capture.h"
#include "media/audio/media_audio.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "ui/special_buttons.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/ui_utility.h"
#include "ui/widgets/input_fields.h"
#include "ui/text/format_values.h"

View file

@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/confirm_box.h"
#include "boxes/peers/edit_contact_box.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_layers.h"
namespace HistoryView {

View file

@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "layout.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -37,7 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_document.h"
#include "data/data_peer.h"
#include "facades.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include <QtWidgets/QApplication>
#include <QtCore/QMimeData>

View file

@ -32,7 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h"
#include "app.h"
#include "styles/style_widgets.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_dialogs.h"
namespace HistoryView {

View file

@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/shadow.h"
#include "ui/wrap/slide_wrap.h"
#include "ui/layers/generic_box.h"
#include "ui/text_options.h"
#include "ui/item_text_options.h"
#include "ui/toast/toast.h"
#include "ui/text/format_values.h"
#include "ui/special_buttons.h"
@ -52,7 +52,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "facades.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_window.h"
#include "styles/style_info.h"
#include "styles/style_boxes.h"

View file

@ -23,7 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "chat_helpers/send_context_menu.h"
#include "styles/style_info.h"
#include "styles/style_layers.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include <QGuiApplication>

View file

@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/scroll_area.h"
#include "ui/widgets/shadow.h"
#include "ui/layers/generic_box.h"
#include "ui/text_options.h"
#include "ui/item_text_options.h"
#include "ui/toast/toast.h"
#include "ui/special_buttons.h"
#include "ui/ui_utility.h"
@ -47,7 +47,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "facades.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_window.h"
#include "styles/style_info.h"
#include "styles/style_boxes.h"

View file

@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history.h"
#include "lang/lang_keys.h"
#include "ui/effects/animations.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "styles/style_dialogs.h"
namespace HistoryView {

View file

@ -15,14 +15,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_abstract_structure.h"
#include "data/data_chat.h"
#include "data/data_channel.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "core/core_settings.h"
#include "core/application.h"
#include "mainwidget.h"
#include "layout.h"
#include "lang/lang_keys.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -46,7 +46,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h"
#include "styles/style_window.h"
#include "styles/style_dialogs.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_info.h"
namespace HistoryView {

View file

@ -19,7 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_media_types.h"
#include "data/data_user.h"
#include "main/main_session.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -18,14 +18,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/history_view_cursor_state.h"
#include "window/window_session_controller.h"
#include "ui/empty_userpic.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "data/data_session.h"
#include "data/data_user.h"
#include "data/data_media_types.h"
#include "data/data_cloud_file.h"
#include "main/main_session.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -19,7 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_utilities.h"
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_media_types.h"
#include "data/data_file_origin.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history.h"
#include "data/data_document.h"
#include "data/data_session.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {

View file

@ -14,13 +14,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/history_view_element.h"
#include "history/view/history_view_cursor_state.h"
#include "history/view/media/history_view_media_common.h"
#include "ui/text_options.h"
#include "ui/item_text_options.h"
#include "core/ui_integration.h"
#include "data/data_session.h"
#include "data/data_game.h"
#include "data/data_media_types.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {

View file

@ -36,7 +36,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_document_media.h"
#include "app.h"
#include "layout.h" // FullSelection
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -13,11 +13,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/history_view_cursor_state.h"
#include "history/view/media/history_view_photo.h"
#include "history/view/media/history_view_media_common.h"
#include "ui/text_options.h"
#include "ui/item_text_options.h"
#include "ui/text/format_values.h"
#include "data/data_media_types.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {

View file

@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/image/image.h"
#include "data/data_file_origin.h"
#include "layout.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -15,12 +15,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/history_view_element.h"
#include "history/view/history_view_cursor_state.h"
#include "ui/image/image.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "data/data_session.h"
#include "data/data_file_origin.h"
#include "data/data_cloud_file.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {

View file

@ -14,9 +14,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lottie/lottie_single_player.h"
#include "storage/storage_shared_media.h"
#include "data/data_document.h"
#include "ui/text_options.h"
#include "ui/item_text_options.h"
#include "core/ui_integration.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/media/history_view_document.h"
#include "history/view/media/history_view_sticker.h"
#include "history/view/media/history_view_theme_document.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {

View file

@ -17,9 +17,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/storage_shared_media.h"
#include "lang/lang_keys.h"
#include "ui/grouped_layout.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "layout.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/core_settings.h"
#include "layout.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_auto_download.h"
#include "core/application.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/history_view_element.h"
#include "history/view/history_view_cursor_state.h"
#include "calls/calls_instance.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/text/text_utilities.h"
#include "ui/text/format_values.h"
#include "ui/effects/animations.h"
@ -30,7 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "layout.h" // FullSelection
#include "apiwrap.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_widgets.h"
#include "styles/style_window.h"

View file

@ -30,7 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_file_origin.h"
#include "lottie/lottie_single_player.h"
#include "chat_helpers/stickers_lottie.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/themes/window_theme.h"
#include "layout.h" // FullSelection
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {

View file

@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/history_view_cursor_state.h"
#include "history/view/media/history_view_media_common.h"
#include "ui/image/image.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/text/format_values.h"
#include "layout.h" // FullSelection
#include "data/data_session.h"
@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_photo_media.h"
#include "data/data_file_origin.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace HistoryView {
namespace {

View file

@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "app.h"
#include "styles/style_overview.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_widgets.h"

View file

@ -39,7 +39,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/image/image.h"
#include "ui/focus_persister.h"
#include "ui/resize_area.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/emoji_config.h"
#include "window/section_memento.h"
#include "window/section_widget.h"
@ -109,7 +109,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "app.h"
#include "facades.h"
#include "styles/style_dialogs.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_boxes.h"
#include <QtCore/QCoreApplication>

View file

@ -28,7 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h"
#include "app.h"
#include "styles/style_media_player.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include <QtWidgets/QApplication>

View file

@ -23,7 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/platform/ui_platform_utility.h"
#include "ui/toast/toast.h"
#include "ui/text/format_values.h"
#include "ui/text_options.h"
#include "ui/item_text_options.h"
#include "ui/ui_utility.h"
#include "boxes/confirm_box.h"
#include "media/audio/media_audio.h"
@ -62,7 +62,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h"
#include "app.h"
#include "styles/style_media_view.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#ifdef Q_OS_MAC
#include "platform/mac/touchbar/mac_touchbar_media_view.h"

View file

@ -6,7 +6,7 @@ For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
using "ui/basic.style";
using "history/history.style";
using "ui/chat/chat.style";
using "ui/widgets/widgets.style";
using "media/view/media_view.style";
using "boxes/boxes.style";

View file

@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_photo_media.h"
#include "data/data_document_media.h"
#include "styles/style_overview.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "core/file_utilities.h"
#include "boxes/add_contact_box.h"
#include "boxes/confirm_box.h"
@ -37,7 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/round_checkbox.h"
#include "ui/image/image.h"
#include "ui/text/format_values.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "app.h"
namespace Overview {

View file

@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/slide_wrap.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/text/text_utilities.h" // Ui::Text::ToUpper
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "core/file_utilities.h"
#include "lang/lang_keys.h"
#include "boxes/abstract_box.h"

View file

@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/fade_wrap.h"
#include "ui/wrap/padding_wrap.h"
#include "ui/text/text_utilities.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/special_buttons.h"
#include "styles/style_passport.h"
#include "styles/style_layers.h"

View file

@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "profile/profile_block_peer_list.h"
#include "ui/effects/ripple_animation.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "data/data_peer.h"
#include "data/data_cloud_file.h"
#include "main/main_session.h"

View file

@ -37,7 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "settings/settings_privacy_security.h"
#include "facades.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_boxes.h"
#include "styles/style_settings.h"

View file

@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/toast/toast.h"
#include "ui/widgets/input_fields.h"
#include "ui/text/text_entity.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "chat_helpers/message_field.h"
#include "chat_helpers/emoji_suggestions_widget.h"
#include "base/unixtime.h"

View file

@ -9,6 +9,24 @@ using "ui/basic.style";
using "dialogs/dialogs.style";
using "ui/widgets/widgets.style";
MessageBar {
title: TextStyle;
titleFg: color;
text: TextStyle;
textFg: color;
textPalette: TextPalette;
duration: int;
}
defaultMessageBar: MessageBar {
title: semiboldTextStyle;
titleFg: windowActiveTextFg;
text: messageTextStyle;
textFg: historyComposeAreaFg;
textPalette: historyComposeAreaPalette;
duration: 160;
}
minPhotoSize: 100px;
minVideoSize: 160px;
maxMediaSize: 430px;

View file

@ -0,0 +1,295 @@
/*
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
*/
#include "ui/chat/message_bar.h"
#include "ui/text/text_options.h"
#include "styles/style_chat.h"
namespace Ui {
MessageBar::MessageBar(not_null<QWidget*> parent, const style::MessageBar &st)
: _st(st)
, _widget(parent) {
setup();
}
void MessageBar::setup() {
_widget.resize(0, st::historyReplyHeight);
_widget.paintRequest(
) | rpl::start_with_next([=](QRect rect) {
auto p = Painter(&_widget);
paint(p);
}, _widget.lifetime());
}
void MessageBar::set(MessageBarContent &&content) {
_contentLifetime.destroy();
tweenTo(std::move(content));
}
void MessageBar::set(rpl::producer<MessageBarContent> content) {
_contentLifetime.destroy();
std::move(
content
) | rpl::start_with_next([=](MessageBarContent &&content) {
tweenTo(std::move(content));
}, _contentLifetime);
}
MessageBar::BodyAnimation MessageBar::DetectBodyAnimationType(
Animation *currentAnimation,
const MessageBarContent &currentContent,
const MessageBarContent &nextContent) {
const auto now = currentAnimation
? currentAnimation->bodyAnimation
: BodyAnimation::None;
return (now == BodyAnimation::Full
|| currentContent.title != nextContent.title)
? BodyAnimation::Full
: (now == BodyAnimation::Text
|| currentContent.text != nextContent.text
|| currentContent.id != nextContent.id)
? BodyAnimation::Text
: BodyAnimation::None;
}
void MessageBar::tweenTo(MessageBarContent &&content) {
_widget.update();
if (!_st.duration || anim::Disabled() || _widget.size().isEmpty()) {
updateFromContent(std::move(content));
return;
}
const auto hasImageChanged = (_content.preview.isNull()
!= content.preview.isNull());
const auto bodyChanged = (_content.id != content.id
|| _content.title != content.title
|| _content.text != content.text
|| _content.preview.constBits() != content.preview.constBits());
auto animation = Animation();
animation.bodyAnimation = DetectBodyAnimationType(
_animation.get(),
_content,
content);
animation.movingTo = (content.id > _content.id)
? RectPart::Top
: (content.id < _content.id)
? RectPart::Bottom
: RectPart::None;
animation.imageFrom = grabImagePart();
animation.bodyOrTextFrom = grabBodyOrTextPart(animation.bodyAnimation);
auto was = std::move(_animation);
updateFromContent(std::move(content));
animation.imageTo = grabImagePart();
animation.bodyOrTextTo = grabBodyOrTextPart(animation.bodyAnimation);
if (was) {
_animation = std::move(was);
std::swap(*_animation, animation);
_animation->imageShown = std::move(animation.imageShown);
} else {
_animation = std::make_unique<Animation>(std::move(animation));
}
if (hasImageChanged) {
_animation->imageShown.start(
[=] { _widget.update(); },
_image.isNull() ? 1. : 0.,
_image.isNull() ? 0. : 1.,
_st.duration);
}
if (bodyChanged) {
_animation->bodyMoved.start(
[=] { _widget.update(); },
0.,
1.,
_st.duration);
}
}
void MessageBar::updateFromContent(MessageBarContent &&content) {
_content = std::move(content);
_title.setText(_st.title, _content.title);
_text.setMarkedText(_st.text, _content.text, Ui::DialogTextOptions());
_image = prepareImage(_content.preview);
}
QRect MessageBar::imageRect() const {
const auto left = st::msgReplyBarSkip + st::msgReplyBarSkip;
const auto top = st::msgReplyPadding.top();
const auto size = st::msgReplyBarSize.height();
return QRect(left, top, size, size);
}
QRect MessageBar::bodyRect(bool withImage) const {
const auto innerLeft = st::msgReplyBarSkip + st::msgReplyBarSkip;
const auto imageSkip = st::msgReplyBarSize.height()
+ st::msgReplyBarSkip
- st::msgReplyBarSize.width()
- st::msgReplyBarPos.x();
const auto left = innerLeft + (withImage ? imageSkip : 0);
const auto top = st::msgReplyPadding.top();
const auto width = _widget.width() - left - st::msgReplyPadding.right();
const auto height = st::msgReplyBarSize.height();
return QRect(left, top, width, height);
}
QRect MessageBar::bodyRect() const {
return bodyRect(!_image.isNull());
}
QRect MessageBar::textRect() const {
auto result = bodyRect();
result.setTop(result.top() + st::msgServiceNameFont->height);
return result;
}
auto MessageBar::makeGrabGuard() {
auto imageShown = _animation
? std::move(_animation->imageShown)
: Ui::Animations::Simple();
return gsl::finally([&, shown = std::move(imageShown)]() mutable {
if (_animation) {
_animation->imageShown = std::move(shown);
}
});
}
QPixmap MessageBar::grabBodyOrTextPart(BodyAnimation type) {
return (type == BodyAnimation::Full)
? grabBodyPart()
: (type == BodyAnimation::Text)
? grabTextPart()
: QPixmap();
}
QPixmap MessageBar::grabBodyPart() {
const auto guard = makeGrabGuard();
return GrabWidget(widget(), bodyRect());
}
QPixmap MessageBar::grabTextPart() {
const auto guard = makeGrabGuard();
return GrabWidget(widget(), textRect());
}
QPixmap MessageBar::grabImagePart() {
if (!_animation) {
return _image;
}
const auto guard = makeGrabGuard();
return (_animation->bodyMoved.animating()
&& !_animation->imageFrom.isNull()
&& !_animation->imageTo.isNull())
? GrabWidget(widget(), imageRect())
: _animation->imageFrom;
}
void MessageBar::finishAnimating() {
if (_animation) {
_animation = nullptr;
_widget.update();
}
}
QPixmap MessageBar::prepareImage(const QImage &preview) {
return QPixmap::fromImage(preview, Qt::ColorOnly);
}
void MessageBar::paint(Painter &p) {
const auto progress = _animation ? _animation->bodyMoved.value(1.) : 1.;
const auto imageFinal = _image.isNull() ? 0. : 1.;
const auto imageShown = _animation
? _animation->imageShown.value(imageFinal)
: imageFinal;
if (progress == 1. && imageShown == 1. && _animation) {
_animation = nullptr;
}
const auto body = [&] {
if (!_animation || !_animation->imageShown.animating()) {
return bodyRect();
}
const auto noImage = bodyRect(false);
const auto withImage = bodyRect(true);
return QRect(
anim::interpolate(noImage.x(), withImage.x(), imageShown),
noImage.y(),
anim::interpolate(noImage.width(), withImage.width(), imageShown),
noImage.height());
}();
const auto text = textRect();
const auto image = imageRect();
const auto width = _widget.width();
const auto noShift = !_animation
|| (_animation->movingTo == RectPart::None);
const auto shiftFull = st::msgReplyBarSkip;
const auto shiftTo = noShift
? 0
: (_animation->movingTo == RectPart::Top)
? anim::interpolate(shiftFull, 0, progress)
: anim::interpolate(-shiftFull, 0, progress);
const auto shiftFrom = noShift
? 0
: (_animation->movingTo == RectPart::Top)
? (shiftTo - shiftFull)
: (shiftTo + shiftFull);
if (!_animation) {
if (!_image.isNull()) {
p.drawPixmap(image, _image);
}
} else if (!_animation->imageFrom.isNull()
|| !_animation->imageTo.isNull()) {
const auto rect = [&] {
if (!_animation->imageShown.animating()) {
return image;
}
const auto size = anim::interpolate(0, image.width(), imageShown);
return QRect(
image.x(),
image.y() + (image.height() - size) / 2,
size,
size);
}();
if (_animation->bodyMoved.animating()) {
p.setOpacity(1. - progress);
p.drawPixmap(
rect.translated(0, shiftFrom),
_animation->imageFrom);
p.setOpacity(progress);
p.drawPixmap(rect.translated(0, shiftTo), _animation->imageTo);
} else {
p.drawPixmap(rect, _image);
}
}
if (!_animation || _animation->bodyAnimation == BodyAnimation::None) {
p.setPen(_st.textFg);
p.setTextPalette(_st.textPalette);
_text.drawLeftElided(p, body.x(), text.y(), body.width(), width);
} else if (_animation->bodyAnimation == BodyAnimation::Text) {
p.setOpacity(1. - progress);
p.drawPixmap(
body.x(),
text.y() + shiftFrom,
_animation->bodyOrTextFrom);
p.setOpacity(progress);
p.drawPixmap(body.x(), text.y() + shiftTo, _animation->bodyOrTextTo);
}
if (!_animation || _animation->bodyAnimation != BodyAnimation::Full) {
p.setPen(_st.titleFg);
_title.drawLeftElided(p, body.x(), body.y(), body.width(), width);
} else {
p.setOpacity(1. - progress);
p.drawPixmap(
body.x(),
body.y() + shiftFrom,
_animation->bodyOrTextFrom);
p.setOpacity(progress);
p.drawPixmap(body.x(), body.y() + shiftTo, _animation->bodyOrTextTo);
}
}
} // namespace Ui

View file

@ -0,0 +1,88 @@
/*
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
#include "ui/rp_widget.h"
class Painter;
namespace style {
struct MessageBar;
} // namespace style
namespace Ui {
struct MessageBarContent {
int id = 0;
QString title;
TextWithEntities text;
QImage preview;
};
class MessageBar final {
public:
MessageBar(not_null<QWidget*> parent, const style::MessageBar &st);
void set(MessageBarContent &&content);
void set(rpl::producer<MessageBarContent> content);
[[nodiscard]] not_null<Ui::RpWidget*> widget() {
return &_widget;
}
void finishAnimating();
private:
enum class BodyAnimation : char {
Full,
Text,
None,
};
struct Animation {
Ui::Animations::Simple bodyMoved;
Ui::Animations::Simple imageShown;
QPixmap bodyOrTextFrom;
QPixmap bodyOrTextTo;
QPixmap imageFrom;
QPixmap imageTo;
BodyAnimation bodyAnimation = BodyAnimation::None;
RectPart movingTo = RectPart::None;
};
void setup();
void paint(Painter &p);
void tweenTo(MessageBarContent &&content);
void updateFromContent(MessageBarContent &&content);
[[nodiscard]] QPixmap prepareImage(const QImage &preview);
[[nodiscard]] QRect imageRect() const;
[[nodiscard]] QRect bodyRect(bool withImage) const;
[[nodiscard]] QRect bodyRect() const;
[[nodiscard]] QRect textRect() const;
auto makeGrabGuard();
[[nodiscard]] QPixmap grabBodyOrTextPart(BodyAnimation type);
[[nodiscard]] QPixmap grabImagePart();
[[nodiscard]] QPixmap grabBodyPart();
[[nodiscard]] QPixmap grabTextPart();
[[nodiscard]] static BodyAnimation DetectBodyAnimationType(
Animation *currentAnimation,
const MessageBarContent &currentContent,
const MessageBarContent &nextContent);
const style::MessageBar &_st;
Ui::RpWidget _widget;
MessageBarContent _content;
rpl::lifetime _contentLifetime;
Ui::Text::String _title, _text;
QPixmap _image;
std::unique_ptr<Animation> _animation;
};
} // namespace Ui

View file

@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/emoji_config.h"
#include "ui/effects/animation_value.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_dialogs.h"
namespace Ui {

View file

@ -0,0 +1,70 @@
/*
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
*/
#include "ui/item_text_options.h"
#include "history/history.h"
#include "history/history_item.h"
#include "data/data_channel.h"
#include "data/data_chat.h"
#include "data/data_user.h"
namespace Ui {
namespace {
bool UseBotTextOptions(
not_null<History*> history,
not_null<PeerData*> author) {
if (const auto user = history->peer->asUser()) {
if (user->isBot()) {
return true;
}
} else if (const auto chat = history->peer->asChat()) {
if (chat->botStatus >= 0) {
return true;
}
} else if (const auto group = history->peer->asMegagroup()) {
if (group->mgInfo->botStatus >= 0) {
return true;
}
}
if (const auto user = author->asUser()) {
if (user->isBot()) {
return true;
}
}
return false;
}
} // namespace
const TextParseOptions &ItemTextOptions(
not_null<History*> history,
not_null<PeerData*> author) {
return UseBotTextOptions(history, author)
? ItemTextBotDefaultOptions()
: ItemTextDefaultOptions();
}
const TextParseOptions &ItemTextOptions(not_null<const HistoryItem*> item) {
return ItemTextOptions(item->history(), item->author());
}
const TextParseOptions &ItemTextNoMonoOptions(
not_null<History*> history,
not_null<PeerData*> author) {
return UseBotTextOptions(history, author)
? ItemTextBotNoMonoOptions()
: ItemTextNoMonoOptions();
}
const TextParseOptions &ItemTextNoMonoOptions(
not_null<const HistoryItem*> item) {
return ItemTextNoMonoOptions(item->history(), item->author());
}
} // namespace Ui

View file

@ -0,0 +1,27 @@
/*
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
#include "ui/text/text_options.h"
class History;
class PeerData;
class HistoryItem;
namespace Ui {
const TextParseOptions &ItemTextOptions(
not_null<History*> history,
not_null<PeerData*> author);
const TextParseOptions &ItemTextNoMonoOptions(
not_null<History*> history,
not_null<PeerData*> author);
const TextParseOptions &ItemTextOptions(not_null<const HistoryItem*> item);
const TextParseOptions &ItemTextNoMonoOptions(not_null<const HistoryItem*> item);
} // namespace Ui

View file

@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/special_buttons.h"
#include "styles/style_boxes.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "dialogs/dialogs_layout.h"
#include "ui/effects/ripple_animation.h"
#include "ui/effects/radial_animation.h"

View file

@ -5,15 +5,10 @@ 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
*/
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "history/history.h"
#include "history/history_item.h"
#include "data/data_channel.h"
#include "data/data_chat.h"
#include "data/data_user.h"
#include "styles/style_history.h"
#include "styles/style_window.h"
#include "styles/style_chat.h"
namespace Ui {
namespace {
@ -110,37 +105,13 @@ TextParseOptions WebpageDescriptionOptions = {
Qt::LayoutDirectionAuto, // dir
};
bool UseBotTextOptions(
not_null<History*> history,
not_null<PeerData*> author) {
if (const auto user = history->peer->asUser()) {
if (user->isBot()) {
return true;
}
} else if (const auto chat = history->peer->asChat()) {
if (chat->botStatus >= 0) {
return true;
}
} else if (const auto group = history->peer->asMegagroup()) {
if (group->mgInfo->botStatus >= 0) {
return true;
}
}
if (const auto user = author->asUser()) {
if (user->isBot()) {
return true;
}
}
return false;
}
} // namespace
void InitTextOptions() {
HistoryServiceOptions.dir
= TextNameOptions.dir
= TextDialogOptions.dir
= cLangDir();
= Qt::LeftToRight;
TextDialogOptions.maxw = st::columnMaximalWidthLeft * 2;
WebpageTitleOptions.maxh = st::webPageTitleFont->height * 2;
WebpageTitleOptions.maxw
@ -188,29 +159,4 @@ const TextParseOptions &DialogTextOptions() {
return TextDialogOptions;
}
const TextParseOptions &ItemTextOptions(
not_null<History*> history,
not_null<PeerData*> author) {
return UseBotTextOptions(history, author)
? HistoryBotOptions
: HistoryTextOptions;
}
const TextParseOptions &ItemTextOptions(not_null<const HistoryItem*> item) {
return ItemTextOptions(item->history(), item->author());
}
const TextParseOptions &ItemTextNoMonoOptions(
not_null<History*> history,
not_null<PeerData*> author) {
return UseBotTextOptions(history, author)
? HistoryBotNoMonoOptions
: HistoryTextNoMonoOptions;
}
const TextParseOptions &ItemTextNoMonoOptions(
not_null<const HistoryItem*> item) {
return ItemTextNoMonoOptions(item->history(), item->author());
}
} // namespace Ui

View file

@ -7,9 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
class History;
class PeerData;
struct TextParseOptions;
namespace Ui {
@ -28,13 +25,4 @@ const TextParseOptions &WebpageTextDescriptionOptions();
const TextParseOptions &NameTextOptions();
const TextParseOptions &DialogTextOptions();
const TextParseOptions &ItemTextOptions(
not_null<History*> history,
not_null<PeerData*> author);
const TextParseOptions &ItemTextNoMonoOptions(
not_null<History*> history,
not_null<PeerData*> author);
const TextParseOptions &ItemTextOptions(not_null<const HistoryItem*> item);
const TextParseOptions &ItemTextNoMonoOptions(not_null<const HistoryItem*> item);
} // namespace Ui

View file

@ -31,3 +31,6 @@
#include "base/basic_types.h"
#include "base/flat_map.h"
#include "base/flat_set.h"
#include "ui/text/text.h"
#include "ui/effects/animations.h"

View file

@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/input_fields.h"
#include "ui/widgets/scroll_area.h"
#include "ui/effects/cross_animation.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "lang/lang_keys.h"
#include "app.h"

View file

@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/buttons.h"
#include "ui/widgets/input_fields.h"
#include "ui/platform/ui_platform_utility.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/emoji_config.h"
#include "ui/empty_userpic.h"
#include "ui/ui_utility.h"

View file

@ -30,7 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/application.h"
#include "app.h"
#include "styles/style_widgets.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include <QtCore/QBuffer>

View file

@ -10,13 +10,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/themes/window_theme.h"
#include "lang/lang_keys.h"
#include "platform/platform_window_title.h"
#include "ui/text_options.h"
#include "ui/text/text_options.h"
#include "ui/image/image_prepare.h"
#include "ui/emoji_config.h"
#include "styles/style_widgets.h"
#include "styles/style_window.h"
#include "styles/style_media_view.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include "styles/style_dialogs.h"
#include "styles/style_info.h"

View file

@ -26,7 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/application.h"
#include "styles/style_settings.h"
#include "styles/style_boxes.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
#include <QtGui/QGuiApplication>
#include <QtGui/QClipboard>

View file

@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
using "ui/basic.style";
using "ui/widgets/widgets.style";
using "history/history.style";
using "ui/chat/chat.style";
using "boxes/boxes.style"; // UserpicButton
windowMinWidth: 380px;

View file

@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h"
#include "app.h"
#include "styles/style_layers.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace Window {

View file

@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_session_controller.h"
#include "styles/style_layers.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_history.h"
#include "styles/style_chat.h"
namespace Window {
namespace {

View file

@ -12,6 +12,9 @@ include(lib_ui/cmake/generate_styles.cmake)
set(style_files
ui/td_common.style
ui/chat/chat.style
dialogs/dialogs.style
window/window.style
)
set(dependent_style_files
@ -29,8 +32,12 @@ PRIVATE
${style_files}
ui/ui_pch.h
ui/chat/message_bar.cpp
ui/chat/message_bar.h
ui/text/format_values.cpp
ui/text/format_values.h
ui/text/text_options.cpp
ui/text/text_options.h
ui/toasts/common_toasts.cpp
ui/toasts/common_toasts.h
)