2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2014-12-01 10:47:38 +00:00
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
2015-10-03 13:16:42 +00:00
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2016-02-08 10:56:18 +00:00
|
|
|
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "localimageloader.h"
|
2016-04-07 18:05:28 +00:00
|
|
|
#include "ui/boxshadow.h"
|
2014-05-30 08:53:19 +00:00
|
|
|
#include "dropdown.h"
|
2016-04-12 21:31:28 +00:00
|
|
|
#include "history/history_common.h"
|
2016-04-29 13:46:16 +00:00
|
|
|
#include "history/field_autocomplete.h"
|
2016-05-19 12:03:51 +00:00
|
|
|
#include "window/section_widget.h"
|
2016-04-29 13:46:16 +00:00
|
|
|
|
|
|
|
namespace InlineBots {
|
|
|
|
namespace Layout {
|
|
|
|
class ItemBase;
|
|
|
|
} // namespace Layout
|
|
|
|
class Result;
|
|
|
|
} // namespace InlineBots
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
class HistoryWidget;
|
2016-02-07 18:58:42 +00:00
|
|
|
class HistoryInner : public TWidget, public AbstractTooltipShower {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2015-09-29 13:24:39 +00:00
|
|
|
HistoryInner(HistoryWidget *historyWidget, ScrollArea *scroll, History *history);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-11-13 15:14:33 +00:00
|
|
|
void messagesReceived(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed);
|
|
|
|
void messagesReceivedDown(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-04-07 10:35:09 +00:00
|
|
|
bool event(QEvent *e) override; // calls touchEvent when necessary
|
2014-05-30 08:53:19 +00:00
|
|
|
void touchEvent(QTouchEvent *e);
|
2016-04-07 10:35:09 +00:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *e) override;
|
|
|
|
void mousePressEvent(QMouseEvent *e) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *e) override;
|
|
|
|
void enterEvent(QEvent *e) override;
|
|
|
|
void leaveEvent(QEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
2014-05-30 08:53:19 +00:00
|
|
|
void showContextMenu(QContextMenuEvent *e, bool showFromTouch = false);
|
|
|
|
|
2016-05-06 17:33:48 +00:00
|
|
|
TextWithEntities getSelectedText() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void dragActionStart(const QPoint &screenPos, Qt::MouseButton button = Qt::LeftButton);
|
|
|
|
void dragActionUpdate(const QPoint &screenPos);
|
|
|
|
void dragActionFinish(const QPoint &screenPos, Qt::MouseButton button = Qt::LeftButton);
|
|
|
|
void dragActionCancel();
|
|
|
|
|
|
|
|
void touchScrollUpdated(const QPoint &screenPos);
|
|
|
|
QPoint mapMouseToItem(QPoint p, HistoryItem *item);
|
|
|
|
|
2016-03-21 18:40:00 +00:00
|
|
|
void recountHeight();
|
2014-05-30 08:53:19 +00:00
|
|
|
void updateSize();
|
|
|
|
|
2015-12-27 21:37:48 +00:00
|
|
|
void repaintItem(const HistoryItem *item);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2014-11-18 12:40:43 +00:00
|
|
|
bool canCopySelected() const;
|
|
|
|
bool canDeleteSelected() const;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void getSelectionState(int32 &selectedForForward, int32 &selectedForDelete) const;
|
|
|
|
void clearSelectedItems(bool onlyTextSelection = false);
|
2014-08-20 05:32:50 +00:00
|
|
|
void fillSelectedItems(SelectedItemSet &sel, bool forDelete = true);
|
2014-09-30 14:11:09 +00:00
|
|
|
void selectItem(HistoryItem *item);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2014-10-10 12:46:20 +00:00
|
|
|
void itemRemoved(HistoryItem *item);
|
|
|
|
|
2015-06-10 15:54:24 +00:00
|
|
|
void updateBotInfo(bool recount = true);
|
|
|
|
|
2015-06-24 17:24:48 +00:00
|
|
|
bool wasSelectedText() const;
|
2015-07-17 19:17:37 +00:00
|
|
|
void setFirstLoading(bool loading);
|
2015-06-24 17:24:48 +00:00
|
|
|
|
2015-09-19 09:13:21 +00:00
|
|
|
HistoryItem *atTopImportantMsg(int32 top, int32 height, int32 &bottomUnderScrollTop) const;
|
|
|
|
|
2016-03-21 18:40:00 +00:00
|
|
|
// updates history->scrollTopItem/scrollTopOffset
|
|
|
|
void visibleAreaUpdated(int top, int bottom);
|
|
|
|
|
|
|
|
int historyHeight() const;
|
|
|
|
int historyScrollTop() const;
|
|
|
|
int migratedTop() const;
|
|
|
|
int historyTop() const;
|
|
|
|
int historyDrawTop() const;
|
|
|
|
int itemTop(const HistoryItem *item) const; // -1 if should not be visible, -2 if bad history()
|
2015-11-13 15:14:33 +00:00
|
|
|
|
2015-11-20 13:34:37 +00:00
|
|
|
void notifyIsBotChanged();
|
2015-11-20 18:24:44 +00:00
|
|
|
void notifyMigrateUpdated();
|
2015-11-20 13:34:37 +00:00
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
// When inline keyboard has moved because of the edition of its item we want
|
|
|
|
// to move scroll position so that mouse points to the same button row.
|
|
|
|
int moveScrollFollowingInlineKeyboard(const HistoryItem *item, int oldKeyboardTop, int newKeyboardTop);
|
|
|
|
|
2016-03-29 17:17:00 +00:00
|
|
|
// AbstractTooltipShower interface
|
|
|
|
QString tooltipText() const override;
|
|
|
|
QPoint tooltipPos() const override;
|
2016-02-07 18:58:42 +00:00
|
|
|
|
2015-09-29 13:24:39 +00:00
|
|
|
~HistoryInner();
|
2015-12-31 15:27:21 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
public slots:
|
|
|
|
|
2014-08-20 05:32:50 +00:00
|
|
|
void onUpdateSelected();
|
2014-05-30 08:53:19 +00:00
|
|
|
void onParentGeometryChanged();
|
|
|
|
|
|
|
|
void copyContextUrl();
|
|
|
|
void saveContextImage();
|
|
|
|
void copyContextImage();
|
|
|
|
void cancelContextDownload();
|
|
|
|
void showContextInFolder();
|
|
|
|
void saveContextFile();
|
2015-12-27 21:37:48 +00:00
|
|
|
void saveContextGif();
|
2014-05-30 08:53:19 +00:00
|
|
|
void copyContextText();
|
|
|
|
void copySelectedText();
|
|
|
|
|
|
|
|
void onMenuDestroy(QObject *obj);
|
|
|
|
void onTouchSelect();
|
|
|
|
void onTouchScrollTimer();
|
2015-06-28 13:16:25 +00:00
|
|
|
void onDragExec();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void touchResetSpeed();
|
|
|
|
void touchUpdateSpeed();
|
|
|
|
void touchDeaccelerate(int32 elapsed);
|
|
|
|
|
2015-09-19 09:13:21 +00:00
|
|
|
void adjustCurrent(int32 y) const;
|
2015-11-13 15:14:33 +00:00
|
|
|
void adjustCurrent(int32 y, History *history) const;
|
2014-05-30 08:53:19 +00:00
|
|
|
HistoryItem *prevItem(HistoryItem *item);
|
|
|
|
HistoryItem *nextItem(HistoryItem *item);
|
|
|
|
void updateDragSelection(HistoryItem *dragSelFrom, HistoryItem *dragSelTo, bool dragSelecting, bool force = false);
|
|
|
|
|
2016-05-06 17:33:48 +00:00
|
|
|
void setToClipboard(const TextWithEntities &forClipboard);
|
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
PeerData *_peer = nullptr;
|
|
|
|
History *_migrated = nullptr;
|
|
|
|
History *_history = nullptr;
|
|
|
|
int _historyOffset = 0;
|
|
|
|
|
|
|
|
// with migrated history we perhaps do not need to display first _history message
|
|
|
|
// (if last _migrated message and first _history message are both isGroupMigrate)
|
|
|
|
// or at least we don't need to display first _history date (just skip it by height)
|
|
|
|
int _historySkipHeight = 0;
|
|
|
|
|
2016-03-29 17:17:00 +00:00
|
|
|
class BotAbout : public ClickHandlerHost {
|
|
|
|
public:
|
2016-04-07 10:35:09 +00:00
|
|
|
BotAbout(HistoryInner *parent, BotInfo *info) : info(info), _parent(parent) {
|
2016-03-29 17:17:00 +00:00
|
|
|
}
|
|
|
|
BotInfo *info = nullptr;
|
|
|
|
int width = 0;
|
|
|
|
int height = 0;
|
|
|
|
QRect rect;
|
|
|
|
|
|
|
|
// ClickHandlerHost interface
|
|
|
|
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
|
|
|
|
void clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
HistoryInner *_parent;
|
|
|
|
|
|
|
|
};
|
2016-04-10 19:20:48 +00:00
|
|
|
std_::unique_ptr<BotAbout> _botAbout;
|
2015-06-10 15:54:24 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
HistoryWidget *_widget = nullptr;
|
|
|
|
ScrollArea *_scroll = nullptr;
|
|
|
|
mutable History *_curHistory = nullptr;
|
|
|
|
mutable int _curBlock = 0;
|
|
|
|
mutable int _curItem = 0;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _firstLoading = false;
|
2015-07-17 19:17:37 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
style::cursor _cursor = style::cur_default;
|
2016-04-13 18:29:32 +00:00
|
|
|
using SelectedItems = QMap<HistoryItem*, TextSelection>;
|
2014-05-30 08:53:19 +00:00
|
|
|
SelectedItems _selected;
|
2015-06-24 17:24:48 +00:00
|
|
|
void applyDragSelection();
|
|
|
|
void applyDragSelection(SelectedItems *toItems) const;
|
2015-11-13 15:14:33 +00:00
|
|
|
void addSelectionRange(SelectedItems *toItems, int32 fromblock, int32 fromitem, int32 toblock, int32 toitem, History *h) const;
|
2015-06-24 17:24:48 +00:00
|
|
|
|
2016-04-04 08:57:36 +00:00
|
|
|
// Does any of the shown histories has this flag set.
|
|
|
|
bool hasPendingResizedItems() const {
|
|
|
|
return (_history && _history->hasPendingResizedItems()) || (_migrated && _migrated->hasPendingResizedItems());
|
|
|
|
}
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
enum DragAction {
|
|
|
|
NoDrag = 0x00,
|
|
|
|
PrepareDrag = 0x01,
|
|
|
|
Dragging = 0x02,
|
|
|
|
PrepareSelect = 0x03,
|
|
|
|
Selecting = 0x04,
|
|
|
|
};
|
2016-03-22 19:43:47 +00:00
|
|
|
DragAction _dragAction = NoDrag;
|
2016-05-26 15:31:20 +00:00
|
|
|
TextSelectType _dragSelType = TextSelectType::Letters;
|
2014-05-30 08:53:19 +00:00
|
|
|
QPoint _dragStartPos, _dragPos;
|
2016-03-22 19:43:47 +00:00
|
|
|
HistoryItem *_dragItem = nullptr;
|
|
|
|
HistoryCursorState _dragCursorState = HistoryDefaultCursorState;
|
|
|
|
uint16 _dragSymbol = 0;
|
|
|
|
bool _dragWasInactive = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
QPoint _trippleClickPoint;
|
|
|
|
QTimer _trippleClickTimer;
|
|
|
|
|
2016-03-29 17:17:00 +00:00
|
|
|
ClickHandlerPtr _contextMenuLnk;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
HistoryItem *_dragSelFrom = nullptr;
|
|
|
|
HistoryItem *_dragSelTo = nullptr;
|
|
|
|
bool _dragSelecting = false;
|
|
|
|
bool _wasSelectedText = false; // was some text selected in current drag action
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
// scroll by touch support (at least Windows Surface tablets)
|
|
|
|
bool _touchScroll = false;
|
|
|
|
bool _touchSelect = false;
|
|
|
|
bool _touchInProgress = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
QPoint _touchStart, _touchPrevPos, _touchPos;
|
|
|
|
QTimer _touchSelectTimer;
|
2015-12-31 15:27:21 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
TouchScrollState _touchScrollState = TouchScrollManual;
|
|
|
|
bool _touchPrevPosValid = false;
|
|
|
|
bool _touchWaitingAcceleration = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
QPoint _touchSpeed;
|
2016-03-22 19:43:47 +00:00
|
|
|
uint64 _touchSpeedTime = 0;
|
|
|
|
uint64 _touchAccelerationTime = 0;
|
|
|
|
uint64 _touchTime = 0;
|
2014-05-30 08:53:19 +00:00
|
|
|
QTimer _touchScrollTimer;
|
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
// context menu
|
|
|
|
PopupMenu *_menu = nullptr;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
// save visible area coords for painting / pressing userpics
|
2016-03-22 15:23:34 +00:00
|
|
|
int _visibleAreaTop = 0;
|
2016-03-22 19:43:47 +00:00
|
|
|
int _visibleAreaBottom = 0;
|
|
|
|
|
|
|
|
// this function finds all userpics on the left that are displayed and calls template method
|
|
|
|
// for each found userpic (from the bottom to the top) in the passed history with passed top offset
|
|
|
|
//
|
|
|
|
// method has "bool (*Method)(HistoryMessage *message, int userpicTop)" signature
|
|
|
|
// if it returns false the enumeration stops immidiately
|
|
|
|
template <typename Method>
|
|
|
|
void enumerateUserpicsInHistory(History *h, int htop, Method method);
|
|
|
|
|
|
|
|
template <typename Method>
|
|
|
|
void enumerateUserpics(Method method) {
|
|
|
|
enumerateUserpicsInHistory(_history, historyTop(), method);
|
|
|
|
enumerateUserpicsInHistory(_migrated, migratedTop(), method);
|
|
|
|
}
|
2016-03-22 15:23:34 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class MessageField : public FlatTextarea {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
MessageField(HistoryWidget *history, const style::flatTextarea &st, const QString &ph = QString(), const QString &val = QString());
|
|
|
|
void dropEvent(QDropEvent *e);
|
|
|
|
bool canInsertFromMimeData(const QMimeData *source) const;
|
|
|
|
void insertFromMimeData(const QMimeData *source);
|
|
|
|
|
|
|
|
void focusInEvent(QFocusEvent *e);
|
|
|
|
|
2015-09-07 07:52:37 +00:00
|
|
|
bool hasSendText() const;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
public slots:
|
|
|
|
void onEmojiInsert(EmojiPtr emoji);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void focused();
|
|
|
|
|
|
|
|
private:
|
|
|
|
HistoryWidget *history;
|
2015-06-15 17:19:24 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2015-09-08 12:20:30 +00:00
|
|
|
class HistoryWidget;
|
|
|
|
class ReportSpamPanel : public TWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
ReportSpamPanel(HistoryWidget *parent);
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
|
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
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
FlatButton _report, _hide;
|
2015-09-08 17:22:29 +00:00
|
|
|
LinkButton _clear;
|
2015-09-08 12:20:30 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-03-29 17:17:00 +00:00
|
|
|
class BotKeyboard : public TWidget, public AbstractTooltipShower, public ClickHandlerHost {
|
2015-06-15 17:19:24 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
BotKeyboard();
|
|
|
|
|
2016-04-07 10:35:09 +00:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void mousePressEvent(QMouseEvent *e) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *e) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
|
|
|
void enterEvent(QEvent *e) override;
|
|
|
|
void leaveEvent(QEvent *e) override;
|
2015-06-15 17:19:24 +00:00
|
|
|
|
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.
|
|
|
|
bool updateMarkup(HistoryItem *last, bool force = false);
|
2015-06-15 17:19:24 +00:00
|
|
|
bool hasMarkup() const;
|
2015-06-22 08:51:39 +00:00
|
|
|
bool forceReply() const;
|
2015-06-15 17:19:24 +00:00
|
|
|
|
2015-12-08 12:33:37 +00:00
|
|
|
void step_selected(uint64 ms, bool timer);
|
2016-03-28 17:15:17 +00:00
|
|
|
void resizeToWidth(int width, int maxOuterHeight);
|
2015-06-17 19:43:03 +00:00
|
|
|
|
|
|
|
bool maximizeSize() const;
|
|
|
|
bool singleUse() const;
|
2015-06-15 17:19:24 +00:00
|
|
|
|
2015-09-03 10:48:40 +00:00
|
|
|
FullMsgId forMsgId() const {
|
2015-06-15 17:19:24 +00:00
|
|
|
return _wasForMsgId;
|
|
|
|
}
|
|
|
|
|
2016-03-29 17:17:00 +00:00
|
|
|
// AbstractTooltipShower interface
|
|
|
|
QString tooltipText() const override;
|
|
|
|
QPoint tooltipPos() const override;
|
|
|
|
|
|
|
|
// ClickHandlerHost interface
|
2016-04-07 10:35:09 +00:00
|
|
|
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
|
|
|
|
void clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed) override;
|
2016-02-07 18:58:42 +00:00
|
|
|
|
2015-06-15 17:19:24 +00:00
|
|
|
public slots:
|
|
|
|
|
2016-04-11 22:34:29 +00:00
|
|
|
void onParentScrolled();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
2015-06-15 17:19:24 +00:00
|
|
|
void updateSelected();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void updateStyle(int32 w = -1);
|
|
|
|
void clearSelection();
|
|
|
|
|
2015-09-03 10:48:40 +00:00
|
|
|
FullMsgId _wasForMsgId;
|
2016-03-28 17:15:17 +00:00
|
|
|
int _height = 0;
|
|
|
|
int _maxOuterHeight = 0;
|
|
|
|
bool _maximizeSize = false;
|
|
|
|
bool _singleUse = false;
|
|
|
|
bool _forceReply = false;
|
2015-06-15 17:19:24 +00:00
|
|
|
|
|
|
|
QPoint _lastMousePos;
|
2016-04-10 19:20:48 +00:00
|
|
|
std_::unique_ptr<ReplyKeyboard> _impl;
|
2016-03-28 17:15:17 +00:00
|
|
|
|
|
|
|
class Style : public ReplyKeyboard::Style {
|
|
|
|
public:
|
|
|
|
Style(BotKeyboard *parent, const style::botKeyboardButton &st) : ReplyKeyboard::Style(st), _parent(parent) {
|
2015-06-15 17:19:24 +00:00
|
|
|
}
|
2016-03-28 12:51:22 +00:00
|
|
|
|
2016-03-28 17:15:17 +00:00
|
|
|
void startPaint(Painter &p) const override;
|
|
|
|
style::font textFont() const override;
|
|
|
|
void repaint(const HistoryItem *item) const override;
|
2015-06-15 17:19:24 +00:00
|
|
|
|
2016-03-28 17:15:17 +00:00
|
|
|
protected:
|
|
|
|
void paintButtonBg(Painter &p, const QRect &rect, bool down, float64 howMuchOver) const override;
|
2016-03-30 16:42:01 +00:00
|
|
|
void paintButtonIcon(Painter &p, const QRect &rect, HistoryMessageReplyMarkup::Button::Type type) const override;
|
2016-04-06 17:02:22 +00:00
|
|
|
void paintButtonLoading(Painter &p, const QRect &rect) const override;
|
2016-03-30 16:42:01 +00:00
|
|
|
int minButtonWidth(HistoryMessageReplyMarkup::Button::Type type) const override;
|
2015-06-15 17:19:24 +00:00
|
|
|
|
2016-03-28 17:15:17 +00:00
|
|
|
private:
|
|
|
|
BotKeyboard *_parent;
|
|
|
|
|
|
|
|
};
|
|
|
|
const style::botKeyboardButton *_st = &st::botKbButton;
|
2015-06-15 17:19:24 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
};
|
|
|
|
|
2015-12-08 12:33:37 +00:00
|
|
|
class HistoryHider : public TWidget {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-07-18 10:37:34 +00:00
|
|
|
HistoryHider(MainWidget *parent, bool forwardSelected); // forward messages
|
|
|
|
HistoryHider(MainWidget *parent, UserData *sharedContact); // share contact
|
|
|
|
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-12-08 12:33:37 +00:00
|
|
|
void step_appearance(float64 ms, bool timer);
|
2015-04-04 20:01:34 +00:00
|
|
|
bool withConfirm() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
void keyPressEvent(QKeyEvent *e);
|
|
|
|
void mousePressEvent(QMouseEvent *e);
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void startHide();
|
|
|
|
void forward();
|
|
|
|
|
2015-04-04 20:01:34 +00:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void forwarded();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
private:
|
|
|
|
|
2014-07-18 10:37:34 +00:00
|
|
|
void init();
|
2014-05-30 08:53:19 +00:00
|
|
|
MainWidget *parent();
|
|
|
|
|
2014-07-18 10:37:34 +00:00
|
|
|
UserData *_sharedContact;
|
|
|
|
bool _forwardSelected, _sendPath;
|
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
|
|
|
|
2015-10-03 10:09:09 +00:00
|
|
|
BoxButton _send, _cancel;
|
2014-05-30 08:53:19 +00:00
|
|
|
PeerData *offered;
|
2015-12-08 12:33:37 +00:00
|
|
|
|
2015-10-03 10:09:09 +00:00
|
|
|
anim::fvalue a_opacity;
|
2015-12-08 12:33:37 +00:00
|
|
|
Animation _a_appearance;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
QRect box;
|
|
|
|
bool hiding;
|
|
|
|
|
|
|
|
mtpRequestId _forwardRequest;
|
|
|
|
|
|
|
|
int32 _chooseWidth;
|
|
|
|
|
|
|
|
Text toText;
|
|
|
|
int32 toTextWidth;
|
|
|
|
QPixmap cacheForAnim;
|
|
|
|
|
|
|
|
BoxShadow shadow;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2015-09-19 09:13:21 +00:00
|
|
|
class CollapseButton : public FlatButton {
|
|
|
|
public:
|
|
|
|
|
|
|
|
CollapseButton(QWidget *parent);
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-02-25 16:19:54 +00:00
|
|
|
class SilentToggle : public FlatCheckbox, public AbstractTooltipShower {
|
|
|
|
public:
|
|
|
|
|
|
|
|
SilentToggle(QWidget *parent);
|
2016-04-07 10:35:09 +00:00
|
|
|
void mouseMoveEvent(QMouseEvent *e) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
|
|
|
void leaveEvent(QEvent *e) override;
|
2016-02-25 16:19:54 +00:00
|
|
|
|
2016-03-29 17:17:00 +00:00
|
|
|
// AbstractTooltipShower interface
|
|
|
|
QString tooltipText() const override;
|
|
|
|
QPoint tooltipPos() const override;
|
2016-02-25 16:19:54 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-05-05 16:04:17 +00:00
|
|
|
EntitiesInText entitiesFromTextTags(const TextWithTags::Tags &tags);
|
|
|
|
TextWithTags::Tags textTagsFromEntities(const EntitiesInText &entities);
|
2016-04-04 21:09:46 +00:00
|
|
|
|
2015-05-29 18:52:43 +00:00
|
|
|
class HistoryWidget : public TWidget, public RPCSender {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
HistoryWidget(QWidget *parent);
|
|
|
|
|
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();
|
2014-07-04 11:12:54 +00:00
|
|
|
bool isActive() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-01 02:36:23 +00:00
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
|
|
|
void mousePressEvent(QMouseEvent *e) override;
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void dragEnterEvent(QDragEnterEvent *e) override;
|
|
|
|
void dragLeaveEvent(QDragLeaveEvent *e) override;
|
|
|
|
void leaveEvent(QEvent *e) override;
|
|
|
|
void dropEvent(QDropEvent *e) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *e) override;
|
|
|
|
void leaveToChildEvent(QEvent *e) override;
|
|
|
|
void contextMenuEvent(QContextMenuEvent *e) override;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void updateTopBarSelection();
|
|
|
|
|
2016-04-21 17:57:29 +00:00
|
|
|
void paintTopBar(Painter &p, float64 over, int32 decreaseWidth);
|
2014-05-30 08:53:19 +00:00
|
|
|
void topBarClick();
|
|
|
|
|
|
|
|
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
|
|
|
void peerMessagesUpdated(PeerId peer);
|
|
|
|
void peerMessagesUpdated();
|
|
|
|
|
2015-03-19 09:18:19 +00:00
|
|
|
void newUnreadMsg(History *history, HistoryItem *item);
|
2014-05-30 08:53:19 +00:00
|
|
|
void historyToDown(History *history);
|
|
|
|
void historyWasRead(bool force = true);
|
2015-06-17 19:43:03 +00:00
|
|
|
void historyCleared(History *history);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
QRect historyRect() const;
|
|
|
|
|
2015-08-01 08:33:00 +00:00
|
|
|
void updateSendAction(History *history, SendActionType type, int32 progress = 0);
|
|
|
|
void cancelSendAction(History *history, SendActionType type);
|
|
|
|
|
2015-01-02 14:55:24 +00:00
|
|
|
void updateRecentStickers();
|
2015-05-19 15:46:45 +00:00
|
|
|
void stickersInstalled(uint64 setId);
|
2015-08-01 08:33:00 +00:00
|
|
|
void sendActionDone(const MTPBool &result, mtpRequestId req);
|
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
|
|
|
|
2015-10-28 02:41:13 +00:00
|
|
|
void uploadImage(const QImage &img, PrepareMediaType type, FileLoadForceConfirmType confirm = FileLoadNoForceConfirm, const QString &source = QString(), bool withText = false);
|
|
|
|
void uploadFile(const QString &file, PrepareMediaType type, FileLoadForceConfirmType confirm = FileLoadNoForceConfirm, bool withText = false); // with confirmation
|
|
|
|
void uploadFiles(const QStringList &files, PrepareMediaType type);
|
|
|
|
void uploadFileContent(const QByteArray &fileContent, PrepareMediaType type);
|
|
|
|
void shareContactWithConfirm(const QString &phone, const QString &fname, const QString &lname, MsgId replyTo, bool withText = false);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-10-27 02:39:02 +00:00
|
|
|
void confirmSendFile(const FileLoadResultPtr &file, bool ctrlShiftEnter);
|
|
|
|
void cancelSendFile(const FileLoadResultPtr &file);
|
2015-10-28 02:41:13 +00:00
|
|
|
void confirmShareContact(const QString &phone, const QString &fname, const QString &lname, MsgId replyTo, bool ctrlShiftEnter);
|
|
|
|
void cancelShareContact();
|
2015-10-27 02:39:02 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void updateControlsVisibility();
|
|
|
|
void updateOnlineDisplay(int32 x, int32 w);
|
|
|
|
void updateOnlineDisplayTimer();
|
|
|
|
|
|
|
|
void onShareContact(const PeerId &peer, UserData *contact);
|
2014-07-18 10:37:34 +00:00
|
|
|
void onSendPaths(const PeerId &peer);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-03-19 09:18:19 +00:00
|
|
|
void shareContact(const PeerId &peer, const QString &phone, const QString &fname, const QString &lname, MsgId replyTo, int32 userId = 0);
|
2014-08-22 14:55:23 +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;
|
2015-09-19 09:13:21 +00:00
|
|
|
HistoryItem *atTopImportantMsg(int32 &bottomUnderScrollTop) 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);
|
2015-12-08 12:33:37 +00:00
|
|
|
void step_show(float64 ms, bool timer);
|
2014-05-30 08:53:19 +00:00
|
|
|
void animStop();
|
2015-10-17 14:52:26 +00:00
|
|
|
|
2016-02-08 14:54:55 +00:00
|
|
|
void updateAdaptiveLayout();
|
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
|
|
|
|
2015-12-11 18:11:38 +00:00
|
|
|
uint64 animActiveTimeStart(const HistoryItem *msg) const;
|
2014-07-04 11:12:54 +00:00
|
|
|
void stopAnimActive();
|
|
|
|
|
2014-08-20 05:32:50 +00:00
|
|
|
void fillSelectedItems(SelectedItemSet &sel, bool forDelete = true);
|
2014-10-10 12:46:20 +00:00
|
|
|
void itemRemoved(HistoryItem *item);
|
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();
|
|
|
|
|
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);
|
2015-09-03 10:48:40 +00:00
|
|
|
bool lastForceReplyReplied(const FullMsgId &replyTo = FullMsgId(NoChannel, -1)) const;
|
2015-06-22 08:51:39 +00:00
|
|
|
void cancelReply(bool lastKeyboardUsed = false);
|
2016-02-25 10:32:31 +00:00
|
|
|
void cancelEdit();
|
2015-03-24 10:00:27 +00:00
|
|
|
void updateForwarding(bool force = false);
|
|
|
|
void cancelForwarding(); // called by MainWidget
|
|
|
|
|
|
|
|
void clearReplyReturns();
|
|
|
|
void pushReplyReturn(HistoryItem *item);
|
|
|
|
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_record(float64 ms, bool timer);
|
|
|
|
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-04-14 19:24:42 +00:00
|
|
|
void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo);
|
2015-12-31 18:34:56 +00:00
|
|
|
bool insertBotCommand(const QString &cmd, bool specialGif);
|
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
|
|
|
|
2015-06-24 17:24:48 +00:00
|
|
|
DragState getDragState(const QMimeData *d);
|
|
|
|
|
2015-07-17 19:17:37 +00:00
|
|
|
void fastShowAtEnd(History *h);
|
2015-10-18 12:49:34 +00:00
|
|
|
void applyDraft(bool parseLinks = true);
|
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();
|
|
|
|
|
2015-09-07 15:53:46 +00:00
|
|
|
void contactsReceived();
|
2015-09-13 08:41:27 +00:00
|
|
|
void updateToEndVisibility();
|
2015-09-19 09:13:21 +00:00
|
|
|
void updateCollapseCommentsVisibility();
|
2015-09-07 15:53:46 +00:00
|
|
|
|
2015-09-12 19:00:56 +00:00
|
|
|
void updateAfterDrag();
|
2016-04-09 11:02:50 +00:00
|
|
|
void updateFieldSubmitSettings();
|
2015-09-16 13:04:08 +00:00
|
|
|
|
|
|
|
void setInnerFocus();
|
2015-09-20 08:55:41 +00:00
|
|
|
bool canSendMessages(PeerData *peer) const;
|
2015-09-12 19:00:56 +00:00
|
|
|
|
2015-09-21 20:57:42 +00:00
|
|
|
void updateNotifySettings();
|
|
|
|
|
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);
|
|
|
|
|
2016-02-28 12:36:23 +00:00
|
|
|
void grabStart() override {
|
2015-10-17 14:52:26 +00:00
|
|
|
_inGrab = true;
|
|
|
|
resizeEvent(0);
|
|
|
|
}
|
2016-05-19 12:03:51 +00:00
|
|
|
void grapWithoutTopBarShadow() {
|
|
|
|
grabStart();
|
|
|
|
_topShadow.hide();
|
|
|
|
}
|
2016-02-28 12:36:23 +00:00
|
|
|
void grabFinish() override {
|
2015-10-17 14:52:26 +00:00
|
|
|
_inGrab = false;
|
|
|
|
resizeEvent(0);
|
2016-05-19 12:03:51 +00:00
|
|
|
_topShadow.show();
|
2015-10-17 14:52:26 +00:00
|
|
|
}
|
|
|
|
|
2015-12-23 16:48:44 +00:00
|
|
|
bool isItemVisible(HistoryItem *item);
|
|
|
|
|
2016-04-06 17:02:22 +00:00
|
|
|
void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col);
|
|
|
|
|
2015-12-27 21:37:48 +00:00
|
|
|
void ui_repaintHistoryItem(const HistoryItem *item);
|
2016-04-04 21:09:46 +00:00
|
|
|
void ui_repaintInlineItem(const InlineBots::Layout::ItemBase *gif);
|
|
|
|
bool ui_isInlineItemVisible(const InlineBots::Layout::ItemBase *layout);
|
2015-12-30 19:09:20 +00:00
|
|
|
bool ui_isInlineItemBeingChosen();
|
2016-03-29 17:17:00 +00:00
|
|
|
PeerData *ui_getPeerForMouseAction();
|
2015-12-13 11:17:15 +00:00
|
|
|
|
|
|
|
void notify_historyItemLayoutChanged(const HistoryItem *item);
|
2016-04-10 18:18:26 +00:00
|
|
|
void notify_inlineItemLayoutChanged(const InlineBots::Layout::ItemBase *layout);
|
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-04-10 20:59:07 +00:00
|
|
|
bool notify_switchInlineBotButtonReceived(const QString &query);
|
2015-12-11 18:11:38 +00:00
|
|
|
void notify_userIsBotChanged(UserData *user);
|
|
|
|
void notify_migrateUpdated(PeerData *peer);
|
2015-12-27 21:37:48 +00:00
|
|
|
void notify_clipStopperHidden(ClipStopperType type);
|
2016-03-19 16:55:15 +00:00
|
|
|
void notify_handlePendingHistoryUpdate();
|
2015-11-20 13:34:37 +00:00
|
|
|
|
2016-02-27 19:39:51 +00:00
|
|
|
void cmd_search();
|
|
|
|
void cmd_next_chat();
|
|
|
|
void cmd_previous_chat();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
~HistoryWidget();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
void cancelled();
|
2015-10-03 10:09:09 +00:00
|
|
|
void historyShown(History *history, MsgId atMsgId);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
2014-11-14 23:23:35 +00:00
|
|
|
void onCancel();
|
2015-03-19 09:18:19 +00:00
|
|
|
void onReplyToMessage();
|
2016-02-21 12:30:16 +00:00
|
|
|
void onEditMessage();
|
2016-03-10 10:15:21 +00:00
|
|
|
void onPinMessage();
|
|
|
|
void onUnpinMessage();
|
|
|
|
void onUnpinMessageSure();
|
|
|
|
void onPinnedHide();
|
2016-02-25 17:23:42 +00:00
|
|
|
void onCopyPostLink();
|
2016-02-25 10:32:31 +00:00
|
|
|
void onFieldBarCancel();
|
2015-04-06 22:15:29 +00:00
|
|
|
|
2015-08-01 08:33:00 +00:00
|
|
|
void onCancelSendAction();
|
|
|
|
|
2015-05-19 15:46:45 +00:00
|
|
|
void onStickerPackInfo();
|
|
|
|
|
2015-04-06 22:15:29 +00:00
|
|
|
void onPreviewParse();
|
|
|
|
void onPreviewCheck();
|
|
|
|
void onPreviewTimeout();
|
2014-11-14 23:23:35 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void peerUpdated(PeerData *data);
|
2015-06-15 17:19:24 +00:00
|
|
|
void onFullPeerUpdated(PeerData *data);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-02-25 16:19:54 +00:00
|
|
|
void onPhotoUploaded(const FullMsgId &msgId, bool silent, const MTPInputFile &file);
|
|
|
|
void onDocumentUploaded(const FullMsgId &msgId, bool silent, const MTPInputFile &file);
|
|
|
|
void onThumbDocumentUploaded(const FullMsgId &msgId, bool silent, const MTPInputFile &file, const MTPInputFile &thumb);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-09-03 10:48:40 +00:00
|
|
|
void onPhotoProgress(const FullMsgId &msgId);
|
|
|
|
void onDocumentProgress(const FullMsgId &msgId);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-09-03 10:48:40 +00:00
|
|
|
void onPhotoFailed(const FullMsgId &msgId);
|
|
|
|
void onDocumentFailed(const FullMsgId &msgId);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-09-08 17:22:29 +00:00
|
|
|
void onReportSpamClicked();
|
2015-09-13 09:24:15 +00:00
|
|
|
void onReportSpamSure();
|
2015-09-08 17:22:29 +00:00
|
|
|
void onReportSpamHide();
|
|
|
|
void onReportSpamClear();
|
|
|
|
|
2016-03-21 18:40:00 +00:00
|
|
|
void onScroll();
|
2014-07-04 11:12:54 +00:00
|
|
|
void onHistoryToEnd();
|
2015-09-19 09:13:21 +00:00
|
|
|
void onCollapseComments();
|
2015-03-19 09:18:19 +00:00
|
|
|
void onSend(bool ctrlShiftEnter = false, MsgId replyTo = -1);
|
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
|
|
|
|
|
|
|
void onPhotoSelect();
|
|
|
|
void onDocumentSelect();
|
2015-06-26 09:07:59 +00:00
|
|
|
void onPhotoDrop(const QMimeData *data);
|
|
|
|
void onDocumentDrop(const QMimeData *data);
|
|
|
|
void onFilesDrop(const QMimeData *data);
|
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();
|
2016-01-09 11:24:16 +00:00
|
|
|
void onStickersUpdated();
|
2014-05-30 08:53:19 +00:00
|
|
|
void onTextChange();
|
|
|
|
|
2015-07-03 08:47:16 +00:00
|
|
|
void onFieldTabbed();
|
2015-01-02 14:55:24 +00:00
|
|
|
void 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 deleteMessage();
|
2014-09-30 14:11:09 +00:00
|
|
|
void forwardMessage();
|
|
|
|
void selectMessage();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-11-13 15:14:33 +00:00
|
|
|
void onForwardHere(); // instead of a reply
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
void onForwardSelected();
|
|
|
|
void onDeleteSelected();
|
|
|
|
void onDeleteSelectedSure();
|
|
|
|
void onDeleteContextSure();
|
|
|
|
void onClearSelected();
|
|
|
|
|
2014-07-04 11:12:54 +00:00
|
|
|
void onAnimActiveStep();
|
|
|
|
|
2014-11-22 09:45:04 +00:00
|
|
|
void onDraftSaveDelayed();
|
|
|
|
void onDraftSave(bool delayed = false);
|
|
|
|
|
2015-01-02 14:55:24 +00:00
|
|
|
void updateStickers();
|
|
|
|
|
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-05-09 12:03:06 +00:00
|
|
|
void updateField();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
private:
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
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-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;
|
2015-03-19 09:18:19 +00:00
|
|
|
void updateReplyToName();
|
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
|
|
|
|
|
|
|
IconedButton _fieldBarCancel;
|
2016-03-10 10:15:21 +00:00
|
|
|
void updateReplyEditTexts(bool force = false);
|
|
|
|
|
|
|
|
struct PinnedBar {
|
|
|
|
PinnedBar(MsgId msgId, HistoryWidget *parent);
|
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
MsgId msgId = 0;
|
|
|
|
HistoryItem *msg = nullptr;
|
2016-03-10 10:15:21 +00:00
|
|
|
Text text;
|
|
|
|
IconedButton cancel;
|
|
|
|
PlainShadow shadow;
|
|
|
|
};
|
2016-03-22 19:43:47 +00:00
|
|
|
PinnedBar *_pinnedBar = nullptr;
|
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);
|
|
|
|
|
2016-03-28 12:51:22 +00:00
|
|
|
class ReplyEditMessageDataCallback : public SharedCallback<void, ChannelData*, MsgId> {
|
2016-03-10 10:15:21 +00:00
|
|
|
public:
|
|
|
|
void call(ChannelData *channel, MsgId msgId) const override;
|
|
|
|
};
|
2016-02-25 10:32:31 +00:00
|
|
|
|
2016-01-07 09:49:54 +00:00
|
|
|
void sendExistingDocument(DocumentData *doc, const QString &caption);
|
|
|
|
void sendExistingPhoto(PhotoData *photo, const QString &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;
|
2015-06-15 17:19:24 +00:00
|
|
|
void drawRecordButton(Painter &p);
|
|
|
|
void drawRecording(Painter &p);
|
2016-03-10 10:15:21 +00:00
|
|
|
void drawPinnedBar(Painter &p);
|
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);
|
|
|
|
|
2016-03-12 16:32:28 +00:00
|
|
|
static const mtpRequestId ReportSpamRequestNeeded = -1;
|
2016-03-22 19:43:47 +00:00
|
|
|
DBIPeerReportSpamStatus _reportSpamStatus = dbiprsUnknown;
|
|
|
|
mtpRequestId _reportSpamSettingRequestId = ReportSpamRequestNeeded;
|
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
|
|
|
|
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;
|
2015-04-06 22:15:29 +00:00
|
|
|
SingleTimer _previewTimer;
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _previewCancelled = false;
|
2015-04-06 22:15:29 +00:00
|
|
|
void gotPreview(QString links, const MTPMessageMedia &media, mtpRequestId req);
|
|
|
|
|
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);
|
2015-11-13 15:14:33 +00:00
|
|
|
void addMessagesToFront(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed);
|
|
|
|
void addMessagesToBack(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-04-06 17:02:22 +00:00
|
|
|
struct BotCallbackInfo {
|
|
|
|
FullMsgId msgId;
|
|
|
|
int row, col;
|
|
|
|
};
|
|
|
|
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;
|
|
|
|
};
|
2016-03-19 16:55:15 +00:00
|
|
|
void updateListSize(bool initial = false, bool loadedDown = false, const ScrollChange &change = { ScrollChangeNone, 0 });
|
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.
|
|
|
|
bool hasPendingResizedItems() const {
|
|
|
|
return (_history && _history->hasPendingResizedItems()) || (_migrated && _migrated->hasPendingResizedItems());
|
|
|
|
}
|
|
|
|
|
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.
|
|
|
|
int unreadBarTop() const;
|
|
|
|
|
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-09-21 20:57:42 +00:00
|
|
|
void joinDone(const MTPUpdates &result, mtpRequestId req);
|
|
|
|
bool joinFail(const RPCError &error, mtpRequestId req);
|
|
|
|
|
2015-07-17 19:17:37 +00:00
|
|
|
void countHistoryShowFrom();
|
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
mtpRequestId _stickersUpdateRequest = 0;
|
2015-01-02 14:55:24 +00:00
|
|
|
void stickersGot(const MTPmessages_AllStickers &stickers);
|
|
|
|
bool stickersFailed(const RPCError &error);
|
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
mtpRequestId _savedGifsUpdateRequest = 0;
|
2015-12-27 21:37:48 +00:00
|
|
|
void savedGifsGot(const MTPmessages_SavedGifs &gifs);
|
|
|
|
bool savedGifsFailed(const RPCError &error);
|
2015-01-02 14:55:24 +00:00
|
|
|
|
2016-05-05 16:04:17 +00:00
|
|
|
enum class TextUpdateEvent {
|
|
|
|
SaveDraft = 0x01,
|
|
|
|
SendTyping = 0x02,
|
|
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(TextUpdateEvents, TextUpdateEvent);
|
|
|
|
Q_DECLARE_FRIEND_OPERATORS_FOR_FLAGS(TextUpdateEvents);
|
|
|
|
|
2016-02-25 10:32:31 +00:00
|
|
|
void writeDrafts(HistoryDraft **msgDraft, HistoryEditDraft **editDraft);
|
|
|
|
void writeDrafts(History *history);
|
2016-05-05 16:04:17 +00:00
|
|
|
void setFieldText(const TextWithTags &textWithTags, TextUpdateEvents events = 0, FlatTextarea::UndoHistoryAction undoHistoryAction = FlatTextarea::ClearUndoHistory);
|
|
|
|
void clearFieldText(TextUpdateEvents events = 0, FlatTextarea::UndoHistoryAction undoHistoryAction = FlatTextarea::ClearUndoHistory) {
|
|
|
|
setFieldText(TextWithTags(), events, undoHistoryAction);
|
2016-04-09 11:02:50 +00:00
|
|
|
}
|
2014-11-05 17:43:32 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
QStringList getMediasFromMime(const QMimeData *d);
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
2015-09-20 08:55:41 +00:00
|
|
|
bool readyToForward() const;
|
|
|
|
bool hasBroadcastToggle() 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;
|
|
|
|
|
|
|
|
// cache current _peer in _clearPeer when showing clear history box
|
|
|
|
PeerData *_clearPeer = nullptr;
|
|
|
|
|
|
|
|
ChannelId _channel = NoChannel;
|
|
|
|
bool _canSendMessages = false;
|
|
|
|
MsgId _showAtMsgId = ShowAtUnreadMsgId;
|
|
|
|
MsgId _fixedInScrollMsgId = 0;
|
|
|
|
int32 _fixedInScrollMsgTop = 0;
|
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
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
MsgId _delayedShowAtMsgId = -1; // wtf?
|
|
|
|
mtpRequestId _delayedShowAtRequest = 0;
|
2015-07-17 19:17:37 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
MsgId _activeAnimMsgId = 0;
|
2014-07-13 09:50:38 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
ScrollArea _scroll;
|
2016-03-22 19:43:47 +00:00
|
|
|
HistoryInner *_list = nullptr;
|
|
|
|
History *_migrated = nullptr;
|
|
|
|
History *_history = nullptr;
|
|
|
|
bool _histInited = false; // initial updateListSize() called
|
2016-04-08 09:20:10 +00:00
|
|
|
int _addToScroll = 0;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
int _lastScroll = 0;// gifs optimization
|
2016-03-22 19:43:47 +00:00
|
|
|
uint64 _lastScrolled = 0;
|
2016-04-08 09:20:10 +00:00
|
|
|
QTimer _updateHistoryItems;
|
2016-01-03 08:01:14 +00:00
|
|
|
|
2014-07-04 11:12:54 +00:00
|
|
|
IconedButton _toHistoryEnd;
|
2015-09-19 09:13:21 +00:00
|
|
|
CollapseButton _collapseComments;
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2016-04-29 13:46:16 +00:00
|
|
|
ChildWidget<FieldAutocomplete> _fieldAutocomplete;
|
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;
|
2016-03-22 19:43:47 +00:00
|
|
|
mtpRequestId _inlineBotResolveRequestId = 0;
|
2016-04-10 19:20:48 +00:00
|
|
|
std_::unique_ptr<IconedButton> _inlineBotCancel;
|
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();
|
2015-06-19 22:13:56 +00:00
|
|
|
|
2015-09-08 12:20:30 +00:00
|
|
|
ReportSpamPanel _reportSpamPanel;
|
|
|
|
|
2015-09-21 20:57:42 +00:00
|
|
|
FlatButton _send, _unblock, _botStart, _joinChannel, _muteUnmute;
|
2016-03-22 19:43:47 +00:00
|
|
|
mtpRequestId _unblockRequest = 0;
|
|
|
|
mtpRequestId _reportSpamRequest = 0;
|
2016-01-01 09:58:05 +00:00
|
|
|
IconedButton _attachDocument, _attachPhoto;
|
|
|
|
EmojiButton _attachEmoji;
|
|
|
|
IconedButton _kbShow, _kbHide, _cmdStart;
|
2015-09-20 08:55:41 +00:00
|
|
|
FlatCheckbox _broadcast;
|
2016-02-25 16:19:54 +00:00
|
|
|
SilentToggle _silent;
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _cmdStartShown = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
MessageField _field;
|
2015-12-08 12:33:37 +00:00
|
|
|
Animation _a_record, _a_recording;
|
2016-03-22 19:43:47 +00:00
|
|
|
bool _recording = false;
|
|
|
|
bool _inRecord = false;
|
|
|
|
bool _inField = false;
|
|
|
|
bool _inReplyEdit = false;
|
|
|
|
bool _inPinnedMsg = false;
|
|
|
|
anim::ivalue a_recordingLevel = { 0, 0 };
|
|
|
|
int32 _recordingSamples = 0;
|
|
|
|
anim::fvalue a_recordOver = { 0, 0 };
|
|
|
|
anim::fvalue a_recordDown = { 0, 0 };
|
2015-05-29 18:52:43 +00:00
|
|
|
anim::cvalue a_recordCancel;
|
|
|
|
int32 _recordCancelWidth;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
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;
|
2015-06-15 17:19:24 +00:00
|
|
|
ScrollArea _kbScroll;
|
|
|
|
BotKeyboard _keyboard;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
Dropdown _attachType;
|
|
|
|
EmojiPan _emojiPan;
|
2016-03-22 19:43:47 +00:00
|
|
|
DragState _attachDrag = DragStateNone;
|
2014-05-30 08:53:19 +00:00
|
|
|
DragArea _attachDragDocument, _attachDragPhoto;
|
|
|
|
|
|
|
|
int32 _selCount; // < 0 - text selected, focus list, not _field
|
|
|
|
|
2015-10-27 02:39:02 +00:00
|
|
|
TaskQueue _fileLoader;
|
2016-05-05 16:04:17 +00:00
|
|
|
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-03-22 19:43:47 +00:00
|
|
|
uint64 _confirmWithTextId = 0;
|
2015-10-27 02:39:02 +00:00
|
|
|
|
2015-07-17 19:17:37 +00:00
|
|
|
QString _titlePeerText;
|
2016-03-22 19:43:47 +00:00
|
|
|
int32 _titlePeerTextWidth = 0;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-10-17 14:52:26 +00:00
|
|
|
Animation _a_show;
|
2016-05-19 12:03:51 +00:00
|
|
|
QPixmap _cacheUnder, _cacheOver;
|
2015-10-17 14:52:26 +00:00
|
|
|
anim::ivalue a_coordUnder, a_coordOver;
|
2016-05-19 12:03:51 +00:00
|
|
|
anim::fvalue a_progress;
|
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
|
|
|
|
2014-07-04 11:12:54 +00:00
|
|
|
QTimer _animActiveTimer;
|
2016-03-22 19:43:47 +00:00
|
|
|
float64 _animActiveStart = 0;
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2015-08-01 08:33:00 +00:00
|
|
|
QMap<QPair<History*, SendActionType>, mtpRequestId> _sendActionRequests;
|
|
|
|
QTimer _sendActionStopTimer;
|
2014-11-05 17:43:32 +00:00
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
uint64 _saveDraftStart = 0;
|
|
|
|
bool _saveDraftText = false;
|
2014-11-22 09:45:04 +00:00
|
|
|
QTimer _saveDraftTimer;
|
|
|
|
|
2016-05-14 16:57:06 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2016-05-05 16:04:17 +00:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(HistoryWidget::TextUpdateEvents)
|