2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 09:05:14 +00:00

Some settings reordered in sections.

This commit is contained in:
John Preston
2018-09-17 13:52:34 +03:00
parent 97a4c76043
commit 130aa67ba0
10 changed files with 163 additions and 187 deletions

View File

@@ -120,15 +120,26 @@ not_null<Button*> AddButton(
void CreateRightLabel(
not_null<Button*> button,
rpl::producer<QString> label,
const style::InfoProfileButton &st) {
const style::InfoProfileButton &st,
LangKey buttonText) {
const auto name = Ui::CreateChild<Ui::FlatLabel>(
button.get(),
std::move(label),
st::settingsButtonRight);
rpl::combine(
name->widthValue(),
button->widthValue()
) | rpl::start_with_next([=] {
button->widthValue(),
Lang::Viewer(buttonText),
std::move(label)
) | rpl::start_with_next([=, &st](
int width,
const QString &button,
const QString &text) {
const auto available = width
- st.padding.left()
- st.padding.right()
- st.font->width(button)
- st::settingsButtonRightSkip;
name->setText(text);
name->resizeToNaturalWidth(available);
name->moveToRight(st::settingsButtonRightSkip, st.padding.top());
}, name->lifetime());
name->setAttribute(Qt::WA_TransparentForMouseEvents);
@@ -141,7 +152,7 @@ not_null<Button*> AddButtonWithLabel(
const style::InfoProfileButton &st,
const style::icon *leftIcon) {
const auto button = AddButton(container, text, st, leftIcon);
CreateRightLabel(button, std::move(label), st);
CreateRightLabel(button, std::move(label), st, text);
return button;
}