Allow adding Settings::Section-s without changing Type.

This commit is contained in:
John Preston 2022-04-01 15:53:23 +04:00
parent 6716c08306
commit aa7143a831
56 changed files with 318 additions and 179 deletions

View file

@ -1071,6 +1071,7 @@ PRIVATE
settings/settings_privacy_controllers.h settings/settings_privacy_controllers.h
settings/settings_privacy_security.cpp settings/settings_privacy_security.cpp
settings/settings_privacy_security.h settings/settings_privacy_security.h
settings/settings_type.h
storage/details/storage_file_utilities.cpp storage/details/storage_file_utilities.cpp
storage/details/storage_file_utilities.h storage/details/storage_file_utilities.h
storage/details/storage_settings_scheme.cpp storage/details/storage_settings_scheme.cpp
@ -1286,6 +1287,8 @@ PRIVATE
qrc/emoji_6.qrc qrc/emoji_6.qrc
qrc/emoji_7.qrc qrc/emoji_7.qrc
qrc/emoji_preview.qrc qrc/emoji_preview.qrc
qrc/telegram/animations.qrc
qrc/telegram/export.qrc
qrc/telegram/telegram.qrc qrc/telegram/telegram.qrc
qrc/telegram/sounds.qrc qrc/telegram/sounds.qrc
winrc/Telegram.rc winrc/Telegram.rc

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/animations">
<file alias="change_number.tgs">../../animations/change_number.tgs</file>
</qresource>
</RCC>

View file

@ -0,0 +1,44 @@
<RCC>
<qresource prefix="/export">
<file alias="css/style.css">../../export_html/css/style.css</file>
<file alias="images/back.png">../../export_html/images/back.png</file>
<file alias="images/back@2x.png">../../export_html/images/back@2x.png</file>
<file alias="images/media_call.png">../../export_html/images/media_call.png</file>
<file alias="images/media_call@2x.png">../../export_html/images/media_call@2x.png</file>
<file alias="images/media_contact.png">../../export_html/images/media_contact.png</file>
<file alias="images/media_contact@2x.png">../../export_html/images/media_contact@2x.png</file>
<file alias="images/media_file.png">../../export_html/images/media_file.png</file>
<file alias="images/media_file@2x.png">../../export_html/images/media_file@2x.png</file>
<file alias="images/media_game.png">../../export_html/images/media_game.png</file>
<file alias="images/media_game@2x.png">../../export_html/images/media_game@2x.png</file>
<file alias="images/media_location.png">../../export_html/images/media_location.png</file>
<file alias="images/media_location@2x.png">../../export_html/images/media_location@2x.png</file>
<file alias="images/media_music.png">../../export_html/images/media_music.png</file>
<file alias="images/media_music@2x.png">../../export_html/images/media_music@2x.png</file>
<file alias="images/media_photo.png">../../export_html/images/media_photo.png</file>
<file alias="images/media_photo@2x.png">../../export_html/images/media_photo@2x.png</file>
<file alias="images/media_shop.png">../../export_html/images/media_shop.png</file>
<file alias="images/media_shop@2x.png">../../export_html/images/media_shop@2x.png</file>
<file alias="images/media_video.png">../../export_html/images/media_video.png</file>
<file alias="images/media_video@2x.png">../../export_html/images/media_video@2x.png</file>
<file alias="images/media_voice.png">../../export_html/images/media_voice.png</file>
<file alias="images/media_voice@2x.png">../../export_html/images/media_voice@2x.png</file>
<file alias="images/section_calls.png">../../export_html/images/section_calls.png</file>
<file alias="images/section_calls@2x.png">../../export_html/images/section_calls@2x.png</file>
<file alias="images/section_chats.png">../../export_html/images/section_chats.png</file>
<file alias="images/section_chats@2x.png">../../export_html/images/section_chats@2x.png</file>
<file alias="images/section_contacts.png">../../export_html/images/section_contacts.png</file>
<file alias="images/section_contacts@2x.png">../../export_html/images/section_contacts@2x.png</file>
<file alias="images/section_frequent.png">../../export_html/images/section_frequent.png</file>
<file alias="images/section_frequent@2x.png">../../export_html/images/section_frequent@2x.png</file>
<file alias="images/section_other.png">../../export_html/images/section_other.png</file>
<file alias="images/section_other@2x.png">../../export_html/images/section_other@2x.png</file>
<file alias="images/section_photos.png">../../export_html/images/section_photos.png</file>
<file alias="images/section_photos@2x.png">../../export_html/images/section_photos@2x.png</file>
<file alias="images/section_sessions.png">../../export_html/images/section_sessions.png</file>
<file alias="images/section_sessions@2x.png">../../export_html/images/section_sessions@2x.png</file>
<file alias="images/section_web.png">../../export_html/images/section_web.png</file>
<file alias="images/section_web@2x.png">../../export_html/images/section_web@2x.png</file>
<file alias="js/script.js">../../export_html/js/script.js</file>
</qresource>
</RCC>

View file

