mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed chats filters strip from forward box while search.
This commit is contained in:
parent
b0b37172ce
commit
a74ee911b3
3 changed files with 29 additions and 3 deletions
|
@ -120,6 +120,9 @@ void PeerListBox::createMultiSelect() {
|
||||||
content()->submitted();
|
content()->submitted();
|
||||||
});
|
});
|
||||||
_select->entity()->setQueryChangedCallback([=](const QString &query) {
|
_select->entity()->setQueryChangedCallback([=](const QString &query) {
|
||||||
|
if (_customQueryChangedCallback) {
|
||||||
|
_customQueryChangedCallback(query);
|
||||||
|
}
|
||||||
searchQueryChanged(query);
|
searchQueryChanged(query);
|
||||||
});
|
});
|
||||||
_select->entity()->setItemRemovedCallback([=](uint64 itemId) {
|
_select->entity()->setItemRemovedCallback([=](uint64 itemId) {
|
||||||
|
@ -138,6 +141,10 @@ void PeerListBox::createMultiSelect() {
|
||||||
_select->moveToLeft(0, 0);
|
_select->moveToLeft(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PeerListBox::appendQueryChangedCallback(Fn<void(QString)> callback) {
|
||||||
|
_customQueryChangedCallback = std::move(callback);
|
||||||
|
}
|
||||||
|
|
||||||
void PeerListBox::setAddedTopScrollSkip(int skip) {
|
void PeerListBox::setAddedTopScrollSkip(int skip) {
|
||||||
_addedTopScrollSkip = skip;
|
_addedTopScrollSkip = skip;
|
||||||
_scrollBottomFixed = false;
|
_scrollBottomFixed = false;
|
||||||
|
|
|
@ -1137,6 +1137,8 @@ public:
|
||||||
|
|
||||||
void showFinished() override;
|
void showFinished() override;
|
||||||
|
|
||||||
|
void appendQueryChangedCallback(Fn<void(QString)>);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
void setInnerFocus() override;
|
void setInnerFocus() override;
|
||||||
|
@ -1174,6 +1176,7 @@ private:
|
||||||
object_ptr<Ui::SlideWrap<Ui::MultiSelect>> _select = { nullptr };
|
object_ptr<Ui::SlideWrap<Ui::MultiSelect>> _select = { nullptr };
|
||||||
|
|
||||||
const std::shared_ptr<Main::SessionShow> _show;
|
const std::shared_ptr<Main::SessionShow> _show;
|
||||||
|
Fn<void(QString)> _customQueryChangedCallback;
|
||||||
std::unique_ptr<PeerListController> _controller;
|
std::unique_ptr<PeerListController> _controller;
|
||||||
Fn<void(PeerListBox*)> _init;
|
Fn<void(PeerListBox*)> _init;
|
||||||
bool _scrollBottomFixed = false;
|
bool _scrollBottomFixed = false;
|
||||||
|
|
|
@ -2234,13 +2234,29 @@ QPointer<Ui::BoxContent> ShowForwardMessagesBox(
|
||||||
auto init = [=](not_null<ListBox*> box) {
|
auto init = [=](not_null<ListBox*> box) {
|
||||||
controllerRaw->setSearchNoResultsText(
|
controllerRaw->setSearchNoResultsText(
|
||||||
tr::lng_bot_chats_not_found(tr::now));
|
tr::lng_bot_chats_not_found(tr::now));
|
||||||
|
const auto lastFilterId = box->lifetime().make_state<FilterId>(0);
|
||||||
const auto chatsFilters = Ui::AddChatFiltersTabsStrip(
|
const auto chatsFilters = Ui::AddChatFiltersTabsStrip(
|
||||||
box,
|
box,
|
||||||
session,
|
session,
|
||||||
[=](FilterId id) { applyFilter(box, id); });
|
[=](FilterId id) {
|
||||||
|
*lastFilterId = id;
|
||||||
|
applyFilter(box, id);
|
||||||
|
});
|
||||||
chatsFilters->lower();
|
chatsFilters->lower();
|
||||||
chatsFilters->heightValue() | rpl::start_with_next([box](int h) {
|
rpl::combine(
|
||||||
box->setAddedTopScrollSkip(h);
|
chatsFilters->heightValue(),
|
||||||
|
rpl::producer<bool>([=](auto consumer) {
|
||||||
|
auto lifetime = rpl::lifetime();
|
||||||
|
consumer.put_next(false);
|
||||||
|
box->appendQueryChangedCallback([=](const QString &q) {
|
||||||
|
const auto hasQuery = !q.isEmpty();
|
||||||
|
applyFilter(box, hasQuery ? 0 : (*lastFilterId));
|
||||||
|
consumer.put_next_copy(hasQuery);
|
||||||
|
});
|
||||||
|
return lifetime;
|
||||||
|
})
|
||||||
|
) | rpl::start_with_next([box](int h, bool hasQuery) {
|
||||||
|
box->setAddedTopScrollSkip(hasQuery ? 0 : h);
|
||||||
}, box->lifetime());
|
}, box->lifetime());
|
||||||
box->multiSelectHeightValue() | rpl::start_with_next([=](int h) {
|
box->multiSelectHeightValue() | rpl::start_with_next([=](int h) {
|
||||||
chatsFilters->moveToLeft(0, h);
|
chatsFilters->moveToLeft(0, h);
|
||||||
|
|
Loading…
Add table
Reference in a new issue