mirror of https://github.com/procxx/kepka.git
Fix crash in HistoryWidget.
This commit is contained in:
parent
677dbd5d6e
commit
6d62673e9e
|
@ -92,6 +92,7 @@ constexpr auto kSkipRepaintWhileScrollMs = 100;
|
|||
constexpr auto kShowMembersDropdownTimeoutMs = 300;
|
||||
constexpr auto kDisplayEditTimeWarningMs = 300 * 1000;
|
||||
constexpr auto kFullDayInMs = 86400 * 1000;
|
||||
constexpr auto kCancelTypingActionTimeout = TimeMs(5000);
|
||||
|
||||
ApiWrap::RequestMessageDataCallback replyEditMessageDataCallback() {
|
||||
return [](ChannelData *channel, MsgId msgId) {
|
||||
|
@ -448,6 +449,7 @@ HistoryWidget::HistoryWidget(QWidget *parent, not_null<Window::Controller*> cont
|
|||
, _attachDragDocument(this)
|
||||
, _attachDragPhoto(this)
|
||||
, _fileLoader(this, FileLoaderQueueStopTimeout)
|
||||
, _sendActionStopTimer([this] { cancelTypingAction(); })
|
||||
, _topShadow(this) {
|
||||
setAcceptDrops(true);
|
||||
|
||||
|
@ -475,7 +477,6 @@ HistoryWidget::HistoryWidget(QWidget *parent, not_null<Window::Controller*> cont
|
|||
connect(_tabbedSelector, SIGNAL(stickerSelected(DocumentData*)), this, SLOT(onStickerSend(DocumentData*)));
|
||||
connect(_tabbedSelector, SIGNAL(photoSelected(PhotoData*)), this, SLOT(onPhotoSend(PhotoData*)));
|
||||
connect(_tabbedSelector, SIGNAL(inlineResultSelected(InlineBots::Result*,UserData*)), this, SLOT(onInlineResultSend(InlineBots::Result*,UserData*)));
|
||||
connect(&_sendActionStopTimer, SIGNAL(timeout()), this, SLOT(onCancelSendAction()));
|
||||
connect(&_previewTimer, SIGNAL(timeout()), this, SLOT(onPreviewTimeout()));
|
||||
connect(Media::Capture::instance(), SIGNAL(error()), this, SLOT(onRecordError()));
|
||||
connect(Media::Capture::instance(), SIGNAL(updated(quint16,qint32)), this, SLOT(onRecordUpdate(quint16,qint32)));
|
||||
|
@ -490,8 +491,6 @@ HistoryWidget::HistoryWidget(QWidget *parent, not_null<Window::Controller*> cont
|
|||
|
||||
_scrollTimer.setSingleShot(false);
|
||||
|
||||
_sendActionStopTimer.setSingleShot(true);
|
||||
|
||||
_highlightTimer.setCallback([this] { updateHighlightedMessage(); });
|
||||
|
||||
_membersDropdownShowTimer.setSingleShot(true);
|
||||
|
@ -1191,8 +1190,11 @@ void HistoryWidget::cancelSendAction(
|
|||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::onCancelSendAction() {
|
||||
cancelSendAction(_history, SendAction::Type::Typing);
|
||||
void HistoryWidget::cancelTypingAction() {
|
||||
if (_history) {
|
||||
cancelSendAction(_history, SendAction::Type::Typing);
|
||||
}
|
||||
_sendActionStopTimer.cancel();
|
||||
}
|
||||
|
||||
void HistoryWidget::updateSendAction(
|
||||
|
@ -1231,7 +1233,9 @@ void HistoryWidget::updateSendAction(
|
|||
action),
|
||||
rpcDone(&HistoryWidget::sendActionDone));
|
||||
_sendActionRequests.insert(key, requestId);
|
||||
if (type == Type::Typing) _sendActionStopTimer.start(5000);
|
||||
if (type == Type::Typing) {
|
||||
_sendActionStopTimer.callOnce(kCancelTypingActionTimeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1627,6 +1631,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
|
|||
return;
|
||||
}
|
||||
updateSendAction(_history, SendAction::Type::Typing, -1);
|
||||
cancelTypingAction();
|
||||
}
|
||||
|
||||
if (!cAutoPlayGif()) {
|
||||
|
|
|
@ -29,6 +29,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "base/flags.h"
|
||||
#include "base/timer.h"
|
||||
|
||||
namespace InlineBots {
|
||||
namespace Layout {
|
||||
|
@ -206,16 +207,7 @@ public:
|
|||
void pushInfoToThirdSection(
|
||||
const Window::SectionShow ¶ms);
|
||||
|
||||
void updateSendAction(
|
||||
not_null<History*> history,
|
||||
SendAction::Type type,
|
||||
int32 progress = 0);
|
||||
void cancelSendAction(
|
||||
not_null<History*> history,
|
||||
SendAction::Type type);
|
||||
|
||||
void updateRecentStickers();
|
||||
void sendActionDone(const MTPBool &result, mtpRequestId req);
|
||||
|
||||
void destroyData();
|
||||
|
||||
|
@ -383,8 +375,6 @@ public slots:
|
|||
void onCopyPostLink();
|
||||
void onFieldBarCancel();
|
||||
|
||||
void onCancelSendAction();
|
||||
|
||||
void onPreviewParse();
|
||||
void onPreviewCheck();
|
||||
void onPreviewTimeout();
|
||||
|
@ -493,6 +483,16 @@ private:
|
|||
void clearHighlightMessages();
|
||||
void stopMessageHighlight();
|
||||
|
||||
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);
|
||||
|
||||
void animationCallback();
|
||||
void updateOverStates(QPoint pos);
|
||||
void recordStartCallback();
|
||||
|
@ -852,7 +852,7 @@ private:
|
|||
TimeMs _highlightStart = 0;
|
||||
|
||||
QMap<QPair<not_null<History*>, SendAction::Type>, mtpRequestId> _sendActionRequests;
|
||||
QTimer _sendActionStopTimer;
|
||||
base::Timer _sendActionStopTimer;
|
||||
|
||||
TimeMs _saveDraftStart = 0;
|
||||
bool _saveDraftText = false;
|
||||
|
|
Loading…
Reference in New Issue