2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2020-06-10 11:22:37 +00:00
|
|
|
#include "history/history_drag_area.h"
|
2021-08-31 16:47:38 +00:00
|
|
|
#include "history/history.h"
|
2016-10-26 16:43:13 +00:00
|
|
|
#include "ui/widgets/tooltip.h"
|
2017-12-07 13:02:24 +00:00
|
|
|
#include "mainwidget.h"
|
2021-07-26 20:06:14 +00:00
|
|
|
#include "chat_helpers/bot_command.h"
|
2017-04-06 14:38:10 +00:00
|
|
|
#include "chat_helpers/field_autocomplete.h"
|
2016-05-19 12:03:51 +00:00
|
|
|
#include "window/section_widget.h"
|
2017-04-08 13:27:53 +00:00
|
|
|
#include "ui/widgets/input_fields.h"
|
2019-04-01 17:44:54 +00:00
|
|
|
#include "ui/effects/animations.h"
|
2017-10-05 15:35:52 +00:00
|
|
|
#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"
|
2016-04-29 13:46:16 +00:00
|
|
|
|
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;
|
2020-08-10 12:22:54 +00:00
|
|
|
|
2021-03-12 12:48:00 +00:00
|
|
|
namespace MTP {
|
|
|
|
class Error;
|
|
|
|
} // namespace MTP
|
|
|
|
|
2021-01-29 11:27:17 +00:00
|
|
|
namespace Data {
|
|
|
|
enum class PreviewState : char;
|
|
|
|
} // namespace Data
|
|
|
|
|
2020-08-10 12:22:54 +00:00
|
|
|
namespace SendMenu {
|
|
|
|
enum class Type;
|
|
|
|
} // namespace SendMenu
|
2017-12-19 16:57:42 +00:00
|
|
|
|
2019-08-12 12:11:34 +00:00
|
|
|
namespace Api {
|
|
|
|
struct SendOptions;
|
2021-11-09 15:24:13 +00:00
|
|
|
struct SendAction;
|
2019-08-12 12:11:34 +00:00
|
|
|
} // namespace Api
|
|
|
|
|
2016-04-29 13:46:16 +00:00
|
|
|
namespace InlineBots {
|
|
|
|
namespace Layout {
|
|
|
|
class ItemBase;
|
2017-03-27 18:11:51 +00:00
|
|
|
class Widget;
|
2016-04-29 13:46:16 +00:00
|
|
|
} // namespace Layout
|
2020-11-12 15:46:17 +00:00
|
|
|
struct ResultSelected;
|
2022-03-29 12:13:54 +00:00
|
|
|
class AttachBotsList;
|
2016-04-29 13:46:16 +00:00
|
|
|
} // namespace InlineBots
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-10-02 20:39:54 +00:00
|
|
|
namespace Support {
|
|
|
|
class Autocomplete;
|
2018-10-05 16:02:33 +00:00
|
|
|
struct Contact;
|
2018-10-02 20:39:54 +00:00
|
|
|
} // namespace Support
|
|
|
|
|
2016-05-19 17:18:23 +00:00
|
|
|
namespace Ui {
|
2017-03-27 12:24:38 +00:00
|
|
|
class AbstractButton;
|
2016-06-17 18:18:01 +00:00
|
|
|
class InnerDropdown;
|
2016-10-26 16:43:13 +00:00
|
|
|
class DropdownMenu;
|
2016-10-12 19:34:25 +00:00
|
|
|
class PlainShadow;
|
2016-10-26 16:43:13 +00:00
|
|
|
class PopupMenu;
|
|
|
|
class IconButton;
|
|
|
|
class HistoryDownButton;
|
|
|
|
class EmojiButton;
|
2016-12-26 22:46:36 +00:00
|
|
|
class SendButton;
|
2017-12-08 11:52:12 +00:00
|
|
|
class SilentToggle;
|
2016-11-11 13:46:04 +00:00
|
|
|
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;
|
2020-10-13 12:07:53 +00:00
|
|
|
struct PreparedList;
|
2020-10-16 17:48:27 +00:00
|
|
|
class SendFilesWay;
|
2021-11-09 12:10:51 +00:00
|
|
|
class SendAsButton;
|
2021-02-15 17:37:22 +00:00
|
|
|
enum class ReportReason;
|
2020-04-30 11:20:50 +00:00
|
|
|
namespace Toast {
|
|
|
|
class Instance;
|
|
|
|
} // namespace Toast
|
2021-09-24 15:10:25 +00:00
|
|
|
class ChooseThemeController;
|
2021-09-30 12:59:08 +00:00
|
|
|
class ContinuousScroll;
|
2016-05-19 17:18:23 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2017-03-27 12:24:38 +00:00
|
|
|
namespace Window {
|
2019-06-06 10:21:40 +00:00
|
|
|
class SessionController;
|
2017-03-27 12:24:38 +00:00
|
|
|
} // namespace Window
|
|
|
|
|
2017-03-29 14:04:00 +00:00
|
|
|
namespace ChatHelpers {
|
2017-04-08 14:05:19 +00:00
|
|
|
class TabbedPanel;
|
2017-04-09 18:06:06 +00:00
|
|
|
class TabbedSection;
|
|
|
|
class TabbedSelector;
|
2017-03-29 14:04:00 +00:00
|
|
|
} // 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 {
|
2022-05-26 08:30:50 +00:00
|
|
|
class StickerToast;
|
2018-01-09 17:08:31 +00:00
|
|
|
class TopBarWidget;
|
2019-06-07 11:32:58 +00:00
|
|
|
class ContactStatus;
|
2019-09-13 06:06:02 +00:00
|
|
|
class Element;
|
2020-10-09 16:23:53 +00:00
|
|
|
class PinnedTracker;
|
2022-03-22 13:18:36 +00:00
|
|
|
class ComposeSearch;
|
2020-10-03 23:25:25 +00:00
|
|
|
namespace Controls {
|
2020-10-07 09:19:03 +00:00
|
|
|
class RecordLock;
|
2020-10-03 23:25:25 +00:00
|
|
|
class VoiceRecordBar;
|
2021-02-11 07:25:43 +00:00
|
|
|
class TTLButton;
|
2020-10-03 23:25:25 +00:00
|
|
|
} // namespace Controls
|
2018-01-09 17:08:31 +00:00
|
|
|
} // namespace HistoryView
|
|
|
|
|
2017-03-29 14:04:00 +00:00
|
|
|
class DragArea;
|
2016-11-28 15:45:07 +00:00
|
|
|
class SendFilesBox;
|
2017-04-08 13:27:53 +00:00
|
|
|
class BotKeyboard;
|
|
|
|
class MessageField;
|
|
|
|
class HistoryInner;
|
2017-12-18 15:44:50 +00:00
|
|
|
struct HistoryMessageMarkupButton;
|
2015-06-15 17:19:24 +00:00
|
|
|
|
2020-06-11 16:09:46 +00:00
|
|
|
class HistoryWidget final : public Window::AbstractSectionWidget {
|
2014-05-30 08:53:19 +00:00
|
|
|
public:
|
2018-05-21 21:31:46 +00:00
|
|
|
using FieldHistoryAction = Ui::InputField::HistoryAction;
|
2020-10-07 09:19:03 +00:00
|
|
|
using RecordLock = HistoryView::Controls::RecordLock;
|
2020-10-03 23:25:25 +00:00
|
|
|
using VoiceRecordBar = HistoryView::Controls::VoiceRecordBar;
|
2018-05-21 21:31:46 +00:00
|
|
|
|
2020-05-12 08:18:31 +00:00
|
|
|
HistoryWidget(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Window::SessionController*> controller);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-03-19 09:18:19 +00:00
|
|
|
void start();
|
|
|
|
|
2015-07-17 19:17:37 +00:00
|
|
|
void historyLoaded();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2020-11-21 23:18:58 +00:00
|
|
|
[[nodiscard]] bool preventsClose(Fn<void()> &&continueCallback) const;
|
|
|
|
|
2020-06-11 09:41:03 +00:00
|
|
|
// 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);
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void windowShown();
|
2020-02-11 11:23:51 +00:00
|
|
|
[[nodiscard]] bool doWeReadServerHistory() const;
|
|
|
|
[[nodiscard]] bool doWeReadMentions() const;
|
2018-01-18 11:46:45 +00:00
|
|
|
bool skipItemRepaint();
|
2020-02-11 11:23:51 +00:00
|
|
|
void checkHistoryActivation();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-10-18 10:32:33 +00:00
|
|
|
void leaveToChildEvent(QEvent *e, QWidget *child) override;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2017-05-23 14:04:59 +00:00
|
|
|
bool isItemCompletelyHidden(HistoryItem *item) const;
|
2014-05-30 08:53:19 +00:00
|
|
|
void updateTopBarSelection();
|
2021-02-15 17:37:22 +00:00
|
|
|
void updateTopBarChooseForReport();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void loadMessages();
|
2014-07-04 11:12:54 +00:00
|
|
|
void loadMessagesDown();
|
2015-07-17 19:17:37 +00:00
|
|
|
void firstLoadMessages();
|
|
|
|
void delayedShowAt(MsgId showAtMsgId);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-12-31 15:27:21 +00:00
|
|
|
void updateFieldPlaceholder();
|
2021-09-03 12:48:11 +00:00
|
|
|
bool updateStickersByEmoji();
|
2015-12-31 15:27:21 +00:00
|
|
|
|
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);
|
2015-10-27 02:39:02 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void updateControlsVisibility();
|
2016-10-18 10:32:33 +00:00
|
|
|
void updateControlsGeometry();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-10-03 10:09:09 +00:00
|
|
|
History *history() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
PeerData *peer() const;
|
2015-10-03 10:09:09 +00:00
|
|
|
void setMsgId(MsgId showAtMsgId);
|
2015-07-17 19:17:37 +00:00
|
|
|
MsgId msgId() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-05-19 12:03:51 +00:00
|
|
|
bool hasTopBarShadow() const {
|
|
|
|
return peer() != nullptr;
|
|
|
|
}
|
|
|
|
void showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams ¶ms);
|
2017-09-30 19:20:40 +00:00
|
|
|
void finishAnimating();
|
2015-10-17 14:52:26 +00:00
|
|
|
|
2015-07-03 08:47:16 +00:00
|
|
|
void doneShow();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
QPoint clampMousePosition(QPoint point);
|
|
|
|
|
|
|
|
bool touchScroll(const QPoint &delta);
|
2015-12-31 15:27:21 +00:00
|
|
|
|
2018-01-14 16:02:25 +00:00
|
|
|
void enqueueMessageHighlight(not_null<HistoryView::Element*> view);
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time highlightStartTime(not_null<const HistoryItem*> item) const;
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2017-12-06 10:13:38 +00:00
|
|
|
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
|
|
|
|
2018-01-11 13:07:29 +00:00
|
|
|
void replyToMessage(FullMsgId itemId);
|
|
|
|
void replyToMessage(not_null<HistoryItem*> item);
|
|
|
|
void editMessage(FullMsgId itemId);
|
|
|
|
void editMessage(not_null<HistoryItem*> item);
|
|
|
|
|
2015-03-19 09:18:19 +00:00
|
|
|
MsgId replyToId() const;
|
2017-12-07 13:02:24 +00:00
|
|
|
bool lastForceReplyReplied(const FullMsgId &replyTo) const;
|
|
|
|
bool lastForceReplyReplied() const;
|
2016-06-14 16:26:41 +00:00
|
|
|
bool cancelReply(bool lastKeyboardUsed = false);
|
2016-02-25 10:32:31 +00:00
|
|
|
void cancelEdit();
|
2017-06-16 20:33:35 +00:00
|
|
|
void updateForwarding();
|
|
|
|
void updateForwardingTexts();
|
2015-03-24 10:00:27 +00:00
|
|
|
|
|
|
|
void clearReplyReturns();
|
2018-01-11 13:07:29 +00:00
|
|
|
void pushReplyReturn(not_null<HistoryItem*> item);
|
2015-03-24 10:00:27 +00:00
|
|
|
QList<MsgId> replyReturns();
|
|
|
|
void setReplyReturns(PeerId peer, const QList<MsgId> &replyReturns);
|
|
|
|
void calcNextReplyReturn();
|
2015-03-19 09:18:19 +00:00
|
|
|
|
2015-04-06 22:15:29 +00:00
|
|
|
void updatePreview();
|
|
|
|
void previewCancel();
|
|
|
|
|
2019-05-01 12:09:16 +00:00
|
|
|
void escape();
|
2015-06-17 19:43:03 +00:00
|
|
|
|
2021-07-26 23:18:11 +00:00
|
|
|
void sendBotCommand(const Bot::SendCommandRequest &request);
|
2016-11-20 12:54:07 +00:00
|
|
|
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
|
2017-03-27 18:11:51 +00:00
|
|
|
bool insertBotCommand(const QString &cmd);
|
2015-06-15 17:19:24 +00:00
|
|
|
|
2016-03-01 02:36:23 +00:00
|
|
|
bool eventFilter(QObject *obj, QEvent *e) override;
|
2016-04-01 15:32:26 +00:00
|
|
|
|
|
|
|
// 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);
|
2015-06-18 17:24:54 +00:00
|
|
|
|
2017-12-07 13:02:24 +00:00
|
|
|
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);
|
2021-02-15 17:37:22 +00:00
|
|
|
void setChooseReportMessagesDetails(
|
|
|
|
Ui::ReportReason reason,
|
|
|
|
Fn<void(MessageIdsList)> callback);
|
2015-07-17 19:17:37 +00:00
|
|
|
void clearAllLoadRequests();
|
2022-02-05 15:15:24 +00:00
|
|
|
void clearSupportPreloadRequest();
|
2020-02-21 14:02:13 +00:00
|
|
|
void clearDelayedShowAtRequest();
|
|
|
|
void clearDelayedShowAt();
|
2016-06-03 18:24:27 +00:00
|
|
|
void saveFieldToHistoryLocalDraft();
|
|
|
|
|
2021-09-24 15:10:25 +00:00
|
|
|
void toggleChooseChatTheme(not_null<PeerData*> peer);
|
2022-05-18 10:18:17 +00:00
|
|
|
[[nodiscard]] Ui::ChatTheme *customChatTheme() const;
|
2021-09-24 15:10:25 +00:00
|
|
|
|
2016-06-03 18:24:27 +00:00
|
|
|
void applyCloudDraft(History *history);
|
2015-07-17 19:17:37 +00:00
|
|
|
|
2016-04-09 11:02:50 +00:00
|
|
|
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();
|
|
|
|
}
|
2015-09-12 19:00:56 +00:00
|
|
|
|
2018-04-09 17:48:29 +00:00
|
|
|
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 ¶ms);
|
2015-10-17 14:52:26 +00:00
|
|
|
|
2018-01-26 15:40:11 +00:00
|
|
|
void forwardSelected();
|
|
|
|
void confirmDeleteSelected();
|
|
|
|
void clearSelected();
|
2016-12-31 13:34:41 +00:00
|
|
|
|
2021-11-02 16:11:20 +00:00
|
|
|
[[nodiscard]] SendMenu::Type sendMenuType() const;
|
2020-07-24 08:22:45 +00:00
|
|
|
bool sendExistingDocument(
|
|
|
|
not_null<DocumentData*> document,
|
2022-02-08 19:20:37 +00:00
|
|
|
Api::SendOptions options,
|
|
|
|
std::optional<MsgId> localId = std::nullopt);
|
2020-08-07 16:13:47 +00:00
|
|
|
bool sendExistingPhoto(
|
|
|
|
not_null<PhotoData*> photo,
|
|
|
|
Api::SendOptions options);
|
2018-11-21 18:14:48 +00:00
|
|
|
|
2020-04-30 11:20:50 +00:00
|
|
|
void showInfoTooltip(
|
|
|
|
const TextWithEntities &text,
|
|
|
|
Fn<void()> hiddenCallback);
|
|
|
|
void hideInfoTooltip(anim::type animated);
|
2022-05-26 08:30:50 +00:00
|
|
|
void showPremiumStickerTooltip(
|
|
|
|
not_null<const HistoryView::Element*> view);
|
2020-04-30 11:20:50 +00:00
|
|
|
|
2019-08-16 12:44:20 +00:00
|
|
|
// Tabbed selector management.
|
2020-05-05 12:55:05 +00:00
|
|
|
bool pushTabbedSelectorToThirdSection(
|
|
|
|
not_null<PeerData*> peer,
|
2019-08-16 12:44:20 +00:00
|
|
|
const Window::SectionShow ¶ms) override;
|
|
|
|
bool returnTabbedSelector() override;
|
|
|
|
|
2017-05-22 15:25:49 +00:00
|
|
|
// Float player interface.
|
2020-06-25 14:17:37 +00:00
|
|
|
bool floatPlayerHandleWheelEvent(QEvent *e) override;
|
|
|
|
QRect floatPlayerAvailableRect() override;
|
2017-05-22 15:25:49 +00:00
|
|
|
|
2016-08-12 16:28:10 +00:00
|
|
|
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
|
2015-11-20 13:34:37 +00:00
|
|
|
|
2016-12-19 16:51:29 +00:00
|
|
|
~HistoryWidget();
|
|
|
|
|
2016-10-18 10:32:33 +00:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
|
|
|
void mousePressEvent(QMouseEvent *e) override;
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2017-02-11 11:24:37 +00:00
|
|
|
void leaveEventHook(QEvent *e) override;
|
2016-10-18 10:32:33 +00:00
|
|
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *e) override;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
private:
|
2017-09-16 16:53:41 +00:00
|
|
|
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;
|
|
|
|
};
|
2021-02-15 17:37:22 +00:00
|
|
|
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;
|
2021-07-19 17:01:39 +00:00
|
|
|
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; };
|
2022-01-26 16:01:40 +00:00
|
|
|
struct CornerButton {
|
|
|
|
template <typename ...Args>
|
|
|
|
CornerButton(Args &&...args) : widget(std::forward<Args>(args)...) {
|
|
|
|
}
|
2017-03-27 18:11:51 +00:00
|
|
|
|
2022-01-26 16:01:40 +00:00
|
|
|
Ui::Animations::Simple animation;
|
|
|
|
bool shown = false;
|
|
|
|
object_ptr<Ui::HistoryDownButton> widget;
|
|
|
|
};
|
2021-02-19 13:53:20 +00:00
|
|
|
void checkSuggestToGigagroup();
|
|
|
|
|
2018-11-21 18:14:48 +00:00
|
|
|
void initTabbedSelector();
|
2020-10-03 23:25:25 +00:00
|
|
|
void initVoiceRecordBar();
|
2019-08-16 12:44:20 +00:00
|
|
|
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();
|
2020-11-12 15:46:17 +00:00
|
|
|
|
|
|
|
[[nodiscard]] Dialogs::EntryState computeDialogsEntryState() const;
|
2020-11-11 20:47:40 +00:00
|
|
|
void refreshTopBarActiveChat();
|
2018-11-21 18:14:48 +00:00
|
|
|
|
2022-04-15 16:57:03 +00:00
|
|
|
void refreshJoinChannelText();
|
2020-06-10 18:08:17 +00:00
|
|
|
void requestMessageData(MsgId msgId);
|
2021-12-09 07:32:54 +00:00
|
|
|
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;
|
2019-08-12 12:11:34 +00:00
|
|
|
void send(Api::SendOptions options);
|
|
|
|
void sendWithModifiers(Qt::KeyboardModifiers modifiers);
|
|
|
|
void sendSilent();
|
|
|
|
void sendScheduled();
|
2020-08-10 12:22:54 +00:00
|
|
|
[[nodiscard]] SendMenu::Type sendButtonMenuType() const;
|
2017-06-21 23:54:38 +00:00
|
|
|
void handlePendingHistoryUpdate();
|
2021-10-12 12:50:18 +00:00
|
|
|
void fullInfoUpdated();
|
2017-04-09 18:06:06 +00:00
|
|
|
void toggleTabbedSelectorMode();
|
|
|
|
void recountChatWidth();
|
2017-08-11 07:16:07 +00:00
|
|
|
void historyDownClicked();
|
|
|
|
void showNextUnreadMention();
|
2022-01-26 16:01:40 +00:00
|
|
|
void showNextUnreadReaction();
|
2017-08-11 10:42:52 +00:00
|
|
|
void handlePeerUpdate();
|
2017-11-13 08:05:56 +00:00
|
|
|
void setMembersShowAreaActive(bool active);
|
2018-01-18 09:53:49 +00:00
|
|
|
void handleHistoryChange(not_null<const History*> history);
|
2020-04-30 11:20:50 +00:00
|
|
|
void showAboutTopPromotion();
|
2018-06-26 18:03:45 +00:00
|
|
|
void unreadCountUpdated();
|
2017-03-27 12:24:38 +00:00
|
|
|
|
2019-05-30 18:53:13 +00:00
|
|
|
[[nodiscard]] int computeMaxFieldHeight() const;
|
2019-05-24 08:24:54 +00:00
|
|
|
void toggleMuteUnmute();
|
2021-02-15 17:37:22 +00:00
|
|
|
void reportSelectedMessages();
|
2019-05-24 08:24:54 +00:00
|
|
|
void toggleKeyboard(bool manual = true);
|
|
|
|
void startBotCommand();
|
|
|
|
void hidePinnedMessage();
|
|
|
|
void cancelFieldAreaState();
|
|
|
|
void unblockUser();
|
|
|
|
void sendBotStartCommand();
|
|
|
|
void joinChannel();
|
|
|
|
|
2018-10-05 16:02:33 +00:00
|
|
|
void supportInitAutocomplete();
|
|
|
|
void supportInsertText(const QString &text);
|
|
|
|
void supportShareContact(Support::Contact contact);
|
|
|
|
|
2017-08-25 15:17:46 +00:00
|
|
|
void highlightMessage(MsgId universalMessageId);
|
|
|
|
void checkNextHighlight();
|
|
|
|
void updateHighlightedMessage();
|
|
|
|
void clearHighlightMessages();
|
|
|
|
void stopMessageHighlight();
|
|
|
|
|
2019-09-02 09:03:02 +00:00
|
|
|
auto computeSendButtonType() const;
|
2017-12-09 18:20:10 +00:00
|
|
|
|
2016-12-05 11:01:08 +00:00
|
|
|
void animationCallback();
|
2016-12-26 22:46:36 +00:00
|
|
|
void updateOverStates(QPoint pos);
|
2022-04-05 06:49:55 +00:00
|
|
|
void chooseAttach(std::optional<bool> overrideSendImagesAsPhotos = {});
|
2022-01-26 16:01:40 +00:00
|
|
|
void cornerButtonsAnimationFinish();
|
2016-12-26 22:46:36 +00:00
|
|
|
void sendButtonClicked();
|
2021-07-19 10:02:36 +00:00
|
|
|
void newItemAdded(not_null<HistoryItem*> item);
|
2022-01-28 11:24:07 +00:00
|
|
|
void maybeMarkReactionsRead(not_null<HistoryItem*> item);
|
2017-12-19 16:57:42 +00:00
|
|
|
|
2022-01-26 16:01:40 +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;
|
2017-12-21 16:15:37 +00:00
|
|
|
bool confirmSendingFiles(
|
|
|
|
const QStringList &files,
|
2020-10-15 14:27:16 +00:00
|
|
|
const QString &insertTextOnCancel);
|
2017-12-21 16:15:37 +00:00
|
|
|
bool confirmSendingFiles(
|
|
|
|
QImage &&image,
|
|
|
|
QByteArray &&content,
|
2020-10-15 14:27:16 +00:00
|
|
|
std::optional<bool> overrideSendImagesAsPhotos = std::nullopt,
|
2017-12-21 16:15:37 +00:00
|
|
|
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,
|
2017-12-21 16:15:37 +00:00
|
|
|
const QString &insertTextOnCancel = QString());
|
|
|
|
bool confirmSendingFiles(
|
2020-10-13 12:07:53 +00:00
|
|
|
Ui::PreparedList &&list,
|
2017-12-22 17:42:33 +00:00
|
|
|
const QString &insertTextOnCancel = QString());
|
2020-10-13 12:07:53 +00:00
|
|
|
bool showSendingFilesError(const Ui::PreparedList &list) const;
|
2017-12-21 16:15:37 +00:00
|
|
|
|
2020-10-16 17:48:27 +00:00
|
|
|
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);
|
2017-10-05 15:35:52 +00:00
|
|
|
void itemRemoved(not_null<const HistoryItem*> item);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-04-09 11:02:50 +00:00
|
|
|
// Updates position of controls around the message field,
|
|
|
|
// like send button, emoji button and others.
|
|
|
|
void moveFieldControls();
|
|
|
|
void updateFieldSize();
|
|
|
|
|
2016-06-10 15:34:35 +00:00
|
|
|
bool canWriteMessage() const;
|
2019-06-19 15:09:03 +00:00
|
|
|
std::optional<QString> writeRestriction() const;
|
2017-03-27 18:11:51 +00:00
|
|
|
void orderWidgets();
|
2016-06-10 15:11:44 +00:00
|
|
|
|
2021-09-24 15:10:25 +00:00
|
|
|
[[nodiscard]] InlineBotQuery parseInlineBotQuery() const;
|
|
|
|
[[nodiscard]] auto parseMentionHashtagBotCommandQuery() const
|
|
|
|
-> AutocompleteQuery;
|
|
|
|
|
2016-04-09 11:02:50 +00:00
|
|
|
void clearInlineBot();
|
|
|
|
void inlineBotChanged();
|
|
|
|
|
2016-05-08 16:11:47 +00:00
|
|
|
// 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);
|
|
|
|
|
2016-06-14 16:26:41 +00:00
|
|
|
void cancelReplyAfterMediaSend(bool lastKeyboardUsed);
|
2019-10-10 10:13:46 +00:00
|
|
|
bool replyToPreviousMessage();
|
|
|
|
bool replyToNextMessage();
|
2019-07-17 14:34:39 +00:00
|
|
|
[[nodiscard]] bool showSlowmodeError();
|
2016-06-14 16:26:41 +00:00
|
|
|
|
2020-10-13 23:48:10 +00:00
|
|
|
void hideChildWidgets();
|
2016-10-26 16:43:13 +00:00
|
|
|
void hideSelectorControlsAnimated();
|
2016-06-20 11:31:12 +00:00
|
|
|
int countMembersDropdownHeightMax() const;
|
|
|
|
|
2017-06-16 20:33:35 +00:00
|
|
|
void updateReplyToName();
|
|
|
|
void checkForwardingInfo();
|
2017-06-17 19:51:23 +00:00
|
|
|
bool editingMessage() const {
|
|
|
|
return _editMsgId != 0;
|
|
|
|
}
|
2018-10-05 16:02:33 +00:00
|
|
|
bool jumpToDialogRow(const Dialogs::RowDescriptor &to);
|
2017-06-16 20:33:35 +00:00
|
|
|
|
2018-11-16 12:15:14 +00:00
|
|
|
void setupShortcuts();
|
|
|
|
bool showNextChat();
|
|
|
|
bool showPreviousChat();
|
|
|
|
|
2019-01-14 06:34:51 +00:00
|
|
|
void handlePeerMigration();
|
|
|
|
|
2016-03-10 10:15:21 +00:00
|
|
|
void updateReplyEditTexts(bool force = false);
|
2018-05-31 11:13:11 +00:00
|
|
|
void updateReplyEditText(not_null<HistoryItem*> item);
|
2016-03-10 10:15:21 +00:00
|
|
|
|
2020-10-09 16:23:53 +00:00
|
|
|
void updatePinnedViewer();
|
|
|
|
void setupPinnedTracker();
|
2020-10-12 09:41:05 +00:00
|
|
|
void checkPinnedBarState();
|
2022-04-22 18:45:54 +00:00
|
|
|
void refreshPinnedBarButton(bool many, HistoryItem *item);
|
2020-10-26 10:22:14 +00:00
|
|
|
void checkLastPinnedClickedIdReset(
|
|
|
|
int wasScrollTop,
|
|
|
|
int nowScrollTop);
|
2016-03-10 10:15:21 +00:00
|
|
|
|
2021-02-11 07:25:43 +00:00
|
|
|
void checkMessagesTTL();
|
2021-10-14 10:17:03 +00:00
|
|
|
void setupGroupCallBar();
|
|
|
|
void setupRequestsBar();
|
2020-11-20 19:25:35 +00:00
|
|
|
|
2020-11-12 15:46:17 +00:00
|
|
|
void sendInlineResult(InlineBots::ResultSelected result);
|
2015-12-31 05:34:43 +00:00
|
|
|
|
2016-05-09 12:03:06 +00:00
|
|
|
void drawField(Painter &p, const QRect &rect);
|
2019-01-14 17:43:06 +00:00
|
|
|
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();
|
2015-03-19 09:18:19 +00:00
|
|
|
|
2016-02-25 10:32:31 +00:00
|
|
|
void updateMouseTracking();
|
|
|
|
|
2016-03-18 19:05:08 +00:00
|
|
|
// destroys _history and _migrated unread bars
|
|
|
|
void destroyUnreadBar();
|
2020-02-20 15:25:31 +00:00
|
|
|
void destroyUnreadBarOnClose();
|
2020-02-20 16:22:30 +00:00
|
|
|
void createUnreadBarIfBelowVisibleArea(int withScrollTop);
|
2020-02-20 16:46:56 +00:00
|
|
|
[[nodiscard]] bool insideJumpToEndInsteadOfToUnread() const;
|
2020-02-21 06:37:57 +00:00
|
|
|
void createUnreadBarAndResize();
|
2016-03-18 19:05:08 +00:00
|
|
|
|
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);
|
2020-02-21 11:51:37 +00:00
|
|
|
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);
|
2016-05-27 16:47:46 +00:00
|
|
|
void addMessagesToFront(PeerData *peer, const QVector<MTPMessage> &messages);
|
|
|
|
void addMessagesToBack(PeerData *peer, const QVector<MTPMessage> &messages);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2017-05-24 19:21:58 +00:00
|
|
|
void updateHistoryGeometry(bool initial = false, bool loadedDown = false, const ScrollChange &change = { ScrollChangeNone, 0 });
|
|
|
|
void updateListSize();
|
2021-07-19 17:01:39 +00:00
|
|
|
void startItemRevealAnimations();
|
2021-07-19 10:02:36 +00:00
|
|
|
void revealItemsCallback();
|
2016-03-14 17:45:59 +00:00
|
|
|
|
2022-02-08 19:20:37 +00:00
|
|
|
void startMessageSendingAnimation(not_null<HistoryItem*> item);
|
|
|
|
|
2016-04-04 08:57:36 +00:00
|
|
|
// Does any of the shown histories has this flag set.
|
2018-01-13 12:45:11 +00:00
|
|
|
bool hasPendingResizedItems() const;
|
2016-04-04 08:57:36 +00:00
|
|
|
|
2016-03-31 14:06:40 +00:00
|
|
|
// 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;
|
2018-01-14 16:02:25 +00:00
|
|
|
int itemTopForHighlight(not_null<HistoryView::Element*> view) const;
|
2017-05-21 17:08:59 +00:00
|
|
|
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);
|
2016-03-31 14:06:40 +00:00
|
|
|
|
2020-11-13 17:27:08 +00:00
|
|
|
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);
|
2014-11-05 17:43:32 +00:00
|
|
|
|
2021-08-30 15:31:01 +00:00
|
|
|
void unregisterDraftSources();
|
|
|
|
void registerDraftSource();
|
|
|
|
void setHistory(History *history);
|
|
|
|
void setEditMsgId(MsgId msgId);
|
|
|
|
|
2017-05-24 19:21:58 +00:00
|
|
|
HistoryItem *getItemFromHistoryOrMigrated(MsgId genericMsgId) const;
|
2017-05-24 13:22:27 +00:00
|
|
|
void animatedScrollToItem(MsgId msgId);
|
2017-05-24 19:21:58 +00:00
|
|
|
void animatedScrollToY(int scrollTo, HistoryItem *attachTo = nullptr);
|
2017-08-25 15:17:46 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
// when scroll position or scroll area size changed this method
|
|
|
|
// updates the boundings of the visible area in HistoryInner
|
|
|
|
void visibleAreaUpdated();
|
2017-05-24 19:21:58 +00:00
|
|
|
int countInitialScrollTop();
|
|
|
|
int countAutomaticScrollTop();
|
|
|
|
void preloadHistoryByScroll();
|
|
|
|
void checkReplyReturns();
|
2019-04-02 09:13:30 +00:00
|
|
|
void scrollToAnimationCallback(FullMsgId attachToId, int relativeTo);
|
2016-03-22 19:43:47 +00:00
|
|
|
|
2015-09-20 08:55:41 +00:00
|
|
|
bool readyToForward() const;
|
2016-02-25 16:19:54 +00:00
|
|
|
bool hasSilentToggle() const;
|
2015-09-07 07:52:37 +00:00
|
|
|
|
2022-02-05 15:15:24 +00:00
|
|
|
void checkSupportPreload(bool force = false);
|
2018-09-29 12:18:26 +00:00
|
|
|
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;
|
2022-03-22 13:18:36 +00:00
|
|
|
[[nodiscard]] bool isSearching() const;
|
2020-10-03 23:25:25 +00:00
|
|
|
|
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;
|
|
|
|
|
2022-03-22 13:18:36 +00:00
|
|
|
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;
|
|
|
|
|
2021-08-31 16:47:38 +00:00
|
|
|
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;
|
|
|
|
|
2020-10-09 16:23:53 +00:00
|
|
|
std::unique_ptr<HistoryView::PinnedTracker> _pinnedTracker;
|
2020-10-12 15:05:54 +00:00
|
|
|
std::unique_ptr<Ui::PinnedBar> _pinnedBar;
|
2020-10-10 12:04:28 +00:00
|
|
|
int _pinnedBarHeight = 0;
|
2020-10-26 10:22:14 +00:00
|
|
|
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;
|
2021-01-29 11:27:17 +00:00
|
|
|
Data::PreviewState _previewState = Data::PreviewState();
|
2019-08-16 09:32:42 +00:00
|
|
|
|
|
|
|
bool _replyForwardPressed = false;
|
|
|
|
|
|
|
|
HistoryItem *_replyReturn = nullptr;
|
|
|
|
QList<MsgId> _replyReturns;
|
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
PeerData *_peer = nullptr;
|
|
|
|
|
|
|
|
bool _canSendMessages = false;
|
|
|
|
MsgId _showAtMsgId = ShowAtUnreadMsgId;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2020-02-21 11:51:37 +00:00
|
|
|
int _firstLoadRequest = 0; // Not real mtpRequestId.
|
|
|
|
int _preloadRequest = 0; // Not real mtpRequestId.
|
|
|
|
int _preloadDownRequest = 0; // Not real mtpRequestId.
|
2015-07-17 19:17:37 +00:00
|
|
|
|
2018-01-18 09:53:49 +00:00
|
|
|
MsgId _delayedShowAtMsgId = -1;
|
2020-02-21 11:51:37 +00:00
|
|
|
int _delayedShowAtRequest = 0; // Not real mtpRequestId.
|
2015-07-17 19:17:37 +00:00
|
|
|
|
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;
|
2021-09-30 12:59:08 +00:00
|
|
|
object_ptr<Ui::ContinuousScroll> _scroll;
|
2016-12-13 17:07:56 +00:00
|
|
|
QPointer<HistoryInner> _list;
|
2016-03-22 19:43:47 +00:00
|
|
|
History *_migrated = nullptr;
|
|
|
|
History *_history = nullptr;
|
2018-01-18 09:53:49 +00:00
|
|
|
// Initial updateHistoryGeometry() was called.
|
|
|
|
bool _historyInited = false;
|
|
|
|
// If updateListSize() was called without updateHistoryGeometry().
|
|
|
|
bool _updateHistoryGeometryRequired = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2017-05-21 17:08:59 +00:00
|
|
|
int _lastScrollTop = 0; // gifs optimization
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time _lastScrolled = 0;
|
2020-11-12 16:19:04 +00:00
|
|
|
base::Timer _updateHistoryItems;
|
2016-01-03 08:01:14 +00:00
|
|
|
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time _lastUserScrolled = 0;
|
2017-05-21 17:08:59 +00:00
|
|
|
bool _synteticScrollEvent = false;
|
2019-04-02 09:13:30 +00:00
|
|
|
Ui::Animations::Simple _scrollToAnimation;
|
2017-05-21 17:08:59 +00:00
|
|
|
|
2022-01-26 16:01:40 +00:00
|
|
|
CornerButton _historyDown;
|
|
|
|
CornerButton _unreadMentions;
|
|
|
|
CornerButton _unreadReactions;
|
2017-08-11 07:16:07 +00:00
|
|
|
|
2021-09-24 15:10:25 +00:00
|
|
|
const object_ptr<FieldAutocomplete> _fieldAutocomplete;
|
2018-10-02 20:39:54 +00:00
|
|
|
object_ptr<Support::Autocomplete> _supportAutocomplete;
|
2018-05-21 21:31:46 +00:00
|
|
|
std::unique_ptr<MessageLinksParser> _fieldLinksParser;
|
2016-04-09 11:02:50 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
UserData *_inlineBot = nullptr;
|
2015-12-30 19:09:20 +00:00
|
|
|
QString _inlineBotUsername;
|
2018-05-21 21:31:46 +00:00
|
|
|
bool _inlineLookingUpBot = false;
|
2016-03-22 19:43:47 +00:00
|
|
|
mtpRequestId _inlineBotResolveRequestId = 0;
|
2016-12-26 22:46:36 +00:00
|
|
|
bool _isInlineBot = false;
|
2019-08-08 17:07:55 +00:00
|
|
|
|
2019-06-07 11:32:58 +00:00
|
|
|
std::unique_ptr<HistoryView::ContactStatus> _contactStatus;
|
2015-09-08 12:20:30 +00:00
|
|
|
|
2020-10-03 23:25:25 +00:00
|
|
|
const std::shared_ptr<Ui::SendButton> _send;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::FlatButton> _unblock;
|
|
|
|
object_ptr<Ui::FlatButton> _botStart;
|
|
|
|
object_ptr<Ui::FlatButton> _joinChannel;
|
|
|
|
object_ptr<Ui::FlatButton> _muteUnmute;
|
2021-02-15 17:37:22 +00:00
|
|
|
object_ptr<Ui::FlatButton> _reportMessages;
|
2022-04-07 12:16:43 +00:00
|
|
|
object_ptr<Ui::RoundButton> _botMenuButton = { nullptr };
|
|
|
|
QString _botMenuButtonText;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::IconButton> _attachToggle;
|
2021-11-09 12:10:51 +00:00
|
|
|
object_ptr<Ui::SendAsButton> _sendAs = { nullptr };
|
2017-04-09 18:06:06 +00:00
|
|
|
object_ptr<Ui::EmojiButton> _tabbedSelectorToggle;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::IconButton> _botKeyboardShow;
|
|
|
|
object_ptr<Ui::IconButton> _botKeyboardHide;
|
|
|
|
object_ptr<Ui::IconButton> _botCommandStart;
|
2017-12-08 11:52:12 +00:00
|
|
|
object_ptr<Ui::SilentToggle> _silent = { nullptr };
|
2019-08-08 17:07:55 +00:00
|
|
|
object_ptr<Ui::IconButton> _scheduled = { nullptr };
|
2021-02-11 07:25:43 +00:00
|
|
|
std::unique_ptr<HistoryView::Controls::TTLButton> _ttlInfo;
|
2020-10-03 23:25:25 +00:00
|
|
|
const std::unique_ptr<VoiceRecordBar> _voiceRecordBar;
|
2022-03-22 13:18:36 +00:00
|
|
|
std::unique_ptr<HistoryView::ComposeSearch> _composeSearch;
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _cmdStartShown = false;
|
2018-05-21 21:31:46 +00:00
|
|
|
object_ptr<Ui::InputField> _field;
|
2017-07-11 10:23:15 +00:00
|
|
|
bool _inReplyEditForward = false;
|
2016-11-18 13:34:58 +00:00
|
|
|
bool _inClickable = false;
|
2016-12-07 13:32:25 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _kbShown = false;
|
|
|
|
HistoryItem *_kbReplyTo = nullptr;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::ScrollArea> _kbScroll;
|
2021-07-05 17:59:23 +00:00
|
|
|
const not_null<BotKeyboard*> _keyboard;
|
2015-06-15 17:19:24 +00:00
|
|
|
|
2021-09-24 15:10:25 +00:00
|
|
|
std::unique_ptr<Ui::ChooseThemeController> _chooseTheme;
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::InnerDropdown> _membersDropdown = { nullptr };
|
2020-11-12 16:19:04 +00:00
|
|
|
base::Timer _membersDropdownShowTimer;
|
2016-06-17 18:18:01 +00:00
|
|
|
|
2017-03-27 18:11:51 +00:00
|
|
|
object_ptr<InlineBots::Layout::Widget> _inlineResults = { nullptr };
|
2019-08-16 12:44:20 +00:00
|
|
|
std::unique_ptr<TabbedPanel> _tabbedPanel;
|
2022-03-29 12:13:54 +00:00
|
|
|
std::unique_ptr<Ui::DropdownMenu> _attachBotsMenu;
|
2020-06-10 11:22:37 +00:00
|
|
|
|
|
|
|
DragArea::Areas _attachDragAreas;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-11-21 10:09:46 +00:00
|
|
|
Fn<void()> _raiseEmojiSuggestions;
|
2017-07-22 08:35:18 +00:00
|
|
|
|
2017-04-27 21:17:00 +00:00
|
|
|
bool _nonEmptySelection = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2017-08-31 16:28:58 +00:00
|
|
|
TextUpdateEvents _textUpdateEvents = (TextUpdateEvents() | TextUpdateEvent::SaveDraft | TextUpdateEvent::SendTyping);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-07-17 19:17:37 +00:00
|
|
|
QString _confirmSource;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2019-04-02 09:13:30 +00:00
|
|
|
Ui::Animations::Simple _a_show;
|
2016-12-05 11:01:08 +00:00
|
|
|
Window::SlideDirection _showDirection;
|
2016-05-19 12:03:51 +00:00
|
|
|
QPixmap _cacheUnder, _cacheOver;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2017-08-25 15:17:46 +00:00
|
|
|
MsgId _highlightedMessageId = 0;
|
|
|
|
std::deque<MsgId> _highlightQueue;
|
|
|
|
base::Timer _highlightTimer;
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time _highlightStart = 0;
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time _saveDraftStart = 0;
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _saveDraftText = false;
|
2020-11-12 16:19:04 +00:00
|
|
|
base::Timer _saveDraftTimer;
|
|
|
|
base::Timer _saveCloudDraftTimer;
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2020-04-30 11:20:50 +00:00
|
|
|
base::weak_ptr<Ui::Toast::Instance> _topToast;
|
2022-05-26 08:30:50 +00:00
|
|
|
std::unique_ptr<HistoryView::StickerToast> _stickerToast;
|
2021-02-15 17:37:22 +00:00
|
|
|
std::unique_ptr<ChooseMessagesForReport> _chooseForReport;
|
2020-04-30 11:20:50 +00:00
|
|
|
|
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;
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::PlainShadow> _topShadow;
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _inGrab = false;
|
2015-10-17 08:31:48 +00:00
|
|
|
|
2020-06-11 09:41:03 +00:00
|
|
|
int _topDelta = 0;
|
|
|
|
|
2020-11-12 16:19:04 +00:00
|
|
|
rpl::event_stream<> _cancelRequests;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
};
|