Defaulting inline bot reuslt video title/description to

"Video file"/duration. Scheme updated.
This commit is contained in:
John Preston 2016-04-06 17:46:52 +04:00
parent 730dce2cdc
commit ba7cb1abbc
3 changed files with 13 additions and 4 deletions

View File

@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "inline_bots/inline_bot_result.h"
#include "localstorage.h"
#include "mainwidget.h"
#include "lang.h"
namespace InlineBots {
namespace Layout {
@ -654,13 +655,21 @@ void Video::initDimensions() {
_maxw = st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft;
int32 textWidth = _maxw - (withThumb ? (st::inlineThumbSize + st::inlineThumbSkip) : 0);
TextParseOptions titleOpts = { 0, _maxw, 2 * st::semiboldFont->height, Qt::LayoutDirectionAuto };
_title.setText(st::semiboldFont, textOneLine(_result->getLayoutTitle()), titleOpts);
QString title = textOneLine(_result->getLayoutTitle());
if (title.isEmpty()) {
title = lang(lng_media_video);
}
_title.setText(st::semiboldFont, title, titleOpts);
int32 titleHeight = qMin(_title.countHeight(_maxw), 2 * st::semiboldFont->height);
int32 descriptionLines = withThumb ? (titleHeight > st::semiboldFont->height ? 1 : 2) : 3;
TextParseOptions descriptionOpts = { TextParseMultiline, _maxw, descriptionLines * st::normalFont->height, Qt::LayoutDirectionAuto };
_description.setText(st::normalFont, _result->getLayoutDescription(), descriptionOpts);
QString description = _result->getLayoutDescription();
if (description.isEmpty()) {
description = _duration;
}
_description.setText(st::normalFont, description, descriptionOpts);
int32 descriptionHeight = qMin(_description.countHeight(_maxw), descriptionLines * st::normalFont->height);
_minh = st::inlineThumbSize;

View File

@ -856,4 +856,4 @@ channels.exportMessageLink#c846d22d channel:InputChannel id:int = ExportedMessag
channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates;
channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates;
// LAYER 52
// LAYER 51

View File

@ -30,7 +30,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
namespace MTP {
namespace internal {
static constexpr mtpPrime CurrentLayer = 52;
static constexpr mtpPrime CurrentLayer = 51;
class TypeCreator;