2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-23 02:37:11 +00:00

119 lines
2.7 KiB
C
Raw Normal View History

2018-09-05 22:05:49 +03:00
/*
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
#include "ui/rp_widget.h"
2019-09-13 15:22:54 +03:00
#include "base/object_ptr.h"
2018-09-05 22:05:49 +03:00
2019-07-24 16:00:30 +02:00
namespace Main {
class Session;
} // namespace Main
namespace Ui {
class VerticalLayout;
2019-09-04 18:59:43 +03:00
class FlatLabel;
class SettingsButton;
class AbstractButton;
} // namespace Ui
2018-09-05 22:39:35 +03:00
namespace Window {
class SessionController;
2018-09-05 22:39:35 +03:00
} // namespace Window
2018-09-07 12:40:25 +03:00
namespace style {
struct SettingsButton;
2018-09-07 12:40:25 +03:00
} // namespace style
2018-09-05 22:05:49 +03:00
namespace Settings {
enum class Type {
Main,
Information,
Notifications,
PrivacySecurity,
Sessions,
2018-09-20 19:47:02 +03:00
Advanced,
2018-09-05 22:05:49 +03:00
Chat,
2020-03-18 14:07:11 +04:00
Folders,
2019-01-05 14:08:02 +03:00
Calls,
Experimental,
2018-09-05 22:05:49 +03:00
};
using Button = Ui::SettingsButton;
2018-09-05 22:05:49 +03:00
class Section : public Ui::RpWidget {
public:
using RpWidget::RpWidget;
virtual rpl::producer<Type> sectionShowOther() {
return nullptr;
2018-09-05 22:05:49 +03:00
}
virtual void sectionSaveChanges(FnMut<void()> done) {
done();
}
2018-09-05 22:05:49 +03:00
};
object_ptr<Section> CreateSection(
Type type,
not_null<QWidget*> parent,
2019-07-24 16:00:30 +02:00
not_null<Window::SessionController*> controller);
2018-09-05 22:05:49 +03:00
void AddSkip(not_null<Ui::VerticalLayout*> container);
2018-09-07 15:19:56 +03:00
void AddSkip(not_null<Ui::VerticalLayout*> container, int skip);
void AddDivider(not_null<Ui::VerticalLayout*> container);
void AddDividerText(
not_null<Ui::VerticalLayout*> container,
rpl::producer<QString> text);
not_null<Ui::RpWidget*> AddButtonIcon(
not_null<Ui::AbstractButton*> button,
const style::icon *leftIcon,
int iconLeft,
const style::color *leftIconOver);
2020-03-24 11:26:08 +04:00
object_ptr<Button> CreateButton(
not_null<QWidget*> parent,
rpl::producer<QString> text,
const style::SettingsButton &st,
const style::icon *leftIcon = nullptr,
int iconLeft = 0,
const style::color *leftIconOver = nullptr);
2018-09-13 23:09:26 +03:00
not_null<Button*> AddButton(
not_null<Ui::VerticalLayout*> container,
rpl::producer<QString> text,
const style::SettingsButton &st,
2018-09-28 14:20:36 +03:00
const style::icon *leftIcon = nullptr,
int iconLeft = 0);
2018-09-07 12:40:25 +03:00
not_null<Button*> AddButtonWithLabel(
not_null<Ui::VerticalLayout*> container,
2019-06-18 14:16:43 +02:00
rpl::producer<QString> text,
2018-09-07 12:40:25 +03:00
rpl::producer<QString> label,
const style::SettingsButton &st,
2018-09-28 14:20:36 +03:00
const style::icon *leftIcon = nullptr,
int iconLeft = 0);
void CreateRightLabel(
not_null<Button*> button,
rpl::producer<QString> label,
const style::SettingsButton &st,
2019-06-18 14:16:43 +02:00
rpl::producer<QString> buttonText);
2019-09-04 18:59:43 +03:00
not_null<Ui::FlatLabel*> AddSubsectionTitle(
not_null<Ui::VerticalLayout*> container,
rpl::producer<QString> text);
using MenuCallback = Fn<QAction*(
const QString &text,
2021-12-09 21:56:24 +04:00
Fn<void()> handler,
const style::icon *icon)>;
void FillMenu(
not_null<Window::SessionController*> controller,
Type type,
Fn<void(Type)> showOther,
MenuCallback addAction);
2018-09-05 22:05:49 +03:00
} // namespace Settings