Display information about proxy sponsor.

This commit is contained in:
John Preston
2018-05-15 20:22:28 +03:00
parent 5a1d4d55c6
commit 5f063c0151
3 changed files with 20 additions and 1 deletions
+18 -1
View File
@@ -155,6 +155,7 @@ private:
std::shared_ptr<Ui::RadioenumGroup<Type>> _type;
QPointer<Ui::SlideWrap<>> _aboutSponsored;
QPointer<Ui::InputField> _host;
QPointer<Ui::PortInput> _port;
QPointer<Ui::InputField> _user;
@@ -763,6 +764,16 @@ void ProxyBox::setupTypes() {
label),
st::proxyEditTypePadding);
}
_aboutSponsored = _content->add(object_ptr<Ui::SlideWrap<>>(
_content,
object_ptr<Ui::PaddingWrap<>>(
_content,
object_ptr<Ui::FlatLabel>(
_content,
lang(lng_proxy_sponsor_warning),
Ui::FlatLabel::InitType::Simple,
st::boxDividerLabel),
st::proxyAboutSponsorPadding)));
}
void ProxyBox::setupSocketAddress(const ProxyData &data) {
@@ -875,6 +886,9 @@ void ProxyBox::setupControls(const ProxyData &data) {
_mtprotoCredentials->toggle(
type == Type::Mtproto,
anim::type::instant);
_aboutSponsored->toggle(
type == Type::Mtproto,
anim::type::instant);
};
_type->setChangedCallback([=](Type type) {
handleType(type);
@@ -1046,7 +1060,10 @@ void ProxiesBoxController::ShowApplyConfirmation(
lt_server,
server,
lt_port,
QString::number(port));
QString::number(port))
+ (proxy.type == Type::Mtproto
? "\n\n" + lang(lng_proxy_sponsor_warning)
: QString());
*box = Ui::show(Box<ConfirmBox>(text, lang(lng_sure_enable), [=] {
auto &proxies = Global::RefProxiesList();
if (ranges::find(proxies, proxy) == end(proxies)) {