mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed display of chats filters strip from share box in search mode.
This commit is contained in:
parent
4a327ba584
commit
a77777f509
2 changed files with 15 additions and 3 deletions
|
@ -83,6 +83,7 @@ public:
|
||||||
void activateSkipColumn(int direction);
|
void activateSkipColumn(int direction);
|
||||||
void activateSkipPage(int pageHeight, int direction);
|
void activateSkipPage(int pageHeight, int direction);
|
||||||
void updateFilter(QString filter = QString());
|
void updateFilter(QString filter = QString());
|
||||||
|
[[nodiscard]] bool isFilterEmpty() const;
|
||||||
void selectActive();
|
void selectActive();
|
||||||
|
|
||||||
rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
|
rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
|
||||||
|
@ -288,6 +289,10 @@ void ShareBox::prepare() {
|
||||||
|
|
||||||
_select->setQueryChangedCallback([=](const QString &query) {
|
_select->setQueryChangedCallback([=](const QString &query) {
|
||||||
applyFilterUpdate(query);
|
applyFilterUpdate(query);
|
||||||
|
if (_chatsFilters) {
|
||||||
|
updateScrollSkips();
|
||||||
|
scrollToY(0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
_select->setItemRemovedCallback([=](uint64 itemId) {
|
_select->setItemRemovedCallback([=](uint64 itemId) {
|
||||||
if (const auto peer = _descriptor.session->data().peerLoaded(PeerId(itemId))) {
|
if (const auto peer = _descriptor.session->data().peerLoaded(PeerId(itemId))) {
|
||||||
|
@ -352,20 +357,23 @@ void ShareBox::prepare() {
|
||||||
_inner->applyChatFilter(id);
|
_inner->applyChatFilter(id);
|
||||||
scrollToY(0);
|
scrollToY(0);
|
||||||
});
|
});
|
||||||
|
chatsFilters->lower();
|
||||||
chatsFilters->heightValue() | rpl::start_with_next([this](int h) {
|
chatsFilters->heightValue() | rpl::start_with_next([this](int h) {
|
||||||
_additionalTopScrollSkip = h;
|
|
||||||
updateScrollSkips();
|
updateScrollSkips();
|
||||||
scrollToY(0);
|
scrollToY(0);
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
_select->heightValue() | rpl::start_with_next([=](int h) {
|
_select->heightValue() | rpl::start_with_next([=](int h) {
|
||||||
chatsFilters->moveToLeft(0, h);
|
chatsFilters->moveToLeft(0, h);
|
||||||
}, chatsFilters->lifetime());
|
}, chatsFilters->lifetime());
|
||||||
|
_chatsFilters = chatsFilters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ShareBox::getTopScrollSkip() const {
|
int ShareBox::getTopScrollSkip() const {
|
||||||
return (_select->isHidden() ? 0 : _select->height())
|
return (_select->isHidden() ? 0 : _select->height())
|
||||||
+ _additionalTopScrollSkip;
|
+ ((_chatsFilters && _inner && _inner->isFilterEmpty())
|
||||||
|
? _chatsFilters->height()
|
||||||
|
: 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ShareBox::getBottomScrollSkip() const {
|
int ShareBox::getBottomScrollSkip() const {
|
||||||
|
@ -1357,6 +1365,10 @@ void ShareBox::Inner::updateFilter(QString filter) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ShareBox::Inner::isFilterEmpty() const {
|
||||||
|
return _filter.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
rpl::producer<Ui::ScrollToRequest> ShareBox::Inner::scrollToRequests() const {
|
rpl::producer<Ui::ScrollToRequest> ShareBox::Inner::scrollToRequests() const {
|
||||||
return _scrollToRequests.events();
|
return _scrollToRequests.events();
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ private:
|
||||||
bool _peopleFull = false;
|
bool _peopleFull = false;
|
||||||
mtpRequestId _peopleRequest = 0;
|
mtpRequestId _peopleRequest = 0;
|
||||||
|
|
||||||
int _additionalTopScrollSkip = 0;
|
RpWidget *_chatsFilters = nullptr;
|
||||||
|
|
||||||
using PeopleCache = QMap<QString, MTPcontacts_Found>;
|
using PeopleCache = QMap<QString, MTPcontacts_Found>;
|
||||||
PeopleCache _peopleCache;
|
PeopleCache _peopleCache;
|
||||||
|
|
Loading…
Add table
Reference in a new issue