diff --git a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp index aa67f1530..075958f53 100644 --- a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp @@ -112,7 +112,7 @@ std::unique_ptr PrivacyExceptionsBoxControl } // namespace -QString EditPrivacyController::optionLabel(Option option) { +QString EditPrivacyController::optionLabel(Option option) const { switch (option) { case Option::Everyone: return tr::lng_edit_privacy_everyone(tr::now); case Option::Contacts: return tr::lng_edit_privacy_contacts(tr::now); diff --git a/Telegram/SourceFiles/boxes/edit_privacy_box.h b/Telegram/SourceFiles/boxes/edit_privacy_box.h index c77fc8c8d..fad806fbb 100644 --- a/Telegram/SourceFiles/boxes/edit_privacy_box.h +++ b/Telegram/SourceFiles/boxes/edit_privacy_box.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "boxes/abstract_box.h" +#include "ui/layers/box_content.h" #include "mtproto/sender.h" #include "api/api_user_privacy.h" @@ -38,25 +38,25 @@ public: Never, }; - [[nodiscard]] virtual Key key() = 0; + [[nodiscard]] virtual Key key() const = 0; - [[nodiscard]] virtual rpl::producer title() = 0; - [[nodiscard]] virtual bool hasOption(Option option) { + [[nodiscard]] virtual rpl::producer title() const = 0; + [[nodiscard]] virtual bool hasOption(Option option) const { return true; } - [[nodiscard]] virtual rpl::producer optionsTitleKey() = 0; - [[nodiscard]] virtual QString optionLabel(Option option); - [[nodiscard]] virtual rpl::producer warning() { + [[nodiscard]] virtual rpl::producer optionsTitleKey() const = 0; + [[nodiscard]] virtual QString optionLabel(Option option) const; + [[nodiscard]] virtual rpl::producer warning() const { return nullptr; } - virtual void prepareWarningLabel(not_null warning) { + virtual void prepareWarningLabel(not_null warning) const { } [[nodiscard]] virtual rpl::producer exceptionButtonTextKey( - Exception exception) = 0; + Exception exception) const = 0; [[nodiscard]] virtual rpl::producer exceptionBoxTitle( - Exception exception) = 0; + Exception exception) const = 0; [[nodiscard]] virtual auto exceptionsDescription() - -> rpl::producer = 0; + const -> rpl::producer = 0; [[nodiscard]] virtual object_ptr setupAboveWidget( not_null parent, @@ -72,7 +72,7 @@ public: } [[nodiscard]] virtual object_ptr setupBelowWidget( not_null controller, - not_null parent) { + not_null parent) const { return { nullptr }; } @@ -87,7 +87,7 @@ public: virtual ~EditPrivacyController() = default; protected: - EditPrivacyBox *view() const { + [[nodiscard]] EditPrivacyBox *view() const { return _view; } @@ -102,7 +102,7 @@ private: }; -class EditPrivacyBox : public Ui::BoxContent { +class EditPrivacyBox final : public Ui::BoxContent { public: using Value = Api::UserPrivacy::Rule; using Option = Api::UserPrivacy::Option; diff --git a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp index bc14b6561..e49b2dbb8 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp @@ -10,7 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "settings/settings_common.h" #include "lang/lang_keys.h" #include "apiwrap.h" -#include "mainwidget.h" #include "main/main_session.h" #include "data/data_user.h" #include "data/data_session.h" @@ -111,9 +110,16 @@ void BlockPeerBoxController::prepareViewHook() { }, lifetime()); } -void BlockPeerBoxController::updateIsBlocked(not_null row, PeerData *peer) const { - auto blocked = peer->isBlocked(); - row->setDisabledState(blocked ? PeerListRow::State::DisabledChecked : PeerListRow::State::Active); +void BlockPeerBoxController::updateIsBlocked( + not_null row, + PeerData *peer) const { + if (!peer) { + return; + } + const auto blocked = peer->isBlocked(); + row->setDisabledState(blocked + ? PeerListRow::State::DisabledChecked + : PeerListRow::State::Active); if (blocked) { row->setCustomStatus(tr::lng_blocked_list_already_blocked(tr::now)); } else { @@ -453,19 +459,20 @@ PhoneNumberPrivacyController::PhoneNumberPrivacyController( : _controller(controller) { } -UserPrivacy::Key PhoneNumberPrivacyController::key() { +UserPrivacy::Key PhoneNumberPrivacyController::key() const { return Key::PhoneNumber; } -rpl::producer PhoneNumberPrivacyController::title() { +rpl::producer PhoneNumberPrivacyController::title() const { return tr::lng_edit_privacy_phone_number_title(); } -rpl::producer PhoneNumberPrivacyController::optionsTitleKey() { +rpl::producer PhoneNumberPrivacyController::optionsTitleKey() const { return tr::lng_edit_privacy_phone_number_header(); } -rpl::producer PhoneNumberPrivacyController::warning() { +auto PhoneNumberPrivacyController::warning() const +-> rpl::producer { using namespace rpl::mappers; const auto self = _controller->session().user(); return rpl::combine( @@ -490,7 +497,7 @@ rpl::producer PhoneNumberPrivacyController::warning() { } void PhoneNumberPrivacyController::prepareWarningLabel( - not_null warning) { + not_null warning) const { warning->setClickHandlerFilter([=]( const ClickHandlerPtr &link, Qt::MouseButton button) { @@ -506,7 +513,7 @@ void PhoneNumberPrivacyController::prepareWarningLabel( } rpl::producer PhoneNumberPrivacyController::exceptionButtonTextKey( - Exception exception) { + Exception exception) const { switch (exception) { case Exception::Always: return tr::lng_edit_privacy_phone_number_always_empty(); @@ -517,15 +524,20 @@ rpl::producer PhoneNumberPrivacyController::exceptionButtonTextKey( } rpl::producer PhoneNumberPrivacyController::exceptionBoxTitle( - Exception exception) { + Exception exception) const { switch (exception) { - case Exception::Always: return tr::lng_edit_privacy_phone_number_always_title(); - case Exception::Never: return tr::lng_edit_privacy_phone_number_never_title(); + case Exception::Always: { + return tr::lng_edit_privacy_phone_number_always_title(); + }; + case Exception::Never: { + return tr::lng_edit_privacy_phone_number_never_title(); + }; } Unexpected("Invalid exception value."); } -rpl::producer PhoneNumberPrivacyController::exceptionsDescription() { +auto PhoneNumberPrivacyController::exceptionsDescription() const +-> rpl::producer { return tr::lng_edit_privacy_phone_number_exceptions(); } @@ -591,24 +603,25 @@ LastSeenPrivacyController::LastSeenPrivacyController( : _session(session) { } -UserPrivacy::Key LastSeenPrivacyController::key() { +UserPrivacy::Key LastSeenPrivacyController::key() const { return Key::LastSeen; } -rpl::producer LastSeenPrivacyController::title() { +rpl::producer LastSeenPrivacyController::title() const { return tr::lng_edit_privacy_lastseen_title(); } -rpl::producer LastSeenPrivacyController::optionsTitleKey() { +rpl::producer LastSeenPrivacyController::optionsTitleKey() const { return tr::lng_edit_privacy_lastseen_header(); } -rpl::producer LastSeenPrivacyController::warning() { +auto LastSeenPrivacyController::warning() const +-> rpl::producer { return tr::lng_edit_privacy_lastseen_warning(Ui::Text::WithEntities); } rpl::producer LastSeenPrivacyController::exceptionButtonTextKey( - Exception exception) { + Exception exception) const { switch (exception) { case Exception::Always: return tr::lng_edit_privacy_lastseen_always_empty(); @@ -619,15 +632,20 @@ rpl::producer LastSeenPrivacyController::exceptionButtonTextKey( } rpl::producer LastSeenPrivacyController::exceptionBoxTitle( - Exception exception) { + Exception exception) const { switch (exception) { - case Exception::Always: return tr::lng_edit_privacy_lastseen_always_title(); - case Exception::Never: return tr::lng_edit_privacy_lastseen_never_title(); + case Exception::Always: { + return tr::lng_edit_privacy_lastseen_always_title(); + }; + case Exception::Never: { + return tr::lng_edit_privacy_lastseen_never_title(); + }; } Unexpected("Invalid exception value."); } -rpl::producer LastSeenPrivacyController::exceptionsDescription() { +auto LastSeenPrivacyController::exceptionsDescription() const +-> rpl::producer{ return tr::lng_edit_privacy_lastseen_exceptions(); } @@ -655,24 +673,25 @@ void LastSeenPrivacyController::confirmSave( } } -UserPrivacy::Key GroupsInvitePrivacyController::key() { +UserPrivacy::Key GroupsInvitePrivacyController::key() const { return Key::Invites; } -rpl::producer GroupsInvitePrivacyController::title() { +rpl::producer GroupsInvitePrivacyController::title() const { return tr::lng_edit_privacy_groups_title(); } -bool GroupsInvitePrivacyController::hasOption(Option option) { +bool GroupsInvitePrivacyController::hasOption(Option option) const { return (option != Option::Nobody); } -rpl::producer GroupsInvitePrivacyController::optionsTitleKey() { +rpl::producer GroupsInvitePrivacyController::optionsTitleKey( + ) const { return tr::lng_edit_privacy_groups_header(); } rpl::producer GroupsInvitePrivacyController::exceptionButtonTextKey( - Exception exception) { + Exception exception) const { switch (exception) { case Exception::Always: return tr::lng_edit_privacy_groups_always_empty(); case Exception::Never: return tr::lng_edit_privacy_groups_never_empty(); @@ -681,7 +700,7 @@ rpl::producer GroupsInvitePrivacyController::exceptionButtonTextKey( } rpl::producer GroupsInvitePrivacyController::exceptionBoxTitle( - Exception exception) { + Exception exception) const { switch (exception) { case Exception::Always: return tr::lng_edit_privacy_groups_always_title(); case Exception::Never: return tr::lng_edit_privacy_groups_never_title(); @@ -689,25 +708,25 @@ rpl::producer GroupsInvitePrivacyController::exceptionBoxTitle( Unexpected("Invalid exception value."); } -auto GroupsInvitePrivacyController::exceptionsDescription() +auto GroupsInvitePrivacyController::exceptionsDescription() const -> rpl::producer { return tr::lng_edit_privacy_groups_exceptions(); } -UserPrivacy::Key CallsPrivacyController::key() { +UserPrivacy::Key CallsPrivacyController::key() const { return Key::Calls; } -rpl::producer CallsPrivacyController::title() { +rpl::producer CallsPrivacyController::title() const { return tr::lng_edit_privacy_calls_title(); } -rpl::producer CallsPrivacyController::optionsTitleKey() { +rpl::producer CallsPrivacyController::optionsTitleKey() const { return tr::lng_edit_privacy_calls_header(); } rpl::producer CallsPrivacyController::exceptionButtonTextKey( - Exception exception) { + Exception exception) const { switch (exception) { case Exception::Always: return tr::lng_edit_privacy_calls_always_empty(); case Exception::Never: return tr::lng_edit_privacy_calls_never_empty(); @@ -716,7 +735,7 @@ rpl::producer CallsPrivacyController::exceptionButtonTextKey( } rpl::producer CallsPrivacyController::exceptionBoxTitle( - Exception exception) { + Exception exception) const { switch (exception) { case Exception::Always: return tr::lng_edit_privacy_calls_always_title(); case Exception::Never: return tr::lng_edit_privacy_calls_never_title(); @@ -724,13 +743,14 @@ rpl::producer CallsPrivacyController::exceptionBoxTitle( Unexpected("Invalid exception value."); } -rpl::producer CallsPrivacyController::exceptionsDescription() { +auto CallsPrivacyController::exceptionsDescription() const +-> rpl::producer{ return tr::lng_edit_privacy_calls_exceptions(); } object_ptr CallsPrivacyController::setupBelowWidget( not_null controller, - not_null parent) { + not_null parent) const { auto result = object_ptr(parent); const auto content = result.data(); @@ -748,51 +768,67 @@ object_ptr CallsPrivacyController::setupBelowWidget( return result; } -UserPrivacy::Key CallsPeer2PeerPrivacyController::key() { +UserPrivacy::Key CallsPeer2PeerPrivacyController::key() const { return Key::CallsPeer2Peer; } -rpl::producer CallsPeer2PeerPrivacyController::title() { +rpl::producer CallsPeer2PeerPrivacyController::title() const { return tr::lng_edit_privacy_calls_p2p_title(); } -rpl::producer CallsPeer2PeerPrivacyController::optionsTitleKey() { +rpl::producer CallsPeer2PeerPrivacyController::optionsTitleKey() const { return tr::lng_edit_privacy_calls_p2p_header(); } QString CallsPeer2PeerPrivacyController::optionLabel( - EditPrivacyBox::Option option) { + EditPrivacyBox::Option option) const { switch (option) { - case Option::Everyone: return tr::lng_edit_privacy_calls_p2p_everyone(tr::now); - case Option::Contacts: return tr::lng_edit_privacy_calls_p2p_contacts(tr::now); - case Option::Nobody: return tr::lng_edit_privacy_calls_p2p_nobody(tr::now); + case Option::Everyone: { + return tr::lng_edit_privacy_calls_p2p_everyone(tr::now); + }; + case Option::Contacts: { + return tr::lng_edit_privacy_calls_p2p_contacts(tr::now); + }; + case Option::Nobody: { + return tr::lng_edit_privacy_calls_p2p_nobody(tr::now); + }; } Unexpected("Option value in optionsLabelKey."); } -rpl::producer CallsPeer2PeerPrivacyController::warning() { +auto CallsPeer2PeerPrivacyController::warning() const +-> rpl::producer { return tr::lng_settings_peer_to_peer_about(Ui::Text::WithEntities); } rpl::producer CallsPeer2PeerPrivacyController::exceptionButtonTextKey( - Exception exception) { + Exception exception) const { switch (exception) { - case Exception::Always: return tr::lng_edit_privacy_calls_p2p_always_empty(); - case Exception::Never: return tr::lng_edit_privacy_calls_p2p_never_empty(); + case Exception::Always: { + return tr::lng_edit_privacy_calls_p2p_always_empty(); + }; + case Exception::Never: { + return tr::lng_edit_privacy_calls_p2p_never_empty(); + }; } Unexpected("Invalid exception value."); } rpl::producer CallsPeer2PeerPrivacyController::exceptionBoxTitle( - Exception exception) { + Exception exception) const { switch (exception) { - case Exception::Always: return tr::lng_edit_privacy_calls_p2p_always_title(); - case Exception::Never: return tr::lng_edit_privacy_calls_p2p_never_title(); + case Exception::Always: { + return tr::lng_edit_privacy_calls_p2p_always_title(); + }; + case Exception::Never: { + return tr::lng_edit_privacy_calls_p2p_never_title(); + }; } Unexpected("Invalid exception value."); } -rpl::producer CallsPeer2PeerPrivacyController::exceptionsDescription() { +auto CallsPeer2PeerPrivacyController::exceptionsDescription() const +-> rpl::producer{ return tr::lng_edit_privacy_calls_p2p_exceptions(); } @@ -804,41 +840,50 @@ ForwardsPrivacyController::ForwardsPrivacyController( _chatStyle->apply(controller->defaultChatTheme().get()); } -UserPrivacy::Key ForwardsPrivacyController::key() { +UserPrivacy::Key ForwardsPrivacyController::key() const { return Key::Forwards; } -rpl::producer ForwardsPrivacyController::title() { +rpl::producer ForwardsPrivacyController::title() const { return tr::lng_edit_privacy_forwards_title(); } -rpl::producer ForwardsPrivacyController::optionsTitleKey() { +rpl::producer ForwardsPrivacyController::optionsTitleKey() const { return tr::lng_edit_privacy_forwards_header(); } -rpl::producer ForwardsPrivacyController::warning() { +auto ForwardsPrivacyController::warning() const +-> rpl::producer { return tr::lng_edit_privacy_forwards_warning(Ui::Text::WithEntities); } rpl::producer ForwardsPrivacyController::exceptionButtonTextKey( - Exception exception) { + Exception exception) const { switch (exception) { - case Exception::Always: return tr::lng_edit_privacy_forwards_always_empty(); - case Exception::Never: return tr::lng_edit_privacy_forwards_never_empty(); + case Exception::Always: { + return tr::lng_edit_privacy_forwards_always_empty(); + }; + case Exception::Never: { + return tr::lng_edit_privacy_forwards_never_empty(); + }; } Unexpected("Invalid exception value."); } rpl::producer ForwardsPrivacyController::exceptionBoxTitle( - Exception exception) { + Exception exception) const { switch (exception) { - case Exception::Always: return tr::lng_edit_privacy_forwards_always_title(); - case Exception::Never: return tr::lng_edit_privacy_forwards_never_title(); + case Exception::Always: { + return tr::lng_edit_privacy_forwards_always_title(); + }; + case Exception::Never: { + return tr::lng_edit_privacy_forwards_never_title(); + }; } Unexpected("Invalid exception value."); } -auto ForwardsPrivacyController::exceptionsDescription() +auto ForwardsPrivacyController::exceptionsDescription() const -> rpl::producer { return tr::lng_edit_privacy_forwards_exceptions(); } @@ -969,41 +1014,49 @@ HistoryView::Context ForwardsPrivacyController::elementContext() { return HistoryView::Context::ContactPreview; } -UserPrivacy::Key ProfilePhotoPrivacyController::key() { +UserPrivacy::Key ProfilePhotoPrivacyController::key() const { return Key::ProfilePhoto; } -rpl::producer ProfilePhotoPrivacyController::title() { +rpl::producer ProfilePhotoPrivacyController::title() const { return tr::lng_edit_privacy_profile_photo_title(); } -bool ProfilePhotoPrivacyController::hasOption(Option option) { +bool ProfilePhotoPrivacyController::hasOption(Option option) const { return (option != Option::Nobody); } -rpl::producer ProfilePhotoPrivacyController::optionsTitleKey() { +rpl::producer ProfilePhotoPrivacyController::optionsTitleKey() const { return tr::lng_edit_privacy_profile_photo_header(); } rpl::producer ProfilePhotoPrivacyController::exceptionButtonTextKey( - Exception exception) { + Exception exception) const { switch (exception) { - case Exception::Always: return tr::lng_edit_privacy_profile_photo_always_empty(); - case Exception::Never: return tr::lng_edit_privacy_profile_photo_never_empty(); + case Exception::Always: { + return tr::lng_edit_privacy_profile_photo_always_empty(); + }; + case Exception::Never: { + return tr::lng_edit_privacy_profile_photo_never_empty(); + }; } Unexpected("Invalid exception value."); } rpl::producer ProfilePhotoPrivacyController::exceptionBoxTitle( - Exception exception) { + Exception exception) const { switch (exception) { - case Exception::Always: return tr::lng_edit_privacy_profile_photo_always_title(); - case Exception::Never: return tr::lng_edit_privacy_profile_photo_never_title(); + case Exception::Always: { + return tr::lng_edit_privacy_profile_photo_always_title(); + }; + case Exception::Never: { + return tr::lng_edit_privacy_profile_photo_never_title(); + }; } Unexpected("Invalid exception value."); } -auto ProfilePhotoPrivacyController::exceptionsDescription() +auto ProfilePhotoPrivacyController::exceptionsDescription() const -> rpl::producer { return tr::lng_edit_privacy_profile_photo_exceptions(); } @@ -1021,24 +1074,24 @@ VoicesPrivacyController::VoicesPrivacyController( }, _lifetime); } -UserPrivacy::Key VoicesPrivacyController::key() { +UserPrivacy::Key VoicesPrivacyController::key() const { return Key::Voices; } -rpl::producer VoicesPrivacyController::title() { +rpl::producer VoicesPrivacyController::title() const { return tr::lng_edit_privacy_voices_title(); } -bool VoicesPrivacyController::hasOption(Option option) { +bool VoicesPrivacyController::hasOption(Option option) const { return (option != Option::Nobody); } -rpl::producer VoicesPrivacyController::optionsTitleKey() { +rpl::producer VoicesPrivacyController::optionsTitleKey() const { return tr::lng_edit_privacy_voices_header(); } rpl::producer VoicesPrivacyController::exceptionButtonTextKey( - Exception exception) { + Exception exception) const { switch (exception) { case Exception::Always: return tr::lng_edit_privacy_voices_always_empty(); case Exception::Never: return tr::lng_edit_privacy_voices_never_empty(); @@ -1047,7 +1100,7 @@ rpl::producer VoicesPrivacyController::exceptionButtonTextKey( } rpl::producer VoicesPrivacyController::exceptionBoxTitle( - Exception exception) { + Exception exception) const { switch (exception) { case Exception::Always: return tr::lng_edit_privacy_voices_always_title(); case Exception::Never: return tr::lng_edit_privacy_voices_never_title(); @@ -1055,7 +1108,7 @@ rpl::producer VoicesPrivacyController::exceptionBoxTitle( Unexpected("Invalid exception value."); } -auto VoicesPrivacyController::exceptionsDescription() +auto VoicesPrivacyController::exceptionsDescription() const -> rpl::producer { return tr::lng_edit_privacy_voices_exceptions(); } diff --git a/Telegram/SourceFiles/settings/settings_privacy_controllers.h b/Telegram/SourceFiles/settings/settings_privacy_controllers.h index d5eeb8042..ea9cb0ece 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_controllers.h +++ b/Telegram/SourceFiles/settings/settings_privacy_controllers.h @@ -22,7 +22,7 @@ class ChatStyle; namespace Settings { -class BlockedBoxController : public PeerListController { +class BlockedBoxController final : public PeerListController { public: explicit BlockedBoxController( not_null window); @@ -56,7 +56,7 @@ private: }; -class PhoneNumberPrivacyController : public EditPrivacyController { +class PhoneNumberPrivacyController final : public EditPrivacyController { public: using Option = EditPrivacyBox::Option; using Exception = EditPrivacyBox::Exception; @@ -64,16 +64,17 @@ public: explicit PhoneNumberPrivacyController( not_null controller); - Key key() override; + Key key() const override; - rpl::producer title() override; - rpl::producer optionsTitleKey() override; - rpl::producer warning() override; - void prepareWarningLabel(not_null warning) override; + rpl::producer title() const override; + rpl::producer optionsTitleKey() const override; + rpl::producer warning() const override; + void prepareWarningLabel(not_null warning) const override; rpl::producer exceptionButtonTextKey( - Exception exception) override; - rpl::producer exceptionBoxTitle(Exception exception) override; - rpl::producer exceptionsDescription() override; + Exception exception) const override; + rpl::producer exceptionBoxTitle( + Exception exception) const override; + rpl::producer exceptionsDescription() const override; object_ptr setupMiddleWidget( not_null controller, @@ -90,22 +91,23 @@ private: }; -class LastSeenPrivacyController : public EditPrivacyController { +class LastSeenPrivacyController final : public EditPrivacyController { public: using Option = EditPrivacyBox::Option; using Exception = EditPrivacyBox::Exception; explicit LastSeenPrivacyController(not_null<::Main::Session*> session); - Key key() override; + Key key() const override; - rpl::producer title() override; - rpl::producer optionsTitleKey() override; - rpl::producer warning() override; + rpl::producer title() const override; + rpl::producer optionsTitleKey() const override; + rpl::producer warning() const override; rpl::producer exceptionButtonTextKey( - Exception exception) override; - rpl::producer exceptionBoxTitle(Exception exception) override; - rpl::producer exceptionsDescription() override; + Exception exception) const override; + rpl::producer exceptionBoxTitle( + Exception exception) const override; + rpl::producer exceptionsDescription() const override; void confirmSave( bool someAreDisallowed, @@ -116,58 +118,61 @@ private: }; -class GroupsInvitePrivacyController : public EditPrivacyController { +class GroupsInvitePrivacyController final : public EditPrivacyController { public: using Option = EditPrivacyBox::Option; using Exception = EditPrivacyBox::Exception; - Key key() override; + Key key() const override; - rpl::producer title() override; - bool hasOption(Option option) override; - rpl::producer optionsTitleKey() override; + rpl::producer title() const override; + bool hasOption(Option option) const override; + rpl::producer optionsTitleKey() const override; rpl::producer exceptionButtonTextKey( - Exception exception) override; - rpl::producer exceptionBoxTitle(Exception exception) override; - rpl::producer exceptionsDescription() override; + Exception exception) const override; + rpl::producer exceptionBoxTitle( + Exception exception) const override; + rpl::producer exceptionsDescription() const override; }; -class CallsPrivacyController : public EditPrivacyController { +class CallsPrivacyController final : public EditPrivacyController { public: using Option = EditPrivacyBox::Option; using Exception = EditPrivacyBox::Exception; - Key key() override; + Key key() const override; - rpl::producer title() override; - rpl::producer optionsTitleKey() override; + rpl::producer title() const override; + rpl::producer optionsTitleKey() const override; rpl::producer exceptionButtonTextKey( - Exception exception) override; - rpl::producer exceptionBoxTitle(Exception exception) override; - rpl::producer exceptionsDescription() override; + Exception exception) const override; + rpl::producer exceptionBoxTitle( + Exception exception) const override; + rpl::producer exceptionsDescription() const override; object_ptr setupBelowWidget( not_null controller, - not_null parent) override; + not_null parent) const override; }; -class CallsPeer2PeerPrivacyController : public EditPrivacyController { +class CallsPeer2PeerPrivacyController final : public EditPrivacyController { public: using Option = EditPrivacyBox::Option; using Exception = EditPrivacyBox::Exception; - Key key() override; + Key key() const override; - rpl::producer title() override; - rpl::producer optionsTitleKey() override; - QString optionLabel(EditPrivacyBox::Option option) override; - rpl::producer warning() override; + rpl::producer title() const override; + rpl::producer optionsTitleKey() const override; + QString optionLabel(EditPrivacyBox::Option option) const override; + rpl::producer warning() const override; rpl::producer exceptionButtonTextKey( - Exception exception) override; - rpl::producer exceptionBoxTitle(Exception exception) override; - rpl::producer exceptionsDescription() override; + Exception exception) const override; + rpl::producer exceptionBoxTitle( + Exception exception) const override; + rpl::producer exceptionsDescription() const override; }; @@ -181,15 +186,16 @@ public: explicit ForwardsPrivacyController( not_null controller); - Key key() override; + Key key() const override; - rpl::producer title() override; - rpl::producer optionsTitleKey() override; - rpl::producer warning() override; + rpl::producer title() const override; + rpl::producer optionsTitleKey() const override; + rpl::producer warning() const override; rpl::producer exceptionButtonTextKey( - Exception exception) override; - rpl::producer exceptionBoxTitle(Exception exception) override; - rpl::producer exceptionsDescription() override; + Exception exception) const override; + rpl::producer exceptionBoxTitle( + Exception exception) const override; + rpl::producer exceptionsDescription() const override; object_ptr setupAboveWidget( not_null parent, @@ -206,39 +212,41 @@ private: }; -class ProfilePhotoPrivacyController : public EditPrivacyController { +class ProfilePhotoPrivacyController final : public EditPrivacyController { public: using Option = EditPrivacyBox::Option; using Exception = EditPrivacyBox::Exception; - Key key() override; + Key key() const override; - rpl::producer title() override; - bool hasOption(Option option) override; - rpl::producer optionsTitleKey() override; + rpl::producer title() const override; + bool hasOption(Option option) const override; + rpl::producer optionsTitleKey() const override; rpl::producer exceptionButtonTextKey( - Exception exception) override; - rpl::producer exceptionBoxTitle(Exception exception) override; - rpl::producer exceptionsDescription() override; + Exception exception) const override; + rpl::producer exceptionBoxTitle( + Exception exception) const override; + rpl::producer exceptionsDescription() const override; }; -class VoicesPrivacyController : public EditPrivacyController { +class VoicesPrivacyController final : public EditPrivacyController { public: using Option = EditPrivacyBox::Option; using Exception = EditPrivacyBox::Exception; explicit VoicesPrivacyController(not_null<::Main::Session*> session); - Key key() override; + Key key() const override; - rpl::producer title() override; - bool hasOption(Option option) override; - rpl::producer optionsTitleKey() override; + rpl::producer title() const override; + bool hasOption(Option option) const override; + rpl::producer optionsTitleKey() const override; rpl::producer exceptionButtonTextKey( - Exception exception) override; - rpl::producer exceptionBoxTitle(Exception exception) override; - rpl::producer exceptionsDescription() override; + Exception exception) const override; + rpl::producer exceptionBoxTitle( + Exception exception) const override; + rpl::producer exceptionsDescription() const override; private: rpl::lifetime _lifetime;