mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
inline bots panel crash fixed, field placeholder fixed, controls active in mediaview when context menu is shown
This commit is contained in:
parent
e43ea5101e
commit
4426e2dd78
@ -1900,6 +1900,10 @@ void StickerPanInner::refreshInlineRows(UserData *bot, const InlineResults &resu
|
||||
return;
|
||||
}
|
||||
|
||||
if (_showingInlineItems) {
|
||||
clearSelection(true);
|
||||
}
|
||||
|
||||
t_assert(bot != 0);
|
||||
_inlineBot = bot;
|
||||
_inlineBotTitle = lng_inline_bot_results(lt_inline_bot, bot->username.isEmpty() ? bot->name : ('@' + bot->username));
|
||||
@ -1976,7 +1980,10 @@ void StickerPanInner::refreshInlineRows(UserData *bot, const InlineResults &resu
|
||||
update();
|
||||
|
||||
emit refreshIcons();
|
||||
updateSelected();
|
||||
if (_showingInlineItems) {
|
||||
_lastMousePos = QCursor::pos();
|
||||
updateSelected();
|
||||
}
|
||||
}
|
||||
|
||||
void StickerPanInner::ui_repaintInlineItem(const LayoutInlineItem *layout) {
|
||||
|
@ -3803,7 +3803,7 @@ void HistoryVideo::updateStatusText(const HistoryItem *parent) const {
|
||||
} else if (_data->status == FileUploading) {
|
||||
statusSize = _data->uploadOffset;
|
||||
} else if (_data->loading()) {
|
||||
statusSize = _data->progress();
|
||||
statusSize = _data->loadOffset();
|
||||
} else if (!_data->already().isEmpty()) {
|
||||
statusSize = FileStatusSizeLoaded;
|
||||
} else {
|
||||
@ -6778,7 +6778,6 @@ HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const
|
||||
, fwdFrom(App::peer(peerFromMTP(msg.vfwd_from_id)))
|
||||
, fwdFromVersion(fwdFrom->nameVersion)
|
||||
, fromWidth(st::msgServiceFont->width(lang(lng_forwarded_from)) + st::msgServiceFont->spacew) {
|
||||
fwdNameUpdated();
|
||||
}
|
||||
|
||||
HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId id, QDateTime date, int32 from, HistoryMessage *msg)
|
||||
@ -6787,7 +6786,6 @@ HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId
|
||||
, fwdFrom(msg->fromForwarded())
|
||||
, fwdFromVersion(fwdFrom->nameVersion)
|
||||
, fromWidth(st::msgServiceFont->width(lang(lng_forwarded_from)) + st::msgServiceFont->spacew) {
|
||||
fwdNameUpdated();
|
||||
}
|
||||
|
||||
QString HistoryForwarded::selectedText(uint32 selection) const {
|
||||
@ -6799,18 +6797,18 @@ QString HistoryForwarded::selectedText(uint32 selection) const {
|
||||
}
|
||||
|
||||
void HistoryForwarded::initDimensions() {
|
||||
HistoryMessage::initDimensions();
|
||||
fwdNameUpdated();
|
||||
}
|
||||
|
||||
void HistoryForwarded::fwdNameUpdated() const {
|
||||
fwdFromName.setText(st::msgServiceNameFont, App::peerName(fwdFrom), _textNameOptions);
|
||||
HistoryMessage::initDimensions();
|
||||
if (!_media) {
|
||||
int32 _namew = st::msgPadding.left() + fromWidth + fwdFromName.maxWidth() + st::msgPadding.right();
|
||||
if (_namew > _maxw) _maxw = _namew;
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryForwarded::fwdNameUpdated() const {
|
||||
fwdFromName.setText(st::msgServiceNameFont, App::peerName(fwdFrom), _textNameOptions);
|
||||
}
|
||||
|
||||
void HistoryForwarded::draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const {
|
||||
if (drawBubble() && fwdFrom->nameVersion > fwdFromVersion) {
|
||||
fwdNameUpdated();
|
||||
@ -6974,7 +6972,9 @@ HistoryReply::HistoryReply(History *history, HistoryBlock *block, MsgId msgId, i
|
||||
if (!updateReplyTo() && App::api()) {
|
||||
App::api()->requestReplyTo(this, history->peer->asChannel(), replyToMsgId);
|
||||
}
|
||||
replyToNameUpdated();
|
||||
}
|
||||
|
||||
QString HistoryReply::selectedText(uint32 selection) const {
|
||||
if (selection != FullSelection || !replyToMsg) return HistoryMessage::selectedText(selection);
|
||||
QString result, original = HistoryMessage::selectedText(selection);
|
||||
@ -6984,8 +6984,12 @@ QString HistoryReply::selectedText(uint32 selection) const {
|
||||
}
|
||||
|
||||
void HistoryReply::initDimensions() {
|
||||
HistoryMessage::initDimensions();
|
||||
replyToNameUpdated();
|
||||
HistoryMessage::initDimensions();
|
||||
if (!_media) {
|
||||
int32 replyw = st::msgPadding.left() + _maxReplyWidth - st::msgReplyPadding.left() - st::msgReplyPadding.right() + st::msgPadding.right();
|
||||
if (replyw > _maxw) _maxw = replyw;
|
||||
}
|
||||
}
|
||||
|
||||
bool HistoryReply::updateReplyTo(bool force) {
|
||||
@ -7020,11 +7024,6 @@ void HistoryReply::replyToNameUpdated() const {
|
||||
_maxReplyWidth = st::msgDateFont->width(lang(replyToMsgId ? lng_profile_loading : lng_deleted_message));
|
||||
}
|
||||
_maxReplyWidth = st::msgReplyPadding.left() + st::msgReplyBarSkip + _maxReplyWidth + st::msgReplyPadding.right();
|
||||
|
||||
if (!_media) {
|
||||
int32 replyw = st::msgPadding.left() + _maxReplyWidth - st::msgReplyPadding.left() - st::msgReplyPadding.right() + st::msgPadding.right();
|
||||
if (replyw > _maxw) _maxw = replyw;
|
||||
}
|
||||
}
|
||||
|
||||
int32 HistoryReply::replyToWidth() const {
|
||||
|
@ -883,6 +883,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
if ((lnkVideo && lnkVideo->video()->loading()) || (lnkAudio && lnkAudio->audio()->loading()) || (lnkDocument && lnkDocument->document()->loading())) {
|
||||
_menu->addAction(lang(lng_context_cancel_download), this, SLOT(cancelContextDownload()))->setEnabled(true);
|
||||
} else {
|
||||
if (lnkDocument && lnkDocument->document()->loaded() && lnkDocument->document()->isGifv()) {
|
||||
_menu->addAction(lang(lng_context_save_gif), this, SLOT(saveContextGif()))->setEnabled(true);
|
||||
}
|
||||
if ((lnkVideo && !lnkVideo->video()->already(true).isEmpty()) || (lnkAudio && !lnkAudio->audio()->already(true).isEmpty()) || (lnkDocument && !lnkDocument->document()->already(true).isEmpty())) {
|
||||
_menu->addAction(lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_context_show_in_finder : lng_context_show_in_folder), this, SLOT(showContextInFolder()))->setEnabled(true);
|
||||
}
|
||||
@ -3401,6 +3404,12 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
|
||||
_scroll.takeWidget();
|
||||
updateTopBarSelection();
|
||||
|
||||
if (_inlineBot) {
|
||||
_inlineBot = 0;
|
||||
_emojiPan.clearInlineBot();
|
||||
updateFieldPlaceholder();
|
||||
}
|
||||
|
||||
_showAtMsgId = showAtMsgId;
|
||||
_histInited = false;
|
||||
|
||||
@ -3504,10 +3513,6 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
|
||||
} else {
|
||||
doneShow();
|
||||
}
|
||||
if (_inlineBot) {
|
||||
_inlineBot = 0;
|
||||
_emojiPan.clearInlineBot();
|
||||
}
|
||||
|
||||
if (App::wnd()) QTimer::singleShot(0, App::wnd(), SLOT(setInnerFocus()));
|
||||
|
||||
|
@ -490,7 +490,7 @@ void MediaView::close() {
|
||||
}
|
||||
|
||||
void MediaView::activateControls() {
|
||||
_controlsHideTimer.start(int(st::mvWaitHide));
|
||||
if (!_menu) _controlsHideTimer.start(int(st::mvWaitHide));
|
||||
if (_controlsState == ControlsHiding || _controlsState == ControlsHidden) {
|
||||
_controlsState = ControlsShowing;
|
||||
_controlsAnimStarted = getms();
|
||||
@ -500,7 +500,7 @@ void MediaView::activateControls() {
|
||||
}
|
||||
|
||||
void MediaView::onHideControls(bool force) {
|
||||
if (!force && !_dropdown.isHidden()) return;
|
||||
if (!force && (!_dropdown.isHidden() || _menu)) return;
|
||||
if (_controlsState == ControlsHiding || _controlsState == ControlsHidden) return;
|
||||
_controlsState = ControlsHiding;
|
||||
_controlsAnimStarted = getms();
|
||||
@ -1871,6 +1871,7 @@ void MediaView::contextMenuEvent(QContextMenuEvent *e) {
|
||||
connect(_menu, SIGNAL(destroyed(QObject*)), this, SLOT(onMenuDestroy(QObject*)));
|
||||
_menu->popup(e->globalPos());
|
||||
e->accept();
|
||||
activateControls();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1968,6 +1969,7 @@ void MediaView::hide() {
|
||||
void MediaView::onMenuDestroy(QObject *obj) {
|
||||
if (_menu == obj) {
|
||||
_menu = 0;
|
||||
activateControls();
|
||||
}
|
||||
_receiveMouse = false;
|
||||
QTimer::singleShot(0, this, SLOT(receiveMouse()));
|
||||
|
Loading…
Reference in New Issue
Block a user