mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Removed AddButton and CreateButton without icon from Settings.
This commit is contained in:
parent
f6cb9072d2
commit
f629bf76ff
40 changed files with 173 additions and 171 deletions
|
@ -109,11 +109,11 @@ void AutoDownloadBox::setupContent() {
|
|||
Type type,
|
||||
rpl::producer<QString> label) {
|
||||
const auto value = settings->bytesLimit(_source, type);
|
||||
AddButton(
|
||||
content->add(object_ptr<Ui::SettingsButton>(
|
||||
content,
|
||||
std::move(label),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
))->toggleOn(
|
||||
rpl::single(value > 0)
|
||||
)->toggledChanges(
|
||||
) | rpl::start_with_next([=](bool enabled) {
|
||||
|
|
|
@ -168,7 +168,7 @@ void BackgroundBox::prepare() {
|
|||
|
||||
Ui::AddSkip(container);
|
||||
|
||||
const auto button = container->add(Settings::CreateButton(
|
||||
const auto button = container->add(object_ptr<Ui::SettingsButton>(
|
||||
container,
|
||||
tr::lng_settings_bg_from_file(),
|
||||
st::infoProfileButton));
|
||||
|
|
|
@ -295,7 +295,7 @@ void EditPrivacyBox::setupContent() {
|
|||
const auto button = content->add(
|
||||
object_ptr<Ui::SlideWrap<Button>>(
|
||||
content,
|
||||
CreateButton(
|
||||
object_ptr<Button>(
|
||||
content,
|
||||
rpl::duplicate(text),
|
||||
st::settingsButtonNoIcon)));
|
||||
|
|
|
@ -516,7 +516,7 @@ not_null<Ui::SettingsButton*> AddToggledButton(
|
|||
const auto toggled = container->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
|
||||
container,
|
||||
CreateButton(
|
||||
CreateButtonWithIcon(
|
||||
container,
|
||||
std::move(text),
|
||||
st,
|
||||
|
@ -664,7 +664,7 @@ void EditFilterBox(
|
|||
Ui::AddSkip(content);
|
||||
Ui::AddSubsectionTitle(content, tr::lng_filters_include());
|
||||
|
||||
const auto includeAdd = AddButton(
|
||||
const auto includeAdd = AddButtonWithIcon(
|
||||
content,
|
||||
tr::lng_filters_add_chats(),
|
||||
st::settingsButtonActive,
|
||||
|
@ -691,7 +691,7 @@ void EditFilterBox(
|
|||
|
||||
Ui::AddSubsectionTitle(excludeInner, tr::lng_filters_exclude());
|
||||
|
||||
const auto excludeAdd = AddButton(
|
||||
const auto excludeAdd = AddButtonWithIcon(
|
||||
excludeInner,
|
||||
tr::lng_filters_remove_chats(),
|
||||
st::settingsButtonActive,
|
||||
|
|
|
@ -1178,12 +1178,12 @@ void LanguageBox::setupTop(not_null<Ui::VerticalLayout*> container) {
|
|||
if (!_controller) {
|
||||
return;
|
||||
}
|
||||
const auto translateEnabled = Settings::AddButton(
|
||||
container,
|
||||
tr::lng_translate_settings_show(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(Core::App().settings().translateButtonEnabled()));
|
||||
const auto translateEnabled = container->add(
|
||||
object_ptr<Ui::SettingsButton>(
|
||||
container,
|
||||
tr::lng_translate_settings_show(),
|
||||
st::settingsButtonNoIcon))->toggleOn(
|
||||
rpl::single(Core::App().settings().translateButtonEnabled()));
|
||||
|
||||
translateEnabled->toggledValue(
|
||||
) | rpl::filter([](bool checked) {
|
||||
|
@ -1195,11 +1195,11 @@ void LanguageBox::setupTop(not_null<Ui::VerticalLayout*> container) {
|
|||
|
||||
using namespace rpl::mappers;
|
||||
auto premium = Data::AmPremiumValue(&_controller->session());
|
||||
const auto translateChat = Settings::AddButton(
|
||||
const auto translateChat = container->add(object_ptr<Ui::SettingsButton>(
|
||||
container,
|
||||
tr::lng_translate_settings_chat(),
|
||||
st::settingsButtonNoIconLocked
|
||||
)->toggleOn(rpl::merge(
|
||||
))->toggleOn(rpl::merge(
|
||||
rpl::combine(
|
||||
Core::App().settings().translateChatEnabledValue(),
|
||||
rpl::duplicate(premium),
|
||||
|
|
|
@ -269,7 +269,7 @@ void Controller::choose(not_null<ChatData*> chat) {
|
|||
Assert(channel->isBroadcast());
|
||||
|
||||
Ui::AddSkip(above);
|
||||
Settings::AddButton(
|
||||
Settings::AddButtonWithIcon(
|
||||
above,
|
||||
tr::lng_manage_discussion_group_create(),
|
||||
st::infoCreateLinkedChatButton,
|
||||
|
@ -287,7 +287,7 @@ void Controller::choose(not_null<ChatData*> chat) {
|
|||
|
||||
auto below = object_ptr<Ui::VerticalLayout>(box);
|
||||
if (chat && canEdit) {
|
||||
Settings::AddButton(
|
||||
Settings::AddButtonWithIcon(
|
||||
below,
|
||||
(channel->isBroadcast()
|
||||
? tr::lng_manage_discussion_group_unlink
|
||||
|
|
|
@ -662,11 +662,10 @@ int ColorSelector::resizeGetHeight(int newWidth) {
|
|||
const auto st = parent->lifetime().make_state<style::SettingsButton>(
|
||||
basicSt);
|
||||
st->padding.setRight(rightPadding);
|
||||
auto result = CreateButton(
|
||||
auto result = object_ptr<Ui::SettingsButton>(
|
||||
parent,
|
||||
tr::lng_settings_color_emoji(),
|
||||
*st,
|
||||
{});
|
||||
*st);
|
||||
const auto raw = result.data();
|
||||
|
||||
const auto right = Ui::CreateChild<Ui::RpWidget>(raw);
|
||||
|
@ -854,7 +853,7 @@ void AddPeerColorButton(
|
|||
not_null<Ui::VerticalLayout*> container,
|
||||
std::shared_ptr<ChatHelpers::Show> show,
|
||||
not_null<PeerData*> peer) {
|
||||
const auto button = AddButton(
|
||||
const auto button = AddButtonWithIcon(
|
||||
container,
|
||||
(peer->isSelf()
|
||||
? tr::lng_settings_theme_name_color()
|
||||
|
|
|
@ -609,7 +609,7 @@ template <typename Flags>
|
|||
|
||||
return checkView;
|
||||
} else {
|
||||
const auto button = Settings::AddButton(
|
||||
const auto button = Settings::AddButtonWithIcon(
|
||||
verticalLayout,
|
||||
rpl::single(entry.label),
|
||||
st,
|
||||
|
|
|
@ -82,11 +82,12 @@ void EditAllowedReactionsBox(
|
|||
|
||||
const auto container = box->verticalLayout();
|
||||
|
||||
const auto enabled = isGroup ? nullptr : Settings::AddButton(
|
||||
container,
|
||||
tr::lng_manage_peer_reactions_enable(),
|
||||
st::manageGroupButton.button
|
||||
).get();
|
||||
const auto enabled = isGroup
|
||||
? nullptr
|
||||
: container->add(object_ptr<Ui::SettingsButton>(
|
||||
container,
|
||||
tr::lng_manage_peer_reactions_enable(),
|
||||
st::manageGroupButton.button));
|
||||
if (enabled && !list.empty()) {
|
||||
AddReactionAnimatedIcon(
|
||||
enabled,
|
||||
|
@ -179,10 +180,10 @@ void EditAllowedReactionsBox(
|
|||
: (inSome || (isDefault && allowed.some.empty()));
|
||||
};
|
||||
const auto add = [&](const Reaction &entry) {
|
||||
const auto button = Settings::AddButton(
|
||||
const auto button = reactions->add(object_ptr<Ui::SettingsButton>(
|
||||
reactions,
|
||||
rpl::single(entry.title),
|
||||
st::manageGroupButton.button);
|
||||
st::manageGroupButton.button));
|
||||
AddReactionAnimatedIcon(
|
||||
button,
|
||||
button->sizeValue(
|
||||
|
@ -223,10 +224,10 @@ void EditAllowedReactionsBox(
|
|||
for (const auto &id : allowed.some) {
|
||||
if (const auto customId = id.custom()) {
|
||||
// Some possible forward compatibility.
|
||||
const auto button = Settings::AddButton(
|
||||
const auto button = reactions->add(object_ptr<Ui::SettingsButton>(
|
||||
reactions,
|
||||
rpl::single(u"Custom reaction"_q),
|
||||
st::manageGroupButton.button);
|
||||
st::manageGroupButton.button));
|
||||
AddReactionCustomIcon(
|
||||
button,
|
||||
button->sizeValue(
|
||||
|
|
|
@ -516,10 +516,10 @@ void ReactionsSettingsBox(
|
|||
}
|
||||
}
|
||||
for (const auto &r : list) {
|
||||
const auto button = Settings::AddButton(
|
||||
const auto button = container->add(object_ptr<Ui::SettingsButton>(
|
||||
container,
|
||||
rpl::single<QString>(base::duplicate(r.title)),
|
||||
st::settingsButton);
|
||||
st::settingsButton));
|
||||
|
||||
const auto premium = r.premium;
|
||||
if (premium && !premiumPossible) {
|
||||
|
|
|
@ -269,7 +269,7 @@ void RingtonesBox(
|
|||
rebuild();
|
||||
|
||||
const auto upload = box->addRow(
|
||||
Settings::CreateButton(
|
||||
Settings::CreateButtonWithIcon(
|
||||
container,
|
||||
tr::lng_ringtones_box_upload_button(),
|
||||
st::ringtonesBoxButton,
|
||||
|
|
|
@ -940,7 +940,7 @@ void SessionsContent::Inner::setupContent() {
|
|||
object_ptr<Ui::VerticalLayout>(content)))->setDuration(0);
|
||||
const auto terminateInner = terminateWrap->entity();
|
||||
_terminateAll = terminateInner->add(
|
||||
CreateButton(
|
||||
CreateButtonWithIcon(
|
||||
terminateInner,
|
||||
tr::lng_sessions_terminate_all(),
|
||||
st::infoBlockButton,
|
||||
|
|
|
@ -1683,7 +1683,7 @@ void Members::setupAddMember(not_null<GroupCall*> call) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
auto addMember = Settings::CreateButton(
|
||||
auto addMember = Settings::CreateButtonWithIcon(
|
||||
_layout.get(),
|
||||
tr::lng_group_call_invite(),
|
||||
st::groupCallAddMember,
|
||||
|
|
|
@ -280,10 +280,10 @@ void SettingsBox(
|
|||
Ui::AddSkip(layout);
|
||||
}
|
||||
const auto muteJoined = addCheck
|
||||
? AddButton(
|
||||
? layout->add(object_ptr<Ui::SettingsButton>(
|
||||
layout,
|
||||
tr::lng_group_call_new_muted(),
|
||||
st::groupCallSettingsButton)->toggleOn(rpl::single(joinMuted))
|
||||
st::groupCallSettingsButton))->toggleOn(rpl::single(joinMuted))
|
||||
: nullptr;
|
||||
if (addCheck) {
|
||||
Ui::AddSkip(layout);
|
||||
|
@ -347,11 +347,11 @@ void SettingsBox(
|
|||
//Ui::AddDivider(layout);
|
||||
//Ui::AddSkip(layout);
|
||||
|
||||
AddButton(
|
||||
layout->add(object_ptr<Ui::SettingsButton>(
|
||||
layout,
|
||||
tr::lng_group_call_noise_suppression(),
|
||||
st::groupCallSettingsButton
|
||||
)->toggleOn(rpl::single(
|
||||
))->toggleOn(rpl::single(
|
||||
settings.groupCallNoiseSuppression()
|
||||
))->toggledChanges(
|
||||
) | rpl::start_with_next([=](bool enabled) {
|
||||
|
@ -390,11 +390,12 @@ void SettingsBox(
|
|||
tryFillFromManager();
|
||||
|
||||
state->delay = settings.groupCallPushToTalkDelay();
|
||||
const auto pushToTalk = AddButton(
|
||||
layout,
|
||||
tr::lng_group_call_push_to_talk(),
|
||||
st::groupCallSettingsButton
|
||||
)->toggleOn(rpl::single(
|
||||
const auto pushToTalk = layout->add(
|
||||
object_ptr<Ui::SettingsButton>(
|
||||
layout,
|
||||
tr::lng_group_call_push_to_talk(),
|
||||
st::groupCallSettingsButton
|
||||
))->toggleOn(rpl::single(
|
||||
settings.groupCallPushToTalk()
|
||||
) | rpl::then(state->pushToTalkToggles.events()));
|
||||
const auto pushToTalkWrap = layout->add(
|
||||
|
@ -402,10 +403,11 @@ void SettingsBox(
|
|||
layout,
|
||||
object_ptr<Ui::VerticalLayout>(layout)));
|
||||
const auto pushToTalkInner = pushToTalkWrap->entity();
|
||||
const auto recording = AddButton(
|
||||
pushToTalkInner,
|
||||
state->recordText.value(),
|
||||
st::groupCallSettingsButton);
|
||||
const auto recording = pushToTalkInner->add(
|
||||
object_ptr<Ui::SettingsButton>(
|
||||
pushToTalkInner,
|
||||
state->recordText.value(),
|
||||
st::groupCallSettingsButton));
|
||||
CreateRightLabel(
|
||||
recording,
|
||||
state->shortcutText.value(),
|
||||
|
@ -645,11 +647,11 @@ void SettingsBox(
|
|||
}
|
||||
}
|
||||
if (shareLink) {
|
||||
AddButton(
|
||||
layout->add(object_ptr<Ui::SettingsButton>(
|
||||
layout,
|
||||
tr::lng_group_call_share(),
|
||||
st::groupCallSettingsButton
|
||||
)->addClickHandler(std::move(shareLink));
|
||||
))->addClickHandler(std::move(shareLink));
|
||||
}
|
||||
if (rtmp && !call->rtmpInfo().url.isEmpty()) {
|
||||
Ui::AddSkip(layout);
|
||||
|
@ -741,13 +743,13 @@ void SettingsBox(
|
|||
}
|
||||
|
||||
if (peer->canManageGroupCall()) {
|
||||
AddButton(
|
||||
layout->add(object_ptr<Ui::SettingsButton>(
|
||||
layout,
|
||||
(peer->isBroadcast()
|
||||
? tr::lng_group_call_end_channel()
|
||||
: tr::lng_group_call_end()),
|
||||
st::groupCallSettingsAttentionButton
|
||||
)->addClickHandler([=] {
|
||||
))->addClickHandler([=] {
|
||||
if (const auto call = weakCall.get()) {
|
||||
box->getDelegate()->show(Box(
|
||||
LeaveBox,
|
||||
|
|
|
@ -662,7 +662,7 @@ void DraftOptionsBox(
|
|||
|
||||
const auto item = state->quote.current().item;
|
||||
if (item->allowsForward()) {
|
||||
Settings::AddButton(
|
||||
Settings::AddButtonWithIcon(
|
||||
bottom,
|
||||
tr::lng_reply_in_another_chat(),
|
||||
st::settingsButton,
|
||||
|
@ -673,7 +673,7 @@ void DraftOptionsBox(
|
|||
}
|
||||
|
||||
const auto weak = Ui::MakeWeak(box);
|
||||
Settings::AddButton(
|
||||
Settings::AddButtonWithIcon(
|
||||
bottom,
|
||||
tr::lng_reply_show_in_chat(),
|
||||
st::settingsButton,
|
||||
|
@ -685,7 +685,7 @@ void DraftOptionsBox(
|
|||
}
|
||||
});
|
||||
|
||||
Settings::AddButton(
|
||||
Settings::AddButtonWithIcon(
|
||||
bottom,
|
||||
tr::lng_reply_remove(),
|
||||
st::settingsAttentionButtonWithIcon,
|
||||
|
@ -703,7 +703,7 @@ void DraftOptionsBox(
|
|||
AddFilledSkip(bottom);
|
||||
|
||||
if (!draft.textWithTags.empty()) {
|
||||
Settings::AddButton(
|
||||
Settings::AddButtonWithIcon(
|
||||
bottom,
|
||||
(state->webpage.invert
|
||||
? tr::lng_link_move_down()
|
||||
|
@ -723,7 +723,7 @@ void DraftOptionsBox(
|
|||
const auto small = state->webpage.forceSmallMedia
|
||||
|| (!state->webpage.forceLargeMedia
|
||||
&& state->preview->computeDefaultSmallMedia());
|
||||
Settings::AddButton(
|
||||
Settings::AddButtonWithIcon(
|
||||
bottom,
|
||||
(small
|
||||
? tr::lng_link_enlarge_photo()
|
||||
|
@ -743,7 +743,7 @@ void DraftOptionsBox(
|
|||
});
|
||||
}
|
||||
|
||||
Settings::AddButton(
|
||||
Settings::AddButtonWithIcon(
|
||||
bottom,
|
||||
tr::lng_link_remove(),
|
||||
st::settingsAttentionButtonWithIcon,
|
||||
|
|
|
@ -438,7 +438,7 @@ void EditWebPageOptions(
|
|||
.result = draft,
|
||||
});
|
||||
|
||||
state->large = Settings::AddButton(
|
||||
state->large = Settings::AddButtonWithIcon(
|
||||
box->verticalLayout(),
|
||||
rpl::single(u"Force large media"_q),
|
||||
st::settingsButton,
|
||||
|
@ -450,7 +450,7 @@ void EditWebPageOptions(
|
|||
state->result = copy;
|
||||
});
|
||||
|
||||
state->small = Settings::AddButton(
|
||||
state->small = Settings::AddButtonWithIcon(
|
||||
box->verticalLayout(),
|
||||
rpl::single(u"Force small media"_q),
|
||||
st::settingsButton,
|
||||
|
@ -472,7 +472,7 @@ void EditWebPageOptions(
|
|||
: std::optional<QColor>());
|
||||
}, box->lifetime());
|
||||
|
||||
Settings::AddButton(
|
||||
Settings::AddButtonWithIcon(
|
||||
box->verticalLayout(),
|
||||
state->result.value(
|
||||
) | rpl::map([=](const Data::WebPageDraft &draft) {
|
||||
|
|
|
@ -536,7 +536,7 @@ void CreateGiveawayBox(
|
|||
})));
|
||||
|
||||
using IconType = Settings::IconType;
|
||||
Settings::AddButton(
|
||||
Settings::AddButtonWithIcon(
|
||||
channelsContainer,
|
||||
tr::lng_giveaway_channels_add(),
|
||||
st::giveawayGiftCodeChannelsAddButton,
|
||||
|
|
|
@ -67,7 +67,7 @@ inline auto AddCountedButton(
|
|||
});
|
||||
auto button = parent->add(object_ptr<Ui::SlideWrap<Button>>(
|
||||
parent,
|
||||
CreateButton(
|
||||
object_ptr<Button>(
|
||||
parent,
|
||||
std::move(text),
|
||||
st::infoSharedMediaButton))
|
||||
|
|
|
@ -123,10 +123,10 @@ void InnerWidget::createButtons() {
|
|||
const auto key = _controller->key();
|
||||
const auto peer = key.storiesPeer();
|
||||
const auto stories = &peer->owner().stories();
|
||||
const auto archive = ::Settings::AddButton(
|
||||
const auto archive = _top->add(object_ptr<Ui::SettingsButton>(
|
||||
_top,
|
||||
tr::lng_stories_archive_button(),
|
||||
st::infoSharedMediaButton);
|
||||
st::infoSharedMediaButton));
|
||||
archive->addClickHandler([=] {
|
||||
_controller->showSection(Info::Stories::Make(
|
||||
_controller->key().storiesPeer(),
|
||||
|
@ -156,7 +156,7 @@ void InnerWidget::createButtons() {
|
|||
const auto recentWrap = _top->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
|
||||
_top,
|
||||
::Settings::CreateButton(
|
||||
object_ptr<Ui::SettingsButton>(
|
||||
_top,
|
||||
tr::lng_stories_recent_button(),
|
||||
st::infoSharedMediaButton)));
|
||||
|
|
|
@ -66,11 +66,11 @@ BottomButton CreateBottomDisableButton(
|
|||
|
||||
Ui::AddSkip(content);
|
||||
|
||||
AddButton(
|
||||
content->add(object_ptr<Button>(
|
||||
content,
|
||||
std::move(buttonText),
|
||||
st::settingsAttentionButton
|
||||
)->addClickHandler(std::move(callback));
|
||||
))->addClickHandler(std::move(callback));
|
||||
|
||||
const auto divider = Ui::CreateChild<OneEdgeBoxContentDivider>(
|
||||
parent.get());
|
||||
|
|
|
@ -129,7 +129,7 @@ void Manage::setupContent() {
|
|||
u"cloud_password/intro"_q);
|
||||
|
||||
Ui::AddSkip(content);
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
content,
|
||||
tr::lng_settings_cloud_password_manage_password_change(),
|
||||
st::settingsButton,
|
||||
|
@ -137,7 +137,7 @@ void Manage::setupContent() {
|
|||
)->setClickedCallback([=] {
|
||||
showOtherAndRememberPassword(CloudPasswordInputId());
|
||||
});
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
content,
|
||||
state->hasRecovery
|
||||
? tr::lng_settings_cloud_password_manage_email_change()
|
||||
|
|
|
@ -119,12 +119,12 @@ void SetupUpdate(not_null<Ui::VerticalLayout*> container) {
|
|||
tr::now,
|
||||
lt_version,
|
||||
currentVersionText());
|
||||
const auto toggle = AddButton(
|
||||
const auto toggle = container->add(object_ptr<Button>(
|
||||
container,
|
||||
tr::lng_settings_update_automatically(),
|
||||
st::settingsUpdateToggle);
|
||||
st::settingsUpdateToggle));
|
||||
const auto label = Ui::CreateChild<Ui::FlatLabel>(
|
||||
toggle.get(),
|
||||
toggle,
|
||||
texts->events(),
|
||||
st::settingsUpdateState);
|
||||
|
||||
|
@ -133,17 +133,19 @@ void SetupUpdate(not_null<Ui::VerticalLayout*> container) {
|
|||
container,
|
||||
object_ptr<Ui::VerticalLayout>(container)));
|
||||
const auto inner = options->entity();
|
||||
const auto install = cAlphaVersion() ? nullptr : AddButton(
|
||||
inner,
|
||||
tr::lng_settings_install_beta(),
|
||||
st::settingsButtonNoIcon).get();
|
||||
const auto install = cAlphaVersion()
|
||||
? nullptr
|
||||
: inner->add(object_ptr<Button>(
|
||||
inner,
|
||||
tr::lng_settings_install_beta(),
|
||||
st::settingsButtonNoIcon));
|
||||
|
||||
const auto check = AddButton(
|
||||
const auto check = inner->add(object_ptr<Button>(
|
||||
inner,
|
||||
tr::lng_settings_check_now(),
|
||||
st::settingsButtonNoIcon);
|
||||
st::settingsButtonNoIcon));
|
||||
const auto update = Ui::CreateChild<Button>(
|
||||
check.get(),
|
||||
check,
|
||||
tr::lng_update_telegram(),
|
||||
st::settingsUpdate);
|
||||
update->hide();
|
||||
|
@ -286,13 +288,13 @@ void SetupSpellchecker(
|
|||
const auto session = &controller->session();
|
||||
const auto settings = &Core::App().settings();
|
||||
const auto isSystem = Platform::Spellchecker::IsSystemSpellchecker();
|
||||
const auto button = AddButton(
|
||||
const auto button = container->add(object_ptr<Button>(
|
||||
container,
|
||||
isSystem
|
||||
? tr::lng_settings_system_spellchecker()
|
||||
: tr::lng_settings_custom_spellchecker(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
))->toggleOn(
|
||||
rpl::single(settings->spellcheckerEnabled())
|
||||
);
|
||||
|
||||
|
@ -313,11 +315,11 @@ void SetupSpellchecker(
|
|||
container,
|
||||
object_ptr<Ui::VerticalLayout>(container)));
|
||||
|
||||
AddButton(
|
||||
sliding->entity()->add(object_ptr<Button>(
|
||||
sliding->entity(),
|
||||
tr::lng_settings_auto_download_dictionaries(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
))->toggleOn(
|
||||
rpl::single(settings->autoDownloadDictionaries())
|
||||
)->toggledValue(
|
||||
) | rpl::filter([=](bool enabled) {
|
||||
|
@ -709,13 +711,11 @@ void SetupWindowTitleOptions(
|
|||
void SetupAnimations(
|
||||
not_null<Window::Controller*> window,
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
AddButton(
|
||||
container->add(object_ptr<Button>(
|
||||
container,
|
||||
tr::lng_settings_power_menu(),
|
||||
st::settingsButtonNoIcon
|
||||
)->setClickedCallback([=] {
|
||||
window->show(Box(PowerSavingBox));
|
||||
});
|
||||
))->setClickedCallback([=] { window->show(Box(PowerSavingBox)); });
|
||||
}
|
||||
|
||||
void ArchiveSettingsBox(
|
||||
|
@ -740,11 +740,11 @@ void ArchiveSettingsBox(
|
|||
AddSubsectionTitle(container, tr::lng_settings_unmuted_chats());
|
||||
|
||||
using Unarchive = Api::UnarchiveOnNewMessage;
|
||||
AddButton(
|
||||
container->add(object_ptr<Button>(
|
||||
container,
|
||||
tr::lng_settings_always_in_archive(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(privacy->unarchiveOnNewMessage(
|
||||
))->toggleOn(privacy->unarchiveOnNewMessage(
|
||||
) | rpl::map(
|
||||
rpl::mappers::_1 == Unarchive::None
|
||||
))->toggledChanges(
|
||||
|
@ -771,11 +771,11 @@ void ArchiveSettingsBox(
|
|||
AddSkip(inner);
|
||||
AddSubsectionTitle(inner, tr::lng_settings_chats_from_folders());
|
||||
|
||||
state->folders = AddButton(
|
||||
state->folders = inner->add(object_ptr<Button>(
|
||||
inner,
|
||||
tr::lng_settings_always_in_archive(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(privacy->unarchiveOnNewMessage(
|
||||
))->toggleOn(privacy->unarchiveOnNewMessage(
|
||||
) | rpl::map(
|
||||
rpl::mappers::_1 != Unarchive::AnyUnmuted
|
||||
));
|
||||
|
@ -808,11 +808,11 @@ void PreloadArchiveSettings(not_null<::Main::Session*> session) {
|
|||
|
||||
void SetupHardwareAcceleration(not_null<Ui::VerticalLayout*> container) {
|
||||
const auto settings = &Core::App().settings();
|
||||
AddButton(
|
||||
container->add(object_ptr<Button>(
|
||||
container,
|
||||
tr::lng_settings_enable_hwaccel(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
))->toggleOn(
|
||||
rpl::single(settings->hardwareAcceleratedVideo())
|
||||
)->toggledValue(
|
||||
) | rpl::filter([=](bool enabled) {
|
||||
|
@ -904,11 +904,11 @@ void SetupOpenGL(
|
|||
const auto toggles = container->lifetime().make_state<
|
||||
rpl::event_stream<bool>
|
||||
>();
|
||||
const auto button = AddButton(
|
||||
const auto button = container->add(object_ptr<Button>(
|
||||
container,
|
||||
tr::lng_settings_enable_opengl(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
))->toggleOn(
|
||||
toggles->events_starting_with_copy(
|
||||
!Core::App().settings().disableOpenGL())
|
||||
);
|
||||
|
|
|
@ -77,7 +77,7 @@ QPointer<Ui::RpWidget> Blocked::createPinnedToTop(not_null<QWidget*> parent) {
|
|||
|
||||
Ui::AddSkip(content);
|
||||
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
content,
|
||||
tr::lng_blocked_list_add(),
|
||||
st::settingsButtonActive,
|
||||
|
|
|
@ -292,11 +292,11 @@ void Calls::setupContent() {
|
|||
Ui::AddSubsectionTitle(content, tr::lng_settings_call_section_other());
|
||||
|
||||
const auto api = &_controller->session().api();
|
||||
AddButton(
|
||||
content->add(object_ptr<Ui::SettingsButton>(
|
||||
content,
|
||||
tr::lng_settings_call_accept_calls(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
))->toggleOn(
|
||||
api->authorizations().callsDisabledHereValue(
|
||||
) | rpl::map(!rpl::mappers::_1)
|
||||
)->toggledChanges(
|
||||
|
@ -306,11 +306,11 @@ void Calls::setupContent() {
|
|||
api->authorizations().toggleCallsDisabledHere(!value);
|
||||
}, content->lifetime());
|
||||
|
||||
AddButton(
|
||||
content->add(object_ptr<Ui::SettingsButton>(
|
||||
content,
|
||||
tr::lng_settings_call_open_system_prefs(),
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
))->addClickHandler([=] {
|
||||
const auto opened = Platform::OpenSystemSettings(
|
||||
Platform::SystemSettingsType::Audio);
|
||||
if (!opened) {
|
||||
|
|
|
@ -804,7 +804,7 @@ void SetupStickersEmoji(
|
|||
Core::App().saveSettingsDelayed();
|
||||
});
|
||||
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_stickers_you_have(),
|
||||
st::settingsButton,
|
||||
|
@ -815,7 +815,7 @@ void SetupStickersEmoji(
|
|||
StickersBox::Section::Installed));
|
||||
});
|
||||
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_emoji_manage_sets(),
|
||||
st::settingsButton,
|
||||
|
@ -1024,7 +1024,7 @@ void SetupArchive(
|
|||
Ui::AddSkip(container);
|
||||
|
||||
PreloadArchiveSettings(&controller->session());
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_context_archive_settings(),
|
||||
st::settingsButton,
|
||||
|
@ -1038,7 +1038,7 @@ void SetupExport(
|
|||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
Fn<void(Type)> showOther) {
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_settings_export_data(),
|
||||
st::settingsButton,
|
||||
|
@ -1052,7 +1052,7 @@ void SetupExport(
|
|||
[=] { Core::App().exportManager().start(session); });
|
||||
});
|
||||
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_settings_experimental(),
|
||||
st::settingsButton,
|
||||
|
@ -1065,7 +1065,7 @@ void SetupExport(
|
|||
void SetupLocalStorage(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_settings_manage_local_storage(),
|
||||
st::settingsButton,
|
||||
|
@ -1096,7 +1096,7 @@ void SetupDataStorage(
|
|||
const auto path = container->add(
|
||||
object_ptr<Ui::SlideWrap<Button>>(
|
||||
container,
|
||||
CreateButton(
|
||||
CreateButtonWithIcon(
|
||||
container,
|
||||
tr::lng_download_path(),
|
||||
st::settingsButton,
|
||||
|
@ -1124,7 +1124,7 @@ void SetupDataStorage(
|
|||
|
||||
SetupLocalStorage(controller, container);
|
||||
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_downloads_section(),
|
||||
st::settingsButton,
|
||||
|
@ -1134,11 +1134,11 @@ void SetupDataStorage(
|
|||
Info::Downloads::Make(controller->session().user()));
|
||||
});
|
||||
|
||||
const auto ask = AddButton(
|
||||
const auto ask = container->add(object_ptr<Ui::SettingsButton>(
|
||||
container,
|
||||
tr::lng_download_path_ask(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(rpl::single(Core::App().settings().askDownloadPath()));
|
||||
))->toggleOn(rpl::single(Core::App().settings().askDownloadPath()));
|
||||
|
||||
ask->toggledValue(
|
||||
) | rpl::filter([](bool checked) {
|
||||
|
@ -1173,7 +1173,7 @@ void SetupAutoDownload(
|
|||
rpl::producer<QString> label,
|
||||
Source source,
|
||||
IconDescriptor &&descriptor) {
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
std::move(label),
|
||||
st::settingsButton,
|
||||
|
@ -1534,7 +1534,7 @@ void SetupCloudThemes(
|
|||
const auto edit = editWrap->entity();
|
||||
|
||||
Ui::AddSkip(edit, st::settingsThemesBottomSkip);
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
edit,
|
||||
tr::lng_settings_bg_theme_edit(),
|
||||
st::settingsButton,
|
||||
|
|
|
@ -132,7 +132,7 @@ void AddButtonIcon(
|
|||
}, icon->widget.lifetime());
|
||||
}
|
||||
|
||||
object_ptr<Button> CreateButton(
|
||||
object_ptr<Button> CreateButtonWithIcon(
|
||||
not_null<QWidget*> parent,
|
||||
rpl::producer<QString> text,
|
||||
const style::SettingsButton &st,
|
||||
|
@ -145,13 +145,13 @@ object_ptr<Button> CreateButton(
|
|||
return result;
|
||||
}
|
||||
|
||||
not_null<Button*> AddButton(
|
||||
not_null<Button*> AddButtonWithIcon(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text,
|
||||
const style::SettingsButton &st,
|
||||
IconDescriptor &&descriptor) {
|
||||
return container->add(
|
||||
CreateButton(container, std::move(text), st, std::move(descriptor)));
|
||||
CreateButtonWithIcon(container, std::move(text), st, std::move(descriptor)));
|
||||
}
|
||||
|
||||
void CreateRightLabel(
|
||||
|
@ -189,7 +189,7 @@ not_null<Button*> AddButtonWithLabel(
|
|||
rpl::producer<QString> label,
|
||||
const style::SettingsButton &st,
|
||||
IconDescriptor &&descriptor) {
|
||||
const auto button = AddButton(
|
||||
const auto button = AddButtonWithIcon(
|
||||
container,
|
||||
rpl::duplicate(text),
|
||||
st,
|
||||
|
|
|
@ -171,12 +171,12 @@ void AddButtonIcon(
|
|||
not_null<Ui::AbstractButton*> button,
|
||||
const style::SettingsButton &st,
|
||||
IconDescriptor &&descriptor);
|
||||
object_ptr<Button> CreateButton(
|
||||
object_ptr<Button> CreateButtonWithIcon(
|
||||
not_null<QWidget*> parent,
|
||||
rpl::producer<QString> text,
|
||||
const style::SettingsButton &st,
|
||||
IconDescriptor &&descriptor = {});
|
||||
not_null<Button*> AddButton(
|
||||
not_null<Button*> AddButtonWithIcon(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text,
|
||||
const style::SettingsButton &st,
|
||||
|
|
|
@ -51,13 +51,13 @@ void AddOption(
|
|||
option.defaultValue()
|
||||
) | rpl::start_to_stream(*toggles, lifetime);
|
||||
|
||||
const auto button = AddButton(
|
||||
const auto button = container->add(object_ptr<Button>(
|
||||
container,
|
||||
rpl::single(name),
|
||||
(option.relevant()
|
||||
? st::settingsButtonNoIcon
|
||||
: st::settingsOptionDisabled)
|
||||
)->toggleOn(toggles->events_starting_with(option.value()));
|
||||
))->toggleOn(toggles->events_starting_with(option.value()));
|
||||
|
||||
const auto restarter = (option.relevant() && option.restartRequired())
|
||||
? button->lifetime().make_state<base::Timer>()
|
||||
|
@ -115,10 +115,10 @@ void SetupExperimental(
|
|||
const auto inner = wrap->entity();
|
||||
Ui::AddDivider(inner);
|
||||
Ui::AddSkip(inner, st::settingsCheckboxesSkip);
|
||||
reset = AddButton(
|
||||
reset = inner->add(object_ptr<Button>(
|
||||
inner,
|
||||
tr::lng_settings_experimental_restore(),
|
||||
st::settingsButtonNoIcon);
|
||||
st::settingsButtonNoIcon));
|
||||
reset->addClickHandler([=] {
|
||||
base::options::reset();
|
||||
wrap->hide(anim::type::normal);
|
||||
|
|
|
@ -540,7 +540,7 @@ void FilterRowButton::paintEvent(QPaintEvent *e) {
|
|||
j->button->updateCount(j->filter);
|
||||
}, container->lifetime());
|
||||
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_filters_create(),
|
||||
st::settingsButtonActive,
|
||||
|
|
|
@ -285,14 +285,14 @@ void GlobalTTL::rebuildButtons(TimeId currentTTL) const {
|
|||
_buttons->clear();
|
||||
for (const auto &ttl : ttls) {
|
||||
const auto ttlText = Ui::FormatTTLAfter(ttl);
|
||||
const auto button = AddButton(
|
||||
const auto button = _buttons->add(object_ptr<Ui::SettingsButton>(
|
||||
_buttons,
|
||||
(!ttl)
|
||||
? tr::lng_settings_ttl_after_off()
|
||||
: tr::lng_settings_ttl_after(
|
||||
lt_after_duration,
|
||||
rpl::single(ttlText)),
|
||||
st::settingsButtonNoIcon);
|
||||
st::settingsButtonNoIcon));
|
||||
button->setClickedCallback([=] {
|
||||
if (_group->value() == ttl) {
|
||||
return;
|
||||
|
@ -305,7 +305,7 @@ void GlobalTTL::rebuildButtons(TimeId currentTTL) const {
|
|||
showSure(ttl, false);
|
||||
});
|
||||
const auto radio = Ui::CreateChild<Ui::Radiobutton>(
|
||||
button.get(),
|
||||
button,
|
||||
_group,
|
||||
ttl,
|
||||
QString());
|
||||
|
@ -344,10 +344,10 @@ void GlobalTTL::setupContent() {
|
|||
}
|
||||
|
||||
const auto show = _controller->uiShow();
|
||||
AddButton(
|
||||
content->add(object_ptr<Ui::SettingsButton>(
|
||||
content,
|
||||
tr::lng_settings_ttl_after_custom(),
|
||||
st::settingsButtonNoIcon)->setClickedCallback([=] {
|
||||
st::settingsButtonNoIcon))->setClickedCallback([=] {
|
||||
struct Args {
|
||||
std::shared_ptr<Ui::Show> show;
|
||||
TimeId startTtl;
|
||||
|
|
|
@ -776,7 +776,7 @@ not_null<Ui::SlideWrap<Ui::SettingsButton>*> AccountsList::setupAdd() {
|
|||
const auto result = _outer->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
|
||||
_outer.get(),
|
||||
CreateButton(
|
||||
CreateButtonWithIcon(
|
||||
_outer.get(),
|
||||
tr::lng_menu_add_account(),
|
||||
st::mainMenuAddAccountButton,
|
||||
|
|
|
@ -440,7 +440,7 @@ void LocalPasscodeManage::setupContent() {
|
|||
|
||||
Ui::AddSkip(content);
|
||||
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
content,
|
||||
tr::lng_passcode_change(),
|
||||
st::settingsButton,
|
||||
|
|
|
@ -261,7 +261,7 @@ void Cover::refreshUsernameGeometry(int newWidth) {
|
|||
void SetupPowerSavingButton(
|
||||
not_null<Window::Controller*> window,
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
const auto button = AddButton(
|
||||
const auto button = AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_settings_power_menu(),
|
||||
st::settingsButton,
|
||||
|
@ -306,7 +306,7 @@ void SetupSections(
|
|||
rpl::producer<QString> label,
|
||||
Type type,
|
||||
IconDescriptor &&descriptor) {
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
std::move(label),
|
||||
st::settingsButton,
|
||||
|
@ -347,7 +347,7 @@ void SetupSections(
|
|||
const auto slided = container->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
|
||||
container,
|
||||
CreateButton(
|
||||
CreateButtonWithIcon(
|
||||
container,
|
||||
tr::lng_settings_section_filters(),
|
||||
st::settingsButton,
|
||||
|
@ -408,7 +408,7 @@ void SetupPremium(
|
|||
Ui::AddDivider(container);
|
||||
Ui::AddSkip(container);
|
||||
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_premium_summary_title(),
|
||||
st::settingsButton,
|
||||
|
@ -436,7 +436,7 @@ void SetupInterfaceScale(
|
|||
container.get());
|
||||
|
||||
const auto switched = (cConfigScale() == style::kScaleAuto);
|
||||
const auto button = AddButton(
|
||||
const auto button = AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_settings_default_scale(),
|
||||
icon ? st::settingsButton : st::settingsButtonNoIcon,
|
||||
|
@ -580,7 +580,7 @@ void OpenFaq() {
|
|||
}
|
||||
|
||||
void SetupFaq(not_null<Ui::VerticalLayout*> container, bool icon) {
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_settings_faq(),
|
||||
icon ? st::settingsButton : st::settingsButtonNoIcon,
|
||||
|
@ -596,7 +596,7 @@ void SetupHelp(
|
|||
|
||||
SetupFaq(container);
|
||||
|
||||
AddButton(
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_settings_features(),
|
||||
st::settingsButton,
|
||||
|
@ -605,7 +605,7 @@ void SetupHelp(
|
|||
UrlClickHandler::Open(tr::lng_telegram_features_url(tr::now));
|
||||
});
|
||||
|
||||
const auto button = AddButton(
|
||||
const auto button = AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_settings_ask_question(),
|
||||
st::settingsButton,
|
||||
|
|
|
@ -166,7 +166,7 @@ void AddTypeButton(
|
|||
}
|
||||
Unexpected("Type value in AddTypeButton.");
|
||||
}();
|
||||
const auto button = AddButton(
|
||||
const auto button = AddButtonWithIcon(
|
||||
container,
|
||||
std::move(label),
|
||||
st::settingsNotificationType,
|
||||
|
@ -917,11 +917,11 @@ void SetupMultiAccountNotifications(
|
|||
}
|
||||
Ui::AddSubsectionTitle(container, tr::lng_settings_show_from());
|
||||
|
||||
const auto fromAll = AddButton(
|
||||
const auto fromAll = container->add(object_ptr<Button>(
|
||||
container,
|
||||
tr::lng_settings_notify_all(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(rpl::single(Core::App().settings().notifyFromAll()));
|
||||
))->toggleOn(rpl::single(Core::App().settings().notifyFromAll()));
|
||||
fromAll->toggledChanges(
|
||||
) | rpl::filter([](bool checked) {
|
||||
return (checked != Core::App().settings().notifyFromAll());
|
||||
|
@ -964,7 +964,7 @@ void SetupNotificationsContent(
|
|||
rpl::producer<QString> label,
|
||||
IconDescriptor &&descriptor,
|
||||
rpl::producer<bool> checked) {
|
||||
auto result = CreateButton(
|
||||
auto result = CreateButtonWithIcon(
|
||||
container,
|
||||
std::move(label),
|
||||
st::settingsButton,
|
||||
|
@ -1098,15 +1098,15 @@ void SetupNotificationsContent(
|
|||
Ui::AddSkip(container, st::settingsCheckboxesSkip);
|
||||
Ui::AddSubsectionTitle(container, tr::lng_settings_badge_title());
|
||||
|
||||
const auto muted = AddButton(
|
||||
const auto muted = container->add(object_ptr<Button>(
|
||||
container,
|
||||
tr::lng_settings_include_muted(),
|
||||
st::settingsButtonNoIcon);
|
||||
st::settingsButtonNoIcon));
|
||||
muted->toggleOn(rpl::single(settings.includeMutedCounter()));
|
||||
const auto count = AddButton(
|
||||
const auto count = container->add(object_ptr<Button>(
|
||||
container,
|
||||
tr::lng_settings_count_unread(),
|
||||
st::settingsButtonNoIcon);
|
||||
st::settingsButtonNoIcon));
|
||||
count->toggleOn(rpl::single(settings.countUnreadMessages()));
|
||||
|
||||
auto nativeText = [&] {
|
||||
|
@ -1127,11 +1127,11 @@ void SetupNotificationsContent(
|
|||
Ui::AddDivider(container);
|
||||
Ui::AddSkip(container, st::settingsCheckboxesSkip);
|
||||
Ui::AddSubsectionTitle(container, tr::lng_settings_native_title());
|
||||
return AddButton(
|
||||
return container->add(object_ptr<Button>(
|
||||
container,
|
||||
std::move(nativeText),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(rpl::single(settings.nativeNotifications()));
|
||||
))->toggleOn(rpl::single(settings.nativeNotifications()));
|
||||
}();
|
||||
|
||||
const auto advancedSlide = !Platform::Notifications::Enforced()
|
||||
|
|
|
@ -385,7 +385,7 @@ void SetupChecks(
|
|||
const auto settings = &session->data().notifySettings();
|
||||
|
||||
const auto enabled = container->add(
|
||||
CreateButton(
|
||||
CreateButtonWithIcon(
|
||||
container,
|
||||
tr::lng_notification_enable(),
|
||||
st::settingsButton,
|
||||
|
@ -424,7 +424,7 @@ void SetupChecks(
|
|||
return !sound || !sound->none;
|
||||
};
|
||||
const auto sound = soundInner->add(
|
||||
CreateButton(
|
||||
CreateButtonWithIcon(
|
||||
soundInner,
|
||||
tr::lng_notification_sound(),
|
||||
st::settingsButton,
|
||||
|
@ -503,7 +503,7 @@ void SetupExceptions(
|
|||
not_null<Ui::VerticalLayout*> container,
|
||||
not_null<Window::SessionController*> window,
|
||||
Notify type) {
|
||||
const auto add = AddButton(
|
||||
const auto add = AddButtonWithIcon(
|
||||
container,
|
||||
tr::lng_notification_exceptions_add(),
|
||||
st::settingsButtonActive,
|
||||
|
@ -547,7 +547,7 @@ void SetupExceptions(
|
|||
const auto wrap = container->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
|
||||
container,
|
||||
CreateButton(
|
||||
CreateButtonWithIcon(
|
||||
container,
|
||||
tr::lng_notification_exceptions_clear(),
|
||||
st::settingsAttentionButtonWithIcon,
|
||||
|
|
|
@ -67,11 +67,11 @@ void PowerSavingBox(not_null<Ui::GenericBox*> box) {
|
|||
Ui::AddSkip(container);
|
||||
Ui::AddDivider(container);
|
||||
Ui::AddSkip(container);
|
||||
automatic = AddButton(
|
||||
automatic = container->add(object_ptr<Ui::SettingsButton>(
|
||||
container,
|
||||
tr::lng_settings_power_auto(),
|
||||
st::powerSavingButtonNoIcon
|
||||
)->toggleOn(rpl::single(!ignore));
|
||||
))->toggleOn(rpl::single(!ignore));
|
||||
Ui::AddSkip(container);
|
||||
Ui::AddDividerText(container, tr::lng_settings_power_auto_about());
|
||||
|
||||
|
|
|
@ -1089,7 +1089,7 @@ object_ptr<Ui::RpWidget> ProfilePhotoPrivacyController::setupMiddleWidget(
|
|||
st::inviteLinkUserpics.size);
|
||||
|
||||
Ui::AddSkip(container);
|
||||
const auto setUserpicButton = AddButton(
|
||||
const auto setUserpicButton = AddButtonWithIcon(
|
||||
container,
|
||||
state->setUserpicButtonText.value(),
|
||||
st::settingsButtonLight,
|
||||
|
|
|
@ -134,23 +134,23 @@ void AddPremiumPrivacyButton(
|
|||
const auto shower = Ui::CreateChild<rpl::lifetime>(container.get());
|
||||
const auto session = &controller->session();
|
||||
const auto &st = st::settingsButtonNoIcon;
|
||||
const auto button = AddButton(
|
||||
const auto button = container->add(object_ptr<Button>(
|
||||
container,
|
||||
rpl::duplicate(label),
|
||||
st);
|
||||
st));
|
||||
struct State {
|
||||
State(QWidget *parent) : widget(parent) {
|
||||
widget.setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
}
|
||||
Ui::RpWidget widget;
|
||||
};
|
||||
const auto state = button->lifetime().make_state<State>(button.get());
|
||||
const auto state = button->lifetime().make_state<State>(button);
|
||||
using WeakToast = base::weak_ptr<Ui::Toast::Instance>;
|
||||
const auto toast = std::make_shared<WeakToast>();
|
||||
|
||||
{
|
||||
const auto rightLabel = Ui::CreateChild<Ui::FlatLabel>(
|
||||
button.get(),
|
||||
button,
|
||||
st.rightLabel);
|
||||
|
||||
state->widget.resize(st::settingsPremiumLock.size());
|
||||
|
@ -437,11 +437,11 @@ void SetupSensitiveContent(
|
|||
) | rpl::start_with_next([=] {
|
||||
session->api().sensitiveContent().reload();
|
||||
}, container->lifetime());
|
||||
AddButton(
|
||||
inner->add(object_ptr<Button>(
|
||||
inner,
|
||||
tr::lng_settings_sensitive_disable_filtering(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
))->toggleOn(
|
||||
session->api().sensitiveContent().enabled()
|
||||
)->toggledChanges(
|
||||
) | rpl::filter([=](bool toggled) {
|
||||
|
@ -556,11 +556,11 @@ void SetupBotsAndWebsites(
|
|||
Ui::AddSubsectionTitle(container, tr::lng_settings_security_bots());
|
||||
|
||||
const auto session = &controller->session();
|
||||
AddButton(
|
||||
container->add(object_ptr<Button>(
|
||||
container,
|
||||
tr::lng_settings_clear_payment_info(),
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
))->addClickHandler([=] {
|
||||
controller->show(ClearPaymentInfoBox(session));
|
||||
});
|
||||
|
||||
|
@ -856,11 +856,11 @@ void SetupArchiveAndMute(
|
|||
|
||||
const auto privacy = &session->api().globalPrivacy();
|
||||
privacy->reload();
|
||||
AddButton(
|
||||
inner->add(object_ptr<Button>(
|
||||
inner,
|
||||
tr::lng_settings_auto_archive(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
))->toggleOn(
|
||||
privacy->archiveAndMute()
|
||||
)->toggledChanges(
|
||||
) | rpl::filter([=](bool toggled) {
|
||||
|
|
|
@ -605,7 +605,7 @@ void Content::Inner::setupContent() {
|
|||
object_ptr<Ui::VerticalLayout>(content)))->setDuration(0);
|
||||
const auto terminateInner = terminateWrap->entity();
|
||||
_terminateAll = terminateInner->add(
|
||||
CreateButton(
|
||||
CreateButtonWithIcon(
|
||||
terminateInner,
|
||||
tr::lng_settings_disconnect_all(),
|
||||
st::infoBlockButton,
|
||||
|
|
|
@ -688,7 +688,7 @@ void MainMenu::setupArchive() {
|
|||
const auto inner = wrap->entity();
|
||||
wrap->toggle(checkArchive(), anim::type::instant);
|
||||
|
||||
const auto button = AddButton(
|
||||
const auto button = AddButtonWithIcon(
|
||||
inner,
|
||||
tr::lng_archived_name(),
|
||||
st::mainMenuButton,
|
||||
|
@ -841,7 +841,7 @@ void MainMenu::setupMenu() {
|
|||
const auto addAction = [&](
|
||||
rpl::producer<QString> text,
|
||||
IconDescriptor &&descriptor) {
|
||||
return AddButton(
|
||||
return AddButtonWithIcon(
|
||||
_menu,
|
||||
std::move(text),
|
||||
st::mainMenuButton,
|
||||
|
@ -864,7 +864,7 @@ void MainMenu::setupMenu() {
|
|||
const auto wrap = _menu->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
|
||||
_menu,
|
||||
CreateButton(
|
||||
CreateButtonWithIcon(
|
||||
_menu,
|
||||
tr::lng_menu_my_stories(),
|
||||
st::mainMenuButton,
|
||||
|
|
Loading…
Add table
Reference in a new issue