@ -1,46 +1,4 @@
<RCC> <RCC>
<qresource prefix="/export">
<file alias="css/style.css">../../export_html/css/style.css</file>
<file alias="images/back.png">../../export_html/images/back.png</file>
<file alias="images/back@2x.png">../../export_html/images/back@2x.png</file>
<file alias="images/media_call.png">../../export_html/images/media_call.png</file>
<file alias="images/media_call@2x.png">../../export_html/images/media_call@2x.png</file>
<file alias="images/media_contact.png">../../export_html/images/media_contact.png</file>
<file alias="images/media_contact@2x.png">../../export_html/images/media_contact@2x.png</file>
<file alias="images/media_file.png">../../export_html/images/media_file.png</file>
<file alias="images/media_file@2x.png">../../export_html/images/media_file@2x.png</file>
<file alias="images/media_game.png">../../export_html/images/media_game.png</file>
<file alias="images/media_game@2x.png">../../export_html/images/media_game@2x.png</file>
<file alias="images/media_location.png">../../export_html/images/media_location.png</file>
<file alias="images/media_location@2x.png">../../export_html/images/media_location@2x.png</file>
<file alias="images/media_music.png">../../export_html/images/media_music.png</file>
<file alias="images/media_music@2x.png">../../export_html/images/media_music@2x.png</file>
<file alias="images/media_photo.png">../../export_html/images/media_photo.png</file>
<file alias="images/media_photo@2x.png">../../export_html/images/media_photo@2x.png</file>
<file alias="images/media_shop.png">../../export_html/images/media_shop.png</file>
<file alias="images/media_shop@2x.png">../../export_html/images/media_shop@2x.png</file>
<file alias="images/media_video.png">../../export_html/images/media_video.png</file>
<file alias="images/media_video@2x.png">../../export_html/images/media_video@2x.png</file>
<file alias="images/media_voice.png">../../export_html/images/media_voice.png</file>
<file alias="images/media_voice@2x.png">../../export_html/images/media_voice@2x.png</file>
<file alias="images/section_calls.png">../../export_html/images/section_calls.png</file>
<file alias="images/section_calls@2x.png">../../export_html/images/section_calls@2x.png</file>
<file alias="images/section_chats.png">../../export_html/images/section_chats.png</file>
<file alias="images/section_chats@2x.png">../../export_html/images/section_chats@2x.png</file>
<file alias="images/section_contacts.png">../../export_html/images/section_contacts.png</file>
<file alias="images/section_contacts@2x.png">../../export_html/images/section_contacts@2x.png</file>
<file alias="images/section_frequent.png">../../export_html/images/section_frequent.png</file>
<file alias="images/section_frequent@2x.png">../../export_html/images/section_frequent@2x.png</file>
<file alias="images/section_other.png">../../export_html/images/section_other.png</file>
<file alias="images/section_other@2x.png">../../export_html/images/section_other@2x.png</file>
<file alias="images/section_photos.png">../../export_html/images/section_photos.png</file>
<file alias="images/section_photos@2x.png">../../export_html/images/section_photos@2x.png</file>
<file alias="images/section_sessions.png">../../export_html/images/section_sessions.png</file>
<file alias="images/section_sessions@2x.png">../../export_html/images/section_sessions@2x.png</file>
<file alias="images/section_web.png">../../export_html/images/section_web.png</file>
<file alias="images/section_web@2x.png">../../export_html/images/section_web@2x.png</file>
<file alias="js/script.js">../../export_html/js/script.js</file>
</qresource>
<qresource prefix="/gui"> <qresource prefix="/gui">
<file alias="art/background.tgv">../../art/background.tgv</file> <file alias="art/background.tgv">../../art/background.tgv</file>
<file alias="art/bg_thumbnail.png">../../art/bg_thumbnail.png</file> <file alias="art/bg_thumbnail.png">../../art/bg_thumbnail.png</file>

View file

