Fixed glitches in draft apply. Fixed overflow / crash in media preview.

Fixed new unread messages with existing unread bar in the shown history.
This commit is contained in:
John Preston 2016-06-10 18:11:44 +03:00
parent 5ffc5dd218
commit b20245c8c8
3 changed files with 24 additions and 5 deletions

View File

@ -3856,8 +3856,12 @@ void HistoryWidget::applyDraft(bool parseLinks) {
}
void HistoryWidget::applyCloudDraft(History *history) {
if (_history == history) {
if (_history == history && !_editMsgId) {
applyDraft();
updateControlsVisibility();
resizeEvent(nullptr);
update();
}
}
@ -4034,7 +4038,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
}
applyDraft(false);
resizeEvent(0);
resizeEvent(nullptr);
if (!_previewCancelled) {
onPreviewParse();
}
@ -4671,8 +4675,21 @@ bool HistoryWidget::doWeReadServerHistory() const {
if (scrollBottom > _list->itemTop(showFrom)) return true;
}
}
if (_history->showFrom && !_history->showFrom->detached() && _history->unreadBar) return true;
if (_migrated && _migrated->showFrom && !_migrated->showFrom->detached() && _migrated->unreadBar) return true;
if (historyHasNotFreezedUnreadBar(_history)) {
return true;
}
if (historyHasNotFreezedUnreadBar(_migrated)) {
return true;
}
return false;
}
bool HistoryWidget::historyHasNotFreezedUnreadBar(History *history) const {
if (history && history->showFrom && !history->showFrom->detached() && history->unreadBar) {
if (auto unreadBar = history->unreadBar->Get<HistoryMessageUnreadBar>()) {
return !unreadBar->_freezed;
}
}
return false;
}

View File

@ -857,6 +857,8 @@ private:
void moveFieldControls();
void updateFieldSize();
bool historyHasNotFreezedUnreadBar(History *history) const;
void clearInlineBot();
void inlineBotChanged();

View File

@ -202,7 +202,7 @@ void MediaPreviewWidget::paintEvent(QPaintEvent *e) {
QRect r(e->rect());
const QPixmap &draw(currentImage());
uint32 w = draw.width() / cIntRetinaFactor(), h = draw.height() / cIntRetinaFactor();
int w = draw.width() / cIntRetinaFactor(), h = draw.height() / cIntRetinaFactor();
if (_a_shown.animating()) {
float64 shown = a_shown.current();
p.setOpacity(shown);