void AboutBox::prepare() { setTitle(qsl("Telegram Desktop")); addButton(lang(lng_close), [this] { closeBox(); }); _text3->setRichText(lng_about_text_3(lt_faq_open, qsl("[a href=\"%1\"]").arg(telegramFaqLink()), lt_faq_close, qsl("[/a]"))); _version->setClickedCallback([this] { showVersionHistory(); }); setDimensions(st::aboutWidth, st::aboutTextTop + _text1->height() + st::aboutSkip + _text2->height() + st::aboutSkip + _text3->height()); }
AboutBox::AboutBox() : AbstractBox(st::aboutWidth) , _version(this, lng_about_version(lt_version, QString::fromWCharArray(AppVersionStr) + (cDevVersion() ? " dev" : "") + (cBetaVersion() ? qsl(" beta %1").arg(cBetaVersion()) : QString())), st::aboutVersionLink) , _text1(this, lang(lng_about_text_1), st::aboutLabel, st::aboutTextStyle) , _text2(this, lang(lng_about_text_2), st::aboutLabel, st::aboutTextStyle) , _text3(this, QString(), st::aboutLabel, st::aboutTextStyle) , _done(this, lang(lng_close), st::defaultBoxButton) { _text3.setRichText(lng_about_text_3(lt_faq_open, qsl("[a href=\"%1\"]").arg(telegramFaqLink()), lt_faq_close, qsl("[/a]"))); setMaxHeight(st::boxTitleHeight + st::aboutTextTop + _text1.height() + st::aboutSkip + _text2.height() + st::aboutSkip + _text3.height() + st::boxButtonPadding.top() + _done.height() + st::boxButtonPadding.bottom()); connect(&_version, SIGNAL(clicked()), this, SLOT(onVersion())); connect(&_done, SIGNAL(clicked()), this, SLOT(onClose())); prepare(); }
void AboutBox::prepare() { setTitle([] { return qsl("Telegram Desktop"); }); addButton(langFactory(lng_close), [this] { closeBox(); }); const auto linkFilter = [](const ClickHandlerPtr &link, auto button) { if (const auto url = dynamic_cast<UrlClickHandler*>(link.get())) { url->UrlClickHandler::onClick({ button }); return false; } return true; }; _text3->setRichText(lng_about_text_3(lt_faq_open, qsl("[a href=\"%1\"]").arg(telegramFaqLink()), lt_faq_close, qsl("[/a]"))); _text1->setClickHandlerFilter(linkFilter); _text2->setClickHandlerFilter(linkFilter); _text3->setClickHandlerFilter(linkFilter); _version->setClickedCallback([this] { showVersionHistory(); }); setDimensions(st::aboutWidth, st::aboutTextTop + _text1->height() + st::aboutSkip + _text2->height() + st::aboutSkip + _text3->height()); }