コード例 #1
0
void InfoWidget::refreshAbout() {
	auto getAboutText = [this]() -> QString {
		if (auto user = peer()->asUser()) {
			return user->about();
		} else if (auto channel = peer()->asChannel()) {
			return channel->about();
		}
		return QString();
	};

	_about.destroy();
	auto aboutText = textClean(getAboutText());
	if (!aboutText.isEmpty()) {
		_about.create(this, st::profileBlockTextPart);
		_about->show();

		EntitiesInText aboutEntities;
		textParseEntities(aboutText, TextParseLinks | TextParseMentions | TextParseHashtags | TextParseBotCommands, &aboutEntities);
		_about->setMarkedText({ aboutText, aboutEntities });
		_about->setSelectable(true);
		_about->setClickHandlerHook([this](const ClickHandlerPtr &handler, Qt::MouseButton button) {
			BotCommandClickHandler::setPeerForCommand(peer());
			return true;
		});
	}
}
コード例 #2
0
ファイル: aboutbox.cpp プロジェクト: 09120898371/tdesktop
AboutBox::AboutBox() :
_done(this, lang(lng_about_done), st::aboutCloseButton),
_version(this, qsl("[a href=\"https://desktop.telegram.org/#changelog\"]") + textClean(lng_about_version(lt_version, QString::fromWCharArray(AppVersionStr) + (DevChannel ? " dev" : ""))) + qsl("[/a]"), st::aboutVersion, st::defaultTextStyle),
_text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle) {
	
	resizeMaxHeight(st::aboutWidth, st::aboutHeight);

	_version.move(0, st::aboutVersionTop);
	_text.move(0, st::aboutTextTop);

	_headerWidth = st::aboutHeaderFont->m.width(qsl("Telegram "));
	_subheaderWidth = st::aboutSubheaderFont->m.width(qsl("Desktop"));

	_done.move(0, height() - _done.height());

	connect(&_done, SIGNAL(clicked()), this, SLOT(onClose()));

	prepare();
}