/* 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_experimental.h" #include "ui/wrap/vertical_layout.h" #include "ui/widgets/buttons.h" #include "ui/widgets/labels.h" #include "base/options.h" #include "chat_helpers/tabbed_panel.h" #include "lang/lang_keys.h" #include "styles/style_settings.h" #include "styles/style_layers.h" namespace Settings { namespace { void AddOption( not_null container, base::options::option &option) { const auto name = option.name().isEmpty() ? option.id() : option.name(); AddButton( container, rpl::single(name), st::settingsButton )->toggleOn(rpl::single(option.value()))->toggledChanges( ) | rpl::start_with_next([=, &option](bool toggled) { option.set(toggled); }, container->lifetime()); const auto &description = option.description(); if (!description.isEmpty()) { AddSkip(container, st::settingsCheckboxesSkip); AddDividerText(container, rpl::single(description)); } } void SetupExperimental( not_null controller, not_null container) { AddSkip(container, st::settingsCheckboxesSkip); container->add( object_ptr( container, tr::lng_settings_experimental_about(), st::boxLabel), st::settingsDividerLabelPadding); AddDivider(container); AddSkip(container, st::settingsCheckboxesSkip); const auto addToggle = [&](const char name[]) { AddOption(container, base::options::lookup(name)); }; addToggle(ChatHelpers::kOptionTabbedPanelShowOnClick); AddSkip(container, st::settingsCheckboxesSkip); } } // namespace Experimental::Experimental( QWidget *parent, not_null controller) : Section(parent) { setupContent(controller); } void Experimental::setupContent( not_null controller) { const auto content = Ui::CreateChild(this); SetupExperimental(controller, content); Ui::ResizeFitChild(this, content); } } // namespace Settings