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
|
|
|
|
|
2016-10-26 16:43:13 +00:00
|
|
|
#include "ui/widgets/tooltip.h"
|
2017-12-07 13:02:24 +00:00
|
|
|
#include "mainwidget.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"
|
2016-10-05 16:56:27 +00:00
|
|
|
#include "core/single_timer.h"
|
2017-04-08 13:27:53 +00:00
|
|
|
#include "ui/widgets/input_fields.h"
|
2017-10-05 15:35:52 +00:00
|
|
|
#include "ui/rp_widget.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 FileMediaInformation;
|
|
|
|
struct SendingAlbum;
|
|
|
|
enum class SendMediaType;
|
|
|
|
enum class CompressConfirm;
|
2018-05-21 21:31:46 +00:00
|
|
|
class MessageLinksParser;
|
2017-12-19 16:57:42 +00:00
|
|
|
|
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
|
|
|
|
class Result;
|
|
|
|
} // namespace InlineBots
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-01-13 12:45:11 +00:00
|
|
|
namespace Data {
|
|
|
|
struct Draft;
|
|
|
|
} // namespace Data
|
|
|
|
|
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;
|
2017-07-22 08:35:18 +00:00
|
|
|
namespace Emoji {
|
|
|
|
class SuggestionsController;
|
|
|
|
} // namespace Emoji
|
2016-05-19 17:18:23 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2017-03-27 12:24:38 +00:00
|
|
|
namespace Window {
|
|
|
|
class Controller;
|
|
|
|
} // 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;
|
|
|
|
struct PreparedList;
|
2018-03-25 11:37:57 +00:00
|
|
|
struct UploadedPhoto;
|
|
|
|
struct UploadedDocument;
|
|
|
|
struct UploadedThumbDocument;
|
2017-12-19 16:57:42 +00:00
|
|
|
} // namespace Storage
|
|
|
|
|
2018-01-09 17:08:31 +00:00
|
|
|
namespace HistoryView {
|
|
|
|
class TopBarWidget;
|
|
|
|
} // 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
|
|
|
|
2015-09-08 12:20:30 +00:00
|
|
|
class ReportSpamPanel : public TWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-04-06 16:49:42 +00:00
|
|
|
ReportSpamPanel(QWidget *parent);
|
2015-09-08 12:20:30 +00:00
|
|
|
|
2015-09-21 20:57:42 +00:00
|
|
|
void setReported(bool reported, PeerData *onPeer);
|
2015-09-08 17:22:29 +00:00
|
|
|
|
2015-09-08 12:20:30 +00:00
|
|
|
signals:
|
|
|
|
void hideClicked();
|
|
|
|
void reportClicked();
|
2015-09-08 17:22:29 +00:00
|
|
|
void clearClicked();
|
2015-09-08 12:20:30 +00:00
|
|
|
|
2016-10-18 10:32:33 +00:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2015-09-08 12:20:30 +00:00
|
|
|
|
2016-10-18 10:32:33 +00:00
|
|
|
private:
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::FlatButton> _report;
|
|
|
|
object_ptr<Ui::FlatButton> _hide;
|
|
|
|
object_ptr<Ui::LinkButton> _clear;
|
2015-09-08 12:20:30 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-10-05 15:35:52 +00:00
|
|
|
class HistoryHider : public Ui::RpWidget, private base::Subscriber {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-12-06 10:13:38 +00:00
|
|
|
HistoryHider(MainWidget *parent, MessageIdsList &&items); // forward messages
|
2014-07-18 10:37:34 +00:00
|
|
|
HistoryHider(MainWidget *parent); // send path from command line argument
|
2015-10-18 12:49:34 +00:00
|
|
|
HistoryHider(MainWidget *parent, const QString &url, const QString &text); // share url
|
2016-04-08 14:16:52 +00:00
|
|
|
HistoryHider(MainWidget *parent, const QString &botAndQuery); // inline switch button handler
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-04-04 20:01:34 +00:00
|
|
|
bool withConfirm() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-03-24 10:00:27 +00:00
|
|
|
bool offerPeer(PeerId peer);
|
2014-12-12 16:27:03 +00:00
|
|
|
QString offeredText() const;
|
2016-04-08 14:16:52 +00:00
|
|
|
QString botAndQuery() const {
|
|
|
|
return _botAndQuery;
|
|
|
|
}
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
bool wasOffered() const;
|
|
|
|
|
|
|
|
void forwardDone();
|
|
|
|
|
|
|
|
~HistoryHider();
|
|
|
|
|
2016-08-16 16:53:10 +00:00
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
|
|
|
void mousePressEvent(QMouseEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-08-16 16:53:10 +00:00
|
|
|
public slots:
|
2014-05-30 08:53:19 +00:00
|
|
|
void startHide();
|
|
|
|
void forward();
|
|
|
|
|
2015-04-04 20:01:34 +00:00
|
|
|
signals:
|
|
|
|
void forwarded();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
private:
|
2017-05-30 15:21:05 +00:00
|
|
|
void refreshLang();
|
|
|
|
void updateControlsGeometry();
|
2016-12-07 13:32:25 +00:00
|
|
|
void animationCallback();
|
2014-07-18 10:37:34 +00:00
|
|
|
void init();
|
2014-05-30 08:53:19 +00:00
|
|
|
MainWidget *parent();
|
|
|
|
|
2017-12-06 10:13:38 +00:00
|
|
|
MessageIdsList _forwardItems;
|
2016-10-01 12:34:23 +00:00
|
|
|
bool _sendPath = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-10-18 12:49:34 +00:00
|
|
|
QString _shareUrl, _shareText;
|
2016-04-08 14:16:52 +00:00
|
|
|
QString _botAndQuery;
|
2015-10-18 12:49:34 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::RoundButton> _send;
|
|
|
|
object_ptr<Ui::RoundButton> _cancel;
|
2016-10-01 12:34:23 +00:00
|
|
|
PeerData *_offered = nullptr;
|
2015-12-08 12:33:37 +00:00
|
|
|
|
2016-12-07 13:32:25 +00:00
|
|
|
Animation _a_opacity;
|
2015-12-08 12:33:37 +00:00
|
|
|
|
2016-10-01 12:34:23 +00:00
|
|
|
QRect _box;
|
|
|
|
bool _hiding = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-10-01 12:34:23 +00:00
|
|
|
mtpRequestId _forwardRequest = 0;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-10-01 12:34:23 +00:00
|
|
|
int _chooseWidth = 0;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-10-01 12:34:23 +00:00
|
|
|
Text _toText;
|
|
|
|
int32 _toTextWidth = 0;
|
|
|
|
QPixmap _cacheForAnim;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-05-22 15:25:49 +00:00
|
|
|
class HistoryWidget final : public Window::AbstractSectionWidget, public RPCSender {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-05-21 21:31:46 +00:00
|
|
|
using FieldHistoryAction = Ui::InputField::HistoryAction;
|
|
|
|
|
2017-08-17 08:31:24 +00:00
|
|
|
HistoryWidget(QWidget *parent, not_null<Window::Controller*> controller);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-03-19 09:18:19 +00:00
|
|
|
void start();
|
|
|
|
|
2015-09-13 08:41:27 +00:00
|
|
|
void messagesReceived(PeerData *peer, const MTPmessages_Messages &messages, mtpRequestId requestId);
|
2015-07-17 19:17:37 +00:00
|
|
|
void historyLoaded();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void windowShown();
|
2016-06-03 12:45:33 +00:00
|
|
|
bool doWeReadServerHistory() const;
|
2017-08-11 07:16:07 +00:00
|
|
|
bool doWeReadMentions() const;
|
2018-01-18 11:46:45 +00:00
|
|
|
bool skipItemRepaint();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-10-18 10:32:33 +00:00
|
|
|
void leaveToChildEvent(QEvent *e, QWidget *child) override;
|
|
|
|
void dragEnterEvent(QDragEnterEvent *e) override;
|
2016-03-01 02:36:23 +00:00
|
|
|
void dragLeaveEvent(QDragLeaveEvent *e) override;
|
|
|
|
void dropEvent(QDropEvent *e) 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();
|
|
|
|
|
|
|
|
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
|
|
|
|
2018-02-23 23:46:35 +00:00
|
|
|
void newUnreadMsg(
|
|
|
|
not_null<History*> history,
|
|
|
|
not_null<HistoryItem*> item);
|
2014-05-30 08:53:19 +00:00
|
|
|
void historyToDown(History *history);
|
2018-01-21 19:21:08 +00:00
|
|
|
void unreadCountChanged(not_null<History*> history);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
QRect historyRect() const;
|
2017-11-12 09:54:18 +00:00
|
|
|
void pushTabbedSelectorToThirdSection(
|
|
|
|
const Window::SectionShow ¶ms);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-01-02 14:55:24 +00:00
|
|
|
void updateRecentStickers();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void destroyData();
|
2015-10-28 02:41:13 +00:00
|
|
|
|
2015-12-31 15:27:21 +00:00
|
|
|
void updateFieldPlaceholder();
|
2016-01-09 11:24:16 +00:00
|
|
|
void 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);
|
2017-12-19 16:57:42 +00:00
|
|
|
void sendFileConfirmed(const std::shared_ptr<FileLoadResult> &file);
|
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);
|
|
|
|
|
|
|
|
void checkSelectingScroll(QPoint point);
|
|
|
|
void noSelectingScroll();
|
|
|
|
|
|
|
|
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);
|
2017-08-25 15:17:46 +00:00
|
|
|
TimeMs highlightStartTime(not_null<const HistoryItem*> item) const;
|
2018-03-08 21:21:27 +00:00
|
|
|
bool inSelectionMode() const;
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2017-12-06 10:13:38 +00:00
|
|
|
MessageIdsList getSelectedItems() const;
|
2016-03-11 12:20:58 +00:00
|
|
|
void itemEdited(HistoryItem *item);
|
2014-08-20 05:32:50 +00:00
|
|
|
|
2015-02-03 15:02:46 +00:00
|
|
|
void updateScrollColors();
|
|
|
|
|
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);
|
|
|
|
void pinMessage(FullMsgId itemId);
|
|
|
|
void unpinMessage(FullMsgId itemId);
|
|
|
|
void copyPostLink(FullMsgId itemId);
|
|
|
|
|
2015-03-19 09:18:19 +00:00
|
|
|
MsgId replyToId() const;
|
2016-03-10 10:15:21 +00:00
|
|
|
void messageDataReceived(ChannelData *channel, MsgId msgId);
|
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();
|
|
|
|
|
2015-12-08 12:33:37 +00:00
|
|
|
void step_recording(float64 ms, bool timer);
|
2015-05-29 18:52:43 +00:00
|
|
|
void stopRecording(bool send);
|
|
|
|
|
2015-06-17 19:43:03 +00:00
|
|
|
void onListEscapePressed();
|
2016-06-21 15:58:07 +00:00
|
|
|
void onListEnterPressed();
|
2015-06-17 19:43:03 +00:00
|
|
|
|
2016-04-14 19:24:42 +00:00
|
|
|
void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo);
|
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);
|
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);
|
2015-07-17 19:17:37 +00:00
|
|
|
void clearDelayedShowAt();
|
|
|
|
void clearAllLoadRequests();
|
2016-06-03 18:24:27 +00:00
|
|
|
void saveFieldToHistoryLocalDraft();
|
|
|
|
|
|
|
|
void applyCloudDraft(History *history);
|
2015-07-17 19:17:37 +00:00
|
|
|
|
2016-12-07 13:32:25 +00:00
|
|
|
void updateHistoryDownPosition();
|
|
|
|
void updateHistoryDownVisibility();
|
2017-08-11 07:16:07 +00:00
|
|
|
void updateUnreadMentionsPosition();
|
|
|
|
void updateUnreadMentionsVisibility();
|
2015-09-07 15:53:46 +00:00
|
|
|
|
2016-04-09 11:02:50 +00:00
|
|
|
void updateFieldSubmitSettings();
|
2015-09-16 13:04:08 +00:00
|
|
|
|
|
|
|
void setInnerFocus();
|
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-12-27 21:37:48 +00:00
|
|
|
void saveGif(DocumentData *doc);
|
|
|
|
|
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
|
|
|
|
2017-05-22 15:25:49 +00:00
|
|
|
// Float player interface.
|
2017-09-16 16:53:41 +00:00
|
|
|
bool wheelEventFromFloatPlayer(QEvent *e) override;
|
|
|
|
QRect rectForFloatPlayer() const override;
|
2017-05-22 15:25:49 +00:00
|
|
|
|
2017-12-18 15:44:50 +00:00
|
|
|
void app_sendBotCallback(
|
|
|
|
not_null<const HistoryMessageMarkupButton*> button,
|
|
|
|
not_null<const HistoryItem*> msg,
|
|
|
|
int row,
|
|
|
|
int column);
|
2016-04-06 17:02:22 +00:00
|
|
|
|
2016-03-29 17:17:00 +00:00
|
|
|
PeerData *ui_getPeerForMouseAction();
|
2015-12-13 11:17:15 +00:00
|
|
|
|
2015-12-11 18:11:38 +00:00
|
|
|
void notify_botCommandsChanged(UserData *user);
|
2016-01-01 09:58:05 +00:00
|
|
|
void notify_inlineBotRequesting(bool requesting);
|
2016-04-01 15:32:26 +00:00
|
|
|
void notify_replyMarkupUpdated(const HistoryItem *item);
|
2016-04-08 09:20:10 +00:00
|
|
|
void notify_inlineKeyboardMoved(const HistoryItem *item, int oldKeyboardTop, int newKeyboardTop);
|
2016-08-12 16:28:10 +00:00
|
|
|
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
|
2015-12-11 18:11:38 +00:00
|
|
|
void notify_userIsBotChanged(UserData *user);
|
|
|
|
void notify_migrateUpdated(PeerData *peer);
|
2015-11-20 13:34:37 +00:00
|
|
|
|
2016-07-14 11:20:46 +00:00
|
|
|
bool cmd_search();
|
|
|
|
bool cmd_next_chat();
|
|
|
|
bool cmd_previous_chat();
|
2016-02-27 19:39:51 +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
|
|
|
signals:
|
|
|
|
void cancelled();
|
|
|
|
|
|
|
|
public slots:
|
2014-11-14 23:23:35 +00:00
|
|
|
void onCancel();
|
2016-03-10 10:15:21 +00:00
|
|
|
void onPinnedHide();
|
2016-02-25 10:32:31 +00:00
|
|
|
void onFieldBarCancel();
|
2015-04-06 22:15:29 +00:00
|
|
|
|
2015-09-08 17:22:29 +00:00
|
|
|
void onReportSpamClicked();
|
|
|
|
void onReportSpamHide();
|
|
|
|
void onReportSpamClear();
|
|
|
|
|
2016-03-21 18:40:00 +00:00
|
|
|
void onScroll();
|
2015-09-21 20:57:42 +00:00
|
|
|
|
2015-08-12 18:01:32 +00:00
|
|
|
void onUnblock();
|
2015-06-17 19:43:03 +00:00
|
|
|
void onBotStart();
|
2015-09-21 20:57:42 +00:00
|
|
|
void onJoinChannel();
|
|
|
|
void onMuteUnmute();
|
2016-02-25 16:19:54 +00:00
|
|
|
void onBroadcastSilentChange();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-06-17 19:43:03 +00:00
|
|
|
void onKbToggle(bool manual = true);
|
2015-06-24 17:24:48 +00:00
|
|
|
void onCmdStart();
|
2015-06-15 17:19:24 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void activate();
|
|
|
|
void onTextChange();
|
|
|
|
|
2015-07-03 08:47:16 +00:00
|
|
|
void onFieldTabbed();
|
2016-09-11 08:38:14 +00:00
|
|
|
bool onStickerSend(DocumentData *sticker);
|
2015-12-31 05:34:43 +00:00
|
|
|
void onPhotoSend(PhotoData *photo);
|
2016-04-04 21:09:46 +00:00
|
|
|
void onInlineResultSend(InlineBots::Result *result, UserData *bot);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-21 18:40:00 +00:00
|
|
|
void onWindowVisibleChanged();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void onFieldFocused();
|
|
|
|
void onFieldResize();
|
2016-04-29 13:46:16 +00:00
|
|
|
void onCheckFieldAutocomplete();
|
2014-05-30 08:53:19 +00:00
|
|
|
void onScrollTimer();
|
|
|
|
|
2014-11-22 09:45:04 +00:00
|
|
|
void onDraftSaveDelayed();
|
|
|
|
void onDraftSave(bool delayed = false);
|
2016-06-03 18:24:27 +00:00
|
|
|
void onCloudDraftSave();
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2015-05-29 18:52:43 +00:00
|
|
|
void onRecordError();
|
2016-02-12 16:35:06 +00:00
|
|
|
void onRecordDone(QByteArray result, VoiceWaveform waveform, qint32 samples);
|
|
|
|
void onRecordUpdate(quint16 level, qint32 samples);
|
2015-05-29 18:52:43 +00:00
|
|
|
|
2016-01-03 08:01:14 +00:00
|
|
|
void onUpdateHistoryItems();
|
|
|
|
|
2016-03-21 18:40:00 +00: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();
|
|
|
|
|
2016-04-09 11:02:50 +00:00
|
|
|
private slots:
|
2016-04-29 13:46:16 +00:00
|
|
|
void onHashtagOrBotCommandInsert(QString str, FieldAutocomplete::ChooseMethod method);
|
|
|
|
void onMentionInsert(UserData *user);
|
2016-04-09 11:02:50 +00:00
|
|
|
void onInlineBotCancel();
|
2016-06-21 14:19:24 +00:00
|
|
|
void onMembersDropdownShow();
|
2016-04-09 11:02:50 +00:00
|
|
|
|
2016-06-22 18:41:13 +00:00
|
|
|
void onModerateKeyActivate(int index, bool *outHandled);
|
|
|
|
|
2016-05-09 12:03:06 +00:00
|
|
|
void updateField();
|
|
|
|
|
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;
|
2017-12-19 16:57:42 +00:00
|
|
|
using DragState = Storage::MimeDataState;
|
2017-03-27 18:11:51 +00:00
|
|
|
|
2018-05-31 12:20:28 +00:00
|
|
|
void send();
|
2017-06-21 23:54:38 +00:00
|
|
|
void handlePendingHistoryUpdate();
|
2017-04-06 16:49:42 +00:00
|
|
|
void fullPeerUpdated(PeerData *peer);
|
2017-04-09 18:06:06 +00:00
|
|
|
void toggleTabbedSelectorMode();
|
2017-09-16 16:53:41 +00:00
|
|
|
void returnTabbedSelector(object_ptr<TabbedSelector> selector);
|
2017-04-09 18:06:06 +00:00
|
|
|
void recountChatWidth();
|
|
|
|
void setReportSpamStatus(DBIPeerReportSpamStatus status);
|
2017-08-11 07:16:07 +00:00
|
|
|
void historyDownClicked();
|
|
|
|
void showNextUnreadMention();
|
2017-08-11 10:42:52 +00:00
|
|
|
void handlePeerUpdate();
|
2017-11-13 08:05:56 +00:00
|
|
|
void setMembersShowAreaActive(bool active);
|
2017-12-06 10:13:38 +00:00
|
|
|
void forwardItems(MessageIdsList &&items);
|
2018-01-18 09:53:49 +00:00
|
|
|
void handleHistoryChange(not_null<const History*> history);
|
2018-05-15 16:38:27 +00:00
|
|
|
void refreshAboutProxyPromotion();
|
2017-03-27 12:24:38 +00:00
|
|
|
|
2017-08-25 15:17:46 +00:00
|
|
|
void highlightMessage(MsgId universalMessageId);
|
|
|
|
void adjustHighlightedMessageToMigrated();
|
|
|
|
void checkNextHighlight();
|
|
|
|
void updateHighlightedMessage();
|
|
|
|
void clearHighlightMessages();
|
|
|
|
void stopMessageHighlight();
|
|
|
|
|
2017-12-09 18:20:10 +00:00
|
|
|
void updateSendAction(
|
|
|
|
not_null<History*> history,
|
|
|
|
SendAction::Type type,
|
|
|
|
int32 progress = 0);
|
|
|
|
void cancelSendAction(
|
|
|
|
not_null<History*> history,
|
|
|
|
SendAction::Type type);
|
|
|
|
void cancelTypingAction();
|
|
|
|
void sendActionDone(const MTPBool &result, mtpRequestId req);
|
|
|
|
|
2016-12-05 11:01:08 +00:00
|
|
|
void animationCallback();
|
2016-12-26 22:46:36 +00:00
|
|
|
void updateOverStates(QPoint pos);
|
|
|
|
void recordStartCallback();
|
|
|
|
void recordStopCallback(bool active);
|
|
|
|
void recordUpdateCallback(QPoint globalPos);
|
2016-11-28 15:45:07 +00:00
|
|
|
void chooseAttach();
|
2016-12-07 13:32:25 +00:00
|
|
|
void historyDownAnimationFinish();
|
2017-08-11 07:16:07 +00:00
|
|
|
void unreadMentionsAnimationFinish();
|
2016-12-26 22:46:36 +00:00
|
|
|
void sendButtonClicked();
|
2017-12-19 16:57:42 +00:00
|
|
|
|
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,
|
2017-12-22 17:42:33 +00:00
|
|
|
CompressConfirm compressed,
|
|
|
|
const QString &insertTextOnCancel = QString());
|
2017-12-21 16:15:37 +00:00
|
|
|
bool confirmSendingFiles(
|
|
|
|
QImage &&image,
|
|
|
|
QByteArray &&content,
|
|
|
|
CompressConfirm compressed,
|
|
|
|
const QString &insertTextOnCancel = QString());
|
|
|
|
bool confirmSendingFiles(
|
2018-05-21 21:31:46 +00:00
|
|
|
not_null<const QMimeData*> data,
|
2017-12-21 16:15:37 +00:00
|
|
|
CompressConfirm compressed,
|
|
|
|
const QString &insertTextOnCancel = QString());
|
|
|
|
bool confirmSendingFiles(
|
|
|
|
Storage::PreparedList &&list,
|
2017-12-22 17:42:33 +00:00
|
|
|
CompressConfirm compressed,
|
|
|
|
const QString &insertTextOnCancel = QString());
|
2017-12-19 16:57:42 +00:00
|
|
|
bool showSendingFilesError(const Storage::PreparedList &list) const;
|
2017-12-21 16:15:37 +00:00
|
|
|
|
2017-12-19 16:57:42 +00:00
|
|
|
void uploadFiles(Storage::PreparedList &&list, SendMediaType type);
|
|
|
|
void uploadFile(const QByteArray &fileContent, SendMediaType type);
|
|
|
|
|
|
|
|
void uploadFilesAfterConfirmation(
|
|
|
|
Storage::PreparedList &&list,
|
|
|
|
SendMediaType type,
|
2018-05-24 13:03:21 +00:00
|
|
|
TextWithTags &&caption,
|
2017-12-19 16:57:42 +00:00
|
|
|
MsgId replyTo,
|
|
|
|
std::shared_ptr<SendingAlbum> album = nullptr);
|
2016-11-28 15:45:07 +00:00
|
|
|
|
2018-03-25 11:37:57 +00:00
|
|
|
void subscribeToUploader();
|
|
|
|
|
|
|
|
void photoUploaded(
|
|
|
|
const FullMsgId &msgId,
|
|
|
|
bool silent,
|
|
|
|
const MTPInputFile &file);
|
|
|
|
void photoProgress(const FullMsgId &msgId);
|
|
|
|
void photoFailed(const FullMsgId &msgId);
|
|
|
|
void documentUploaded(
|
|
|
|
const FullMsgId &msgId,
|
|
|
|
bool silent,
|
|
|
|
const MTPInputFile &file);
|
|
|
|
void thumbDocumentUploaded(
|
|
|
|
const FullMsgId &msgId,
|
|
|
|
bool silent,
|
|
|
|
const MTPInputFile &file,
|
|
|
|
const MTPInputFile &thumb);
|
|
|
|
void documentProgress(const FullMsgId &msgId);
|
|
|
|
void documentFailed(const FullMsgId &msgId);
|
|
|
|
|
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();
|
2017-05-17 09:40:03 +00:00
|
|
|
void updateTabbedSelectorToggleTooltipGeometry();
|
|
|
|
void checkTabbedSelectorToggleTooltip();
|
2016-04-09 11:02:50 +00:00
|
|
|
|
2016-06-10 15:34:35 +00:00
|
|
|
bool canWriteMessage() const;
|
2017-06-11 18:33:20 +00:00
|
|
|
bool isRestrictedWrite() const;
|
2017-03-27 18:11:51 +00:00
|
|
|
void orderWidgets();
|
2016-06-10 15:11:44 +00:00
|
|
|
|
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);
|
2018-01-31 17:10:29 +00:00
|
|
|
void replyToPreviousMessage();
|
|
|
|
void replyToNextMessage();
|
2016-06-14 16:26:41 +00:00
|
|
|
|
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;
|
|
|
|
}
|
2017-06-16 20:33:35 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
MsgId _replyToId = 0;
|
2016-02-25 10:32:31 +00:00
|
|
|
Text _replyToName;
|
2016-03-22 19:43:47 +00:00
|
|
|
int _replyToNameVersion = 0;
|
2017-06-16 20:33:35 +00:00
|
|
|
|
2017-12-06 10:13:38 +00:00
|
|
|
HistoryItemsList _toForward;
|
2017-06-16 20:33:35 +00:00
|
|
|
Text _toForwardFrom, _toForwardText;
|
|
|
|
int _toForwardNameVersion = 0;
|
2015-06-15 17:19:24 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
MsgId _editMsgId = 0;
|
2016-02-25 10:32:31 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
HistoryItem *_replyEditMsg = nullptr;
|
2016-02-25 10:32:31 +00:00
|
|
|
Text _replyEditMsgText;
|
2016-05-09 12:03:06 +00:00
|
|
|
mutable SingleTimer _updateEditTimeLeftDisplay;
|
2016-02-25 10:32:31 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::IconButton> _fieldBarCancel;
|
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
|
|
|
|
|
|
|
struct PinnedBar {
|
|
|
|
PinnedBar(MsgId msgId, HistoryWidget *parent);
|
2016-10-18 15:19:13 +00:00
|
|
|
~PinnedBar();
|
2016-03-10 10:15:21 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
MsgId msgId = 0;
|
|
|
|
HistoryItem *msg = nullptr;
|
2016-03-10 10:15:21 +00:00
|
|
|
Text text;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::IconButton> cancel;
|
|
|
|
object_ptr<Ui::PlainShadow> shadow;
|
2016-03-10 10:15:21 +00:00
|
|
|
};
|
2017-02-21 13:45:56 +00:00
|
|
|
std::unique_ptr<PinnedBar> _pinnedBar;
|
2016-03-10 10:15:21 +00:00
|
|
|
void updatePinnedBar(bool force = false);
|
|
|
|
bool pinnedMsgVisibilityUpdated();
|
2016-03-15 19:38:30 +00:00
|
|
|
void destroyPinnedBar();
|
2016-03-10 10:15:21 +00:00
|
|
|
void unpinDone(const MTPUpdates &updates);
|
|
|
|
|
2018-01-18 13:59:22 +00:00
|
|
|
bool sendExistingDocument(DocumentData *doc, TextWithEntities caption);
|
|
|
|
void sendExistingPhoto(PhotoData *photo, TextWithEntities caption);
|
2015-12-31 05:34:43 +00:00
|
|
|
|
2016-05-09 12:03:06 +00:00
|
|
|
void drawField(Painter &p, const QRect &rect);
|
|
|
|
void paintEditHeader(Painter &p, const QRect &rect, int left, int top) const;
|
2016-12-05 11:01:08 +00:00
|
|
|
void drawRecording(Painter &p, float64 recordActive);
|
2016-03-10 10:15:21 +00:00
|
|
|
void drawPinnedBar(Painter &p);
|
2017-06-11 18:33:20 +00:00
|
|
|
void drawRestrictedWrite(Painter &p);
|
2018-01-09 17:08:31 +00:00
|
|
|
bool paintShowAnimationFrame(TimeMs ms);
|
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();
|
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
mtpRequestId _saveEditMsgRequestId = 0;
|
2016-02-25 10:32:31 +00:00
|
|
|
void saveEditMsg();
|
|
|
|
void saveEditMsgDone(History *history, const MTPUpdates &updates, mtpRequestId req);
|
|
|
|
bool saveEditMsgFail(History *history, const RPCError &error, mtpRequestId req);
|
|
|
|
|
2015-09-07 15:53:46 +00:00
|
|
|
void updateReportSpamStatus();
|
2016-03-12 16:32:28 +00:00
|
|
|
void requestReportSpamSetting();
|
|
|
|
void reportSpamSettingDone(const MTPPeerSettings &result, mtpRequestId req);
|
|
|
|
bool reportSpamSettingFail(const RPCError &error, mtpRequestId req);
|
2015-09-07 15:53:46 +00:00
|
|
|
|
2018-05-21 21:31:46 +00:00
|
|
|
void checkPreview();
|
|
|
|
void requestPreview();
|
|
|
|
void gotPreview(QString links, const MTPMessageMedia &media, mtpRequestId req);
|
|
|
|
|
|
|
|
static const mtpRequestId ReportSpamRequestNeeded = -1;
|
|
|
|
DBIPeerReportSpamStatus _reportSpamStatus = dbiprsUnknown;
|
|
|
|
mtpRequestId _reportSpamSettingRequestId = ReportSpamRequestNeeded;
|
|
|
|
|
|
|
|
QStringList _parsedLinks;
|
2015-04-06 22:15:29 +00:00
|
|
|
QString _previewLinks;
|
2016-03-22 19:43:47 +00:00
|
|
|
WebPageData *_previewData = nullptr;
|
2015-04-06 22:15:29 +00:00
|
|
|
typedef QMap<QString, WebPageId> PreviewCache;
|
|
|
|
PreviewCache _previewCache;
|
2016-03-22 19:43:47 +00:00
|
|
|
mtpRequestId _previewRequest = 0;
|
|
|
|
Text _previewTitle;
|
|
|
|
Text _previewDescription;
|
2018-05-21 21:31:46 +00:00
|
|
|
base::Timer _previewTimer;
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _previewCancelled = false;
|
2015-04-06 22:15:29 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _replyForwardPressed = false;
|
2015-04-07 23:03:32 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
HistoryItem *_replyReturn = nullptr;
|
2015-03-24 10:00:27 +00:00
|
|
|
QList<MsgId> _replyReturns;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
bool messagesFailed(const RPCError &error, mtpRequestId 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
|
|
|
|
2016-04-06 17:02:22 +00:00
|
|
|
struct BotCallbackInfo {
|
2016-09-15 19:15:49 +00:00
|
|
|
UserData *bot;
|
2016-04-06 17:02:22 +00:00
|
|
|
FullMsgId msgId;
|
|
|
|
int row, col;
|
2016-09-07 09:04:57 +00:00
|
|
|
bool game;
|
2016-04-06 17:02:22 +00:00
|
|
|
};
|
|
|
|
void botCallbackDone(BotCallbackInfo info, const MTPmessages_BotCallbackAnswer &answer, mtpRequestId req);
|
|
|
|
bool botCallbackFail(BotCallbackInfo info, const RPCError &error, mtpRequestId req);
|
2016-03-29 17:17:00 +00:00
|
|
|
|
2016-03-14 17:45:59 +00:00
|
|
|
enum ScrollChangeType {
|
|
|
|
ScrollChangeNone,
|
2016-03-31 14:06:40 +00:00
|
|
|
|
|
|
|
// When we toggle a pinned message.
|
2016-03-14 17:45:59 +00:00
|
|
|
ScrollChangeAdd,
|
2016-03-31 14:06:40 +00:00
|
|
|
|
|
|
|
// When loading a history part while scrolling down.
|
|
|
|
ScrollChangeNoJumpToBottom,
|
2016-03-14 17:45:59 +00:00
|
|
|
};
|
|
|
|
struct ScrollChange {
|
|
|
|
ScrollChangeType type;
|
|
|
|
int value;
|
|
|
|
};
|
2017-05-24 19:21:58 +00:00
|
|
|
void updateHistoryGeometry(bool initial = false, bool loadedDown = false, const ScrollChange &change = { ScrollChangeNone, 0 });
|
|
|
|
void updateListSize();
|
2016-03-14 17:45:59 +00:00
|
|
|
|
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-01-21 19:21:08 +00:00
|
|
|
base::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);
|
2018-01-21 19:21:08 +00:00
|
|
|
HistoryView::Element *firstUnreadMessage() const;
|
2017-05-21 17:08:59 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
2015-12-27 21:37:48 +00:00
|
|
|
void saveGifDone(DocumentData *doc, const MTPBool &result);
|
|
|
|
|
2015-09-08 17:22:29 +00:00
|
|
|
void reportSpamDone(PeerData *peer, const MTPBool &result, mtpRequestId request);
|
|
|
|
bool reportSpamFail(const RPCError &error, mtpRequestId request);
|
|
|
|
|
2015-09-21 20:57:42 +00:00
|
|
|
void unblockDone(PeerData *peer, const MTPBool &result, mtpRequestId req);
|
|
|
|
bool unblockFail(const RPCError &error, mtpRequestId req);
|
2015-09-08 17:22:29 +00:00
|
|
|
void blockDone(PeerData *peer, const MTPBool &result);
|
2015-08-12 18:01:32 +00:00
|
|
|
|
2015-07-17 19:17:37 +00:00
|
|
|
void countHistoryShowFrom();
|
|
|
|
|
2016-05-05 16:04:17 +00:00
|
|
|
enum class TextUpdateEvent {
|
2017-09-03 18:36:06 +00:00
|
|
|
SaveDraft = (1 << 0),
|
|
|
|
SendTyping = (1 << 1),
|
2016-05-05 16:04:17 +00:00
|
|
|
};
|
2017-08-31 16:28:58 +00:00
|
|
|
using TextUpdateEvents = base::flags<TextUpdateEvent>;
|
2017-09-05 17:46:16 +00:00
|
|
|
friend inline constexpr bool is_flag_type(TextUpdateEvent) { return true; };
|
2016-05-05 16:04:17 +00:00
|
|
|
|
2016-06-09 14:31:10 +00:00
|
|
|
void writeDrafts(Data::Draft **localDraft, Data::Draft **editDraft);
|
2016-02-25 10:32:31 +00:00
|
|
|
void writeDrafts(History *history);
|
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
|
|
|
|
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
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void updateDragAreas();
|
|
|
|
|
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();
|
|
|
|
void scrollToAnimationCallback(FullMsgId attachToId);
|
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
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
PeerData *_peer = nullptr;
|
|
|
|
|
|
|
|
ChannelId _channel = NoChannel;
|
|
|
|
bool _canSendMessages = false;
|
|
|
|
MsgId _showAtMsgId = ShowAtUnreadMsgId;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
mtpRequestId _firstLoadRequest = 0;
|
|
|
|
mtpRequestId _preloadRequest = 0;
|
|
|
|
mtpRequestId _preloadDownRequest = 0;
|
2015-07-17 19:17:37 +00:00
|
|
|
|
2018-01-18 09:53:49 +00:00
|
|
|
MsgId _delayedShowAtMsgId = -1;
|
2016-03-22 19:43:47 +00:00
|
|
|
mtpRequestId _delayedShowAtRequest = 0;
|
2015-07-17 19:17:37 +00:00
|
|
|
|
2018-01-09 17:08:31 +00:00
|
|
|
object_ptr<HistoryView::TopBarWidget> _topBar;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::ScrollArea> _scroll;
|
|
|
|
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;
|
2016-04-08 09:20:10 +00:00
|
|
|
int _addToScroll = 0;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2017-05-21 17:08:59 +00:00
|
|
|
int _lastScrollTop = 0; // gifs optimization
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs _lastScrolled = 0;
|
2016-04-08 09:20:10 +00:00
|
|
|
QTimer _updateHistoryItems;
|
2016-01-03 08:01:14 +00:00
|
|
|
|
2017-05-21 17:08:59 +00:00
|
|
|
TimeMs _lastUserScrolled = 0;
|
|
|
|
bool _synteticScrollEvent = false;
|
2017-05-24 19:21:58 +00:00
|
|
|
Animation _scrollToAnimation;
|
2017-05-21 17:08:59 +00:00
|
|
|
|
2016-12-07 13:32:25 +00:00
|
|
|
Animation _historyDownShown;
|
|
|
|
bool _historyDownIsShown = false;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::HistoryDownButton> _historyDown;
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2017-08-11 07:16:07 +00:00
|
|
|
Animation _unreadMentionsShown;
|
|
|
|
bool _unreadMentionsIsShown = false;
|
|
|
|
object_ptr<Ui::HistoryDownButton> _unreadMentions;
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<FieldAutocomplete> _fieldAutocomplete;
|
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;
|
2015-12-30 19:09:20 +00:00
|
|
|
void inlineBotResolveDone(const MTPcontacts_ResolvedPeer &result);
|
2015-12-31 15:27:21 +00:00
|
|
|
bool inlineBotResolveFail(QString name, const RPCError &error);
|
2015-03-19 09:18:19 +00:00
|
|
|
|
2015-06-19 22:13:56 +00:00
|
|
|
bool isBotStart() const;
|
2015-08-12 18:01:32 +00:00
|
|
|
bool isBlocked() const;
|
2015-09-21 20:57:42 +00:00
|
|
|
bool isJoinChannel() const;
|
|
|
|
bool isMuteUnmute() const;
|
2015-06-24 17:24:48 +00:00
|
|
|
bool updateCmdStartShown();
|
2016-12-26 22:46:36 +00:00
|
|
|
void updateSendButtonType();
|
|
|
|
bool showRecordButton() const;
|
|
|
|
bool showInlineBotCancel() const;
|
2017-12-08 11:52:12 +00:00
|
|
|
void refreshSilentToggle();
|
2015-06-19 22:13:56 +00:00
|
|
|
|
2017-04-09 18:06:06 +00:00
|
|
|
object_ptr<ReportSpamPanel> _reportSpamPanel = { nullptr };
|
2015-09-08 12:20:30 +00:00
|
|
|
|
2016-12-26 22:46:36 +00:00
|
|
|
object_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;
|
2018-05-15 16:38:27 +00:00
|
|
|
object_ptr<Ui::RpWidget> _aboutProxyPromotion = { nullptr };
|
2016-03-22 19:43:47 +00:00
|
|
|
mtpRequestId _unblockRequest = 0;
|
|
|
|
mtpRequestId _reportSpamRequest = 0;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::IconButton> _attachToggle;
|
2017-04-09 18:06:06 +00:00
|
|
|
object_ptr<Ui::EmojiButton> _tabbedSelectorToggle;
|
2017-05-17 09:40:03 +00:00
|
|
|
object_ptr<Ui::ImportantTooltip> _tabbedSelectorToggleTooltip = { nullptr };
|
|
|
|
bool _tabbedSelectorToggleTooltipShown = false;
|
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 };
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _cmdStartShown = false;
|
2018-05-21 21:31:46 +00:00
|
|
|
object_ptr<Ui::InputField> _field;
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _recording = false;
|
|
|
|
bool _inField = false;
|
2017-07-11 10:23:15 +00:00
|
|
|
bool _inReplyEditForward = false;
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _inPinnedMsg = false;
|
2016-11-18 13:34:58 +00:00
|
|
|
bool _inClickable = false;
|
2016-12-05 11:01:08 +00:00
|
|
|
int _recordingSamples = 0;
|
|
|
|
int _recordCancelWidth;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-03-25 11:37:57 +00:00
|
|
|
rpl::lifetime _uploaderSubscriptions;
|
|
|
|
|
2016-12-07 13:32:25 +00:00
|
|
|
// This can animate for a very long time (like in music playing),
|
|
|
|
// so it should be a BasicAnimation, not an Animation.
|
|
|
|
BasicAnimation _a_recording;
|
|
|
|
anim::value a_recordingLevel;
|
|
|
|
|
2015-11-23 15:34:38 +00:00
|
|
|
bool kbWasHidden() const;
|
|
|
|
|
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;
|
|
|
|
QPointer<BotKeyboard> _keyboard;
|
2015-06-15 17:19:24 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::InnerDropdown> _membersDropdown = { nullptr };
|
2016-06-21 14:19:24 +00:00
|
|
|
QTimer _membersDropdownShowTimer;
|
2016-06-17 18:18:01 +00:00
|
|
|
|
2017-03-27 18:11:51 +00:00
|
|
|
object_ptr<InlineBots::Layout::Widget> _inlineResults = { nullptr };
|
2017-09-16 16:53:41 +00:00
|
|
|
object_ptr<TabbedPanel> _tabbedPanel;
|
|
|
|
QPointer<TabbedSelector> _tabbedSelector;
|
2017-12-19 16:57:42 +00:00
|
|
|
DragState _attachDragState;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<DragArea> _attachDragDocument, _attachDragPhoto;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2017-07-22 08:35:18 +00:00
|
|
|
object_ptr<Ui::Emoji::SuggestionsController> _emojiSuggestions = { nullptr };
|
|
|
|
|
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
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
int64 _serviceImageCacheSize = 0;
|
2015-07-17 19:17:37 +00:00
|
|
|
QString _confirmSource;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-12-07 13:32:25 +00:00
|
|
|
Animation _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
|
|
|
|
|
|
|
QTimer _scrollTimer;
|
2016-03-22 19:43:47 +00:00
|
|
|
int32 _scrollDelta = 0;
|
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;
|
|
|
|
TimeMs _highlightStart = 0;
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2017-12-07 14:27:59 +00:00
|
|
|
QMap<QPair<not_null<History*>, SendAction::Type>, mtpRequestId> _sendActionRequests;
|
2017-12-09 18:20:10 +00:00
|
|
|
base::Timer _sendActionStopTimer;
|
2014-11-05 17:43:32 +00:00
|
|
|
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs _saveDraftStart = 0;
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _saveDraftText = false;
|
2016-06-03 18:24:27 +00:00
|
|
|
QTimer _saveDraftTimer, _saveCloudDraftTimer;
|
2014-11-22 09:45:04 +00:00
|
|
|
|
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
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
};
|