@ -576,17 +576,13 @@ colorValueInput: InputField(defaultInputField) {
colorResultInput: InputField(colorValueInput) { colorResultInput: InputField(colorValueInput) {
} }
changePhoneIcon: icon {
{ "phone_simcard_from", changePhoneSimcardFrom },
{ "phone_simcard_migrate", changePhoneSimcardTo, point(30px, 11px) },
{ "phone_simcard_to", changePhoneSimcardTo, point(78px, 0px) }
};
changePhoneDescription: FlatLabel(boxLabel) { changePhoneDescription: FlatLabel(boxLabel) {
minWidth: 332px; minWidth: 332px;
align: align(top); align: align(top);
} }
changePhoneIconTop: 20px; changePhoneIconTop: 16px;
changePhoneDescriptionTop: 96px; changePhoneIconSize: 96px;
changePhoneDescriptionTop: 128px;
changePhoneLabel: FlatLabel(defaultFlatLabel) { changePhoneLabel: FlatLabel(defaultFlatLabel) {
minWidth: 275px; minWidth: 275px;
textFg: windowSubTextFg; textFg: windowSubTextFg;

View file

@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h" #include "data/data_session.h"
#include "data/data_user.h" #include "data/data_user.h"
#include "mtproto/sender.h" #include "mtproto/sender.h"
#include "lottie/lottie_icon.h"
#include "apiwrap.h" #include "apiwrap.h"
#include "window/window_session_controller.h" #include "window/window_session_controller.h"
#include "styles/style_layers.h" #include "styles/style_layers.h"
@ -66,6 +67,26 @@ void CreateErrorLabel(
} // namespace } // namespace
namespace Settings {
ChangePhone::ChangePhone(
QWidget *parent,
not_null<Window::SessionController*> controller)
: Section(parent) {
setupContent(controller);
}
rpl::producer<QString> ChangePhone::Title() {
return tr::lng_change_phone_button();
}
void ChangePhone::setupContent(
not_null<Window::SessionController*> controller) {
}
} // namespace Settings
class ChangePhoneBox::EnterPhone : public Ui::BoxContent { class ChangePhoneBox::EnterPhone : public Ui::BoxContent {
public: public:
EnterPhone(QWidget*, not_null<Window::SessionController*> controller); EnterPhone(QWidget*, not_null<Window::SessionController*> controller);
@ -434,7 +455,22 @@ void ChangePhoneBox::EnterCode::sendCodeFail(const MTP::Error &error) {
ChangePhoneBox::ChangePhoneBox( ChangePhoneBox::ChangePhoneBox(
QWidget*, QWidget*,
not_null<Window::SessionController*> controller) not_null<Window::SessionController*> controller)
: _controller(controller) { : _controller(controller)
, _icon(Lottie::MakeIcon({
.name = u"change_number"_q,
.sizeOverride = {
st::changePhoneIconSize,
st::changePhoneIconSize,
},
})) {
}
void ChangePhoneBox::showFinished() {
animateIcon();
}
void ChangePhoneBox::animateIcon() {
_icon->animate([=] { update(); }, 0, _icon->framesCount());
} }
void ChangePhoneBox::prepare() { void ChangePhoneBox::prepare() {
@ -473,9 +509,9 @@ void ChangePhoneBox::paintEvent(QPaintEvent *e) {
BoxContent::paintEvent(e); BoxContent::paintEvent(e);
Painter p(this); Painter p(this);
st::changePhoneIcon.paint( const auto left = (width() - st::changePhoneIconSize) / 2;
p, _icon->paint(p, left, st::changePhoneIconTop);
(width() - st::changePhoneIcon.width()) / 2, if (!_icon->animating() && _icon->frameIndex() > 0) {
st::changePhoneIconTop, animateIcon();
width()); }
} }

View file

@ -8,14 +8,40 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#pragma once #pragma once
#include "boxes/abstract_box.h" #include "boxes/abstract_box.h"
#include "settings/settings_common.h"
namespace Lottie {
class Icon;
} // namespace Lottie
namespace Window { namespace Window {
class SessionController; class SessionController;
} // namespace Window } // namespace Window
namespace Settings {
class ChangePhone : public Section<ChangePhone> {
public:
ChangePhone(
QWidget *parent,
not_null<Window::SessionController*> controller);
[[nodiscard]] static rpl::producer<QString> Title();
private:
void setupContent(not_null<Window::SessionController*> controller);
};
} // namespace Settings
class ChangePhoneBox : public Ui::BoxContent { class ChangePhoneBox : public Ui::BoxContent {
public: public:
ChangePhoneBox(QWidget*, not_null<Window::SessionController*> controller); ChangePhoneBox(
QWidget*,
not_null<Window::SessionController*> controller);
void showFinished() override;
protected: protected:
void prepare() override; void prepare() override;
@ -23,10 +49,13 @@ protected:
void paintEvent(QPaintEvent *e) override; void paintEvent(QPaintEvent *e) override;
private: private:
void animateIcon();
class EnterPhone; class EnterPhone;
class EnterCode; class EnterCode;
const not_null<Window::SessionController*> _controller; const not_null<Window::SessionController*> _controller;
const std::unique_ptr<Lottie::Icon> _icon;
}; };

View file

@ -53,7 +53,7 @@ void AddReactionIcon(
}, icon->lifetime()); }, icon->lifetime());
const auto initLottie = [=] { const auto initLottie = [=] {
state->icon = std::make_unique<Lottie::Icon>(Lottie::IconDescriptor{ state->icon = Lottie::MakeIcon({
.path = state->media->owner()->filepath(true), .path = state->media->owner()->filepath(true),
.json = state->media->bytes(), .json = state->media->bytes(),
.sizeOverride = QSize(size, size), .sizeOverride = QSize(size, size),

View file

@ -289,7 +289,7 @@ void RenameBox(not_null<Ui::GenericBox*> box) {
Unexpected("Type in LottieForType."); Unexpected("Type in LottieForType.");
}(); }();
const auto size = st::sessionBigLottieSize; const auto size = st::sessionBigLottieSize;
return std::make_unique<Lottie::Icon>(Lottie::IconDescriptor{ return Lottie::MakeIcon({
.path = u":/icons/settings/devices/"_q + path + u".lottie"_q, .path = u":/icons/settings/devices/"_q + path + u".lottie"_q,
.sizeOverride = QSize(size, size), .sizeOverride = QSize(size, size),
}); });
@ -1163,6 +1163,10 @@ Sessions::Sessions(
setupContent(controller); setupContent(controller);
} }
rpl::producer<QString> Sessions::Title() {
return tr::lng_settings_sessions_title();
}
void Sessions::setupContent(not_null<Window::SessionController*> controller) { void Sessions::setupContent(not_null<Window::SessionController*> controller) {
const auto container = Ui::CreateChild<Ui::VerticalLayout>(this); const auto container = Ui::CreateChild<Ui::VerticalLayout>(this);
AddSkip(container, st::settingsPrivacySkip); AddSkip(container, st::settingsPrivacySkip);

View file

@ -16,12 +16,14 @@ class Session;
namespace Settings { namespace Settings {
class Sessions : public Section { class Sessions : public Section<Sessions> {
public: public:
Sessions( Sessions(
QWidget *parent, QWidget *parent,
not_null<Window::SessionController*> controller); not_null<Window::SessionController*> controller);
[[nodiscard]] static rpl::producer<QString> Title();
private: private:
void setupContent(not_null<Window::SessionController*> controller); void setupContent(not_null<Window::SessionController*> controller);

View file

@ -38,6 +38,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_controller.h" #include "window/window_controller.h"
#include "window/themes/window_theme_editor_box.h" // GenerateSlug. #include "window/themes/window_theme_editor_box.h" // GenerateSlug.
#include "settings/settings_common.h" #include "settings/settings_common.h"
#include "settings/settings_folders.h"
#include "settings/settings_main.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "main/main_session.h" #include "main/main_session.h"
#include "main/main_session_settings.h" #include "main/main_session_settings.h"
@ -435,10 +437,10 @@ bool ResolveSettings(
controller->session().api().authorizations().reload(); controller->session().api().authorizations().reload();
} }
const auto type = (section == qstr("folders")) const auto type = (section == qstr("folders"))
? ::Settings::Type::Folders ? ::Settings::Folders::Id()
: (section == qstr("devices")) : (section == qstr("devices"))
? ::Settings::Type::Sessions ? ::Settings::Sessions::Id()
: ::Settings::Type::Main; : ::Settings::Main::Id();
controller->showSettings(type); controller->showSettings(type);
return true; return true;
} }

View file

@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/info_memento.h" #include "info/info_memento.h"
#include "info/settings/info_settings_widget.h" #include "info/settings/info_settings_widget.h"
#include "window/window_session_controller.h" #include "window/window_session_controller.h"
#include "settings/settings_advanced.h"
#include "settings/settings_intro.h" #include "settings/settings_intro.h"
#include "ui/layers/box_content.h" #include "ui/layers/box_content.h"
@ -1652,7 +1653,7 @@ void UpdateApplication() {
controller->showSection( controller->showSection(
std::make_shared<Info::Memento>( std::make_shared<Info::Memento>(
Info::Settings::Tag{ controller->session().user() }, Info::Settings::Tag{ controller->session().user() },
Info::Section::SettingsType::Advanced), ::Settings::Advanced::Id()),
Window::SectionShow()); Window::SectionShow());
} else { } else {
window->showSpecialLayer( window->showSpecialLayer(

View file

@ -234,7 +234,7 @@ void Reactions::loadImage(
void Reactions::setLottie(ImageSet &set) { void Reactions::setLottie(ImageSet &set) {
const auto size = style::ConvertScale(kSizeForDownscale); const auto size = style::ConvertScale(kSizeForDownscale);
set.icon = std::make_unique<Lottie::Icon>(Lottie::IconDescriptor{ set.icon = Lottie::MakeIcon({
.path = set.media->owner()->filepath(true), .path = set.media->owner()->filepath(true),
.json = set.media->bytes(), .json = set.media->bytes(),
.sizeOverride = QSize(size, size), .sizeOverride = QSize(size, size),

View file

@ -45,7 +45,7 @@ Animation::Animation(
if (!media || !media->loaded()) { if (!media || !media->loaded()) {
return false; return false;
} }
icon = std::make_unique<Lottie::Icon>(Lottie::IconDescriptor{ icon = Lottie::MakeIcon({
.path = document->filepath(true), .path = document->filepath(true),
.json = media->bytes(), .json = media->bytes(),
.sizeOverride = QSize(size, size), .sizeOverride = QSize(size, size),

View file

@ -617,29 +617,7 @@ rpl::producer<QString> TitleValue(
return tr::lng_profile_participants_section(); return tr::lng_profile_participants_section();
case Section::Type::Settings: case Section::Type::Settings:
switch (section.settingsType()) { return section.settingsType()()->title();
case Section::SettingsType::Main:
return tr::lng_menu_settings();
case Section::SettingsType::Information:
return tr::lng_settings_section_info();
case Section::SettingsType::Notifications:
return tr::lng_settings_section_notify();
case Section::SettingsType::PrivacySecurity:
return tr::lng_settings_section_privacy();
case Section::SettingsType::Sessions:
return tr::lng_settings_sessions_title();
case Section::SettingsType::Advanced:
return tr::lng_settings_advanced();
case Section::SettingsType::Chat:
return tr::lng_settings_section_chat_settings();
case Section::SettingsType::Folders:
return tr::lng_filters_title();
case Section::SettingsType::Calls:
return tr::lng_settings_section_call_settings();
case Section::SettingsType::Experimental:
return tr::lng_settings_experimental();
}
Unexpected("Bad settings type in Info::TitleValue()");
case Section::Type::PollResults: case Section::Type::PollResults:
return key.poll()->quiz() return key.poll()->quiz()

View file

@ -14,6 +14,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/info_controller.h" #include "info/info_controller.h"
#include "info/info_memento.h" #include "info/info_memento.h"
#include "info/info_top_bar.h" #include "info/info_top_bar.h"
#include "settings/settings_chat.h"
#include "settings/settings_main.h"
#include "ui/widgets/discrete_sliders.h" #include "ui/widgets/discrete_sliders.h"
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/shadow.h" #include "ui/widgets/shadow.h"
@ -395,8 +397,8 @@ void WrapWidget::createTopBar() {
addTopBarMenuButton(); addTopBarMenuButton();
addProfileCallsButton(); addProfileCallsButton();
} else if (section.type() == Section::Type::Settings } else if (section.type() == Section::Type::Settings
&& (section.settingsType() == Section::SettingsType::Main && (section.settingsType() == ::Settings::Main::Id()
|| section.settingsType() == Section::SettingsType::Chat)) { || section.settingsType() == ::Settings::Chat::Id())) {
addTopBarMenuButton(); addTopBarMenuButton();
} else if (section.type() == Section::Type::Downloads) { } else if (section.type() == Section::Type::Downloads) {
auto &manager = Core::App().downloadManager(); auto &manager = Core::App().downloadManager();

View file

@ -10,6 +10,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/info_memento.h" #include "info/info_memento.h"
#include "info/info_controller.h" #include "info/info_controller.h"
#include "settings/settings_common.h" #include "settings/settings_common.h"
#include "settings/settings_main.h"
#include "settings/settings_information.h"
#include "ui/ui_utility.h" #include "ui/ui_utility.h"
namespace Info { namespace Info {
@ -43,11 +45,9 @@ Widget::Widget(
: ContentWidget(parent, controller) : ContentWidget(parent, controller)
, _self(controller->key().settingsSelf()) , _self(controller->key().settingsSelf())
, _type(controller->section().settingsType()) , _type(controller->section().settingsType())
, _inner(setInnerWidget( , _inner(
::Settings::CreateSection( setInnerWidget(
_type, _type()->create(this, controller->parentController()))) {
this,
controller->parentController()))) {
_inner->sectionShowOther( _inner->sectionShowOther(
) | rpl::start_with_next([=](Type type) { ) | rpl::start_with_next([=](Type type) {
controller->showSettings(type); controller->showSettings(type);
@ -84,7 +84,8 @@ void Widget::saveChanges(FnMut<void()> done) {
} }
rpl::producer<bool> Widget::desiredShadowVisibility() const { rpl::producer<bool> Widget::desiredShadowVisibility() const {
return (_type == Type::Main || _type == Type::Information) return (_type == ::Settings::Main::Id()
|| _type == ::Settings::Information::Id())
? ContentWidget::desiredShadowVisibility() ? ContentWidget::desiredShadowVisibility()
: rpl::single(true); : rpl::single(true);
} }

View file

@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/info_controller.h" #include "info/info_controller.h"
namespace Settings { namespace Settings {
class Section; class AbstractSection;
} // namespace Settings } // namespace Settings
namespace Info { namespace Info {
@ -76,7 +76,7 @@ private:
not_null<UserData*> _self; not_null<UserData*> _self;
Type _type = Type(); Type _type = Type();
not_null<::Settings::Section*> _inner; not_null<::Settings::AbstractSection*> _inner;
}; };

View file

@ -682,6 +682,12 @@ std::unique_ptr<Ui::DropdownMenu> MakeAttachBotsMenu(
const auto raw = result.get(); const auto raw = result.get();
const auto refresh = [=] { const auto refresh = [=] {
raw->clearActions(); raw->clearActions();
raw->addAction(u"Photo or video"_q, [=] {
});
raw->addAction(u"Document"_q, [=] {
});
for (const auto &bot : bots->attachBots()) { for (const auto &bot : bots->attachBots()) {
const auto callback = [=] { const auto callback = [=] {
const auto active = controller->activeChatCurrent(); const auto active = controller->activeChatCurrent();

View file

@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "settings/settings_common.h" #include "settings/settings_common.h"
#include "settings/settings_chat.h" #include "settings/settings_chat.h"
#include "settings/settings_experimental.h"
#include "ui/wrap/vertical_layout.h" #include "ui/wrap/vertical_layout.h"
#include "ui/wrap/slide_wrap.h" #include "ui/wrap/slide_wrap.h"
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
@ -133,7 +134,7 @@ void SetupUpdate(
experimental->toggleOn(install->toggledValue()); experimental->toggleOn(install->toggledValue());
} }
experimental->entity()->setClickedCallback([=] { experimental->entity()->setClickedCallback([=] {
showOther(Type::Experimental); showOther(Experimental::Id());
}); });
} }
@ -740,6 +741,10 @@ Advanced::Advanced(
setupContent(controller); setupContent(controller);
} }
rpl::producer<QString> Advanced::Title() {
return tr::lng_settings_advanced();
}
rpl::producer<Type> Advanced::sectionShowOther() { rpl::producer<Type> Advanced::sectionShowOther() {
return _showOther.events(); return _showOther.events();
} }

View file

@ -21,7 +21,7 @@ namespace Settings {
void SetupConnectionType( void SetupConnectionType(
not_null<Window::Controller*> controller, not_null<Window::Controller*> controller,
not_null<Main::Account*> account, not_null<::Main::Account*> account,
not_null<Ui::VerticalLayout*> container); not_null<Ui::VerticalLayout*> container);
bool HasUpdate(); bool HasUpdate();
void SetupUpdate( void SetupUpdate(
@ -32,12 +32,14 @@ void SetupSystemIntegrationContent(
not_null<Ui::VerticalLayout*> container); not_null<Ui::VerticalLayout*> container);
void SetupAnimations(not_null<Ui::VerticalLayout*> container); void SetupAnimations(not_null<Ui::VerticalLayout*> container);
class Advanced : public Section { class Advanced : public Section<Advanced> {
public: public:
Advanced( Advanced(
QWidget *parent, QWidget *parent,
not_null<Window::SessionController*> controller); not_null<Window::SessionController*> controller);
[[nodiscard]] static rpl::producer<QString> Title();
rpl::producer<Type> sectionShowOther() override; rpl::producer<Type> sectionShowOther() override;
private: private:

View file

@ -56,6 +56,10 @@ Calls::Calls(
Calls::~Calls() = default; Calls::~Calls() = default;
rpl::producer<QString> Calls::Title() {
return tr::lng_settings_section_call_settings();
}
Webrtc::VideoTrack *Calls::AddCameraSubsection( Webrtc::VideoTrack *Calls::AddCameraSubsection(
std::shared_ptr<Ui::Show> show, std::shared_ptr<Ui::Show> show,
not_null<Ui::VerticalLayout*> content, not_null<Ui::VerticalLayout*> content,

View file

@ -33,11 +33,13 @@ class VideoTrack;
namespace Settings { namespace Settings {
class Calls : public Section { class Calls : public Section<Calls> {
public: public:
Calls(QWidget *parent, not_null<Window::SessionController*> controller); Calls(QWidget *parent, not_null<Window::SessionController*> controller);
~Calls(); ~Calls();
[[nodiscard]] static rpl::producer<QString> Title();
void sectionSaveChanges(FnMut<void()> done) override; void sectionSaveChanges(FnMut<void()> done) override;
static Webrtc::VideoTrack *AddCameraSubsection( static Webrtc::VideoTrack *AddCameraSubsection(

View file

@ -1513,6 +1513,10 @@ Chat::Chat(QWidget *parent, not_null<Window::SessionController*> controller)
setupContent(controller); setupContent(controller);
} }
rpl::producer<QString> Chat::Title() {
return tr::lng_settings_section_chat_settings();
}
void Chat::setupContent(not_null<Window::SessionController*> controller) { void Chat::setupContent(not_null<Window::SessionController*> controller) {
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this); const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);

View file

@ -31,10 +31,12 @@ void SetupExport(
not_null<Window::SessionController*> controller, not_null<Window::SessionController*> controller,
not_null<Ui::VerticalLayout*> container); not_null<Ui::VerticalLayout*> container);
class Chat : public Section { class Chat : public Section<Chat> {
public: public:
Chat(QWidget *parent, not_null<Window::SessionController*> controller); Chat(QWidget *parent, not_null<Window::SessionController*> controller);
[[nodiscard]] static rpl::producer<QString> Title();
private: private:
void setupContent(not_null<Window::SessionController*> controller); void setupContent(not_null<Window::SessionController*> controller);

View file

@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_session_controller.h" #include "window/window_session_controller.h"
#include "media/audio/media_audio_track.h" #include "media/audio/media_audio_track.h"
#include "settings/settings_common.h" #include "settings/settings_common.h"
#include "settings/settings_folders.h"
#include "api/api_updates.h" #include "api/api_updates.h"
#include "base/qt/qt_common_adapters.h" #include "base/qt/qt_common_adapters.h"
#include "base/custom_app_icon.h" #include "base/custom_app_icon.h"
@ -171,7 +172,7 @@ auto GenerateCodes() {
}); });
codes.emplace(qsl("folders"), [](SessionController *window) { codes.emplace(qsl("folders"), [](SessionController *window) {
if (window) { if (window) {
window->showSettings(Settings::Type::Folders); window->showSettings(Settings::Folders::Id());
} }
}); });
codes.emplace(qsl("registertg"), [](SessionController *window) { codes.emplace(qsl("registertg"), [](SessionController *window) {

View file

@ -106,35 +106,6 @@ QSize Icon::size() const {
return _icon->size(); return _icon->size();
} }
object_ptr<Section> CreateSection(
Type type,
not_null<QWidget*> parent,
not_null<Window::SessionController*> controller) {
switch (type) {
case Type::Main:
return object_ptr<Main>(parent, controller);
case Type::Information:
return object_ptr<Information>(parent, controller);
case Type::Notifications:
return object_ptr<Notifications>(parent, controller);
case Type::PrivacySecurity:
return object_ptr<PrivacySecurity>(parent, controller);
case Type::Sessions:
return object_ptr<Sessions>(parent, controller);
case Type::Advanced:
return object_ptr<Advanced>(parent, controller);
case Type::Folders:
return object_ptr<Folders>(parent, controller);
case Type::Chat:
return object_ptr<Chat>(parent, controller);
case Type::Calls:
return object_ptr<Calls>(parent, controller);
case Type::Experimental:
return object_ptr<Experimental>(parent, controller);
}
Unexpected("Settings section type in Widget::createInnerWidget.");
}
void AddSkip(not_null<Ui::VerticalLayout*> container) { void AddSkip(not_null<Ui::VerticalLayout*> container) {
AddSkip(container, st::settingsSectionSkip); AddSkip(container, st::settingsSectionSkip);
} }
@ -278,7 +249,7 @@ void FillMenu(
Fn<void(Type)> showOther, Fn<void(Type)> showOther,
MenuCallback addAction) { MenuCallback addAction) {
const auto window = &controller->window(); const auto window = &controller->window();
if (type == Type::Chat) { if (type == Chat::Id()) {
addAction( addAction(
tr::lng_settings_bg_theme_create(tr::now), tr::lng_settings_bg_theme_create(tr::now),
[=] { window->show(Box(Window::Theme::CreateBox, window)); }, [=] { window->show(Box(Window::Theme::CreateBox, window)); },
@ -293,7 +264,7 @@ void FillMenu(
if (!controller->session().supportMode()) { if (!controller->session().supportMode()) {
addAction( addAction(
tr::lng_settings_information(tr::now), tr::lng_settings_information(tr::now),
[=] { showOther(Type::Information); }, [=] { showOther(Information::Id()); },
&st::menuIconInfo); &st::menuIconInfo);
} }
addAction( addAction(

View file

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/rp_widget.h" #include "ui/rp_widget.h"
#include "ui/round_rect.h" #include "ui/round_rect.h"
#include "base/object_ptr.h" #include "base/object_ptr.h"
#include "settings/settings_type.h"
namespace Main { namespace Main {
class Session; class Session;
@ -35,32 +36,59 @@ namespace Settings {
extern const char kOptionMonoSettingsIcons[]; extern const char kOptionMonoSettingsIcons[];
enum class Type {
Main,
Information,
Notifications,
PrivacySecurity,
Sessions,
Advanced,
Chat,
Folders,
Calls,
Experimental,
};
using Button = Ui::SettingsButton; using Button = Ui::SettingsButton;
class Section : public Ui::RpWidget { class AbstractSection;
struct SectionMeta {
[[nodiscard]] virtual object_ptr<AbstractSection> create(
not_null<QWidget*> parent,
not_null<Window::SessionController*> controller) const = 0;
[[nodiscard]] virtual rpl::producer<QString> title() const = 0;
};
template <typename SectionType>
struct SectionMetaImplementation : SectionMeta {
object_ptr<AbstractSection> create(
not_null<QWidget*> parent,
not_null<Window::SessionController*> controller
) const final override {
return object_ptr<SectionType>(parent, controller);
}
rpl::producer<QString> title() const final override {
return SectionType::Title();
}
[[nodiscard]] static not_null<SectionMeta*> Meta() {
static SectionMetaImplementation result;
return &result;
}
};
class AbstractSection : public Ui::RpWidget {
public: public:
using RpWidget::RpWidget; using RpWidget::RpWidget;
virtual rpl::producer<Type> sectionShowOther() { [[nodiscard]] virtual Type id() const = 0;
[[nodiscard]] virtual rpl::producer<Type> sectionShowOther() {
return nullptr; return nullptr;
} }
virtual void sectionSaveChanges(FnMut<void()> done) { virtual void sectionSaveChanges(FnMut<void()> done) {
done(); done();
} }
};
template <typename SectionType>
class Section : public AbstractSection {
public:
using AbstractSection::AbstractSection;
[[nodiscard]] static Type Id() {
return &SectionMetaImplementation<SectionType>::Meta;
}
[[nodiscard]] Type id() const final override {
return Id();
}
}; };
inline constexpr auto kIconRed = 1; inline constexpr auto kIconRed = 1;
@ -105,11 +133,6 @@ private:
}; };
object_ptr<Section> CreateSection(
Type type,
not_null<QWidget*> parent,
not_null<Window::SessionController*> controller);
void AddSkip(not_null<Ui::VerticalLayout*> container); void AddSkip(not_null<Ui::VerticalLayout*> container);
void AddSkip(not_null<Ui::VerticalLayout*> container, int skip); void AddSkip(not_null<Ui::VerticalLayout*> container, int skip);
void AddDivider(not_null<Ui::VerticalLayout*> container); void AddDivider(not_null<Ui::VerticalLayout*> container);

View file

@ -146,6 +146,10 @@ Experimental::Experimental(
setupContent(controller); setupContent(controller);
} }
rpl::producer<QString> Experimental::Title() {
return tr::lng_settings_experimental();
}
void Experimental::setupContent( void Experimental::setupContent(
not_null<Window::SessionController*> controller) { not_null<Window::SessionController*> controller) {
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this); const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);

View file

@ -11,12 +11,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Settings { namespace Settings {
class Experimental : public Section { class Experimental : public Section<Experimental> {
public: public:
Experimental( Experimental(
QWidget *parent, QWidget *parent,
not_null<Window::SessionController*> controller); not_null<Window::SessionController*> controller);
[[nodiscard]] static rpl::producer<QString> Title();
private: private:
void setupContent(not_null<Window::SessionController*> controller); void setupContent(not_null<Window::SessionController*> controller);

View file

@ -580,6 +580,10 @@ Folders::~Folders() {
} }
} }
rpl::producer<QString> Folders::Title() {
return tr::lng_filters_title();
}
void Folders::setupContent(not_null<Window::SessionController*> controller) { void Folders::setupContent(not_null<Window::SessionController*> controller) {
controller->session().data().chatsFilters().requestSuggested(); controller->session().data().chatsFilters().requestSuggested();

View file

@ -11,13 +11,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Settings { namespace Settings {
class Folders : public Section { class Folders : public Section<Folders> {
public: public:
Folders( Folders(
QWidget *parent, QWidget *parent,
not_null<Window::SessionController*> controller); not_null<Window::SessionController*> controller);
~Folders(); ~Folders();
[[nodiscard]] static rpl::producer<QString> Title();
private: private:
void setupContent(not_null<Window::SessionController*> controller); void setupContent(not_null<Window::SessionController*> controller);

View file

@ -793,6 +793,10 @@ Information::Information(
setupContent(controller); setupContent(controller);
} }
rpl::producer<QString> Information::Title() {
return tr::lng_settings_section_info();
}
void Information::setupContent( void Information::setupContent(
not_null<Window::SessionController*> controller) { not_null<Window::SessionController*> controller) {
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this); const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);

View file

@ -15,12 +15,14 @@ struct UnreadBadgeStyle;
namespace Settings { namespace Settings {
class Information : public Section { class Information : public Section<Information> {
public: public:
Information( Information(
QWidget *parent, QWidget *parent,
not_null<Window::SessionController*> controller); not_null<Window::SessionController*> controller);
[[nodiscard]] static rpl::producer<QString> Title();
private: private:
void setupContent(not_null<Window::SessionController*> controller); void setupContent(not_null<Window::SessionController*> controller);

View file

@ -10,6 +10,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "settings/settings_common.h" #include "settings/settings_common.h"
#include "settings/settings_codes.h" #include "settings/settings_codes.h"
#include "settings/settings_chat.h" #include "settings/settings_chat.h"
#include "settings/settings_information.h"
#include "settings/settings_notifications.h"
#include "settings/settings_privacy_security.h"
#include "settings/settings_advanced.h"
#include "settings/settings_folders.h"
#include "settings/settings_calls.h"
#include "boxes/language_box.h" #include "boxes/language_box.h"
#include "boxes/username_box.h" #include "boxes/username_box.h"
#include "ui/boxes/confirm_box.h" #include "ui/boxes/confirm_box.h"
@ -251,20 +257,20 @@ void SetupSections(
} else { } else {
addSection( addSection(
tr::lng_settings_information(), tr::lng_settings_information(),
Type::Information, Information::Id(),
{ &st::settingsIconAccount, kIconLightOrange }); { &st::settingsIconAccount, kIconLightOrange });
} }
addSection( addSection(
tr::lng_settings_section_notify(), tr::lng_settings_section_notify(),
Type::Notifications, Notifications::Id(),
{ &st::settingsIconNotifications, kIconRed }); { &st::settingsIconNotifications, kIconRed });
addSection( addSection(
tr::lng_settings_section_privacy(), tr::lng_settings_section_privacy(),
Type::PrivacySecurity, PrivacySecurity::Id(),
{ &st::settingsIconLock, kIconGreen }); { &st::settingsIconLock, kIconGreen });
addSection( addSection(
tr::lng_settings_section_chat_settings(), tr::lng_settings_section_chat_settings(),
Type::Chat, Chat::Id(),
{ &st::settingsIconChat, kIconLightBlue }); { &st::settingsIconChat, kIconLightBlue });
const auto preload = [=] { const auto preload = [=] {
@ -307,16 +313,16 @@ void SetupSections(
) | rpl::before_next(preloadIfEnabled)); ) | rpl::before_next(preloadIfEnabled));
} }
slided->entity()->setClickedCallback([=] { slided->entity()->setClickedCallback([=] {
showOther(Type::Folders); showOther(Folders::Id());
}); });
addSection( addSection(
tr::lng_settings_advanced(), tr::lng_settings_advanced(),
Type::Advanced, Advanced::Id(),
{ &st::settingsIconGeneral, kIconPurple }); { &st::settingsIconGeneral, kIconPurple });
addSection( addSection(
tr::lng_settings_section_call_settings(), tr::lng_settings_section_call_settings(),
Type::Calls, Calls::Id(),
{ &st::settingsIconCalls, kIconGreen }); { &st::settingsIconCalls, kIconGreen });
SetupLanguageButton(container); SetupLanguageButton(container);
@ -524,6 +530,10 @@ Main::Main(
setupContent(controller); setupContent(controller);
} }
rpl::producer<QString> Main::Title() {
return tr::lng_menu_settings();
}
void Main::keyPressEvent(QKeyEvent *e) { void Main::keyPressEvent(QKeyEvent *e) {
crl::on_main(this, [=, text = e->text()]{ crl::on_main(this, [=, text = e->text()]{
CodesFeedString(_controller, text); CodesFeedString(_controller, text);

View file

@ -32,10 +32,12 @@ void SetupFaq(
not_null<Ui::VerticalLayout*> container, not_null<Ui::VerticalLayout*> container,
bool icon = true); bool icon = true);
class Main : public Section { class Main : public Section<Main> {
public: public:
Main(QWidget *parent, not_null<Window::SessionController*> controller); Main(QWidget *parent, not_null<Window::SessionController*> controller);
[[nodiscard]] static rpl::producer<QString> Title();
rpl::producer<Type> sectionShowOther() override; rpl::producer<Type> sectionShowOther() override;
protected: protected:

View file

@ -1097,6 +1097,10 @@ Notifications::Notifications(
setupContent(controller); setupContent(controller);
} }
rpl::producer<QString> Notifications::Title() {
return tr::lng_settings_section_notify();
}
void Notifications::setupContent( void Notifications::setupContent(
not_null<Window::SessionController*> controller) { not_null<Window::SessionController*> controller) {
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this); const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);

View file

@ -11,12 +11,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Settings { namespace Settings {
class Notifications : public Section { class Notifications : public Section<Notifications> {
public: public:
Notifications( Notifications(
QWidget *parent, QWidget *parent,
not_null<Window::SessionController*> controller); not_null<Window::SessionController*> controller);
[[nodiscard]] static rpl::producer<QString> Title();
private: private:
void setupContent(not_null<Window::SessionController*> controller); void setupContent(not_null<Window::SessionController*> controller);

View file

@ -820,7 +820,7 @@ void SetupSessionsList(
st::settingsButton, st::settingsButton,
{ &st::settingsIconLaptop, kIconLightOrange } { &st::settingsIconLaptop, kIconLightOrange }
)->addClickHandler([=] { )->addClickHandler([=] {
showOther(Type::Sessions); showOther(Sessions::Id());
}); });
} }
@ -971,6 +971,10 @@ PrivacySecurity::PrivacySecurity(
setupContent(controller); setupContent(controller);
} }
rpl::producer<QString> PrivacySecurity::Title() {
return tr::lng_settings_section_privacy();
}
rpl::producer<Type> PrivacySecurity::sectionShowOther() { rpl::producer<Type> PrivacySecurity::sectionShowOther() {
return _showOther.events(); return _showOther.events();
} }

View file

@ -34,12 +34,14 @@ void AddPrivacyButton(
Api::UserPrivacy::Key key, Api::UserPrivacy::Key key,
Fn<std::unique_ptr<EditPrivacyController>()> controllerFactory); Fn<std::unique_ptr<EditPrivacyController>()> controllerFactory);
class PrivacySecurity : public Section { class PrivacySecurity : public Section<PrivacySecurity> {
public: public:
PrivacySecurity( PrivacySecurity(
QWidget *parent, QWidget *parent,
not_null<Window::SessionController*> controller); not_null<Window::SessionController*> controller);
[[nodiscard]] static rpl::producer<QString> Title();
rpl::producer<Type> sectionShowOther() override; rpl::producer<Type> sectionShowOther() override;
private: private:

View file

@ -0,0 +1,15 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
namespace Settings {
struct SectionMeta;
using Type = not_null<SectionMeta*>(*)();
} // namespace Settings

View file

@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/boxes/confirm_box.h" #include "ui/boxes/confirm_box.h"
#include "boxes/filters/edit_filter_box.h" #include "boxes/filters/edit_filter_box.h"
#include "settings/settings_common.h" #include "settings/settings_common.h"
#include "settings/settings_folders.h"
#include "api/api_chat_filters.h" #include "api/api_chat_filters.h"
#include "apiwrap.h" #include "apiwrap.h"
#include "styles/style_widgets.h" #include "styles/style_widgets.h"
@ -275,13 +276,13 @@ base::unique_qptr<Ui::SideBarButton> FiltersMenu::prepareButton(
} else { } else {
const auto filters = &_session->session().data().chatsFilters(); const auto filters = &_session->session().data().chatsFilters();
if (filters->suggestedLoaded()) { if (filters->suggestedLoaded()) {
_session->showSettings(Settings::Type::Folders); _session->showSettings(Settings::Folders::Id());
} else if (!_waitingSuggested) { } else if (!_waitingSuggested) {
_waitingSuggested = true; _waitingSuggested = true;
filters->requestSuggested(); filters->requestSuggested();
filters->suggestedUpdated( filters->suggestedUpdated(
) | rpl::take(1) | rpl::start_with_next([=] { ) | rpl::take(1) | rpl::start_with_next([=] {
_session->showSettings(Settings::Type::Folders); _session->showSettings(Settings::Folders::Id());
}, _outer.lifetime()); }, _outer.lifetime());
} }
} }

View file

@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/storage_account.h" #include "storage/storage_account.h"
#include "support/support_templates.h" #include "support/support_templates.h"
#include "settings/settings_common.h" #include "settings/settings_common.h"
#include "settings/settings_calls.h"
#include "settings/settings_information.h" #include "settings/settings_information.h"
#include "base/qt_signal_producer.h" #include "base/qt_signal_producer.h"
#include "boxes/about_box.h" #include "boxes/about_box.h"
@ -85,7 +86,7 @@ void ShowCallsBox(not_null<Window::SessionController*> window) {
st::popupMenuWithIcons); st::popupMenuWithIcons);
const auto showSettings = [=] { const auto showSettings = [=] {
window->showSettings( window->showSettings(
Settings::Type::Calls, Settings::Calls::Id(),
Window::SectionShow(anim::type::instant)); Window::SectionShow(anim::type::instant));
}; };
const auto clearAll = crl::guard(box, [=] { const auto clearAll = crl::guard(box, [=] {

View file

@ -76,6 +76,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/file_upload.h" #include "storage/file_upload.h"
#include "facades.h" #include "facades.h"
#include "window/themes/window_theme.h" #include "window/themes/window_theme.h"
#include "settings/settings_main.h"
#include "settings/settings_privacy_security.h"
#include "styles/style_window.h" #include "styles/style_window.h"
#include "styles/style_dialogs.h" #include "styles/style_dialogs.h"
#include "styles/style_layers.h" // st::boxLabel #include "styles/style_layers.h" // st::boxLabel
@ -567,7 +569,7 @@ void SessionNavigation::showSettings(
} }
void SessionNavigation::showSettings(const SectionShow &params) { void SessionNavigation::showSettings(const SectionShow &params) {
showSettings(Settings::Type::Main, params); showSettings(Settings::Main::Id(), params);
} }
void SessionNavigation::showPollResults( void SessionNavigation::showPollResults(
@ -667,7 +669,7 @@ void SessionController::suggestArchiveAndMute() {
tr::lng_suggest_hide_new_about(Ui::Text::RichLangValue), tr::lng_suggest_hide_new_about(Ui::Text::RichLangValue),
st::boxLabel)); st::boxLabel));
box->addButton(tr::lng_suggest_hide_new_to_settings(), [=] { box->addButton(tr::lng_suggest_hide_new_to_settings(), [=] {
showSettings(Settings::Type::PrivacySecurity); showSettings(Settings::PrivacySecurity::Id());
}); });
box->setCloseByOutsideClick(false); box->setCloseByOutsideClick(false);
box->boxClosing( box->boxClosing(

View file

@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "dialogs/dialogs_key.h" #include "dialogs/dialogs_key.h"
#include "ui/layers/layer_widget.h" #include "ui/layers/layer_widget.h"
#include "ui/layers/show.h" #include "ui/layers/show.h"
#include "settings/settings_type.h"
#include "window/window_adaptive.h" #include "window/window_adaptive.h"
#include "mtproto/sender.h" #include "mtproto/sender.h"
@ -40,10 +41,6 @@ namespace InlineBots {
class AttachWebView; class AttachWebView;
} // namespace InlineBots } // namespace InlineBots
namespace Settings {
enum class Type;
} // namespace Settings
namespace Calls { namespace Calls {
struct StartGroupCallArgs; struct StartGroupCallArgs;
} // namespace Calls } // namespace Calls

@ -1 +1 @@
Subproject commit e052821270b913798b65f3a1a292b7ab74107ff6 Subproject commit 2ae9d2928a406da58e510bdda54a99e44c4eff10