Adjust privacy edit boxes to the mockup.
BIN
Telegram/Resources/icons/settings/arrows.png
Normal file
After Width: | Height: | Size: 454 B |
BIN
Telegram/Resources/icons/settings/arrows@2x.png
Normal file
After Width: | Height: | Size: 818 B |
BIN
Telegram/Resources/icons/settings/arrows@3x.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
Telegram/Resources/icons/settings/email.png
Normal file
After Width: | Height: | Size: 368 B |
BIN
Telegram/Resources/icons/settings/email@2x.png
Normal file
After Width: | Height: | Size: 586 B |
BIN
Telegram/Resources/icons/settings/email@3x.png
Normal file
After Width: | Height: | Size: 842 B |
BIN
Telegram/Resources/icons/settings/forward.png
Normal file
After Width: | Height: | Size: 374 B |
BIN
Telegram/Resources/icons/settings/forward@2x.png
Normal file
After Width: | Height: | Size: 636 B |
BIN
Telegram/Resources/icons/settings/forward@3x.png
Normal file
After Width: | Height: | Size: 972 B |
BIN
Telegram/Resources/icons/settings/laptop.png
Normal file
After Width: | Height: | Size: 272 B |
BIN
Telegram/Resources/icons/settings/laptop@2x.png
Normal file
After Width: | Height: | Size: 373 B |
BIN
Telegram/Resources/icons/settings/laptop@3x.png
Normal file
After Width: | Height: | Size: 500 B |
BIN
Telegram/Resources/icons/settings/minus.png
Normal file
After Width: | Height: | Size: 400 B |
BIN
Telegram/Resources/icons/settings/minus@2x.png
Normal file
After Width: | Height: | Size: 642 B |
BIN
Telegram/Resources/icons/settings/minus@3x.png
Normal file
After Width: | Height: | Size: 955 B |
BIN
Telegram/Resources/icons/settings/online.png
Normal file
After Width: | Height: | Size: 439 B |
BIN
Telegram/Resources/icons/settings/online@2x.png
Normal file
After Width: | Height: | Size: 778 B |
BIN
Telegram/Resources/icons/settings/online@3x.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
Telegram/Resources/icons/settings/plus.png
Normal file
After Width: | Height: | Size: 355 B |
BIN
Telegram/Resources/icons/settings/plus@2x.png
Normal file
After Width: | Height: | Size: 650 B |
BIN
Telegram/Resources/icons/settings/plus@3x.png
Normal file
After Width: | Height: | Size: 968 B |
BIN
Telegram/Resources/icons/settings/timer.png
Normal file
After Width: | Height: | Size: 441 B |
BIN
Telegram/Resources/icons/settings/timer@2x.png
Normal file
After Width: | Height: | Size: 724 B |
BIN
Telegram/Resources/icons/settings/timer@3x.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
Telegram/Resources/icons/settings/video_calls.png
Normal file
After Width: | Height: | Size: 440 B |
BIN
Telegram/Resources/icons/settings/video_calls@2x.png
Normal file
After Width: | Height: | Size: 832 B |
BIN
Telegram/Resources/icons/settings/video_calls@3x.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
|
@ -112,7 +112,7 @@ void AutoDownloadBox::setupContent() {
|
|||
AddButton(
|
||||
content,
|
||||
std::move(label),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(value > 0)
|
||||
)->toggledChanges(
|
||||
|
|
|
@ -201,28 +201,42 @@ Ui::Radioenum<EditPrivacyBox::Option> *EditPrivacyBox::AddOption(
|
|||
group,
|
||||
option,
|
||||
controller->optionLabel(option),
|
||||
st::settingsSendType),
|
||||
st::settingsSendTypePadding);
|
||||
st::settingsPrivacyOption),
|
||||
(st::settingsSendTypePadding + style::margins(
|
||||
-st::lineWidth,
|
||||
st::settingsPrivacySkipTop,
|
||||
0,
|
||||
0)));
|
||||
}
|
||||
|
||||
Ui::FlatLabel *EditPrivacyBox::addLabel(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text) {
|
||||
const auto wrap = container->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::FlatLabel>>(
|
||||
rpl::producer<QString> text,
|
||||
int topSkip) {
|
||||
if (!text) {
|
||||
return nullptr;
|
||||
}
|
||||
return container->add(
|
||||
object_ptr<Ui::DividerLabel>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
rpl::duplicate(text),
|
||||
st::boxDividerLabel),
|
||||
st::settingsPrivacyEditLabelPadding));
|
||||
wrap->hide(anim::type::instant);
|
||||
wrap->toggleOn(std::move(
|
||||
text
|
||||
) | rpl::map([](const QString &text) {
|
||||
return !text.isEmpty();
|
||||
}));
|
||||
return wrap->entity();
|
||||
st::settingsDividerLabelPadding),
|
||||
{ 0, topSkip, 0, 0 }
|
||||
)->entity();
|
||||
}
|
||||
|
||||
void EditPrivacyBox::addLabelOrDivider(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text,
|
||||
int topSkip) {
|
||||
if (!addLabel(container, std::move(text), topSkip)) {
|
||||
container->add(
|
||||
object_ptr<Ui::BoxContentDivider>(container),
|
||||
{ 0, topSkip, 0, 0 });
|
||||
}
|
||||
}
|
||||
|
||||
void EditPrivacyBox::setupContent() {
|
||||
|
@ -262,13 +276,20 @@ void EditPrivacyBox::setupContent() {
|
|||
: tr::lng_edit_privacy_exceptions_add(tr::now);
|
||||
});
|
||||
auto text = _controller->exceptionButtonTextKey(exception);
|
||||
const auto always = (exception == Exception::Always);
|
||||
const auto button = content->add(
|
||||
object_ptr<Ui::SlideWrap<Button>>(
|
||||
content,
|
||||
object_ptr<Button>(
|
||||
CreateButton(
|
||||
content,
|
||||
rpl::duplicate(text),
|
||||
st::settingsButton)));
|
||||
st::settingsButton,
|
||||
{
|
||||
(always
|
||||
? &st::settingsIconPlus
|
||||
: &st::settingsIconMinus),
|
||||
always ? kIconGreen : kIconRed,
|
||||
})));
|
||||
CreateRightLabel(
|
||||
button->entity(),
|
||||
std::move(label),
|
||||
|
@ -286,17 +307,23 @@ void EditPrivacyBox::setupContent() {
|
|||
|
||||
auto above = _controller->setupAboveWidget(
|
||||
content,
|
||||
rpl::duplicate(optionValue));
|
||||
rpl::duplicate(optionValue),
|
||||
getDelegate()->outerContainer());
|
||||
if (above) {
|
||||
content->add(std::move(above));
|
||||
}
|
||||
|
||||
AddSubsectionTitle(content, _controller->optionsTitleKey());
|
||||
AddSubsectionTitle(
|
||||
content,
|
||||
_controller->optionsTitleKey(),
|
||||
{ 0, st::settingsPrivacySkipTop, 0, 0 });
|
||||
addOptionRow(Option::Everyone);
|
||||
addOptionRow(Option::Contacts);
|
||||
addOptionRow(Option::Nobody);
|
||||
addLabel(content, _controller->warning());
|
||||
AddSkip(content);
|
||||
addLabelOrDivider(
|
||||
content,
|
||||
_controller->warning(),
|
||||
st::settingsSectionSkip + st::settingsPrivacySkipTop);
|
||||
|
||||
auto middle = _controller->setupMiddleWidget(
|
||||
_window,
|
||||
|
@ -306,13 +333,17 @@ void EditPrivacyBox::setupContent() {
|
|||
content->add(std::move(middle));
|
||||
}
|
||||
|
||||
AddDivider(content);
|
||||
AddSkip(content);
|
||||
AddSubsectionTitle(content, tr::lng_edit_privacy_exceptions());
|
||||
AddSubsectionTitle(
|
||||
content,
|
||||
tr::lng_edit_privacy_exceptions(),
|
||||
{ 0, st::settingsPrivacySkipTop, 0, 0 });
|
||||
const auto always = addExceptionLink(Exception::Always);
|
||||
const auto never = addExceptionLink(Exception::Never);
|
||||
addLabel(content, _controller->exceptionsDescription());
|
||||
AddSkip(content);
|
||||
addLabel(
|
||||
content,
|
||||
_controller->exceptionsDescription(),
|
||||
st::settingsSectionSkip);
|
||||
|
||||
if (auto below = _controller->setupBelowWidget(_window, content)) {
|
||||
content->add(std::move(below));
|
||||
|
|
|
@ -58,7 +58,8 @@ public:
|
|||
|
||||
[[nodiscard]] virtual object_ptr<Ui::RpWidget> setupAboveWidget(
|
||||
not_null<QWidget*> parent,
|
||||
rpl::producer<Option> option) {
|
||||
rpl::producer<Option> option,
|
||||
not_null<QWidget*> outerContainer) {
|
||||
return { nullptr };
|
||||
}
|
||||
[[nodiscard]] virtual object_ptr<Ui::RpWidget> setupMiddleWidget(
|
||||
|
@ -126,7 +127,12 @@ private:
|
|||
|
||||
Ui::FlatLabel *addLabel(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text);
|
||||
rpl::producer<QString> text,
|
||||
int topSkip);
|
||||
void addLabelOrDivider(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text,
|
||||
int topSkip);
|
||||
|
||||
void editExceptions(Exception exception, Fn<void()> done);
|
||||
std::vector<not_null<PeerData*>> &exceptions(Exception exception);
|
||||
|
|
|
@ -966,9 +966,8 @@ void SessionsContent::Inner::setupContent() {
|
|||
AddButtonWithLabel(
|
||||
ttlInner,
|
||||
tr::lng_settings_terminate_if(),
|
||||
_ttlDays.value(
|
||||
) | rpl::map(SelfDestructionBox::DaysLabel),
|
||||
st::settingsButton
|
||||
_ttlDays.value() | rpl::map(SelfDestructionBox::DaysLabel),
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
_controller->show(Box<SelfDestructionBox>(
|
||||
&_controller->session(),
|
||||
|
|
|
@ -367,11 +367,10 @@ void SettingsBox(
|
|||
layout,
|
||||
object_ptr<Ui::VerticalLayout>(layout)));
|
||||
const auto pushToTalkInner = pushToTalkWrap->entity();
|
||||
const auto recording = pushToTalkInner->add(
|
||||
object_ptr<Button>(
|
||||
layout,
|
||||
state->recordText.value(),
|
||||
st::groupCallSettingsButton));
|
||||
const auto recording = AddButton(
|
||||
pushToTalkInner,
|
||||
state->recordText.value(),
|
||||
st::groupCallSettingsButton);
|
||||
CreateRightLabel(
|
||||
recording,
|
||||
state->shortcutText.value(),
|
||||
|
|
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_user.h"
|
||||
|
@ -54,7 +55,7 @@ inline auto AddCountedButton(
|
|||
Ui::MultiSlideTracker &tracker) {
|
||||
using namespace rpl::mappers;
|
||||
|
||||
using Button = Ui::SettingsButton;
|
||||
using namespace ::Settings;
|
||||
auto forked = std::move(count)
|
||||
| start_spawning(parent->lifetime());
|
||||
auto text = rpl::duplicate(
|
||||
|
@ -66,7 +67,7 @@ inline auto AddCountedButton(
|
|||
});
|
||||
auto button = parent->add(object_ptr<Ui::SlideWrap<Button>>(
|
||||
parent,
|
||||
object_ptr<Button>(
|
||||
CreateButton(
|
||||
parent,
|
||||
std::move(text),
|
||||
st::infoSharedMediaButton))
|
||||
|
|
|
@ -10,19 +10,19 @@ using "ui/widgets/widgets.style";
|
|||
using "info/info.style";
|
||||
using "boxes/boxes.style";
|
||||
|
||||
settingsSectionButton: SettingsButton(infoProfileButton) {
|
||||
settingsButton: SettingsButton(infoProfileButton) {
|
||||
font: boxTextFont;
|
||||
padding: margins(60px, 10px, 22px, 10px);
|
||||
iconLeft: 20px;
|
||||
}
|
||||
settingsButton: SettingsButton(settingsSectionButton) {
|
||||
settingsButtonNoIcon: SettingsButton(settingsButton) {
|
||||
padding: margins(22px, 10px, 22px, 8px);
|
||||
}
|
||||
settingsAttentionButton: SettingsButton(settingsButton) {
|
||||
settingsAttentionButton: SettingsButton(settingsButtonNoIcon) {
|
||||
textFg: attentionButtonFg;
|
||||
textFgOver: attentionButtonFgOver;
|
||||
}
|
||||
settingsOptionDisabled: SettingsButton(settingsButton) {
|
||||
settingsOptionDisabled: SettingsButton(settingsButtonNoIcon) {
|
||||
textFg: windowSubTextFg;
|
||||
textFgOver: windowSubTextFg;
|
||||
textBg: windowBg;
|
||||
|
@ -39,24 +39,24 @@ settingsSlider: SettingsSlider(defaultSettingsSlider) {
|
|||
labelFg: windowSubTextFg;
|
||||
labelFgActive: windowActiveTextFg;
|
||||
}
|
||||
settingsUpdateToggle: SettingsButton(settingsButton) {
|
||||
settingsUpdateToggle: SettingsButton(settingsButtonNoIcon) {
|
||||
height: 40px;
|
||||
padding: margins(22px, 8px, 22px, 8px);
|
||||
}
|
||||
settingsUpdateState: FlatLabel(defaultFlatLabel) {
|
||||
textFg: windowSubTextFg;
|
||||
}
|
||||
settingsUpdate: SettingsButton(infoMainButton, settingsButton) {
|
||||
settingsUpdate: SettingsButton(infoMainButton, settingsButtonNoIcon) {
|
||||
}
|
||||
settingsUpdateStatePosition: point(22px, 29px);
|
||||
settingsDividerLabelPadding: margins(22px, 10px, 22px, 19px);
|
||||
settingsDividerLabelPadding: margins(22px, 8px, 22px, 16px);
|
||||
|
||||
settingsIconInformation: icon {{ "settings/account", settingsIconFg }};
|
||||
settingsIconAccount: icon {{ "settings/account", settingsIconFg }};
|
||||
settingsIconNotifications: icon {{ "settings/notifications", settingsIconFg }};
|
||||
settingsIconChat: icon {{ "settings/chat", settingsIconFg }};
|
||||
settingsIconFolders: icon {{ "settings/folders", settingsIconFg }};
|
||||
settingsIconGeneral: icon {{ "settings/advanced", settingsIconFg }};
|
||||
settingsIconPrivacySecurity: icon {{ "settings/lock", settingsIconFg }};
|
||||
settingsIconLock: icon {{ "settings/lock", settingsIconFg }};
|
||||
settingsIconLanguage: icon {{ "settings/language", settingsIconFg }};
|
||||
settingsIconInterfaceScale: icon {{ "settings/interface_scale", settingsIconFg }};
|
||||
settingsIconFaq: icon {{ "settings/faq", settingsIconFg }};
|
||||
|
@ -66,8 +66,8 @@ settingsIconTips: icon {{ "settings/tips", settingsIconFg }};
|
|||
settingsIconStickers: icon {{ "settings/stickers", settingsIconFg }};
|
||||
settingsIconEmoji: icon {{ "settings/emoji", settingsIconFg }};
|
||||
settingsIconThemes: icon {{ "settings/palette", settingsIconFg }};
|
||||
settingsIconNewGroup: icon {{ "settings/group", settingsIconFg }};
|
||||
settingsIconNewChannel: icon {{ "settings/channel", settingsIconFg }};
|
||||
settingsIconGroup: icon {{ "settings/group", settingsIconFg }};
|
||||
settingsIconChannel: icon {{ "settings/channel", settingsIconFg }};
|
||||
settingsIconContacts: icon {{ "settings/user", settingsIconFg }};
|
||||
settingsIconSavedMessages: icon {{ "settings/saved_messages", settingsIconFg }};
|
||||
settingsIconKey: icon {{ "settings/key", settingsIconFg }};
|
||||
|
@ -75,6 +75,15 @@ settingsIconReload: icon {{ "settings/reload", settingsIconFg }};
|
|||
settingsIconNight: icon {{ "settings/night", settingsIconFg }};
|
||||
settingsIconSettings: icon {{ "settings/settings", settingsIconFg }};
|
||||
settingsIconArchive: icon {{ "settings/archive", settingsIconFg }};
|
||||
settingsIconPlus: icon {{ "settings/plus", settingsIconFg }};
|
||||
settingsIconMinus: icon {{ "settings/minus", settingsIconFg }};
|
||||
settingsIconTimer: icon {{ "settings/timer", settingsIconFg }};
|
||||
settingsIconLaptop: icon {{ "settings/laptop", settingsIconFg }};
|
||||
settingsIconArrows: icon {{ "settings/arrows", settingsIconFg }};
|
||||
settingsIconOnline: icon {{ "settings/online", settingsIconFg }};
|
||||
settingsIconVideoCalls: icon {{ "settings/video_calls", settingsIconFg }};
|
||||
settingsIconEmail: icon {{ "settings/email", settingsIconFg }};
|
||||
settingsIconForward: icon {{ "settings/forward", settingsIconFg }};
|
||||
|
||||
settingsSetPhotoSkip: 7px;
|
||||
|
||||
|
@ -110,8 +119,12 @@ settingsBackgroundPadding: margins(22px, 11px, 10px, 12px);
|
|||
settingsTileSkip: 15px;
|
||||
settingsFromGalleryTop: 2px;
|
||||
settingsFromFileTop: 14px;
|
||||
settingsPrivacyOption: Checkbox(settingsCheckbox) {
|
||||
textPosition: point(13px, 1px);
|
||||
}
|
||||
settingsPrivacySecurityPadding: 12px;
|
||||
settingsPrivacySkip: 14px;
|
||||
settingsPrivacySkipTop: 4px;
|
||||
|
||||
settingsCloudPasswordLabel: FlatLabel(defaultFlatLabel) {
|
||||
textFg: windowSubTextFg;
|
||||
|
@ -130,7 +143,7 @@ settingsInfoPhotoTop: 17px;
|
|||
settingsInfoPhotoSkip: 16px;
|
||||
settingsInfoPhotoSet: defaultActiveButton;
|
||||
|
||||
settingsInfoRow: SettingsButton(settingsButton) {
|
||||
settingsInfoRow: SettingsButton(settingsButtonNoIcon) {
|
||||
height: 62px;
|
||||
padding: margins(0px, 0px, 0px, 0px);
|
||||
}
|
||||
|
@ -206,7 +219,7 @@ settingsThemeMinSkip: 4px;
|
|||
settingsThemeNotSupportedBg: windowBgOver;
|
||||
settingsThemeNotSupportedIcon: icon {{ "theme_preview", menuIconFg }};
|
||||
|
||||
autoDownloadLimitButton: SettingsButton(settingsButton) {
|
||||
autoDownloadLimitButton: SettingsButton(settingsButtonNoIcon) {
|
||||
padding: margins(22px, 10px, 22px, 0px);
|
||||
}
|
||||
settingsAudioVolumeSlider: MediaSlider(defaultContinuousSlider) {
|
||||
|
@ -220,10 +233,10 @@ settingsAudioVolumeLabel: LabelSimple(defaultLabelSimple) {
|
|||
settingsAudioVolumeLabelPadding: margins(22px, 11px, 22px, 11px);
|
||||
settingsLevelMeterPadding: margins(22px, 10px, 20px, 10px);
|
||||
|
||||
settingsForwardPrivacyPadding: 8px;
|
||||
settingsForwardPrivacyPadding: 10px;
|
||||
settingsForwardPrivacyArrowSkip: 32px;
|
||||
settingsForwardPrivacyArrowSize: 6px;
|
||||
settingsForwardPrivacyTooltipPadding: margins(8px, 6px, 8px, 6px);
|
||||
settingsForwardPrivacyArrowSize: 7px;
|
||||
settingsForwardPrivacyTooltipPadding: margins(12px, 7px, 12px, 7px);
|
||||
|
||||
settingsAccentColorSize: 24px;
|
||||
settingsAccentColorSkip: 4px;
|
||||
|
@ -356,5 +369,6 @@ settingsPhoneLeft: settingsNameLeft;
|
|||
settingsPhoneTop: 37px;
|
||||
settingsUsernameLeft: settingsNameLeft;
|
||||
settingsUsernameTop: 58px;
|
||||
settingsPeerToPeerSkip: 9px;
|
||||
|
||||
settingsIconRadius: 6px;
|
||||
|
|
|
@ -74,7 +74,7 @@ void SetupConnectionType(
|
|||
// Handle language switch.
|
||||
tr::lng_connection_auto_connecting() | rpl::to_empty
|
||||
) | rpl::map(connectionType),
|
||||
st::settingsButton);
|
||||
st::settingsButtonNoIcon);
|
||||
button->addClickHandler([=] {
|
||||
controller->show(ProxiesBoxController::CreateOwningBox(account));
|
||||
});
|
||||
|
@ -116,16 +116,16 @@ void SetupUpdate(
|
|||
const auto install = cAlphaVersion() ? nullptr : AddButton(
|
||||
inner,
|
||||
tr::lng_settings_install_beta(),
|
||||
st::settingsButton).get();
|
||||
st::settingsButtonNoIcon).get();
|
||||
|
||||
if (showOther) {
|
||||
const auto experimental = inner->add(
|
||||
object_ptr<Ui::SlideWrap<Button>>(
|
||||
inner,
|
||||
object_ptr<Button>(
|
||||
CreateButton(
|
||||
inner,
|
||||
tr::lng_settings_experimental(),
|
||||
st::settingsButton)));
|
||||
st::settingsButtonNoIcon)));
|
||||
if (!install) {
|
||||
experimental->toggle(true, anim::type::instant);
|
||||
} else {
|
||||
|
@ -139,7 +139,7 @@ void SetupUpdate(
|
|||
const auto check = AddButton(
|
||||
inner,
|
||||
tr::lng_settings_check_now(),
|
||||
st::settingsButton);
|
||||
st::settingsButtonNoIcon);
|
||||
const auto update = Ui::CreateChild<Button>(
|
||||
check.get(),
|
||||
tr::lng_update_telegram() | Ui::Text::ToUpper(),
|
||||
|
@ -289,7 +289,7 @@ void SetupSpellchecker(
|
|||
isSystem
|
||||
? tr::lng_settings_system_spellchecker()
|
||||
: tr::lng_settings_custom_spellchecker(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->spellcheckerEnabled())
|
||||
);
|
||||
|
@ -314,7 +314,7 @@ void SetupSpellchecker(
|
|||
AddButton(
|
||||
sliding->entity(),
|
||||
tr::lng_settings_auto_download_dictionaries(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->autoDownloadDictionaries())
|
||||
)->toggledValue(
|
||||
|
@ -329,7 +329,7 @@ void SetupSpellchecker(
|
|||
sliding->entity(),
|
||||
tr::lng_settings_manage_dictionaries(),
|
||||
Spellchecker::ButtonManageDictsState(session),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
controller->show(Box<Ui::ManageDictionariesBox>(controller));
|
||||
});
|
||||
|
@ -568,7 +568,7 @@ void SetupAnimations(not_null<Ui::VerticalLayout*> container) {
|
|||
AddButton(
|
||||
container,
|
||||
tr::lng_settings_enable_animations(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(!anim::Disabled())
|
||||
)->toggledValue(
|
||||
|
@ -609,7 +609,7 @@ void SetupANGLE(
|
|||
container,
|
||||
tr::lng_settings_angle_backend(),
|
||||
rpl::single(options[backendIndex]),
|
||||
st::settingsButton);
|
||||
st::settingsButtonNoIcon);
|
||||
button->addClickHandler([=] {
|
||||
controller->show(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
const auto save = [=](int index) {
|
||||
|
@ -662,7 +662,7 @@ void SetupOpenGL(
|
|||
const auto button = AddButton(
|
||||
container,
|
||||
tr::lng_settings_enable_opengl(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
toggles->events_starting_with_copy(
|
||||
!Core::App().settings().disableOpenGL())
|
||||
|
|
|
@ -99,7 +99,7 @@ void Calls::setupContent() {
|
|||
) | rpl::then(
|
||||
_cameraNameStream.events()
|
||||
),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
const auto &devices = GetVideoInputList();
|
||||
const auto options = ranges::views::concat(
|
||||
|
@ -143,7 +143,7 @@ void Calls::setupContent() {
|
|||
const auto bubble = content->lifetime().make_state<::Calls::VideoBubble>(
|
||||
bubbleWrap,
|
||||
track);
|
||||
const auto padding = st::settingsButton.padding.left();
|
||||
const auto padding = st::settingsButtonNoIcon.padding.left();
|
||||
const auto top = st::boxRoundShadow.extend.top();
|
||||
const auto bottom = st::boxRoundShadow.extend.bottom();
|
||||
|
||||
|
@ -216,7 +216,7 @@ void Calls::setupContent() {
|
|||
) | rpl::then(
|
||||
_outputNameStream.events()
|
||||
),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
_controller->show(ChooseAudioOutputBox(crl::guard(this, [=](
|
||||
const QString &id,
|
||||
|
@ -237,7 +237,7 @@ void Calls::setupContent() {
|
|||
) | rpl::then(
|
||||
_inputNameStream.events()
|
||||
),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
_controller->show(ChooseAudioInputBox(crl::guard(this, [=](
|
||||
const QString &id,
|
||||
|
@ -273,7 +273,7 @@ void Calls::setupContent() {
|
|||
AddButton(
|
||||
content,
|
||||
tr::lng_settings_call_accept_calls(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
api->authorizations().callsDisabledHereValue(
|
||||
) | rpl::map(!rpl::mappers::_1)
|
||||
|
@ -287,7 +287,7 @@ void Calls::setupContent() {
|
|||
AddButton(
|
||||
content,
|
||||
tr::lng_settings_call_open_system_prefs(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
const auto opened = Platform::OpenSystemSettings(
|
||||
Platform::SystemSettingsType::Audio);
|
||||
|
|
|
@ -356,7 +356,7 @@ void ColorsPalette::updateInnerGeometry() {
|
|||
}
|
||||
const auto inner = _outer->entity();
|
||||
const auto size = st::settingsAccentColorSize;
|
||||
const auto padding = st::settingsButton.padding;
|
||||
const auto padding = st::settingsButtonNoIcon.padding;
|
||||
const auto width = inner->width() - padding.left() - padding.right();
|
||||
const auto skip = (width - size * _buttons.size())
|
||||
/ float64(_buttons.size() - 1);
|
||||
|
@ -747,7 +747,7 @@ void SetupStickersEmoji(
|
|||
AddButton(
|
||||
container,
|
||||
tr::lng_stickers_you_have(),
|
||||
st::settingsSectionButton,
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconStickers, kIconLightOrange }
|
||||
)->addClickHandler([=] {
|
||||
controller->show(
|
||||
|
@ -757,7 +757,7 @@ void SetupStickersEmoji(
|
|||
AddButton(
|
||||
container,
|
||||
tr::lng_emoji_manage_sets(),
|
||||
st::settingsSectionButton,
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconEmoji, kIconDarkOrange }
|
||||
)->addClickHandler([=] {
|
||||
controller->show(Box<Ui::Emoji::ManageSetsBox>(session));
|
||||
|
@ -821,7 +821,7 @@ void SetupExport(
|
|||
AddButton(
|
||||
container,
|
||||
tr::lng_settings_export_data(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
const auto session = &controller->session();
|
||||
Ui::hideSettingsAndLayer();
|
||||
|
@ -838,7 +838,7 @@ void SetupLocalStorage(
|
|||
AddButton(
|
||||
container,
|
||||
tr::lng_settings_manage_local_storage(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
LocalStorageBox::Show(&controller->session());
|
||||
});
|
||||
|
@ -857,7 +857,7 @@ void SetupDataStorage(
|
|||
const auto ask = AddButton(
|
||||
container,
|
||||
tr::lng_download_path_ask(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(rpl::single(Core::App().settings().askDownloadPath()));
|
||||
|
||||
#ifndef OS_WIN_STORE
|
||||
|
@ -865,10 +865,10 @@ void SetupDataStorage(
|
|||
const auto path = container->add(
|
||||
object_ptr<Ui::SlideWrap<Button>>(
|
||||
container,
|
||||
object_ptr<Button>(
|
||||
CreateButton(
|
||||
container,
|
||||
tr::lng_download_path(),
|
||||
st::settingsButton)));
|
||||
st::settingsButtonNoIcon)));
|
||||
auto pathtext = Core::App().settings().downloadPathValue(
|
||||
) | rpl::map([](const QString &text) {
|
||||
if (text.isEmpty()) {
|
||||
|
@ -881,7 +881,7 @@ void SetupDataStorage(
|
|||
CreateRightLabel(
|
||||
path->entity(),
|
||||
std::move(pathtext),
|
||||
st::settingsButton,
|
||||
st::settingsButtonNoIcon,
|
||||
tr::lng_download_path());
|
||||
path->entity()->addClickHandler([=] {
|
||||
controller->show(Box<DownloadPathBox>(controller));
|
||||
|
@ -921,7 +921,7 @@ void SetupAutoDownload(
|
|||
AddButton(
|
||||
container,
|
||||
std::move(label),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
controller->show(
|
||||
Box<AutoDownloadBox>(&controller->session(), source));
|
||||
|
@ -1139,7 +1139,7 @@ void SetupDefaultThemes(
|
|||
) | rpl::start_with_next([buttons = std::move(buttons)](int width) {
|
||||
Expects(!buttons.empty());
|
||||
|
||||
const auto padding = st::settingsButton.padding;
|
||||
const auto padding = st::settingsButtonNoIcon.padding;
|
||||
width -= padding.left() + padding.right();
|
||||
const auto desired = st::settingsThemePreviewSize.width();
|
||||
const auto count = int(buttons.size());
|
||||
|
@ -1247,9 +1247,9 @@ void SetupCloudThemes(
|
|||
inner->add(
|
||||
list->takeWidget(),
|
||||
style::margins(
|
||||
st::settingsButton.padding.left(),
|
||||
st::settingsButtonNoIcon.padding.left(),
|
||||
0,
|
||||
st::settingsButton.padding.right(),
|
||||
st::settingsButtonNoIcon.padding.right(),
|
||||
0));
|
||||
|
||||
list->allShown(
|
||||
|
@ -1272,7 +1272,7 @@ void SetupCloudThemes(
|
|||
AddButton(
|
||||
edit,
|
||||
tr::lng_settings_bg_theme_edit(),
|
||||
st::settingsSectionButton,
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconThemes, kIconGreen }
|
||||
)->addClickHandler([=] {
|
||||
StartEditor(
|
||||
|
|
|
@ -242,13 +242,14 @@ not_null<Button*> AddButtonWithLabel(
|
|||
|
||||
not_null<Ui::FlatLabel*> AddSubsectionTitle(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text) {
|
||||
rpl::producer<QString> text,
|
||||
style::margins addPadding) {
|
||||
return container->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
std::move(text),
|
||||
st::settingsSubsectionTitle),
|
||||
st::settingsSubsectionTitlePadding);
|
||||
st::settingsSubsectionTitlePadding + addPadding);
|
||||
}
|
||||
|
||||
void FillMenu(
|
||||
|
|
|
@ -140,7 +140,8 @@ void CreateRightLabel(
|
|||
rpl::producer<QString> buttonText);
|
||||
not_null<Ui::FlatLabel*> AddSubsectionTitle(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text);
|
||||
rpl::producer<QString> text,
|
||||
style::margins addPadding = {});
|
||||
|
||||
using MenuCallback = Fn<QAction*(
|
||||
const QString &text,
|
||||
|
|
|
@ -43,7 +43,9 @@ void AddOption(
|
|||
const auto button = AddButton(
|
||||
container,
|
||||
rpl::single(name),
|
||||
option.relevant() ? st::settingsButton : st::settingsOptionDisabled
|
||||
(option.relevant()
|
||||
? st::settingsButtonNoIcon
|
||||
: st::settingsOptionDisabled)
|
||||
)->toggleOn(toggles->events_starting_with(option.value()));
|
||||
|
||||
const auto restarter = (option.relevant() && option.restartRequired())
|
||||
|
@ -68,7 +70,7 @@ void AddOption(
|
|||
}
|
||||
option.set(toggled);
|
||||
if (restarter) {
|
||||
restarter->callOnce(st::settingsButton.toggle.duration);
|
||||
restarter->callOnce(st::settingsButtonNoIcon.toggle.duration);
|
||||
}
|
||||
}, container->lifetime());
|
||||
|
||||
|
@ -104,7 +106,7 @@ void SetupExperimental(
|
|||
reset = AddButton(
|
||||
inner,
|
||||
tr::lng_settings_experimental_restore(),
|
||||
st::settingsButton);
|
||||
st::settingsButtonNoIcon);
|
||||
reset->addClickHandler([=] {
|
||||
base::options::reset();
|
||||
wrap->hide(anim::type::normal);
|
||||
|
|
|
@ -213,7 +213,7 @@ void SetupLanguageButton(
|
|||
) | rpl::then(
|
||||
Lang::GetInstance().idChanges()
|
||||
) | rpl::map([] { return Lang::GetInstance().nativeName(); }),
|
||||
icon ? st::settingsSectionButton : st::settingsButton,
|
||||
icon ? st::settingsButton : st::settingsButtonNoIcon,
|
||||
{ icon ? &st::settingsIconLanguage : nullptr, kIconDarkOrange });
|
||||
const auto guard = Ui::CreateChild<base::binary_guard>(button.get());
|
||||
button->addClickHandler([=] {
|
||||
|
@ -240,7 +240,7 @@ void SetupSections(
|
|||
AddButton(
|
||||
container,
|
||||
std::move(label),
|
||||
st::settingsSectionButton,
|
||||
st::settingsButton,
|
||||
std::move(descriptor)
|
||||
)->addClickHandler([=] { showOther(type); });
|
||||
};
|
||||
|
@ -253,7 +253,7 @@ void SetupSections(
|
|||
addSection(
|
||||
tr::lng_settings_information(),
|
||||
Type::Information,
|
||||
{ &st::settingsIconInformation, kIconLightOrange });
|
||||
{ &st::settingsIconAccount, kIconLightOrange });
|
||||
}
|
||||
addSection(
|
||||
tr::lng_settings_section_notify(),
|
||||
|
@ -262,7 +262,7 @@ void SetupSections(
|
|||
addSection(
|
||||
tr::lng_settings_section_privacy(),
|
||||
Type::PrivacySecurity,
|
||||
{ &st::settingsIconPrivacySecurity, kIconGreen });
|
||||
{ &st::settingsIconLock, kIconGreen });
|
||||
addSection(
|
||||
tr::lng_settings_section_chat_settings(),
|
||||
Type::Chat,
|
||||
|
@ -278,7 +278,7 @@ void SetupSections(
|
|||
CreateButton(
|
||||
container,
|
||||
tr::lng_settings_section_filters(),
|
||||
st::settingsSectionButton,
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconFolders, kIconDarkBlue }))
|
||||
)->setDuration(0);
|
||||
if (!controller->session().data().chatsFilters().list().empty()
|
||||
|
@ -346,7 +346,7 @@ void SetupInterfaceScale(
|
|||
const auto button = AddButton(
|
||||
container,
|
||||
tr::lng_settings_default_scale(),
|
||||
icon ? st::settingsSectionButton : st::settingsButton,
|
||||
icon ? st::settingsButton : st::settingsButtonNoIcon,
|
||||
{ icon ? &st::settingsIconInterfaceScale : nullptr, kIconLightBlue }
|
||||
)->toggleOn(toggled->events_starting_with_copy(switched));
|
||||
|
||||
|
@ -453,7 +453,7 @@ void SetupFaq(not_null<Ui::VerticalLayout*> container, bool icon) {
|
|||
AddButton(
|
||||
container,
|
||||
tr::lng_settings_faq(),
|
||||
icon ? st::settingsSectionButton : st::settingsButton,
|
||||
icon ? st::settingsButton : st::settingsButtonNoIcon,
|
||||
{ icon ? &st::settingsIconFaq : nullptr, kIconLightBlue }
|
||||
)->addClickHandler(OpenFaq);
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ void SetupHelp(
|
|||
AddButton(
|
||||
container,
|
||||
rpl::single(u"Telegram Features"_q),
|
||||
st::settingsSectionButton,
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconTips, kIconLightOrange }
|
||||
)->setClickedCallback([=] {
|
||||
UrlClickHandler::Open(tr::lng_telegram_features_url(tr::now));
|
||||
|
@ -478,7 +478,7 @@ void SetupHelp(
|
|||
const auto button = AddButton(
|
||||
container,
|
||||
tr::lng_settings_ask_question(),
|
||||
st::settingsSectionButton,
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconAskQuestion, kIconGreen });
|
||||
const auto requestId = button->lifetime().make_state<mtpRequestId>();
|
||||
button->lifetime().add([=] {
|
||||
|
|
|
@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history.h"
|
||||
#include "calls/calls_instance.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "base/event_filter.h"
|
||||
#include "ui/chat/chat_theme.h"
|
||||
#include "ui/chat/chat_style.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
|
@ -49,6 +50,7 @@ namespace {
|
|||
|
||||
using UserPrivacy = Api::UserPrivacy;
|
||||
using PrivacyRule = Api::UserPrivacy::Rule;
|
||||
using Option = EditPrivacyBox::Option;
|
||||
|
||||
class BlockPeerBoxController final : public ChatsListBoxController {
|
||||
public:
|
||||
|
@ -177,6 +179,119 @@ AdminLog::OwnedItem GenerateForwardedItem(
|
|||
return AdminLog::OwnedItem(delegate, item);
|
||||
}
|
||||
|
||||
struct ForwardedTooltip {
|
||||
QRect geometry;
|
||||
Fn<void(Painter&)> paint;
|
||||
};
|
||||
[[nodiscard]] ForwardedTooltip PrepareForwardedTooltip(
|
||||
not_null<HistoryView::Element*> view,
|
||||
Option value) {
|
||||
// This breaks HistoryView::Element encapsulation :(
|
||||
const auto forwarded = view->data()->Get<HistoryMessageForwarded>();
|
||||
const auto availableWidth = view->width()
|
||||
- st::msgMargin.left()
|
||||
- st::msgMargin.right();
|
||||
const auto bubbleWidth = ranges::min({
|
||||
availableWidth,
|
||||
view->maxWidth(),
|
||||
st::msgMaxWidth
|
||||
});
|
||||
const auto innerWidth = bubbleWidth
|
||||
- st::msgPadding.left()
|
||||
- st::msgPadding.right();
|
||||
const auto phrase = tr::lng_forwarded(
|
||||
tr::now,
|
||||
lt_user,
|
||||
view->data()->history()->session().user()->name);
|
||||
const auto kReplacementPosition = QChar(0x0001);
|
||||
const auto possiblePosition = tr::lng_forwarded(
|
||||
tr::now,
|
||||
lt_user,
|
||||
QString(1, kReplacementPosition)
|
||||
).indexOf(kReplacementPosition);
|
||||
const auto position = (possiblePosition >= 0
|
||||
&& possiblePosition < phrase.size())
|
||||
? possiblePosition
|
||||
: 0;
|
||||
const auto before = phrase.mid(0, position);
|
||||
const auto skip = st::msgMargin.left() + st::msgPadding.left();
|
||||
const auto small = forwarded->text.countHeight(innerWidth)
|
||||
< 2 * st::msgServiceFont->height;
|
||||
const auto nameLeft = skip
|
||||
+ (small ? st::msgServiceFont->width(before) : 0);
|
||||
const auto right = skip + innerWidth;
|
||||
const auto text = [&] {
|
||||
switch (value) {
|
||||
case Option::Everyone:
|
||||
return tr::lng_edit_privacy_forwards_sample_everyone(tr::now);
|
||||
case Option::Contacts:
|
||||
return tr::lng_edit_privacy_forwards_sample_contacts(tr::now);
|
||||
case Option::Nobody:
|
||||
return tr::lng_edit_privacy_forwards_sample_nobody(tr::now);
|
||||
}
|
||||
Unexpected("Option value in ForwardsPrivacyController.");
|
||||
}();
|
||||
const auto &font = st::defaultToast.style.font;
|
||||
const auto textWidth = font->width(text);
|
||||
const auto arrowSkip = st::settingsForwardPrivacyArrowSkip;
|
||||
const auto arrowSize = st::settingsForwardPrivacyArrowSize;
|
||||
const auto padding = st::settingsForwardPrivacyTooltipPadding;
|
||||
const auto rect = QRect(0, 0, textWidth, font->height).marginsAdded(
|
||||
padding
|
||||
).translated(padding.left(), padding.top());
|
||||
|
||||
const auto top = st::settingsForwardPrivacyPadding
|
||||
+ view->marginTop()
|
||||
+ st::msgPadding.top()
|
||||
- arrowSize
|
||||
- rect.height();
|
||||
const auto left1 = std::min(nameLeft, right - rect.width());
|
||||
const auto left2 = std::max(left1, skip);
|
||||
const auto left = left2;
|
||||
const auto arrowLeft1 = nameLeft + arrowSkip;
|
||||
const auto arrowLeft2 = std::min(
|
||||
arrowLeft1,
|
||||
std::max((left + right) / 2, right - arrowSkip));
|
||||
const auto arrowLeft = arrowLeft2;
|
||||
const auto geometry = rect.translated(left, top);
|
||||
|
||||
const auto line = st::lineWidth;
|
||||
const auto full = geometry.marginsAdded(
|
||||
{ line, line, line, line + arrowSize });
|
||||
const auto origin = full.topLeft();
|
||||
|
||||
const auto paint = [=](Painter &p) {
|
||||
p.translate(-origin);
|
||||
|
||||
Ui::FillRoundRect(
|
||||
p,
|
||||
geometry,
|
||||
st::toastBg,
|
||||
ImageRoundRadius::Large);
|
||||
|
||||
p.setFont(font);
|
||||
p.setPen(st::toastFg);
|
||||
p.drawText(
|
||||
geometry.x() + padding.left(),
|
||||
geometry.y() + padding.top() + font->ascent,
|
||||
text);
|
||||
|
||||
const auto bottom = full.y() + full.height() - line;
|
||||
|
||||
QPainterPath path;
|
||||
path.moveTo(arrowLeft - arrowSize, bottom - arrowSize);
|
||||
path.lineTo(arrowLeft, bottom);
|
||||
path.lineTo(arrowLeft + arrowSize, bottom - arrowSize);
|
||||
path.lineTo(arrowLeft - arrowSize, bottom - arrowSize);
|
||||
{
|
||||
PainterHighQualityEnabler hq(p);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.fillPath(path, st::toastBg);
|
||||
}
|
||||
};
|
||||
return { .geometry = full, .paint = paint };
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
BlockedBoxController::BlockedBoxController(
|
||||
|
@ -379,7 +494,6 @@ object_ptr<Ui::RpWidget> PhoneNumberPrivacyController::setupMiddleWidget(
|
|||
object_ptr<Ui::VerticalLayout>(parent));
|
||||
|
||||
const auto container = widget->entity();
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, tr::lng_edit_privacy_phone_number_find());
|
||||
const auto group = std::make_shared<Ui::RadioenumGroup<Option>>();
|
||||
|
@ -399,7 +513,8 @@ object_ptr<Ui::RpWidget> PhoneNumberPrivacyController::setupMiddleWidget(
|
|||
};
|
||||
addOption(Option::Everyone);
|
||||
addOption(Option::Contacts);
|
||||
AddSkip(container);
|
||||
AddSkip(container, st::settingsSectionSkip + st::settingsPrivacySkipTop);
|
||||
AddDivider(container);
|
||||
|
||||
using namespace rpl::mappers;
|
||||
widget->toggleOn(_phoneNumberOption.value(
|
||||
|
@ -570,13 +685,13 @@ object_ptr<Ui::RpWidget> CallsPrivacyController::setupBelowWidget(
|
|||
auto result = object_ptr<Ui::VerticalLayout>(parent);
|
||||
const auto content = result.data();
|
||||
|
||||
AddDivider(content);
|
||||
AddSkip(content);
|
||||
AddSkip(content, st::settingsPeerToPeerSkip);
|
||||
AddSubsectionTitle(content, tr::lng_settings_calls_peer_to_peer_title());
|
||||
Settings::AddPrivacyButton(
|
||||
controller,
|
||||
content,
|
||||
tr::lng_settings_calls_peer_to_peer_button(),
|
||||
{ &st::settingsIconArrows, kIconLightBlue },
|
||||
UserPrivacy::Key::CallsPeer2Peer,
|
||||
[] { return std::make_unique<CallsPeer2PeerPrivacyController>(); });
|
||||
AddSkip(content);
|
||||
|
@ -681,7 +796,8 @@ auto ForwardsPrivacyController::exceptionsDescription()
|
|||
|
||||
object_ptr<Ui::RpWidget> ForwardsPrivacyController::setupAboveWidget(
|
||||
not_null<QWidget*> parent,
|
||||
rpl::producer<Option> optionValue) {
|
||||
rpl::producer<Option> optionValue,
|
||||
not_null<QWidget*> outerContainer) {
|
||||
using namespace rpl::mappers;
|
||||
|
||||
auto message = GenerateForwardedItem(
|
||||
|
@ -691,11 +807,65 @@ object_ptr<Ui::RpWidget> ForwardsPrivacyController::setupAboveWidget(
|
|||
tr::lng_edit_privacy_forwards_sample_message(tr::now));
|
||||
const auto view = message.get();
|
||||
|
||||
auto result = object_ptr<Ui::RpWidget>(parent);
|
||||
const auto widget = result.data();
|
||||
Ui::AttachAsChild(widget, std::move(message));
|
||||
auto result = object_ptr<Ui::PaddingWrap<Ui::RpWidget>>(
|
||||
parent,
|
||||
object_ptr<Ui::RpWidget>(parent),
|
||||
style::margins(
|
||||
0,
|
||||
st::settingsSectionSkip,
|
||||
0,
|
||||
st::settingsPrivacySkipTop));
|
||||
const auto widget = result->entity();
|
||||
|
||||
const auto option = widget->lifetime().make_state<Option>();
|
||||
struct State {
|
||||
AdminLog::OwnedItem item;
|
||||
Option option = {};
|
||||
base::unique_qptr<Ui::RpWidget> tooltip;
|
||||
ForwardedTooltip info;
|
||||
Fn<void()> refreshGeometry;
|
||||
};
|
||||
const auto state = widget->lifetime().make_state<State>();
|
||||
state->item = std::move(message);
|
||||
state->tooltip = base::make_unique_q<Ui::RpWidget>(outerContainer);
|
||||
state->tooltip->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
if (state->info.paint) {
|
||||
auto p = Painter(state->tooltip.get());
|
||||
state->info.paint(p);
|
||||
}
|
||||
}, state->tooltip->lifetime());
|
||||
state->refreshGeometry = [=] {
|
||||
state->tooltip->show();
|
||||
state->tooltip->raise();
|
||||
auto position = state->info.geometry.topLeft();
|
||||
auto parent = (QWidget*)widget;
|
||||
while (parent && parent != outerContainer) {
|
||||
position += parent->pos();
|
||||
parent = parent->parentWidget();
|
||||
}
|
||||
state->tooltip->move(position);
|
||||
};
|
||||
auto &lifetime = state->tooltip->lifetime();
|
||||
const auto watch = [&](QWidget *widget, const auto &self) -> void {
|
||||
if (!widget) {
|
||||
return;
|
||||
}
|
||||
base::install_event_filter(state->tooltip, widget, [=](
|
||||
not_null<QEvent*> e) {
|
||||
if (e->type() == QEvent::Move
|
||||
|| e->type() == QEvent::Show
|
||||
|| e->type() == QEvent::ShowToParent
|
||||
|| e->type() == QEvent::ZOrderChange) {
|
||||
state->refreshGeometry();
|
||||
}
|
||||
return base::EventFilterResult::Continue;
|
||||
});
|
||||
if (widget == outerContainer) {
|
||||
return;
|
||||
}
|
||||
self(widget->parentWidget(), self);
|
||||
};
|
||||
watch(widget, watch);
|
||||
|
||||
const auto padding = st::settingsForwardPrivacyPadding;
|
||||
widget->widthValue(
|
||||
|
@ -705,10 +875,20 @@ object_ptr<Ui::RpWidget> ForwardsPrivacyController::setupAboveWidget(
|
|||
const auto height = view->resizeGetHeight(width);
|
||||
const auto top = view->marginTop();
|
||||
const auto bottom = view->marginBottom();
|
||||
const auto full = padding + bottom + height + top + padding;
|
||||
const auto full = padding + top + height + bottom + padding;
|
||||
widget->resize(width, full);
|
||||
}, widget->lifetime());
|
||||
|
||||
rpl::combine(
|
||||
widget->widthValue(),
|
||||
std::move(optionValue)
|
||||
) | rpl::start_with_next([=](int width, Option value) {
|
||||
state->info = PrepareForwardedTooltip(view, value);
|
||||
state->tooltip->resize(state->info.geometry.size());
|
||||
state->refreshGeometry();
|
||||
state->tooltip->update();
|
||||
}, state->tooltip->lifetime());
|
||||
|
||||
widget->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect rect) {
|
||||
// #TODO themes
|
||||
|
@ -724,115 +904,14 @@ object_ptr<Ui::RpWidget> ForwardsPrivacyController::setupAboveWidget(
|
|||
_chatStyle.get(),
|
||||
widget->rect(),
|
||||
widget->rect());
|
||||
p.translate(0, padding + view->marginBottom());
|
||||
p.translate(padding / 2, padding + view->marginBottom());
|
||||
context.outbg = view->hasOutLayout();
|
||||
view->draw(p, context);
|
||||
|
||||
PaintForwardedTooltip(p, view, *option);
|
||||
}, widget->lifetime());
|
||||
|
||||
std::move(
|
||||
optionValue
|
||||
) | rpl::start_with_next([=](Option value) {
|
||||
*option = value;
|
||||
widget->update();
|
||||
}, widget->lifetime());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void ForwardsPrivacyController::PaintForwardedTooltip(
|
||||
Painter &p,
|
||||
not_null<HistoryView::Element*> view,
|
||||
Option value) {
|
||||
// This breaks HistoryView::Element encapsulation :(
|
||||
const auto forwarded = view->data()->Get<HistoryMessageForwarded>();
|
||||
const auto availableWidth = view->width()
|
||||
- st::msgMargin.left()
|
||||
- st::msgMargin.right();
|
||||
const auto bubbleWidth = ranges::min({
|
||||
availableWidth,
|
||||
view->maxWidth(),
|
||||
st::msgMaxWidth
|
||||
});
|
||||
const auto innerWidth = bubbleWidth
|
||||
- st::msgPadding.left()
|
||||
- st::msgPadding.right();
|
||||
const auto phrase = tr::lng_forwarded(
|
||||
tr::now,
|
||||
lt_user,
|
||||
view->data()->history()->session().user()->name);
|
||||
const auto kReplacementPosition = QChar(0x0001);
|
||||
const auto possiblePosition = tr::lng_forwarded(
|
||||
tr::now,
|
||||
lt_user,
|
||||
QString(1, kReplacementPosition)
|
||||
).indexOf(kReplacementPosition);
|
||||
const auto position = (possiblePosition >= 0
|
||||
&& possiblePosition < phrase.size())
|
||||
? possiblePosition
|
||||
: 0;
|
||||
const auto before = phrase.mid(0, position);
|
||||
const auto skip = st::msgMargin.left() + st::msgPadding.left();
|
||||
const auto small = forwarded->text.countHeight(innerWidth)
|
||||
< 2 * st::msgServiceFont->height;
|
||||
const auto nameLeft = skip + (small ? st::msgServiceFont->width(before) : 0);
|
||||
const auto right = skip + innerWidth;
|
||||
const auto text = [&] {
|
||||
switch (value) {
|
||||
case Option::Everyone:
|
||||
return tr::lng_edit_privacy_forwards_sample_everyone(tr::now);
|
||||
case Option::Contacts:
|
||||
return tr::lng_edit_privacy_forwards_sample_contacts(tr::now);
|
||||
case Option::Nobody:
|
||||
return tr::lng_edit_privacy_forwards_sample_nobody(tr::now);
|
||||
}
|
||||
Unexpected("Option value in ForwardsPrivacyController.");
|
||||
}();
|
||||
const auto &font = st::defaultToast.style.font;
|
||||
const auto textWidth = font->width(text);
|
||||
const auto arrowSkip = st::settingsForwardPrivacyArrowSkip;
|
||||
const auto arrowSize = st::settingsForwardPrivacyArrowSize;
|
||||
const auto padding = st::settingsForwardPrivacyTooltipPadding;
|
||||
const auto rect = QRect(0, 0, textWidth, font->height).marginsAdded(
|
||||
padding
|
||||
).translated(padding.left(), padding.top());
|
||||
|
||||
const auto top = view->marginTop()
|
||||
+ st::msgPadding.top()
|
||||
+ (small ? 1 : 2) * st::msgServiceFont->height
|
||||
+ arrowSize;
|
||||
const auto left1 = std::min(nameLeft, right - rect.width());
|
||||
const auto left2 = std::max(left1, skip);
|
||||
const auto left = left2;
|
||||
const auto arrowLeft1 = nameLeft + arrowSkip;
|
||||
const auto arrowLeft2 = std::min(
|
||||
arrowLeft1,
|
||||
std::max((left + right) / 2, right - arrowSkip));
|
||||
const auto arrowLeft = arrowLeft2;
|
||||
const auto geometry = rect.translated(left, top);
|
||||
|
||||
Ui::FillRoundRect(p, geometry, st::toastBg, ImageRoundRadius::Small);
|
||||
|
||||
p.setFont(font);
|
||||
p.setPen(st::toastFg);
|
||||
p.drawText(
|
||||
geometry.x() + padding.left(),
|
||||
geometry.y() + padding.top() + font->ascent,
|
||||
text);
|
||||
|
||||
QPainterPath path;
|
||||
path.moveTo(arrowLeft - arrowSize, top);
|
||||
path.lineTo(arrowLeft, top - arrowSize);
|
||||
path.lineTo(arrowLeft + arrowSize, top);
|
||||
path.lineTo(arrowLeft - arrowSize, top);
|
||||
{
|
||||
PainterHighQualityEnabler hq(p);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.fillPath(path, st::toastBg);
|
||||
}
|
||||
}
|
||||
|
||||
auto ForwardsPrivacyController::delegate()
|
||||
-> not_null<HistoryView::ElementDelegate*> {
|
||||
return static_cast<HistoryView::ElementDelegate*>(this);
|
||||
|
|
|
@ -184,18 +184,14 @@ public:
|
|||
|
||||
object_ptr<Ui::RpWidget> setupAboveWidget(
|
||||
not_null<QWidget*> parent,
|
||||
rpl::producer<Option> optionValue) override;
|
||||
rpl::producer<Option> optionValue,
|
||||
not_null<QWidget*> outerContainer) override;
|
||||
|
||||
private:
|
||||
using Element = HistoryView::Element;
|
||||
not_null<HistoryView::ElementDelegate*> delegate();
|
||||
HistoryView::Context elementContext() override;
|
||||
|
||||
static void PaintForwardedTooltip(
|
||||
Painter &p,
|
||||
not_null<HistoryView::Element*> view,
|
||||
Option value);
|
||||
|
||||
const not_null<Window::SessionController*> _controller;
|
||||
const std::unique_ptr<Ui::ChatStyle> _chatStyle;
|
||||
|
||||
|
|
|
@ -124,71 +124,50 @@ void SetupPrivacy(
|
|||
AddSubsectionTitle(container, tr::lng_settings_privacy_title());
|
||||
|
||||
const auto session = &controller->session();
|
||||
auto count = rpl::combine(
|
||||
BlockedPeersCount(session),
|
||||
tr::lng_settings_no_blocked_users()
|
||||
) | rpl::map([](int count, const QString &none) {
|
||||
return count ? QString::number(count) : none;
|
||||
});
|
||||
const auto blockedPeers = AddButtonWithLabel(
|
||||
container,
|
||||
tr::lng_settings_blocked_users(),
|
||||
std::move(count),
|
||||
st::settingsButton);
|
||||
blockedPeers->addClickHandler([=] {
|
||||
const auto initBox = [=](not_null<PeerListBox*> box) {
|
||||
box->addButton(tr::lng_close(), [=] {
|
||||
box->closeBox();
|
||||
});
|
||||
box->addLeftButton(tr::lng_blocked_list_add(), [=] {
|
||||
BlockedBoxController::BlockNewPeer(controller);
|
||||
});
|
||||
};
|
||||
controller->show(Box<PeerListBox>(
|
||||
std::make_unique<BlockedBoxController>(controller),
|
||||
initBox));
|
||||
});
|
||||
std::move(
|
||||
updateTrigger
|
||||
) | rpl::start_with_next([=] {
|
||||
session->api().blockedPeers().reload();
|
||||
}, blockedPeers->lifetime());
|
||||
|
||||
using Key = Privacy::Key;
|
||||
const auto add = [&](
|
||||
rpl::producer<QString> label,
|
||||
IconDescriptor &&descriptor,
|
||||
Key key,
|
||||
auto controllerFactory) {
|
||||
AddPrivacyButton(
|
||||
controller,
|
||||
container,
|
||||
std::move(label),
|
||||
std::move(descriptor),
|
||||
key,
|
||||
controllerFactory);
|
||||
};
|
||||
add(
|
||||
tr::lng_settings_phone_number_privacy(),
|
||||
{ &st::settingsIconCalls, kIconGreen },
|
||||
Key::PhoneNumber,
|
||||
[] { return std::make_unique<PhoneNumberPrivacyController>(); });
|
||||
add(
|
||||
tr::lng_settings_last_seen(),
|
||||
{ &st::settingsIconOnline, kIconLightBlue },
|
||||
Key::LastSeen,
|
||||
[=] { return std::make_unique<LastSeenPrivacyController>(session); });
|
||||
add(
|
||||
tr::lng_settings_forwards_privacy(),
|
||||
{ &st::settingsIconForward, kIconLightOrange },
|
||||
Key::Forwards,
|
||||
[=] { return std::make_unique<ForwardsPrivacyController>(
|
||||
controller); });
|
||||
add(
|
||||
tr::lng_settings_profile_photo_privacy(),
|
||||
{ &st::settingsIconAccount, kIconRed },
|
||||
Key::ProfilePhoto,
|
||||
[] { return std::make_unique<ProfilePhotoPrivacyController>(); });
|
||||
add(
|
||||
tr::lng_settings_calls(),
|
||||
{ &st::settingsIconVideoCalls, kIconGreen },
|
||||
Key::Calls,
|
||||
[] { return std::make_unique<CallsPrivacyController>(); });
|
||||
add(
|
||||
tr::lng_settings_groups_invite(),
|
||||
{ &st::settingsIconGroup, kIconDarkBlue },
|
||||
Key::Invites,
|
||||
[] { return std::make_unique<GroupsInvitePrivacyController>(); });
|
||||
|
||||
|
@ -219,7 +198,7 @@ void SetupArchiveAndMute(
|
|||
AddButton(
|
||||
inner,
|
||||
tr::lng_settings_auto_archive(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
privacy->archiveAndMute()
|
||||
)->toggledChanges(
|
||||
|
@ -245,7 +224,8 @@ void SetupLocalPasscode(
|
|||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, tr::lng_settings_passcode_title());
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
auto has = rpl::single(
|
||||
rpl::empty_value()
|
||||
|
@ -261,11 +241,11 @@ void SetupLocalPasscode(
|
|||
[](const QString &change, const QString &create, bool has) {
|
||||
return has ? change : create;
|
||||
});
|
||||
container->add(
|
||||
object_ptr<Button>(
|
||||
container,
|
||||
std::move(text),
|
||||
st::settingsButton)
|
||||
AddButton(
|
||||
container,
|
||||
std::move(text),
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconLock, kIconGreen }
|
||||
)->addClickHandler([=] {
|
||||
controller->show(Box<PasscodeBox>(&controller->session(), false));
|
||||
});
|
||||
|
@ -275,11 +255,11 @@ void SetupLocalPasscode(
|
|||
container,
|
||||
object_ptr<Ui::VerticalLayout>(container)));
|
||||
const auto inner = wrap->entity();
|
||||
inner->add(
|
||||
object_ptr<Button>(
|
||||
inner,
|
||||
tr::lng_settings_passcode_disable(),
|
||||
st::settingsButton)
|
||||
AddButton(
|
||||
inner,
|
||||
tr::lng_settings_passcode_disable(),
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconMinus, kIconRed }
|
||||
)->addClickHandler([=] {
|
||||
controller->show(Box<PasscodeBox>(&controller->session(), true));
|
||||
});
|
||||
|
@ -318,7 +298,8 @@ void SetupLocalPasscode(
|
|||
inner,
|
||||
label(),
|
||||
std::move(value),
|
||||
st::settingsButton
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconTimer, kIconGreen }
|
||||
)->addClickHandler([=] {
|
||||
const auto box = controller->show(Box<AutoLockBox>());
|
||||
box->boxClosing(
|
||||
|
@ -326,8 +307,6 @@ void SetupLocalPasscode(
|
|||
});
|
||||
|
||||
wrap->toggleOn(base::duplicate(has));
|
||||
|
||||
AddSkip(container);
|
||||
}
|
||||
|
||||
void SetupCloudPassword(
|
||||
|
@ -336,9 +315,9 @@ void SetupCloudPassword(
|
|||
using namespace rpl::mappers;
|
||||
using State = Core::CloudPasswordState;
|
||||
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, tr::lng_settings_password_title());
|
||||
|
||||
const auto session = &controller->session();
|
||||
auto has = rpl::single(
|
||||
|
@ -384,12 +363,12 @@ void SetupCloudPassword(
|
|||
base::duplicate(confirmation),
|
||||
st::settingsCloudPasswordLabel),
|
||||
QMargins(
|
||||
st::settingsButton.padding.left(),
|
||||
st::settingsButton.padding.top(),
|
||||
st::settingsButton.padding.right(),
|
||||
(st::settingsButton.height
|
||||
st::settingsButtonNoIcon.padding.left(),
|
||||
st::settingsButtonNoIcon.padding.top(),
|
||||
st::settingsButtonNoIcon.padding.right(),
|
||||
(st::settingsButtonNoIcon.height
|
||||
- st::settingsCloudPasswordLabel.style.font->height
|
||||
+ st::settingsButton.padding.bottom()))));
|
||||
+ st::settingsButtonNoIcon.padding.bottom()))));
|
||||
label->toggleOn(base::duplicate(noconfirmed))->setDuration(0);
|
||||
|
||||
std::move(
|
||||
|
@ -408,10 +387,11 @@ void SetupCloudPassword(
|
|||
const auto change = container->add(
|
||||
object_ptr<Ui::SlideWrap<Button>>(
|
||||
container,
|
||||
object_ptr<Button>(
|
||||
CreateButton(
|
||||
container,
|
||||
std::move(text),
|
||||
st::settingsButton)));
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconKey, kIconLightBlue })));
|
||||
change->toggleOn(rpl::duplicate(
|
||||
noconfirmed
|
||||
) | rpl::map(
|
||||
|
@ -428,10 +408,11 @@ void SetupCloudPassword(
|
|||
const auto confirm = container->add(
|
||||
object_ptr<Ui::SlideWrap<Button>>(
|
||||
container,
|
||||
object_ptr<Button>(
|
||||
CreateButton(
|
||||
container,
|
||||
tr::lng_cloud_password_confirm(),
|
||||
st::settingsButton)));
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconEmail, kIconLightOrange })));
|
||||
confirm->toggleOn(rpl::single(
|
||||
false
|
||||
) | rpl::then(rpl::duplicate(
|
||||
|
@ -471,10 +452,11 @@ void SetupCloudPassword(
|
|||
const auto disable = container->add(
|
||||
object_ptr<Ui::SlideWrap<Button>>(
|
||||
container,
|
||||
object_ptr<Button>(
|
||||
CreateButton(
|
||||
container,
|
||||
tr::lng_settings_password_disable(),
|
||||
st::settingsButton)));
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconMinus, kIconRed })));
|
||||
disable->toggleOn(rpl::combine(
|
||||
rpl::duplicate(has),
|
||||
rpl::duplicate(noconfirmed),
|
||||
|
@ -543,7 +525,7 @@ void SetupCloudPassword(
|
|||
const auto reset = container->add(
|
||||
object_ptr<Ui::SlideWrap<Button>>(
|
||||
container,
|
||||
object_ptr<Button>(
|
||||
CreateButton(
|
||||
container,
|
||||
rpl::duplicate(resetText),
|
||||
st::settingsButton))
|
||||
|
@ -596,7 +578,7 @@ void SetupCloudPassword(
|
|||
const auto abort = container->add(
|
||||
object_ptr<Ui::SlideWrap<Button>>(
|
||||
container,
|
||||
object_ptr<Button>(
|
||||
CreateButton(
|
||||
container,
|
||||
tr::lng_settings_password_abort(),
|
||||
st::settingsAttentionButton)));
|
||||
|
@ -648,7 +630,7 @@ void SetupSensitiveContent(
|
|||
AddButton(
|
||||
inner,
|
||||
tr::lng_settings_sensitive_disable_filtering(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
session->api().sensitiveContent().enabled()
|
||||
)->toggledChanges(
|
||||
|
@ -689,7 +671,7 @@ void SetupSelfDestruction(
|
|||
container,
|
||||
tr::lng_settings_destroy_if(),
|
||||
label(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
controller->show(Box<SelfDestructionBox>(
|
||||
session,
|
||||
|
@ -769,7 +751,7 @@ void SetupBotsAndWebsites(
|
|||
AddButton(
|
||||
container,
|
||||
tr::lng_settings_clear_payment_info(),
|
||||
st::settingsButton
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler([=] {
|
||||
controller->show(ClearPaymentInfoBox(session));
|
||||
});
|
||||
|
@ -777,14 +759,49 @@ void SetupBotsAndWebsites(
|
|||
AddSkip(container);
|
||||
}
|
||||
|
||||
void SetupBlockedList(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<> updateTrigger,
|
||||
Fn<void(Type)> showOther) {
|
||||
const auto session = &controller->session();
|
||||
auto blockedCount = rpl::combine(
|
||||
BlockedPeersCount(session),
|
||||
tr::lng_settings_no_blocked_users()
|
||||
) | rpl::map([](int count, const QString &none) {
|
||||
return count ? QString::number(count) : none;
|
||||
});
|
||||
const auto blockedPeers = AddButtonWithLabel(
|
||||
container,
|
||||
tr::lng_settings_blocked_users(),
|
||||
std::move(blockedCount),
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconMinus, kIconRed });
|
||||
blockedPeers->addClickHandler([=] {
|
||||
const auto initBox = [=](not_null<PeerListBox*> box) {
|
||||
box->addButton(tr::lng_close(), [=] {
|
||||
box->closeBox();
|
||||
});
|
||||
box->addLeftButton(tr::lng_blocked_list_add(), [=] {
|
||||
BlockedBoxController::BlockNewPeer(controller);
|
||||
});
|
||||
};
|
||||
controller->show(Box<PeerListBox>(
|
||||
std::make_unique<BlockedBoxController>(controller),
|
||||
initBox));
|
||||
});
|
||||
std::move(
|
||||
updateTrigger
|
||||
) | rpl::start_with_next([=] {
|
||||
session->api().blockedPeers().reload();
|
||||
}, blockedPeers->lifetime());
|
||||
}
|
||||
|
||||
void SetupSessionsList(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<> updateTrigger,
|
||||
Fn<void(Type)> showOther) {
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, tr::lng_settings_sessions_title());
|
||||
|
||||
std::move(
|
||||
updateTrigger
|
||||
) | rpl::start_with_next([=] {
|
||||
|
@ -800,12 +817,33 @@ void SetupSessionsList(
|
|||
container,
|
||||
tr::lng_settings_show_sessions(),
|
||||
std::move(count),
|
||||
st::settingsButton
|
||||
st::settingsButton,
|
||||
{ &st::settingsIconLaptop, kIconLightOrange }
|
||||
)->addClickHandler([=] {
|
||||
showOther(Type::Sessions);
|
||||
});
|
||||
AddSkip(container, st::settingsPrivacySecurityPadding);
|
||||
AddDividerText(container, tr::lng_settings_sessions_about());
|
||||
}
|
||||
|
||||
void SetupSecurity(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<> updateTrigger,
|
||||
Fn<void(Type)> showOther) {
|
||||
AddSkip(container, st::settingsPrivacySkip);
|
||||
AddSubsectionTitle(container, rpl::single(u"Security"_q));
|
||||
|
||||
SetupBlockedList(
|
||||
controller,
|
||||
container,
|
||||
rpl::duplicate(updateTrigger),
|
||||
showOther);
|
||||
SetupSessionsList(
|
||||
controller,
|
||||
container,
|
||||
rpl::duplicate(updateTrigger),
|
||||
showOther);
|
||||
SetupLocalPasscode(controller, container);
|
||||
SetupCloudPassword(controller, container);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -901,6 +939,7 @@ void AddPrivacyButton(
|
|||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> label,
|
||||
IconDescriptor &&descriptor,
|
||||
Privacy::Key key,
|
||||
Fn<std::unique_ptr<EditPrivacyController>()> controllerFactory) {
|
||||
const auto shower = Ui::CreateChild<rpl::lifetime>(container.get());
|
||||
|
@ -909,7 +948,8 @@ void AddPrivacyButton(
|
|||
container,
|
||||
std::move(label),
|
||||
PrivacyString(session, key),
|
||||
st::settingsButton
|
||||
st::settingsButton,
|
||||
std::move(descriptor)
|
||||
)->addClickHandler([=] {
|
||||
*shower = session->api().userPrivacy().value(
|
||||
key
|
||||
|
@ -945,20 +985,18 @@ void PrivacySecurity::setupContent(
|
|||
};
|
||||
|
||||
SetupPrivacy(controller, content, trigger());
|
||||
SetupSessionsList(controller, content, trigger(), [=](Type type) {
|
||||
SetupSecurity(controller, content, trigger(), [=](Type type) {
|
||||
_showOther.fire_copy(type);
|
||||
});
|
||||
SetupLocalPasscode(controller, content);
|
||||
SetupCloudPassword(controller, content);
|
||||
#if !defined OS_MAC_STORE && !defined OS_WIN_STORE
|
||||
SetupSensitiveContent(controller, content, trigger());
|
||||
#else // !OS_MAC_STORE && !OS_WIN_STORE
|
||||
AddDivider(content);
|
||||
#endif // !OS_MAC_STORE && !OS_WIN_STORE
|
||||
SetupArchiveAndMute(controller, content);
|
||||
SetupSelfDestruction(controller, content, trigger());
|
||||
AddDivider(content);
|
||||
SetupBotsAndWebsites(controller, content);
|
||||
AddDivider(content);
|
||||
SetupSelfDestruction(controller, content, trigger());
|
||||
|
||||
Ui::ResizeFitChild(this, content);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ void AddPrivacyButton(
|
|||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> label,
|
||||
IconDescriptor &&descriptor,
|
||||
Api::UserPrivacy::Key key,
|
||||
Fn<std::unique_ptr<EditPrivacyController>()> controllerFactory);
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ void EditInviteLinkBox(
|
|||
object_ptr<SettingsButton>(
|
||||
container,
|
||||
tr::lng_group_invite_request_approve(),
|
||||
st::settingsButton),
|
||||
st::settingsButtonNoIcon),
|
||||
style::margins{ 0, 0, 0, st::settingsSectionSkip });
|
||||
if (requestApproval) {
|
||||
requestApproval->toggleOn(state->requestApproval.value());
|
||||
|
|
|
@ -960,13 +960,13 @@ void MainMenu::setupMenu() {
|
|||
if (!_controller->session().supportMode()) {
|
||||
addAction(
|
||||
tr::lng_create_group_title(),
|
||||
{ &st::settingsIconNewGroup, kIconLightBlue }
|
||||
{ &st::settingsIconGroup, kIconLightBlue }
|
||||
)->setClickedCallback([=] {
|
||||
controller->showNewGroup();
|
||||
});
|
||||
addAction(
|
||||
tr::lng_create_channel_title(),
|
||||
{ &st::settingsIconNewChannel, kIconLightOrange }
|
||||
{ &st::settingsIconChannel, kIconLightOrange }
|
||||
)->setClickedCallback([=] {
|
||||
controller->showNewChannel();
|
||||
});
|
||||
|
|