/* 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_advanced.h" #include "api/api_global_privacy.h" #include "apiwrap.h" #include "settings/settings_common.h" #include "settings/settings_chat.h" #include "settings/settings_power_saving.h" #include "settings/settings_privacy_security.h" #include "ui/wrap/vertical_layout.h" #include "ui/wrap/slide_wrap.h" #include "ui/widgets/labels.h" #include "ui/widgets/checkbox.h" #include "ui/widgets/buttons.h" #include "ui/gl/gl_detection.h" #include "ui/layers/generic_box.h" #include "ui/text/format_values.h" #include "ui/boxes/single_choice_box.h" #include "ui/painter.h" #include "boxes/connection_box.h" #include "boxes/about_box.h" #include "ui/boxes/confirm_box.h" #include "platform/platform_specific.h" #include "ui/platform/ui_platform_window.h" #include "base/platform/base_platform_custom_app_icon.h" #include "base/platform/base_platform_info.h" #include "window/window_controller.h" #include "window/window_session_controller.h" #include "lang/lang_keys.h" #include "core/update_checker.h" #include "core/launcher.h" #include "core/application.h" #include "tray.h" #include "storage/localstorage.h" #include "storage/storage_domain.h" #include "data/data_session.h" #include "main/main_account.h" #include "main/main_domain.h" #include "main/main_session.h" #include "mtproto/facade.h" #include "styles/style_layers.h" #include "styles/style_menu_icons.h" #include "styles/style_settings.h" #ifdef Q_OS_MAC #include "base/platform/mac/base_confirm_quit.h" #endif // Q_OS_MAC #ifndef TDESKTOP_DISABLE_SPELLCHECK #include "boxes/dictionaries_manager.h" #include "chat_helpers/spellchecker_common.h" #include "spellcheck/platform/platform_spellcheck.h" #endif // !TDESKTOP_DISABLE_SPELLCHECK namespace Settings { namespace { #if defined Q_OS_MAC && !defined OS_MAC_STORE [[nodiscard]] const QImage &IconMacRound() { static const auto result = QImage(u":/gui/art/icon_round512@2x.png"_q); return result; } #endif // Q_OS_MAC && !OS_MAC_STORE } // namespace void SetupConnectionType( not_null controller, not_null account, not_null container) { const auto connectionType = [=] { const auto transport = account->mtp().dctransport(); if (!Core::App().settings().proxy().isEnabled()) { return transport.isEmpty() ? tr::lng_connection_auto_connecting(tr::now) : tr::lng_connection_auto(tr::now, lt_transport, transport); } else { return transport.isEmpty() ? tr::lng_connection_proxy_connecting(tr::now) : tr::lng_connection_proxy(tr::now, lt_transport, transport); } }; const auto button = AddButtonWithLabel( container, tr::lng_settings_connection_type(), rpl::merge( Core::App().settings().proxy().connectionTypeChanges(), // Handle language switch. tr::lng_connection_auto_connecting() | rpl::to_empty ) | rpl::map(connectionType), st::settingsButton, { &st::menuIconNetwork }); button->addClickHandler([=] { controller->show(ProxiesBoxController::CreateOwningBox(account)); }); } bool HasUpdate() { return !Core::UpdaterDisabled(); } void SetupUpdate(not_null container) { if (!HasUpdate()) { return; } const auto texts = Ui::CreateChild>( container.get()); const auto downloading = Ui::CreateChild>( container.get()); const auto version = tr::lng_settings_current_version( tr::now, lt_version, currentVersionText()); const auto toggle = AddButton( container, tr::lng_settings_update_automatically(), st::settingsUpdateToggle); const auto label = Ui::CreateChild( toggle.get(), texts->events(), st::settingsUpdateState); const auto options = container->add( object_ptr>( container, object_ptr(container))); const auto inner = options->entity(); const auto install = cAlphaVersion() ? nullptr : AddButton( inner, tr::lng_settings_install_beta(), st::settingsButtonNoIcon).get(); const auto check = AddButton( inner, tr::lng_settings_check_now(), st::settingsButtonNoIcon); const auto update = Ui::CreateChild