/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "settings/settings_general.h" #include "settings/settings_common.h" #include "ui/wrap/vertical_layout.h" #include "ui/wrap/slide_wrap.h" #include "ui/widgets/labels.h" #include "boxes/local_storage_box.h" #include "boxes/connection_box.h" #include "boxes/about_box.h" #include "boxes/confirm_box.h" #include "info/profile/info_profile_button.h" #include "info/profile/info_profile_values.h" #include "data/data_session.h" #include "platform/platform_specific.h" #include "lang/lang_keys.h" #include "core/update_checker.h" #include "storage/localstorage.h" #include "auth_session.h" #include "layout.h" #include "styles/style_settings.h" namespace Settings { namespace { void SetupConnectionType(not_null container) { #ifndef TDESKTOP_DISABLE_NETWORK_PROXY const auto connectionType = [] { const auto transport = MTP::dctransport(); if (!Global::UseProxy()) { return transport.isEmpty() ? lang(lng_connection_auto_connecting) : lng_connection_auto(lt_transport, transport); } else { return transport.isEmpty() ? lang(lng_connection_proxy_connecting) : lng_connection_proxy(lt_transport, transport); } }; const auto button = AddButtonWithLabel( container, lng_settings_connection_type, rpl::single( rpl::empty_value() ) | rpl::then(base::ObservableViewer( Global::RefConnectionTypeChanged() )) | rpl::map(connectionType), st::settingsGeneralButton); button->addClickHandler([] { Ui::show(ProxiesBoxController::CreateOwningBox()); }); #endif // TDESKTOP_DISABLE_NETWORK_PROXY } void SetupStorageAndConnection(not_null container) { AddDivider(container); AddSkip(container); AddButton( container, lng_settings_local_storage, st::settingsGeneralButton )->addClickHandler([] { LocalStorageBox::Show(&Auth().data().cache()); }); SetupConnectionType(container); AddSkip(container); } void SetupUpdate(not_null container) { if (Core::UpdaterDisabled()) { return; } AddDivider(container); AddSkip(container); const auto texts = Ui::AttachAsChild( container, rpl::event_stream()); const auto downloading = Ui::AttachAsChild( container, rpl::event_stream()); const auto version = lng_settings_current_version( lt_version, currentVersionText()); const auto toggle = AddButton( container, lng_settings_update_automatically, st::settingsUpdateToggle); const auto label = Ui::CreateChild( toggle.get(), texts->events(), st::settingsUpdateState); const auto check = container->add(object_ptr>( container, object_ptr