tdesktop/Telegram/SourceFiles/history/history_widget.h

821 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/history_drag_area.h"
#include "history/history.h"
#include "ui/widgets/tooltip.h"
#include "mainwidget.h"
#include "chat_helpers/bot_command.h"
2017-04-06 14:38:10 +00:00
#include "chat_helpers/field_autocomplete.h"
#include "window/section_widget.h"
#include "ui/widgets/input_fields.h"
#include "ui/effects/animations.h"
#include "ui/rp_widget.h"
2020-06-30 14:14:05 +00:00
#include "mtproto/sender.h"
2017-08-31 16:28:58 +00:00
#include "base/flags.h"
2017-12-09 18:20:10 +00:00
#include "base/timer.h"
2017-12-19 16:57:42 +00:00
struct FileLoadResult;
struct SendingAlbum;
enum class SendMediaType;
2018-05-21 21:31:46 +00:00
class MessageLinksParser;
2021-09-24 15:10:25 +00:00
struct InlineBotQuery;
struct AutocompleteQuery;
2021-03-12 12:48:00 +00:00
namespace MTP {
class Error;
} // namespace MTP
namespace Data {
enum class PreviewState : char;
} // namespace Data
namespace SendMenu {
enum class Type;
} // namespace SendMenu
2017-12-19 16:57:42 +00:00
namespace Api {
struct SendOptions;
2021-11-09 15:24:13 +00:00
struct SendAction;
} // namespace Api
namespace InlineBots {
namespace Layout {
class ItemBase;
class Widget;
} // namespace Layout
struct ResultSelected;
class AttachBotsList;
} // namespace InlineBots
namespace Support {
class Autocomplete;
struct Contact;
} // namespace Support
2016-05-19 17:18:23 +00:00
namespace Ui {
class AbstractButton;
class InnerDropdown;
class DropdownMenu;
class PlainShadow;
class PopupMenu;
class IconButton;
class HistoryDownButton;
class EmojiButton;
class SendButton;
class SilentToggle;
class FlatButton;
class LinkButton;
class RoundButton;
2020-10-12 15:05:54 +00:00
class PinnedBar;
2020-11-20 19:25:35 +00:00
class GroupCallBar;
2021-10-14 10:17:03 +00:00
class RequestsBar;
struct PreparedList;
class SendFilesWay;
2021-11-09 12:10:51 +00:00
class SendAsButton;
enum class ReportReason;
namespace Toast {
class Instance;
} // namespace Toast
2021-09-24 15:10:25 +00:00
class ChooseThemeController;
class ContinuousScroll;
2016-05-19 17:18:23 +00:00
} // namespace Ui
namespace Window {
class SessionController;
} // namespace Window
namespace ChatHelpers {
class TabbedPanel;
class TabbedSection;
class TabbedSelector;
} // namespace ChatHelpers
2017-12-19 16:57:42 +00:00
namespace Storage {
enum class MimeDataState;
} // namespace Storage
2018-01-09 17:08:31 +00:00
namespace HistoryView {
class StickerToast;
2018-01-09 17:08:31 +00:00
class TopBarWidget;
class ContactStatus;
class Element;
class PinnedTracker;
class ComposeSearch;
namespace Controls {
class RecordLock;
class VoiceRecordBar;
class TTLButton;
} // namespace Controls
2018-01-09 17:08:31 +00:00
} // namespace HistoryView
class DragArea;
class SendFilesBox;
class BotKeyboard;
class MessageField;
class HistoryInner;
struct HistoryMessageMarkupButton;
class HistoryWidget final : public Window::AbstractSectionWidget {
public:
2018-05-21 21:31:46 +00:00
using FieldHistoryAction = Ui::InputField::HistoryAction;
using RecordLock = HistoryView::Controls::RecordLock;
using VoiceRecordBar = HistoryView::Controls::VoiceRecordBar;
2018-05-21 21:31:46 +00: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 doWeReadServerHistory() const;
[[nodiscard]] bool doWeReadMentions() const;
bool skipItemRepaint();
void checkHistoryActivation();
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);
void updateFieldPlaceholder();
bool updateStickersByEmoji();
2017-12-19 16:57:42 +00:00
bool confirmSendingFiles(const QStringList &files);
2018-05-21 21:31:46 +00:00
bool confirmSendingFiles(not_null<const QMimeData*> data);
2019-03-24 12:39:19 +00:00
void sendFileConfirmed(const std::shared_ptr<FileLoadResult> &file,
const std::optional<FullMsgId> &oldId = std::nullopt);
void updateControlsVisibility();
void updateControlsGeometry();
2015-10-03 10:09:09 +00:00
History *history() const;
PeerData *peer() const;
2015-10-03 10:09:09 +00:00
void setMsgId(MsgId showAtMsgId);
MsgId msgId() const;
bool hasTopBarShadow() const {
return peer() != nullptr;
}
void showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams &params);
void finishAnimating();
2015-10-17 14:52:26 +00:00
2015-07-03 08:47:16 +00:00
void doneShow();
QPoint clampMousePosition(QPoint point);
bool touchScroll(const QPoint &delta);
void enqueueMessageHighlight(not_null<HistoryView::Element*> view);
crl::time highlightStartTime(not_null<const HistoryItem*> item) const;
MessageIdsList getSelectedItems() const;
2020-06-12 14:09:04 +00:00
void itemEdited(not_null<HistoryItem*> item);
2014-08-20 05:32:50 +00:00
void replyToMessage(FullMsgId itemId);
void replyToMessage(not_null<HistoryItem*> item);
void editMessage(FullMsgId itemId);
void editMessage(not_null<HistoryItem*> item);
MsgId replyToId() const;
bool lastForceReplyReplied(const FullMsgId &replyTo) const;
bool lastForceReplyReplied() const;
bool cancelReply(bool lastKeyboardUsed = false);
2016-02-25 10:32:31 +00:00
void cancelEdit();
void updateForwarding();
void updateForwardingTexts();
void clearReplyReturns();
void pushReplyReturn(not_null<HistoryItem*> item);
QList<MsgId> replyReturns();
void setReplyReturns(PeerId peer, const QList<MsgId> &replyReturns);
void calcNextReplyReturn();
2015-04-06 22:15:29 +00:00
void updatePreview();
void previewCancel();
void escape();
2015-06-17 19:43:03 +00:00
2021-07-26 23:18:11 +00:00
void sendBotCommand(const Bot::SendCommandRequest &request);
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
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 10:02:36 +00:00
void botCallbackSent(not_null<HistoryItem*> item);
void fastShowAtEnd(not_null<History*> history);
2018-05-21 21:31:46 +00:00
void applyDraft(
FieldHistoryAction fieldHistoryAction = FieldHistoryAction::Clear);
2015-11-20 18:24:44 +00:00
void showHistory(const PeerId &peer, MsgId showAtMsgId, bool reload = false);
void setChooseReportMessagesDetails(
Ui::ReportReason reason,
Fn<void(MessageIdsList)> callback);
void clearAllLoadRequests();
2022-02-05 15:15:24 +00:00
void clearSupportPreloadRequest();
2020-02-21 14:02:13 +00:00
void clearDelayedShowAtRequest();
void clearDelayedShowAt();
void saveFieldToHistoryLocalDraft();
2021-09-24 15:10:25 +00:00
void toggleChooseChatTheme(not_null<PeerData*> peer);
[[nodiscard]] Ui::ChatTheme *customChatTheme() const;
2021-09-24 15:10:25 +00:00
void applyCloudDraft(History *history);
void updateFieldSubmitSettings();
2015-09-16 13:04:08 +00:00
2020-11-12 16:19:04 +00:00
void activate();
2015-09-16 13:04:08 +00:00
void setInnerFocus();
2020-11-12 16:19:04 +00:00
[[nodiscard]] rpl::producer<> cancelRequests() const {
return _cancelRequests.events();
}
void updateNotifyControls();
2015-09-21 20:57:42 +00:00
2015-10-01 14:05:05 +00:00
bool contentOverlapped(const QRect &globalRect);
2018-04-06 16:23:09 +00:00
QPixmap grabForShowAnimation(const Window::SectionSlideParams &params);
2015-10-17 14:52:26 +00: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 hideInfoTooltip(anim::type animated);
void showPremiumStickerTooltip(
not_null<const HistoryView::Element*> view);
// Tabbed selector management.
bool pushTabbedSelectorToThirdSection(
not_null<PeerData*> peer,
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 13:34:37 +00:00
~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 09:32:42 +00: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 10:02:36 +00:00
struct ItemRevealAnimation {
Ui::Animations::Simple animation;
int startHeight = 0;
2021-07-19 10:02:36 +00:00
};
2019-08-16 09:32:42 +00: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; };
struct CornerButton {
template <typename ...Args>
CornerButton(Args &&...args) : widget(std::forward<Args>(args)...) {
}
Ui::Animations::Simple animation;
bool shown = false;
object_ptr<Ui::HistoryDownButton> widget;
};
2021-02-19 13:53:20 +00:00
void checkSuggestToGigagroup();
void initTabbedSelector();
void initVoiceRecordBar();
void refreshTabbedPanel();
void createTabbedPanel();
void setTabbedPanel(std::unique_ptr<TabbedPanel> panel);
2019-01-18 11:26:43 +00:00
void updateField();
2020-11-12 16:19:04 +00:00
void fieldChanged();
void fieldTabbed();
void fieldFocused();
void fieldResized();
void insertHashtagOrBotCommand(
QString str,
FieldAutocomplete::ChooseMethod method);
void insertMention(UserData *user);
void cancelInlineBot();
void saveDraft(bool delayed = false);
void saveCloudDraft();
void saveDraftDelayed();
void checkFieldAutocomplete();
void showMembersDropdown();
void windowIsVisibleChanged();
// 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 20:47:40 +00:00
void refreshTopBarActiveChat();
void refreshJoinChannelText();
2020-06-10 18:08:17 +00:00
void requestMessageData(MsgId msgId);
void messageDataReceived(not_null<PeerData*> peer, MsgId msgId);
2020-06-10 18:08:17 +00:00
2021-11-09 15:24:13 +00:00
[[nodiscard]] Api::SendAction prepareSendAction(
Api::SendOptions options) const;
void send(Api::SendOptions options);
void sendWithModifiers(Qt::KeyboardModifiers modifiers);
void sendSilent();
void sendScheduled();
[[nodiscard]] SendMenu::Type sendButtonMenuType() const;
void handlePendingHistoryUpdate();
2021-10-12 12:50:18 +00:00
void fullInfoUpdated();
void toggleTabbedSelectorMode();
void recountChatWidth();
void historyDownClicked();
void showNextUnreadMention();
void showNextUnreadReaction();
void handlePeerUpdate();
void setMembersShowAreaActive(bool active);
void handleHistoryChange(not_null<const History*> history);
void showAboutTopPromotion();
2018-06-26 18:03:45 +00:00
void unreadCountUpdated();
[[nodiscard]] int computeMaxFieldHeight() const;
void toggleMuteUnmute();
void reportSelectedMessages();
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);
void highlightMessage(MsgId universalMessageId);
void checkNextHighlight();
void updateHighlightedMessage();
void clearHighlightMessages();
void stopMessageHighlight();
auto computeSendButtonType() const;
2017-12-09 18:20:10 +00:00
void animationCallback();
void updateOverStates(QPoint pos);
void chooseAttach(std::optional<bool> overrideSendImagesAsPhotos = {});
void cornerButtonsAnimationFinish();
void sendButtonClicked();
2021-07-19 10:02:36 +00:00
void newItemAdded(not_null<HistoryItem*> item);
void maybeMarkReactionsRead(not_null<HistoryItem*> item);
2017-12-19 16:57:42 +00:00
void updateCornerButtonsPositions();
void updateHistoryDownVisibility();
void updateUnreadThingsVisibility();
void updateCornerButtonVisibility(CornerButton &button, bool shown);
2018-05-21 21:31:46 +00:00
bool canSendFiles(not_null<const QMimeData*> data) const;
bool confirmSendingFiles(
const QStringList &files,
2020-10-15 14:27:16 +00:00
const QString &insertTextOnCancel);
bool confirmSendingFiles(
QImage &&image,
QByteArray &&content,
2020-10-15 14:27:16 +00:00
std::optional<bool> overrideSendImagesAsPhotos = std::nullopt,
const QString &insertTextOnCancel = QString());
bool confirmSendingFiles(
2018-05-21 21:31:46 +00:00
not_null<const QMimeData*> data,
2020-10-15 14:27:16 +00:00
std::optional<bool> overrideSendImagesAsPhotos,
const QString &insertTextOnCancel = QString());
bool confirmSendingFiles(
Ui::PreparedList &&list,
2017-12-22 17:42:33 +00:00
const QString &insertTextOnCancel = QString());
bool showSendingFilesError(const Ui::PreparedList &list) const;
void sendingFilesConfirmed(
Ui::PreparedList &&list,
Ui::SendFilesWay way,
TextWithTags &&caption,
Api::SendOptions options,
bool ctrlShiftEnter);
2017-12-19 16:57:42 +00: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 15:09:03 +00:00
std::optional<QString> writeRestriction() const;
void orderWidgets();
2021-09-24 15:10:25 +00: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 14:34:39 +00:00
[[nodiscard]] bool showSlowmodeError();
void hideChildWidgets();
void hideSelectorControlsAnimated();
int countMembersDropdownHeightMax() const;
void updateReplyToName();
void checkForwardingInfo();
bool editingMessage() const {
return _editMsgId != 0;
}
bool jumpToDialogRow(const Dialogs::RowDescriptor &to);
2018-11-16 12:15:14 +00:00
void setupShortcuts();
bool showNextChat();
bool showPreviousChat();
void handlePeerMigration();
void updateReplyEditTexts(bool force = false);
void updateReplyEditText(not_null<HistoryItem*> item);
void updatePinnedViewer();
void setupPinnedTracker();
2020-10-12 09:41:05 +00:00
void checkPinnedBarState();
void refreshPinnedBarButton(bool many, HistoryItem *item);
void checkLastPinnedClickedIdReset(
int wasScrollTop,
int nowScrollTop);
void checkMessagesTTL();
2021-10-14 10:17:03 +00:00
void setupGroupCallBar();
void setupRequestsBar();
2020-11-20 19:25:35 +00: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 09:13:30 +00:00
bool paintShowAnimationFrame();
2016-02-25 10:32:31 +00:00
void updateMouseTracking();
// destroys _history and _migrated unread bars
void destroyUnreadBar();
2020-02-20 15:25:31 +00:00
void destroyUnreadBarOnClose();
void createUnreadBarIfBelowVisibleArea(int withScrollTop);
[[nodiscard]] bool insideJumpToEndInsteadOfToUnread() const;
void createUnreadBarAndResize();
2016-02-25 10:32:31 +00:00
void saveEditMsg();
2018-05-21 21:31:46 +00:00
void checkPreview();
void requestPreview();
void gotPreview(QString links, const MTPMessageMedia &media, mtpRequestId req);
void messagesReceived(PeerData *peer, const MTPmessages_Messages &messages, int requestId);
2021-03-12 12:48:00 +00:00
void messagesFailed(const MTP::Error &error, int requestId);
void addMessagesToFront(PeerData *peer, const QVector<MTPMessage> &messages);
void addMessagesToBack(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 10:02:36 +00: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 16:28:46 +00: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 21:31:46 +00:00
void setFieldText(
const TextWithTags &textWithTags,
TextUpdateEvents events = 0,
FieldHistoryAction fieldHistoryAction = FieldHistoryAction::Clear);
void clearFieldText(
TextUpdateEvents events = 0,
FieldHistoryAction fieldHistoryAction = FieldHistoryAction::Clear);
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
void visibleAreaUpdated();
int countInitialScrollTop();
int countAutomaticScrollTop();
void preloadHistoryByScroll();
void checkReplyReturns();
2019-04-02 09:13:30 +00:00
void scrollToAnimationCallback(FullMsgId attachToId, int relativeTo);
bool readyToForward() const;
2016-02-25 16:19:54 +00:00
bool hasSilentToggle() const;
2022-02-05 15:15:24 +00:00
void checkSupportPreload(bool force = false);
void handleSupportSwitch(not_null<History*> updated);
2019-08-16 09:32:42 +00:00
void inlineBotResolveDone(const MTPcontacts_ResolvedPeer &result);
2021-03-12 12:48:00 +00:00
void inlineBotResolveFail(const MTP::Error &error, const QString &username);
2019-08-16 09:32:42 +00:00
2021-09-24 15:10:25 +00:00
[[nodiscard]] bool isRecording() const;
[[nodiscard]] bool isSearching() const;
2021-09-24 15:10:25 +00:00
[[nodiscard]] bool isBotStart() const;
[[nodiscard]] bool isBlocked() const;
[[nodiscard]] bool isJoinChannel() const;
[[nodiscard]] bool isMuteUnmute() const;
[[nodiscard]] bool isReportMessages() const;
2019-08-16 09:32:42 +00:00
bool updateCmdStartShown();
void updateSendButtonType();
2021-09-24 15:10:25 +00:00
[[nodiscard]] bool showRecordButton() const;
[[nodiscard]] bool showInlineBotCancel() const;
2019-08-16 09:32:42 +00:00
void refreshSilentToggle();
2021-09-24 15:10:25 +00:00
[[nodiscard]] bool isChoosingTheme() const;
2019-08-16 09:32:42 +00:00
void setupScheduledToggle();
void refreshScheduledToggle();
2021-11-09 12:10:51 +00:00
void setupSendAsToggle();
void refreshSendAsToggle();
2022-04-28 12:16:26 +00:00
void refreshAttachBotsMenu();
2019-08-16 09:32:42 +00:00
2020-11-12 16:19:04 +00:00
bool kbWasHidden() const;
void searchInChat();
2020-06-30 14:14:05 +00:00
MTP::Sender _api;
2019-08-16 09:32:42 +00:00
MsgId _replyToId = 0;
Ui::Text::String _replyToName;
int _replyToNameVersion = 0;
Data::ResolvedForwardDraft _toForward;
2019-08-16 09:32:42 +00:00
Ui::Text::String _toForwardFrom, _toForwardText;
int _toForwardNameVersion = 0;
MsgId _editMsgId = 0;
HistoryItem *_replyEditMsg = nullptr;
Ui::Text::String _replyEditMsgText;
mutable base::Timer _updateEditTimeLeftDisplay;
object_ptr<Ui::IconButton> _fieldBarCancel;
std::unique_ptr<HistoryView::PinnedTracker> _pinnedTracker;
2020-10-12 15:05:54 +00:00
std::unique_ptr<Ui::PinnedBar> _pinnedBar;
int _pinnedBarHeight = 0;
FullMsgId _pinnedClickedId;
2020-10-26 11:46:08 +00:00
std::optional<FullMsgId> _minPinnedId;
2020-11-20 19:25:35 +00:00
std::unique_ptr<Ui::GroupCallBar> _groupCallBar;
int _groupCallBarHeight = 0;
2021-10-14 10:17:03 +00:00
std::unique_ptr<Ui::RequestsBar> _requestsBar;
int _requestsBarHeight = 0;
2020-11-20 19:25:35 +00:00
bool _preserveScrollTop = false;
2019-08-16 09:32:42 +00:00
mtpRequestId _saveEditMsgRequestId = 0;
QStringList _parsedLinks;
QString _previewLinks;
WebPageData *_previewData = nullptr;
typedef QMap<QString, WebPageId> PreviewCache;
PreviewCache _previewCache;
mtpRequestId _previewRequest = 0;
Ui::Text::String _previewTitle;
Ui::Text::String _previewDescription;
base::Timer _previewTimer;
Data::PreviewState _previewState = Data::PreviewState();
2019-08-16 09:32:42 +00:00
bool _replyForwardPressed = false;
HistoryItem *_replyReturn = nullptr;
QList<MsgId> _replyReturns;
PeerData *_peer = nullptr;
bool _canSendMessages = false;
MsgId _showAtMsgId = ShowAtUnreadMsgId;
int _firstLoadRequest = 0; // Not real mtpRequestId.
int _preloadRequest = 0; // Not real mtpRequestId.
int _preloadDownRequest = 0; // Not real mtpRequestId.
MsgId _delayedShowAtMsgId = -1;
int _delayedShowAtRequest = 0; // Not real mtpRequestId.
2022-02-05 15:15:24 +00:00
History *_supportPreloadHistory = nullptr;
int _supportPreloadRequest = 0; // Not real mtpRequestId.
2018-01-09 17:08:31 +00: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 16:19:04 +00:00
base::Timer _updateHistoryItems;
crl::time _lastUserScrolled = 0;
bool _synteticScrollEvent = false;
2019-04-02 09:13:30 +00:00
Ui::Animations::Simple _scrollToAnimation;
CornerButton _historyDown;
CornerButton _unreadMentions;
CornerButton _unreadReactions;
2021-09-24 15:10:25 +00:00
const object_ptr<FieldAutocomplete> _fieldAutocomplete;
object_ptr<Support::Autocomplete> _supportAutocomplete;
2018-05-21 21:31:46 +00:00
std::unique_ptr<MessageLinksParser> _fieldLinksParser;
UserData *_inlineBot = nullptr;
QString _inlineBotUsername;
2018-05-21 21:31:46 +00:00
bool _inlineLookingUpBot = false;
mtpRequestId _inlineBotResolveRequestId = 0;
bool _isInlineBot = false;
std::unique_ptr<HistoryView::ContactStatus> _contactStatus;
2015-09-08 12:20:30 +00: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;
2021-11-09 12:10:51 +00: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;
std::unique_ptr<HistoryView::ComposeSearch> _composeSearch;
bool _cmdStartShown = false;
2018-05-21 21:31:46 +00:00
object_ptr<Ui::InputField> _field;
bool _inReplyEditForward = false;
bool _inClickable = false;
bool _kbShown = false;
HistoryItem *_kbReplyTo = nullptr;
object_ptr<Ui::ScrollArea> _kbScroll;
2021-07-05 17:59:23 +00:00
const not_null<BotKeyboard*> _keyboard;
2021-09-24 15:10:25 +00:00
std::unique_ptr<Ui::ChooseThemeController> _chooseTheme;
object_ptr<Ui::InnerDropdown> _membersDropdown = { nullptr };
2020-11-12 16:19:04 +00: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 10:09:46 +00:00
Fn<void()> _raiseEmojiSuggestions;
2017-04-27 21:17:00 +00:00
bool _nonEmptySelection = false;
2017-08-31 16:28:58 +00:00
TextUpdateEvents _textUpdateEvents = (TextUpdateEvents() | TextUpdateEvent::SaveDraft | TextUpdateEvent::SendTyping);
QString _confirmSource;
2019-04-02 09:13:30 +00:00
Ui::Animations::Simple _a_show;
Window::SlideDirection _showDirection;
QPixmap _cacheUnder, _cacheOver;
MsgId _highlightedMessageId = 0;
std::deque<MsgId> _highlightQueue;
base::Timer _highlightTimer;
crl::time _highlightStart = 0;
crl::time _saveDraftStart = 0;
bool _saveDraftText = false;
2020-11-12 16:19:04 +00:00
base::Timer _saveDraftTimer;
base::Timer _saveCloudDraftTimer;
base::weak_ptr<Ui::Toast::Instance> _topToast;
std::unique_ptr<HistoryView::StickerToast> _stickerToast;
std::unique_ptr<ChooseMessagesForReport> _chooseForReport;
2021-07-19 10:02:36 +00:00
base::flat_set<not_null<HistoryItem*>> _itemRevealPending;
base::flat_map<
not_null<HistoryItem*>,
ItemRevealAnimation> _itemRevealAnimations;
int _itemsRevealHeight = 0;
object_ptr<Ui::PlainShadow> _topShadow;
bool _inGrab = false;
int _topDelta = 0;
2020-11-12 16:19:04 +00:00
rpl::event_stream<> _cancelRequests;
};