2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Move manage filters to a Settings section.

This commit is contained in:
John Preston
2020-03-24 12:58:47 +04:00
parent 568325f201
commit e8bf5bb5ce
14 changed files with 238 additions and 191 deletions

View File

@@ -13,10 +13,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "data/data_session.h"
#include "data/data_chat_filters.h"
#include "boxes/filters/manage_filters_box.h"
#include "lang/lang_keys.h"
#include "ui/filter_icons.h"
#include "ui/wrap/vertical_layout_reorder.h"
#include "settings/settings_common.h"
#include "api/api_chat_filters.h"
#include "styles/style_widgets.h"
#include "styles/style_window.h"
@@ -28,7 +28,6 @@ FiltersMenu::FiltersMenu(
not_null<SessionController*> session)
: _session(session)
, _parent(parent)
, _manage(std::make_unique<ManageFiltersPrepare>(_session))
, _outer(_parent)
, _menu(&_outer, QString(), st::windowFiltersMainMenu)
, _scroll(&_outer)
@@ -191,7 +190,17 @@ base::unique_qptr<Ui::SideBarButton> FiltersMenu::prepareButton(
} else if (id >= 0) {
_session->setActiveChatsFilter(id);
} else {
_manage->showBox();
const auto filters = &_session->session().data().chatsFilters();
if (filters->suggestedLoaded()) {
_session->showSettings(Settings::Type::Folders);
} else if (!_waitingSuggested) {
_waitingSuggested = true;
filters->requestSuggested();
filters->suggestedUpdated(
) | rpl::take(1) | rpl::start_with_next([=] {
_session->showSettings(Settings::Type::Folders);
}, _outer.lifetime());
}
}
});
return button;

View File

@@ -11,8 +11,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/scroll_area.h"
#include "ui/wrap/vertical_layout.h"
class ManageFiltersPrepare;
namespace Ui {
class VerticalLayoutReorder;
enum class FilterIcon : uchar;
@@ -45,7 +43,6 @@ private:
const not_null<SessionController*> _session;
const not_null<Ui::RpWidget*> _parent;
std::unique_ptr<ManageFiltersPrepare> _manage;
Ui::RpWidget _outer;
Ui::SideBarButton _menu;
Ui::ScrollArea _scroll;
@@ -58,6 +55,7 @@ private:
FilterId _activeFilterId = 0;
int _reordering = 0;
bool _ignoreRefresh = false;
bool _waitingSuggested = false;
};

View File

@@ -91,8 +91,6 @@ void SessionNavigation::showPeerInfo(
void SessionNavigation::showSettings(
Settings::Type type,
const SectionShow &params) {
Expects(type != Settings::Type::Folders);
showSection(
Info::Memento(
Info::Settings::Tag{ _session->user() },