tdesktop/Telegram/SourceFiles/history/history_widget.h

826 lines
24 KiB
C
Raw Normal View History

/*
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 "history/view/history_view_corner_buttons.h"
#include "history/history_drag_area.h"
#include "history/history_view_highlight_manager.h"
#include "history/history_view_top_toast.h"
#include "history/history.h"
#include "chat_helpers/bot_command.h"
2017-04-06 16:38:10 +02:00
#include "chat_helpers/field_autocomplete.h"
#include "data/data_drafts.h"
#include "window/section_widget.h"
#include "ui/widgets/fields/input_field.h"
2020-06-30 16:14:05 +02:00
#include "mtproto/sender.h"
2017-08-31 18:28:58 +02:00
#include "base/flags.h"
2017-12-19 17:57:42 +01:00
struct FileLoadResult;
enum class SendMediaType;
2018-05-21 23:31:46 +02:00
class MessageLinksParser;
2021-09-24 17:10:25 +02:00
struct InlineBotQuery;
struct AutocompleteQuery;
2021-03-12 13:48:00 +01:00
namespace MTP {
class Error;
} // namespace MTP
namespace Data {
2023-04-07 16:32:53 +02:00
class PhotoMedia;
} // namespace Data
namespace SendMenu {
enum class Type;
} // namespace SendMenu
2017-12-19 17:57:42 +01:00
namespace Api {
struct SendOptions;
2021-11-09 16:24:13 +01:00
struct SendAction;
} // namespace Api
namespace InlineBots {
namespace Layout {
class Widget;
} // namespace Layout
struct ResultSelected;
} // namespace InlineBots
namespace Support {
class Autocomplete;
struct Contact;
} // namespace Support
2016-05-19 19:18:23 +02:00
namespace Ui {
class InnerDropdown;
class DropdownMenu;
class PlainShadow;
class IconButton;
class EmojiButton;
class SendButton;
class SilentToggle;
class FlatButton;
class RoundButton;
2020-10-12 17:05:54 +02:00
class PinnedBar;
2020-11-20 20:25:35 +01:00
class GroupCallBar;
2021-10-14 12:17:03 +02:00
class RequestsBar;
struct PreparedList;
class SendFilesWay;
2021-11-09 13:10:51 +01:00
class SendAsButton;
class SpoilerAnimation;
enum class ReportReason;
2021-09-24 17:10:25 +02:00
class ChooseThemeController;
class ContinuousScroll;
struct ChatPaintHighlight;
2016-05-19 19:18:23 +02:00
} // namespace Ui
namespace Window {
class SessionController;
} // namespace Window
namespace ChatHelpers {
class TabbedPanel;
class TabbedSelector;
} // namespace ChatHelpers
2018-01-09 18:08:31 +01:00
namespace HistoryView {
class StickerToast;
2018-01-09 18:08:31 +01:00
class TopBarWidget;
class ContactStatus;
class Element;
class PinnedTracker;
class TranslateBar;
class ComposeSearch;
2023-10-25 19:23:54 +02:00
} // namespace HistoryView
namespace HistoryView::Controls {
class RecordLock;
class VoiceRecordBar;
2022-11-01 05:46:31 +01:00
class ForwardPanel;
class TTLButton;
2023-10-25 19:23:54 +02:00
class WebpageProcessor;
} // namespace HistoryView::Controls
2018-01-09 18:08:31 +01:00
class BotKeyboard;
class HistoryInner;
class HistoryWidget final
: public Window::AbstractSectionWidget
, private HistoryView::CornerButtonsDelegate {
public:
2018-05-21 23:31:46 +02:00
using FieldHistoryAction = Ui::InputField::HistoryAction;
using RecordLock = HistoryView::Controls::RecordLock;
using VoiceRecordBar = HistoryView::Controls::VoiceRecordBar;
2022-11-01 05:46:31 +01:00
using ForwardPanel = HistoryView::Controls::ForwardPanel;
2018-05-21 23:31:46 +02:00
HistoryWidget(
QWidget *parent,
not_null<Window::SessionController*> controller);
void start();
void historyLoaded();
[[nodiscard]] bool preventsClose(Fn<void()> &&continueCallback) const;
// When resizing the widget with top edge moved up or down and we
// want to add this top movement to the scroll position, so inner
// content will not move.
void setGeometryWithTopMoved(const QRect &newGeometry, int topDelta);
void windowShown();
[[nodiscard]] bool markingMessagesRead() const;
[[nodiscard]] bool markingContentsRead() const;
bool skipItemRepaint();
void checkActivation();
void leaveToChildEvent(QEvent *e, QWidget *child) override;
bool isItemCompletelyHidden(HistoryItem *item) const;
void updateTopBarSelection();
void updateTopBarChooseForReport();
void loadMessages();
void loadMessagesDown();
void firstLoadMessages();
void delayedShowAt(
MsgId showAtMsgId,
const TextWithEntities &highlightPart);
2023-04-07 16:32:53 +02:00
bool updateReplaceMediaButton();
void updateFieldPlaceholder();
bool updateStickersByEmoji();
2017-12-19 17:57:42 +01:00
bool confirmSendingFiles(const QStringList &files);
2018-05-21 23:31:46 +02:00
bool confirmSendingFiles(not_null<const QMimeData*> data);
void updateControlsVisibility();
void updateControlsGeometry();
2015-10-03 12:09:09 +02:00
History *history() const;
PeerData *peer() const;
void setMsgId(
MsgId showAtMsgId,
const TextWithEntities &highlightPart = {});
MsgId msgId() const;
bool hasTopBarShadow() const {
return peer() != nullptr;
}
void showAnimated(
Window::SlideDirection direction,
const Window::SectionSlideParams &params);
void finishAnimating();
2015-10-17 16:52:26 +02:00
2015-07-03 10:47:16 +02:00
void doneShow();
QPoint clampMousePosition(QPoint point);
bool touchScroll(const QPoint &delta);
void enqueueMessageHighlight(
not_null<HistoryView::Element*> view,
2023-10-31 19:37:59 +01:00
const TextWithEntities &part);
[[nodiscard]] Ui::ChatPaintHighlight itemHighlight(
not_null<const HistoryItem*> item) const;
MessageIdsList getSelectedItems() const;
2020-06-12 16:09:04 +02:00
void itemEdited(not_null<HistoryItem*> item);
2014-08-20 07:32:50 +02:00
2023-10-10 08:49:22 +02:00
void replyToMessage(FullReplyTo id);
void replyToMessage(
not_null<HistoryItem*> item,
TextWithEntities quote = {});
void editMessage(FullMsgId itemId);
void editMessage(not_null<HistoryItem*> item);
2023-10-10 08:49:22 +02:00
[[nodiscard]] FullReplyTo replyTo() const;
bool lastForceReplyReplied(const FullMsgId &replyTo) const;
bool lastForceReplyReplied() const;
bool cancelReply(bool lastKeyboardUsed = false);
2016-02-25 11:32:31 +01:00
void cancelEdit();
void updateForwarding();
void pushReplyReturn(not_null<HistoryItem*> item);
[[nodiscard]] QVector<FullMsgId> replyReturns() const;
void setReplyReturns(PeerId peer, QVector<FullMsgId> replyReturns);
void escape();
2015-06-17 21:43:03 +02:00
2021-07-27 01:18:11 +02:00
void sendBotCommand(const Bot::SendCommandRequest &request);
2023-10-10 08:49:22 +02:00
void hideSingleUseKeyboard(FullMsgId replyToId);
bool insertBotCommand(const QString &cmd);
bool eventFilter(QObject *obj, QEvent *e) override;
// With force=true the markup is updated even if it is
// already shown for the passed history item.
void updateBotKeyboard(History *h = nullptr, bool force = false);
2021-07-19 12:02:36 +02:00
void botCallbackSent(not_null<HistoryItem*> item);
void fastShowAtEnd(not_null<History*> history);
bool applyDraft(
2018-05-21 23:31:46 +02:00
FieldHistoryAction fieldHistoryAction = FieldHistoryAction::Clear);
void showHistory(
const PeerId &peer,
MsgId showAtMsgId,
const TextWithEntities &highlightPart);
void setChooseReportMessagesDetails(
Ui::ReportReason reason,
Fn<void(MessageIdsList)> callback);
void clearAllLoadRequests();
2022-02-05 16:15:24 +01:00
void clearSupportPreloadRequest();
2020-02-21 15:02:13 +01:00
void clearDelayedShowAtRequest();
void clearDelayedShowAt();
void toggleChooseChatTheme(
not_null<PeerData*> peer,
std::optional<bool> show = std::nullopt);
[[nodiscard]] Ui::ChatTheme *customChatTheme() const;
2021-09-24 17:10:25 +02:00
void applyCloudDraft(History *history);
void updateFieldSubmitSettings();
2015-09-16 15:04:08 +02:00
2020-11-12 17:19:04 +01:00
void activate();
2015-09-16 15:04:08 +02:00
void setInnerFocus();
2020-11-12 17:19:04 +01:00
[[nodiscard]] rpl::producer<> cancelRequests() const {
return _cancelRequests.events();
}
2023-01-18 10:35:52 +01:00
void searchInChatEmbedded(std::optional<QString> query = {});
void updateNotifyControls();
2015-09-21 22:57:42 +02:00
2015-10-01 16:05:05 +02:00
bool contentOverlapped(const QRect &globalRect);
2018-04-06 18:23:09 +02:00
QPixmap grabForShowAnimation(const Window::SectionSlideParams &params);
2015-10-17 16:52:26 +02:00
void forwardSelected();
void confirmDeleteSelected();
void clearSelected();
[[nodiscard]] SendMenu::Type sendMenuType() const;
bool sendExistingDocument(
not_null<DocumentData*> document,
Api::SendOptions options,
std::optional<MsgId> localId = std::nullopt);
bool sendExistingPhoto(
not_null<PhotoData*> photo,
Api::SendOptions options);
void showInfoTooltip(
const TextWithEntities &text,
Fn<void()> hiddenCallback);
void showPremiumStickerTooltip(
not_null<const HistoryView::Element*> view);
2022-07-15 16:52:36 +02:00
void showPremiumToast(not_null<DocumentData*> document);
// Tabbed selector management.
bool pushTabbedSelectorToThirdSection(
2022-10-25 10:07:47 +02:00
not_null<Data::Thread*> thread,
const Window::SectionShow &params) override;
bool returnTabbedSelector() override;
// Float player interface.
bool floatPlayerHandleWheelEvent(QEvent *e) override;
QRect floatPlayerAvailableRect() override;
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
2015-11-20 14:34:37 +01:00
void tryProcessKeyInput(not_null<QKeyEvent*> e);
~HistoryWidget();
protected:
void resizeEvent(QResizeEvent *e) override;
void keyPressEvent(QKeyEvent *e) override;
void mousePressEvent(QMouseEvent *e) override;
void paintEvent(QPaintEvent *e) override;
void leaveEventHook(QEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override;
private:
using TabbedPanel = ChatHelpers::TabbedPanel;
using TabbedSelector = ChatHelpers::TabbedSelector;
2019-08-16 11:32:42 +02:00
enum ScrollChangeType {
ScrollChangeNone,
// When we toggle a pinned message.
ScrollChangeAdd,
// When loading a history part while scrolling down.
ScrollChangeNoJumpToBottom,
};
struct ScrollChange {
ScrollChangeType type;
int value;
};
struct ChooseMessagesForReport {
Ui::ReportReason reason = {};
Fn<void(MessageIdsList)> callback;
bool active = false;
};
2021-07-19 12:02:36 +02:00
struct ItemRevealAnimation {
Ui::Animations::Simple animation;
int startHeight = 0;
2021-07-19 12:02:36 +02:00
};
2019-08-16 11:32:42 +02:00
enum class TextUpdateEvent {
SaveDraft = (1 << 0),
SendTyping = (1 << 1),
};
using TextUpdateEvents = base::flags<TextUpdateEvent>;
friend inline constexpr bool is_flag_type(TextUpdateEvent) { return true; };
void cornerButtonsShowAtPosition(
Data::MessagePosition position) override;
Data::Thread *cornerButtonsThread() override;
FullMsgId cornerButtonsCurrentId() override;
bool cornerButtonsIgnoreVisibility() override;
std::optional<bool> cornerButtonsDownShown() override;
bool cornerButtonsUnreadMayBeShown() override;
bool cornerButtonsHas(HistoryView::CornerButtonType type) override;
2021-02-19 14:53:20 +01:00
void checkSuggestToGigagroup();
void processReply();
void setReplyFieldsFromProcessing();
2021-02-19 14:53:20 +01:00
void initTabbedSelector();
void initVoiceRecordBar();
void refreshTabbedPanel();
void createTabbedPanel();
void setTabbedPanel(std::unique_ptr<TabbedPanel> panel);
2019-01-18 12:26:43 +01:00
void updateField();
2020-11-12 17:19:04 +01:00
void fieldChanged();
void fieldTabbed();
void fieldFocused();
void fieldResized();
void insertHashtagOrBotCommand(
QString str,
FieldAutocomplete::ChooseMethod method);
void cancelInlineBot();
void saveDraft(bool delayed = false);
void saveCloudDraft();
void saveDraftDelayed();
void checkFieldAutocomplete();
void showMembersDropdown();
void windowIsVisibleChanged();
void saveFieldToHistoryLocalDraft();
2020-11-12 17:19:04 +01:00
// Checks if we are too close to the top or to the bottom
// in the scroll area and preloads history if needed.
void preloadHistoryIfNeeded();
void handleScroll();
void updateHistoryItemsByTimer();
[[nodiscard]] Dialogs::EntryState computeDialogsEntryState() const;
2020-11-11 21:47:40 +01:00
void refreshTopBarActiveChat();
void refreshJoinChannelText();
2020-06-10 20:08:17 +02:00
void requestMessageData(MsgId msgId);
void messageDataReceived(not_null<PeerData*> peer, MsgId msgId);
2020-06-10 20:08:17 +02:00
2021-11-09 16:24:13 +01:00
[[nodiscard]] Api::SendAction prepareSendAction(
Api::SendOptions options) const;
void send(Api::SendOptions options);
void sendWithModifiers(Qt::KeyboardModifiers modifiers);
void sendSilent();
void sendScheduled();
void sendWhenOnline();
[[nodiscard]] SendMenu::Type sendButtonMenuType() const;
void handlePendingHistoryUpdate();
2021-10-12 14:50:18 +02:00
void fullInfoUpdated();
void toggleTabbedSelectorMode();
void recountChatWidth();
void handlePeerUpdate();
bool updateCanSendMessage();
void setMembersShowAreaActive(bool active);
void handleHistoryChange(not_null<const History*> history);
void showAboutTopPromotion();
void hideFieldIfVisible();
2018-06-26 20:03:45 +02:00
void unreadCountUpdated();
void closeCurrent();
[[nodiscard]] int computeMaxFieldHeight() const;
void toggleMuteUnmute();
void reportSelectedMessages();
void showKeyboardHideButton();
void toggleKeyboard(bool manual = true);
void startBotCommand();
void hidePinnedMessage();
void cancelFieldAreaState();
void unblockUser();
void sendBotStartCommand();
void joinChannel();
void supportInitAutocomplete();
void supportInsertText(const QString &text);
void supportShareContact(Support::Contact contact);
auto computeSendButtonType() const;
2017-12-09 19:20:10 +01:00
void showFinished();
void updateOverStates(QPoint pos);
void chooseAttach(std::optional<bool> overrideSendImagesAsPhotos = {});
void sendButtonClicked();
2021-07-19 12:02:36 +02:00
void newItemAdded(not_null<HistoryItem*> item);
void maybeMarkReactionsRead(not_null<HistoryItem*> item);
2017-12-19 17:57:42 +01:00
2018-05-21 23:31:46 +02:00
bool canSendFiles(not_null<const QMimeData*> data) const;
bool confirmSendingFiles(
const QStringList &files,
2020-10-15 16:27:16 +02:00
const QString &insertTextOnCancel);
bool confirmSendingFiles(
QImage &&image,
QByteArray &&content,
2020-10-15 16:27:16 +02:00
std::optional<bool> overrideSendImagesAsPhotos = std::nullopt,
const QString &insertTextOnCancel = QString());
bool confirmSendingFiles(
2018-05-21 23:31:46 +02:00
not_null<const QMimeData*> data,
2020-10-15 16:27:16 +02:00
std::optional<bool> overrideSendImagesAsPhotos,
const QString &insertTextOnCancel = QString());
bool confirmSendingFiles(
Ui::PreparedList &&list,
2017-12-22 18:42:33 +01:00
const QString &insertTextOnCancel = QString());
bool showSendingFilesError(const Ui::PreparedList &list) const;
bool showSendingFilesError(
const Ui::PreparedList &list,
std::optional<bool> compress) const;
bool showSendMessageError(
const TextWithTags &textWithTags,
bool ignoreSlowmodeCountdown) const;
void sendingFilesConfirmed(
Ui::PreparedList &&list,
Ui::SendFilesWay way,
TextWithTags &&caption,
Api::SendOptions options,
bool ctrlShiftEnter);
2017-12-19 17:57:42 +01:00
void uploadFile(const QByteArray &fileContent, SendMediaType type);
void itemRemoved(not_null<const HistoryItem*> item);
// Updates position of controls around the message field,
// like send button, emoji button and others.
void moveFieldControls();
void updateFieldSize();
bool canWriteMessage() const;
2019-06-19 17:09:03 +02:00
std::optional<QString> writeRestriction() const;
void orderWidgets();
2021-09-24 17:10:25 +02:00
[[nodiscard]] InlineBotQuery parseInlineBotQuery() const;
[[nodiscard]] auto parseMentionHashtagBotCommandQuery() const
-> AutocompleteQuery;
void clearInlineBot();
void inlineBotChanged();
// Look in the _field for the inline bot and query string.
void updateInlineBotQuery();
// Request to show results in the emoji panel.
void applyInlineBotQuery(UserData *bot, const QString &query);
void cancelReplyAfterMediaSend(bool lastKeyboardUsed);
bool replyToPreviousMessage();
bool replyToNextMessage();
2019-07-17 16:34:39 +02:00
[[nodiscard]] bool showSlowmodeError();
void hideChildWidgets();
void hideSelectorControlsAnimated();
int countMembersDropdownHeightMax() const;
void updateReplyToName();
bool editingMessage() const {
return _editMsgId != 0;
}
bool jumpToDialogRow(const Dialogs::RowDescriptor &to);
2018-11-16 13:15:14 +01:00
void setupShortcuts();
bool showNextChat();
bool showPreviousChat();
void handlePeerMigration();
void updateReplyEditTexts(bool force = false);
void updateReplyEditText(not_null<HistoryItem*> item);
void updatePinnedViewer();
void setupTranslateBar();
void setupPinnedTracker();
2020-10-12 11:41:05 +02:00
void checkPinnedBarState();
void clearHidingPinnedBar();
void refreshPinnedBarButton(bool many, HistoryItem *item);
void checkLastPinnedClickedIdReset(
int wasScrollTop,
int nowScrollTop);
void checkMessagesTTL();
2021-10-14 12:17:03 +02:00
void setupGroupCallBar();
void setupRequestsBar();
2020-11-20 20:25:35 +01:00
void sendInlineResult(InlineBots::ResultSelected result);
void drawField(Painter &p, const QRect &rect);
void paintEditHeader(
Painter &p,
const QRect &rect,
int left,
int top) const;
void drawRestrictedWrite(Painter &p, const QString &error);
2019-04-02 11:13:30 +02:00
bool paintShowAnimationFrame();
2016-02-25 11:32:31 +01:00
void updateMouseTracking();
// destroys _history and _migrated unread bars
void destroyUnreadBar();
2020-02-20 16:25:31 +01:00
void destroyUnreadBarOnClose();
void createUnreadBarIfBelowVisibleArea(int withScrollTop);
[[nodiscard]] bool insideJumpToEndInsteadOfToUnread() const;
void createUnreadBarAndResize();
2016-02-25 11:32:31 +01:00
void saveEditMsg();
2023-10-25 19:23:54 +02:00
void setupPreview();
void editDraftOptions();
void jumpToReply(FullReplyTo to);
2023-10-25 19:23:54 +02:00
void messagesReceived(not_null<PeerData*> peer, const MTPmessages_Messages &messages, int requestId);
2021-03-12 13:48:00 +01:00
void messagesFailed(const MTP::Error &error, int requestId);
void addMessagesToFront(not_null<PeerData*> peer, const QVector<MTPMessage> &messages);
void addMessagesToBack(not_null<PeerData*> peer, const QVector<MTPMessage> &messages);
void updateHistoryGeometry(bool initial = false, bool loadedDown = false, const ScrollChange &change = { ScrollChangeNone, 0 });
void updateListSize();
void startItemRevealAnimations();
2021-07-19 12:02:36 +02:00
void revealItemsCallback();
void startMessageSendingAnimation(not_null<HistoryItem*> item);
// Does any of the shown histories has this flag set.
bool hasPendingResizedItems() const;
// Counts scrollTop for placing the scroll right at the unread
// messages bar, choosing from _history and _migrated unreadBar.
2018-09-21 18:28:46 +02:00
std::optional<int> unreadBarTop() const;
int itemTopForHighlight(not_null<HistoryView::Element*> view) const;
void scrollToCurrentVoiceMessage(FullMsgId fromId, FullMsgId toId);
// Scroll to current y without updating the _lastUserScrolled time.
// Used to distinguish between user scrolls and syntetic scrolls.
// This one is syntetic.
void synteticScrollToY(int y);
void writeDrafts();
void writeDraftTexts();
void writeDraftCursors();
2018-05-21 23:31:46 +02:00
void setFieldText(
const TextWithTags &textWithTags,
TextUpdateEvents events = 0,
FieldHistoryAction fieldHistoryAction = FieldHistoryAction::Clear);
void clearFieldText(
TextUpdateEvents events = 0,
FieldHistoryAction fieldHistoryAction = FieldHistoryAction::Clear);
[[nodiscard]] int fieldHeight() const;
[[nodiscard]] bool fieldOrDisabledShown() const;
void unregisterDraftSources();
void registerDraftSource();
void setHistory(History *history);
void setEditMsgId(MsgId msgId);
HistoryItem *getItemFromHistoryOrMigrated(MsgId genericMsgId) const;
void animatedScrollToItem(MsgId msgId);
void animatedScrollToY(int scrollTo, HistoryItem *attachTo = nullptr);
// when scroll position or scroll area size changed this method
// updates the boundings of the visible area in HistoryInner
[[nodiscard]] bool hasSavedScroll() const;
void visibleAreaUpdated();
int countInitialScrollTop();
int countAutomaticScrollTop();
void preloadHistoryByScroll();
void checkReplyReturns();
2019-04-02 11:13:30 +02:00
void scrollToAnimationCallback(FullMsgId attachToId, int relativeTo);
[[nodiscard]] bool readyToForward() const;
[[nodiscard]] bool hasSilentToggle() const;
2022-02-05 16:15:24 +01:00
void checkSupportPreload(bool force = false);
void handleSupportSwitch(not_null<History*> updated);
2021-09-24 17:10:25 +02:00
[[nodiscard]] bool isRecording() const;
[[nodiscard]] bool isSearching() const;
2021-09-24 17:10:25 +02:00
[[nodiscard]] bool isBotStart() const;
[[nodiscard]] bool isBlocked() const;
[[nodiscard]] bool isJoinChannel() const;
[[nodiscard]] bool isMuteUnmute() const;
[[nodiscard]] bool isReportMessages() const;
2019-08-16 11:32:42 +02:00
bool updateCmdStartShown();
void updateSendButtonType();
2021-09-24 17:10:25 +02:00
[[nodiscard]] bool showRecordButton() const;
[[nodiscard]] bool showInlineBotCancel() const;
2019-08-16 11:32:42 +02:00
void refreshSilentToggle();
2021-09-24 17:10:25 +02:00
[[nodiscard]] bool isChoosingTheme() const;
2019-08-16 11:32:42 +02:00
void setupScheduledToggle();
void refreshScheduledToggle();
2021-11-09 13:10:51 +01:00
void setupSendAsToggle();
void refreshSendAsToggle();
2022-04-28 14:16:26 +02:00
void refreshAttachBotsMenu();
2019-08-16 11:32:42 +02:00
void injectSponsoredMessages() const;
2020-11-12 17:19:04 +01:00
bool kbWasHidden() const;
void searchInChat();
2020-06-30 16:14:05 +02:00
MTP::Sender _api;
2023-10-10 08:49:22 +02:00
FullReplyTo _replyTo;
2019-08-16 11:32:42 +02:00
Ui::Text::String _replyToName;
int _replyToNameVersion = 0;
2023-10-10 08:49:22 +02:00
FullReplyTo _processingReplyTo;
HistoryItem *_processingReplyItem = nullptr;
2019-08-16 11:32:42 +02:00
MsgId _editMsgId = 0;
2023-04-07 16:32:53 +02:00
std::shared_ptr<Data::PhotoMedia> _photoEditMedia;
bool _canReplaceMedia = false;
2019-08-16 11:32:42 +02:00
HistoryItem *_replyEditMsg = nullptr;
Ui::Text::String _replyEditMsgText;
std::unique_ptr<Ui::SpoilerAnimation> _replySpoiler;
2019-08-16 11:32:42 +02:00
mutable base::Timer _updateEditTimeLeftDisplay;
object_ptr<Ui::IconButton> _fieldBarCancel;
std::unique_ptr<HistoryView::TranslateBar> _translateBar;
int _translateBarHeight = 0;
std::unique_ptr<HistoryView::PinnedTracker> _pinnedTracker;
2020-10-12 17:05:54 +02:00
std::unique_ptr<Ui::PinnedBar> _pinnedBar;
std::unique_ptr<Ui::PinnedBar> _hidingPinnedBar;
int _pinnedBarHeight = 0;
FullMsgId _pinnedClickedId;
2020-10-26 12:46:08 +01:00
std::optional<FullMsgId> _minPinnedId;
2020-11-20 20:25:35 +01:00
std::unique_ptr<Ui::GroupCallBar> _groupCallBar;
int _groupCallBarHeight = 0;
2021-10-14 12:17:03 +02:00
std::unique_ptr<Ui::RequestsBar> _requestsBar;
int _requestsBarHeight = 0;
2020-11-20 20:25:35 +01:00
bool _preserveScrollTop = false;
bool _repaintFieldScheduled = false;
2019-08-16 11:32:42 +02:00
mtpRequestId _saveEditMsgRequestId = 0;
2023-10-25 19:23:54 +02:00
std::unique_ptr<HistoryView::Controls::WebpageProcessor> _preview;
Fn<bool(QPainter &p, QRect to)> _previewDrawPreview;
2019-08-16 11:32:42 +02:00
Ui::Text::String _previewTitle;
Ui::Text::String _previewDescription;
bool _replyForwardPressed = false;
PeerData *_peer = nullptr;
bool _canSendMessages = false;
bool _canSendTexts = false;
MsgId _showAtMsgId = ShowAtUnreadMsgId;
TextWithEntities _showAtMsgHighlightPart;
int _firstLoadRequest = 0; // Not real mtpRequestId.
int _preloadRequest = 0; // Not real mtpRequestId.
int _preloadDownRequest = 0; // Not real mtpRequestId.
MsgId _delayedShowAtMsgId = -1;
TextWithEntities _delayedShowAtMsgHighlightPart;
int _delayedShowAtRequest = 0; // Not real mtpRequestId.
2022-02-05 16:15:24 +01:00
History *_supportPreloadHistory = nullptr;
int _supportPreloadRequest = 0; // Not real mtpRequestId.
2018-01-09 18:08:31 +01:00
object_ptr<HistoryView::TopBarWidget> _topBar;
object_ptr<Ui::ContinuousScroll> _scroll;
QPointer<HistoryInner> _list;
History *_migrated = nullptr;
History *_history = nullptr;
// Initial updateHistoryGeometry() was called.
bool _historyInited = false;
// If updateListSize() was called without updateHistoryGeometry().
bool _updateHistoryGeometryRequired = false;
int _lastScrollTop = 0; // gifs optimization
crl::time _lastScrolled = 0;
2020-11-12 17:19:04 +01:00
base::Timer _updateHistoryItems;
crl::time _lastUserScrolled = 0;
bool _synteticScrollEvent = false;
2019-04-02 11:13:30 +02:00
Ui::Animations::Simple _scrollToAnimation;
HistoryView::CornerButtons _cornerButtons;
2021-09-24 17:10:25 +02:00
const object_ptr<FieldAutocomplete> _fieldAutocomplete;
object_ptr<Support::Autocomplete> _supportAutocomplete;
UserData *_inlineBot = nullptr;
QString _inlineBotUsername;
2018-05-21 23:31:46 +02:00
bool _inlineLookingUpBot = false;
mtpRequestId _inlineBotResolveRequestId = 0;
bool _isInlineBot = false;
std::unique_ptr<HistoryView::ContactStatus> _contactStatus;
2015-09-08 14:20:30 +02:00
const std::shared_ptr<Ui::SendButton> _send;
object_ptr<Ui::FlatButton> _unblock;
object_ptr<Ui::FlatButton> _botStart;
object_ptr<Ui::FlatButton> _joinChannel;
object_ptr<Ui::FlatButton> _muteUnmute;
object_ptr<Ui::FlatButton> _reportMessages;
object_ptr<Ui::RoundButton> _botMenuButton = { nullptr };
QString _botMenuButtonText;
object_ptr<Ui::IconButton> _attachToggle;
2023-04-07 16:32:53 +02:00
object_ptr<Ui::IconButton> _replaceMedia = { nullptr };
2021-11-09 13:10:51 +01:00
object_ptr<Ui::SendAsButton> _sendAs = { nullptr };
object_ptr<Ui::EmojiButton> _tabbedSelectorToggle;
object_ptr<Ui::IconButton> _botKeyboardShow;
object_ptr<Ui::IconButton> _botKeyboardHide;
object_ptr<Ui::IconButton> _botCommandStart;
object_ptr<Ui::SilentToggle> _silent = { nullptr };
object_ptr<Ui::IconButton> _scheduled = { nullptr };
std::unique_ptr<HistoryView::Controls::TTLButton> _ttlInfo;
const std::unique_ptr<VoiceRecordBar> _voiceRecordBar;
2022-11-01 05:46:31 +01:00
const std::unique_ptr<ForwardPanel> _forwardPanel;
std::unique_ptr<HistoryView::ComposeSearch> _composeSearch;
bool _cmdStartShown = false;
2018-05-21 23:31:46 +02:00
object_ptr<Ui::InputField> _field;
base::unique_qptr<Ui::RpWidget> _fieldDisabled;
2023-04-07 16:32:53 +02:00
Ui::Animations::Simple _inPhotoEditOver;
2023-10-20 15:48:15 +02:00
bool _inDetails = false;
2023-04-07 16:32:53 +02:00
bool _inPhotoEdit = false;
bool _inClickable = false;
bool _kbShown = false;
2022-06-22 18:15:50 +02:00
bool _fieldIsEmpty = true;
HistoryItem *_kbReplyTo = nullptr;
object_ptr<Ui::ScrollArea> _kbScroll;
2021-07-05 19:59:23 +02:00
const not_null<BotKeyboard*> _keyboard;
2021-09-24 17:10:25 +02:00
std::unique_ptr<Ui::ChooseThemeController> _chooseTheme;
object_ptr<Ui::InnerDropdown> _membersDropdown = { nullptr };
2020-11-12 17:19:04 +01:00
base::Timer _membersDropdownShowTimer;
object_ptr<InlineBots::Layout::Widget> _inlineResults = { nullptr };
std::unique_ptr<TabbedPanel> _tabbedPanel;
std::unique_ptr<Ui::DropdownMenu> _attachBotsMenu;
DragArea::Areas _attachDragAreas;
2018-11-21 11:09:46 +01:00
Fn<void()> _raiseEmojiSuggestions;
2017-04-27 23:17:00 +02:00
bool _nonEmptySelection = false;
2017-08-31 18:28:58 +02:00
TextUpdateEvents _textUpdateEvents = (TextUpdateEvents() | TextUpdateEvent::SaveDraft | TextUpdateEvent::SendTyping);
QString _confirmSource;
std::unique_ptr<Window::SlideAnimation> _showAnimation;
HistoryView::ElementHighlighter _highlighter;
crl::time _saveDraftStart = 0;
bool _saveDraftText = false;
2020-11-12 17:19:04 +01:00
base::Timer _saveDraftTimer;
base::Timer _saveCloudDraftTimer;
HistoryView::InfoTooltip _topToast;
std::unique_ptr<HistoryView::StickerToast> _stickerToast;
std::unique_ptr<ChooseMessagesForReport> _chooseForReport;
2021-07-19 12:02:36 +02:00
base::flat_set<not_null<HistoryItem*>> _itemRevealPending;
base::flat_map<
not_null<HistoryItem*>,
ItemRevealAnimation> _itemRevealAnimations;
int _itemsRevealHeight = 0;
bool _sponsoredMessagesStateKnown = false;
bool _justMarkingAsRead = false;
object_ptr<Ui::PlainShadow> _topShadow;
bool _inGrab = false;
int _topDelta = 0;
2020-11-12 17:19:04 +01:00
rpl::event_stream<> _cancelRequests;
};