Improve mute and info display in video messages.

Display mute on top of the video and move info to the right side
for incoming messages (because of channel authors and views count).
This commit is contained in:
John Preston 2017-04-06 14:37:13 +03:00
parent 1b7777e3a0
commit 96dbb38aaa
1 changed files with 18 additions and 1 deletions

View File

@ -1918,7 +1918,7 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, TimeM
}
}
if (displayMute) {
auto muteRect = rtlrect(rthumb.x() + (rthumb.width() - st::historyVideoMessageMuteSize) / 2, rthumb.y() + rthumb.height() - st::msgDateImgDelta - st::historyVideoMessageMuteSize, st::historyVideoMessageMuteSize, st::historyVideoMessageMuteSize, _width);
auto muteRect = rtlrect(rthumb.x() + (rthumb.width() - st::historyVideoMessageMuteSize) / 2, rthumb.y() + st::msgDateImgDelta, st::historyVideoMessageMuteSize, st::historyVideoMessageMuteSize, _width);
p.setPen(Qt::NoPen);
p.setBrush(selected ? st::msgDateImgBgSelected : st::msgDateImgBg);
PainterHighQualityEnabler hq(p);
@ -1955,6 +1955,23 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, TimeM
} else if (_parent->getMedia() == this && (isRound || _data->uploading() || App::hoveredItem() == _parent)) {
auto fullRight = skipx + width;
auto fullBottom = skipy + height;
if (isRound && !outbg) {
auto infoWidth = _parent->infoWidth();
// This is just some arbitrary point,
// the main idea is to make info left aligned here.
fullRight += infoWidth - st::normalFont->height;
auto maxRight = _parent->history()->width - st::msgMargin.left();
if (_parent->history()->canHaveFromPhotos()) {
maxRight -= st::msgMargin.right();
} else {
maxRight -= st::msgMargin.left();
}
if (fullRight > maxRight) {
fullRight = maxRight;
}
}
_parent->drawInfo(p, fullRight, fullBottom, 2 * skipx + width, selected, isRound ? InfoDisplayOverBackground : InfoDisplayOverImage);
}
}