mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-01 15:05:56 +00:00
Implement general settings section.
This commit is contained in:
@@ -15,6 +15,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "settings/settings_privacy_security.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "info/profile/info_profile_button.h"
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwindow.h"
|
||||
@@ -22,16 +24,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
namespace Settings {
|
||||
|
||||
void AddSkip(not_null<Ui::VerticalLayout*> container) {
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
st::settingsSectionSkip));
|
||||
}
|
||||
|
||||
void AddDivider(not_null<Ui::VerticalLayout*> container) {
|
||||
container->add(object_ptr<BoxContentDivider>(container));
|
||||
}
|
||||
|
||||
object_ptr<Section> CreateSection(
|
||||
Type type,
|
||||
not_null<QWidget*> parent,
|
||||
@@ -54,6 +46,48 @@ object_ptr<Section> CreateSection(
|
||||
Unexpected("Settings section type in Widget::createInnerWidget.");
|
||||
}
|
||||
|
||||
void AddSkip(not_null<Ui::VerticalLayout*> container) {
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
st::settingsSectionSkip));
|
||||
}
|
||||
|
||||
void AddDivider(not_null<Ui::VerticalLayout*> container) {
|
||||
container->add(object_ptr<BoxContentDivider>(container));
|
||||
}
|
||||
|
||||
not_null<Button*> AddButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey text,
|
||||
const style::InfoProfileButton &st) {
|
||||
return container->add(object_ptr<Button>(
|
||||
container,
|
||||
Lang::Viewer(text),
|
||||
st));
|
||||
}
|
||||
|
||||
not_null<Button*> AddButtonWithLabel(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey text,
|
||||
rpl::producer<QString> label,
|
||||
const style::InfoProfileButton &st) {
|
||||
const auto button = AddButton(container, text, st);
|
||||
const auto name = Ui::CreateChild<Ui::FlatLabel>(
|
||||
button.get(),
|
||||
std::move(label),
|
||||
st::settingsButtonRight);
|
||||
rpl::combine(
|
||||
name->widthValue(),
|
||||
button->widthValue()
|
||||
) | rpl::start_with_next([=] {
|
||||
name->moveToRight(
|
||||
st::settingsButtonRightPosition.x(),
|
||||
st::settingsButtonRightPosition.y());
|
||||
}, name->lifetime());
|
||||
name->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
return button;
|
||||
}
|
||||
|
||||
void FillMenu(Fn<void(Type)> showOther, MenuCallback addAction) {
|
||||
addAction(
|
||||
lang(lng_settings_edit_info),
|
||||
|
Reference in New Issue
Block a user