Added setting for chat filters view type to filters settings.

This commit is contained in:
23rd 2024-11-02 22:23:32 +03:00
parent 36741ab780
commit dc49c788a8
2 changed files with 34 additions and 0 deletions

View File

@ -5099,6 +5099,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_filters_toast_add" = "{chat} added to {folder} folder";
"lng_filters_toast_remove" = "{chat} removed from {folder} folder";
"lng_filters_shareable_status" = "shareable folder";
"lng_filters_view_subtitle" = "Tabs view";
"lng_filters_vertical" = "Tabs on the left";
"lng_filters_horizontal" = "Tabs at the top";
"lng_filters_delete_sure" = "Are you sure you want to delete this folder? This will also deactivate all the invite links created to share this folder.";
"lng_filters_link" = "Share Folder";

View File

@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_utilities.h"
#include "ui/widgets/box_content_divider.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/fields/input_field.h"
#include "ui/widgets/labels.h"
#include "ui/wrap/slide_wrap.h"
@ -843,6 +844,34 @@ void SetupTopContent(
}
void SetupView(not_null<Ui::VerticalLayout*> content) {
Ui::AddDivider(content);
Ui::AddSkip(content);
Ui::AddSubsectionTitle(content, tr::lng_filters_view_subtitle());
const auto group = std::make_shared<Ui::RadioenumGroup<bool>>(
Core::App().settings().chatFiltersHorizontal());
const auto addSend = [&](bool value, const QString &text) {
content->add(
object_ptr<Ui::Radioenum<bool>>(
content,
group,
value,
text,
st::settingsSendType),
st::settingsSendTypePadding);
};
addSend(false, tr::lng_filters_vertical(tr::now));
addSend(true, tr::lng_filters_horizontal(tr::now));
group->setChangedCallback([=](bool value) {
Core::App().settings().setChatFiltersHorizontal(value);
Core::App().saveSettingsDelayed();
});
Ui::AddSkip(content);
Ui::AddSkip(content);
}
} // namespace
Folders::Folders(
@ -871,6 +900,8 @@ void Folders::setupContent(not_null<Window::SessionController*> controller) {
_save = SetupFoldersContent(controller, content);
SetupView(content);
Ui::ResizeFitChild(this, content);
}