mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Added folders options in menu
This commit is contained in:
@@ -2464,4 +2464,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"ktg_filters_context_edit_all" = "Edit folders";
|
||||
"ktg_filters_context_make_default" = "Make folder default";
|
||||
|
||||
"ktg_settings_filters" = "Folders";
|
||||
"ktg_settings_filters_only_unmuted_counter" = "Do not count muted chats";
|
||||
"ktg_settings_filters_hide_edit" = "Hide Edit button";
|
||||
"ktg_settings_filters_hide_folder_names" = "Compact folders";
|
||||
|
||||
// Keys finished
|
||||
|
@@ -100,5 +100,9 @@
|
||||
"ktg_settings_recent_stickers_limit_none": "Недавние стикеры: скрыть все",
|
||||
"ktg_filters_default": "Папка по умолчанию",
|
||||
"ktg_filters_context_edit_all": "Изменить папки",
|
||||
"ktg_filters_context_make_default": "Сделать папкой по умолчанию"
|
||||
"ktg_filters_context_make_default": "Сделать папкой по умолчанию",
|
||||
"ktg_settings_filters": "Папки",
|
||||
"ktg_settings_filters_only_unmuted_counter": "Не считать чаты без уведомлений",
|
||||
"ktg_settings_filters_hide_edit": "Скрыть кнопку изменения",
|
||||
"ktg_settings_filters_hide_folder_names": "Компактные папки"
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@ https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL
|
||||
#include "data/data_session.h"
|
||||
#include "main/main_session.h"
|
||||
#include "layout.h"
|
||||
#include "mainwindow.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_settings.h"
|
||||
@@ -201,6 +202,64 @@ void SetupKotatoNetwork(not_null<Ui::VerticalLayout*> container) {
|
||||
AddSkip(container);
|
||||
}
|
||||
|
||||
void SetupKotatoFolders(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, tr::ktg_settings_filters());
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
tr::ktg_settings_filters_only_unmuted_counter(),
|
||||
st::settingsButton
|
||||
)->toggleOn(
|
||||
rpl::single(cUnmutedFilterCounterOnly())
|
||||
)->toggledValue(
|
||||
) | rpl::filter([](bool enabled) {
|
||||
return (enabled != cUnmutedFilterCounterOnly());
|
||||
}) | rpl::start_with_next([=](bool enabled) {
|
||||
cSetUnmutedFilterCounterOnly(enabled);
|
||||
KotatoSettings::Write();
|
||||
controller->reloadFiltersMenu();
|
||||
App::wnd()->fixOrder();
|
||||
}, container->lifetime());
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
tr::ktg_settings_filters_hide_edit(),
|
||||
st::settingsButton
|
||||
)->toggleOn(
|
||||
rpl::single(cHideFilterEditButton())
|
||||
)->toggledValue(
|
||||
) | rpl::filter([](bool enabled) {
|
||||
return (enabled != cHideFilterEditButton());
|
||||
}) | rpl::start_with_next([=](bool enabled) {
|
||||
cSetHideFilterEditButton(enabled);
|
||||
KotatoSettings::Write();
|
||||
controller->reloadFiltersMenu();
|
||||
App::wnd()->fixOrder();
|
||||
}, container->lifetime());
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
tr::ktg_settings_filters_hide_folder_names(),
|
||||
st::settingsButton
|
||||
)->toggleOn(
|
||||
rpl::single(cHideFilterNames())
|
||||
)->toggledValue(
|
||||
) | rpl::filter([](bool enabled) {
|
||||
return (enabled != cHideFilterNames());
|
||||
}) | rpl::start_with_next([=](bool enabled) {
|
||||
cSetHideFilterNames(enabled);
|
||||
KotatoSettings::Write();
|
||||
controller->reloadFiltersMenu();
|
||||
App::wnd()->fixOrder();
|
||||
}, container->lifetime());
|
||||
|
||||
AddSkip(container);
|
||||
}
|
||||
|
||||
void SetupKotatoSystem(not_null<Ui::VerticalLayout*> container) {
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
@@ -285,6 +344,7 @@ void Kotato::setupContent(not_null<Window::SessionController*> controller) {
|
||||
|
||||
SetupKotatoChats(content);
|
||||
SetupKotatoNetwork(content);
|
||||
SetupKotatoFolders(controller, content);
|
||||
SetupKotatoSystem(content);
|
||||
SetupKotatoOther(content);
|
||||
|
||||
|
@@ -15,6 +15,9 @@ namespace Settings {
|
||||
|
||||
void SetupKotatoChats(not_null<Ui::VerticalLayout*> container);
|
||||
void SetupKotatoNetwork(not_null<Ui::VerticalLayout*> container);
|
||||
void SetupKotatoFolders(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container);
|
||||
void SetupKotatoSystem(not_null<Ui::VerticalLayout*> container);
|
||||
void SetupKotatoOther(not_null<Ui::VerticalLayout*> container);
|
||||
|
||||
|
@@ -212,6 +212,14 @@ void SessionController::toggleFiltersMenu(bool enabled) {
|
||||
_filtersMenuChanged.fire({});
|
||||
}
|
||||
|
||||
void SessionController::reloadFiltersMenu() {
|
||||
const auto enabled = !session().data().chatsFilters().list().empty();
|
||||
if (enabled) {
|
||||
toggleFiltersMenu(false);
|
||||
toggleFiltersMenu(true);
|
||||
}
|
||||
}
|
||||
|
||||
void SessionController::refreshFiltersMenu() {
|
||||
const auto enabled = !session().data().chatsFilters().list().empty();
|
||||
if (enabled != Global::DialogsFiltersEnabled()) {
|
||||
|
@@ -299,6 +299,7 @@ public:
|
||||
void setActiveChatsFilter(FilterId id);
|
||||
|
||||
void toggleFiltersMenu(bool enabled);
|
||||
void reloadFiltersMenu();
|
||||
[[nodiscard]] rpl::producer<> filtersMenuChanged() const;
|
||||
|
||||
rpl::lifetime &lifetime() {
|
||||
|
Reference in New Issue
Block a user