2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Reorder chat settings sections.

This commit is contained in:
John Preston
2018-09-28 14:20:36 +03:00
parent 7ee1af5348
commit d485a05935
11 changed files with 52 additions and 34 deletions

View File

@@ -53,6 +53,8 @@ settingsIconPrivacySecurity: icon {{ "settings_privacy_security", menuIconFg }};
settingsIconLanguage: icon {{ "settings_language", menuIconFg }};
settingsIconInterfaceScale: icon {{ "settings_interface_scale", menuIconFg }};
settingsIconFaq: icon {{ "settings_faq", menuIconFg }};
settingsIconStickers: icon {{ "settings_stickers", menuIconFg }};
settingsIconThemes: icon {{ "settings_themes", menuIconFg }};
settingsSetPhotoSkip: 7px;
@@ -64,7 +66,6 @@ settingsLink: boxLinkButton;
settingsAdvancedNotificationsPadding: margins(22px, 20px, 10px, 10px);
settingsLinkLabel: defaultFlatLabel;
settingsCheckboxesSkip: 12px;
settingsStickersEmojiPadding: 17px;
settingsSendType: settingsCheckbox;
settingsSendTypePadding: margins(22px, 5px, 10px, 5px);
@@ -153,6 +154,13 @@ settingsBioLabelPadding: margins(22px, 11px, 22px, 0px);
settingsPrivacyEditLabelPadding: margins(22px, 11px, 22px, 11px);
settingsChatButton: InfoProfileButton(settingsSectionButton) {
padding: margins(59px, 13px, 22px, 11px);
}
settingsChatIconLeft: 19px;
settingsThemesTopSkip: 10px;
settingsThemesBottomSkip: 8px;
settingsTheme: Checkbox(defaultCheckbox) {
textFg: windowSubTextFg;
textFgActive: windowActiveTextFg;
@@ -160,7 +168,7 @@ settingsTheme: Checkbox(defaultCheckbox) {
width: 80px;
margin: margins(0px, 0px, 0px, 0px);
textPosition: point(0px, 88px);
textPosition: point(0px, 86px);
checkPosition: point(0px, 0px);
style: defaultTextStyle;

View File

@@ -416,7 +416,8 @@ QString DownloadPathText() {
}
void SetupStickersEmoji(not_null<Ui::VerticalLayout*> container) {
AddSkip(container, st::settingsStickersEmojiPadding);
AddDivider(container);
AddSkip(container);
AddSubsectionTitle(container, lng_settings_stickers_emoji);
@@ -472,7 +473,9 @@ void SetupStickersEmoji(not_null<Ui::VerticalLayout*> container) {
AddButton(
container,
lng_stickers_you_have,
st::settingsButton
st::settingsChatButton,
&st::settingsIconStickers,
st::settingsChatIconLeft
)->addClickHandler([] {
Ui::show(Box<StickersBox>(StickersBox::Section::Installed));
});
@@ -910,19 +913,22 @@ void SetupDefaultThemes(not_null<Ui::VerticalLayout*> container) {
}
void SetupThemeOptions(not_null<Ui::VerticalLayout*> container) {
AddDivider(container);
AddSkip(container);
AddSkip(container, st::settingsPrivacySkip);
AddSubsectionTitle(container, lng_settings_themes);
AddSkip(container, st::settingsThemesTopSkip);
SetupDefaultThemes(container);
AddSkip(container, st::settingsThemesBottomSkip);
AddButton(
container,
lng_settings_bg_edit_theme,
st::settingsButton
st::settingsChatButton,
&st::settingsIconThemes,
st::settingsChatIconLeft
)->addClickHandler(App::LambdaDelayed(
st::settingsButton.ripple.hideDuration,
st::settingsChatButton.ripple.hideDuration,
container,
[] { Window::Theme::Editor::Start(); }));
@@ -940,10 +946,10 @@ Chat::Chat(QWidget *parent, not_null<UserData*> self)
void Chat::setupContent() {
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
SetupThemeOptions(content);
SetupChatBackground(content);
SetupStickersEmoji(content);
SetupMessages(content);
SetupChatBackground(content);
SetupThemeOptions(content);
Ui::ResizeFitChild(this, content);
}

View File

@@ -77,15 +77,17 @@ not_null<Button*> AddButton(
not_null<Ui::VerticalLayout*> container,
LangKey text,
const style::InfoProfileButton &st,
const style::icon *leftIcon) {
return AddButton(container, Lang::Viewer(text), st, leftIcon);
const style::icon *leftIcon,
int iconLeft) {
return AddButton(container, Lang::Viewer(text), st, leftIcon, iconLeft);
}
not_null<Button*> AddButton(
not_null<Ui::VerticalLayout*> container,
rpl::producer<QString> text,
const style::InfoProfileButton &st,
const style::icon *leftIcon) {
const style::icon *leftIcon,
int iconLeft) {
const auto result = container->add(object_ptr<Button>(
container,
std::move(text),
@@ -97,7 +99,7 @@ not_null<Button*> AddButton(
result->sizeValue(
) | rpl::start_with_next([=](QSize size) {
icon->moveToLeft(
st::settingsSectionIconLeft,
iconLeft ? iconLeft : st::settingsSectionIconLeft,
(size.height() - icon->height()) / 2,
size.width());
}, icon->lifetime());
@@ -150,8 +152,9 @@ not_null<Button*> AddButtonWithLabel(
LangKey text,
rpl::producer<QString> label,
const style::InfoProfileButton &st,
const style::icon *leftIcon) {
const auto button = AddButton(container, text, st, leftIcon);
const style::icon *leftIcon,
int iconLeft) {
const auto button = AddButton(container, text, st, leftIcon, iconLeft);
CreateRightLabel(button, std::move(label), st, text);
return button;
}

View File

@@ -74,18 +74,21 @@ not_null<Button*> AddButton(
not_null<Ui::VerticalLayout*> container,
LangKey text,
const style::InfoProfileButton &st,
const style::icon *leftIcon = nullptr);
const style::icon *leftIcon = nullptr,
int iconLeft = 0);
not_null<Button*> AddButton(
not_null<Ui::VerticalLayout*> container,
rpl::producer<QString> text,
const style::InfoProfileButton &st,
const style::icon *leftIcon = nullptr);
const style::icon *leftIcon = nullptr,
int iconLeft = 0);
not_null<Button*> AddButtonWithLabel(
not_null<Ui::VerticalLayout*> container,
LangKey text,
rpl::producer<QString> label,
const style::InfoProfileButton &st,
const style::icon *leftIcon = nullptr);
const style::icon *leftIcon = nullptr,
int iconLeft = 0);
void CreateRightLabel(
not_null<Button*> button,
rpl::producer<QString> label,