Show poll question in pinned bar.

This commit is contained in:
John Preston 2018-12-24 13:25:02 +04:00
parent 12905f0dcb
commit fb7ac874f0
3 changed files with 6 additions and 4 deletions

View File

@ -156,6 +156,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_deleted" = "Deleted Account";
"lng_deleted_message" = "Deleted message";
"lng_pinned_message" = "Pinned message";
"lng_pinned_poll" = "Pinned poll";
"lng_pinned_unpin_sure" = "Would you like to unpin this message?";
"lng_pinned_pin_sure" = "Would you like to pin this message?";
"lng_pinned_pin" = "Pin";

View File

@ -1217,7 +1217,7 @@ PollData *MediaPoll::poll() const {
}
QString MediaPoll::notificationText() const {
return lang(lng_in_dlg_poll);
return _poll->question;
}
QString MediaPoll::pinnedTextSubstring() const {

View File

@ -6496,8 +6496,9 @@ void HistoryWidget::drawPinnedBar(Painter &p) {
int32 left = st::msgReplyBarSkip + st::msgReplyBarSkip;
if (_pinnedBar->msg) {
if (_pinnedBar->msg->media() && _pinnedBar->msg->media()->hasReplyPreview()) {
if (const auto image = _pinnedBar->msg->media()->replyPreview()) {
const auto media = _pinnedBar->msg->media();
if (media && media->hasReplyPreview()) {
if (const auto image = media->replyPreview()) {
QRect to(left, top, st::msgReplyBarSize.height(), st::msgReplyBarSize.height());
p.drawPixmap(to.x(), to.y(), image->pixSingle(_pinnedBar->msg->fullId(), image->width() / cIntRetinaFactor(), image->height() / cIntRetinaFactor(), to.width(), to.height(), ImageRoundRadius::Small));
}
@ -6505,7 +6506,7 @@ void HistoryWidget::drawPinnedBar(Painter &p) {
}
p.setPen(st::historyReplyNameFg);
p.setFont(st::msgServiceNameFont);
p.drawText(left, top + st::msgServiceNameFont->ascent, lang(lng_pinned_message));
p.drawText(left, top + st::msgServiceNameFont->ascent, lang((media && media->poll()) ? lng_pinned_poll : lng_pinned_message));
p.setPen(st::historyComposeAreaFg);
p.setTextPalette(st::historyComposeAreaPalette);