mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Grab/return focus in status/reactions search.
This commit is contained in:
parent
2e88ada392
commit
22f9e87fbe
7 changed files with 54 additions and 1 deletions
|
@ -718,6 +718,20 @@ object_ptr<TabbedSelector::InnerFooter> EmojiListWidget::createFooter() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EmojiListWidget::afterShown() {
|
||||||
|
const auto steal = (_mode == Mode::EmojiStatus)
|
||||||
|
|| (_mode == Mode::FullReactions);
|
||||||
|
if (_search && steal) {
|
||||||
|
_search->stealFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EmojiListWidget::beforeHiding() {
|
||||||
|
if (_search) {
|
||||||
|
_search->returnFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Callback>
|
template <typename Callback>
|
||||||
bool EmojiListWidget::enumerateSections(Callback callback) const {
|
bool EmojiListWidget::enumerateSections(Callback callback) const {
|
||||||
Expects(_columnCount > 0);
|
Expects(_columnCount > 0);
|
||||||
|
@ -2153,6 +2167,10 @@ void EmojiListWidget::refreshEmoji() {
|
||||||
|
|
||||||
void EmojiListWidget::showSet(uint64 setId) {
|
void EmojiListWidget::showSet(uint64 setId) {
|
||||||
clearSelection();
|
clearSelection();
|
||||||
|
if (_search && _searchMode) {
|
||||||
|
_search->cancel();
|
||||||
|
applyNextSearchQuery();
|
||||||
|
}
|
||||||
|
|
||||||
auto y = 0;
|
auto y = 0;
|
||||||
enumerateSections([&](const SectionInfo &info) {
|
enumerateSections([&](const SectionInfo &info) {
|
||||||
|
|
|
@ -102,6 +102,9 @@ public:
|
||||||
void clearSelection() override;
|
void clearSelection() override;
|
||||||
object_ptr<TabbedSelector::InnerFooter> createFooter() override;
|
object_ptr<TabbedSelector::InnerFooter> createFooter() override;
|
||||||
|
|
||||||
|
void afterShown() override;
|
||||||
|
void beforeHiding() override;
|
||||||
|
|
||||||
void showSet(uint64 setId);
|
void showSet(uint64 setId);
|
||||||
[[nodiscard]] uint64 currentSet(int yOffset) const;
|
[[nodiscard]] uint64 currentSet(int yOffset) const;
|
||||||
void setAllowWithoutPremium(bool allow);
|
void setAllowWithoutPremium(bool allow);
|
||||||
|
|
|
@ -282,6 +282,12 @@ void Selector::initGeometry(int innerTop) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Selector::beforeDestroy() {
|
||||||
|
if (_list) {
|
||||||
|
_list->beforeHiding();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Selector::updateShowState(
|
void Selector::updateShowState(
|
||||||
float64 progress,
|
float64 progress,
|
||||||
float64 opacity,
|
float64 opacity,
|
||||||
|
@ -531,6 +537,7 @@ void Selector::finishExpand() {
|
||||||
_footer->show();
|
_footer->show();
|
||||||
}
|
}
|
||||||
_scroll->show();
|
_scroll->show();
|
||||||
|
_list->afterShown();
|
||||||
|
|
||||||
if (const auto controller = _parentController.get()) {
|
if (const auto controller = _parentController.get()) {
|
||||||
controller->session().api().updateCustomEmoji();
|
controller->session().api().updateCustomEmoji();
|
||||||
|
@ -940,6 +947,12 @@ AttachSelectorResult MakeJustSelectorMenu(
|
||||||
}
|
}
|
||||||
const auto selectorInnerTop = menu->preparedPadding().top()
|
const auto selectorInnerTop = menu->preparedPadding().top()
|
||||||
- st::reactStripExtend.top();
|
- st::reactStripExtend.top();
|
||||||
|
menu->animatePhaseValue(
|
||||||
|
) | rpl::start_with_next([=](Ui::PopupMenu::AnimatePhase phase) {
|
||||||
|
if (phase == Ui::PopupMenu::AnimatePhase::StartHide) {
|
||||||
|
selector->beforeDestroy();
|
||||||
|
}
|
||||||
|
}, selector->lifetime());
|
||||||
selector->initGeometry(selectorInnerTop);
|
selector->initGeometry(selectorInnerTop);
|
||||||
selector->show();
|
selector->show();
|
||||||
|
|
||||||
|
@ -1005,6 +1018,12 @@ AttachSelectorResult AttachSelectorToMenu(
|
||||||
const auto selectorInnerTop = selector->useTransparency()
|
const auto selectorInnerTop = selector->useTransparency()
|
||||||
? (menu->preparedPadding().top() - st::reactStripExtend.top())
|
? (menu->preparedPadding().top() - st::reactStripExtend.top())
|
||||||
: st::lineWidth;
|
: st::lineWidth;
|
||||||
|
menu->animatePhaseValue(
|
||||||
|
) | rpl::start_with_next([=](Ui::PopupMenu::AnimatePhase phase) {
|
||||||
|
if (phase == Ui::PopupMenu::AnimatePhase::StartHide) {
|
||||||
|
selector->beforeDestroy();
|
||||||
|
}
|
||||||
|
}, selector->lifetime());
|
||||||
selector->initGeometry(selectorInnerTop);
|
selector->initGeometry(selectorInnerTop);
|
||||||
selector->show();
|
selector->show();
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ public:
|
||||||
[[nodiscard]] int minimalHeight() const;
|
[[nodiscard]] int minimalHeight() const;
|
||||||
void setSpecialExpandTopSkip(int skip);
|
void setSpecialExpandTopSkip(int skip);
|
||||||
void initGeometry(int innerTop);
|
void initGeometry(int innerTop);
|
||||||
|
void beforeDestroy();
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<ChosenReaction> chosen() const {
|
[[nodiscard]] rpl::producer<ChosenReaction> chosen() const {
|
||||||
return _chosen.events();
|
return _chosen.events();
|
||||||
|
|
|
@ -526,6 +526,12 @@ auto SearchWithGroups::debouncedQueryValue() const
|
||||||
return _debouncedQuery.value();
|
return _debouncedQuery.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchWithGroups::cancel() {
|
||||||
|
_field->setText(QString());
|
||||||
|
_chosenGroup = QString();
|
||||||
|
scrollGroupsToStart();
|
||||||
|
}
|
||||||
|
|
||||||
void SearchWithGroups::setLoading(bool loading) {
|
void SearchWithGroups::setLoading(bool loading) {
|
||||||
_cancel->setLoadingAnimation(loading);
|
_cancel->setLoadingAnimation(loading);
|
||||||
}
|
}
|
||||||
|
@ -637,6 +643,10 @@ QImage TabbedSearch::grab() {
|
||||||
return Ui::GrabWidgetToImage(&_search);
|
return Ui::GrabWidgetToImage(&_search);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabbedSearch::cancel() {
|
||||||
|
_search.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
void TabbedSearch::setLoading(bool loading) {
|
void TabbedSearch::setLoading(bool loading) {
|
||||||
_search.setLoading(loading);
|
_search.setLoading(loading);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
[[nodiscard]] auto debouncedQueryValue() const
|
[[nodiscard]] auto debouncedQueryValue() const
|
||||||
-> rpl::producer<std::vector<QString>>;
|
-> rpl::producer<std::vector<QString>>;
|
||||||
|
|
||||||
|
void cancel();
|
||||||
void setLoading(bool loading);
|
void setLoading(bool loading);
|
||||||
void stealFocus();
|
void stealFocus();
|
||||||
void returnFocus();
|
void returnFocus();
|
||||||
|
@ -118,6 +119,7 @@ public:
|
||||||
[[nodiscard]] auto debouncedQueryValue() const
|
[[nodiscard]] auto debouncedQueryValue() const
|
||||||
->rpl::producer<std::vector<QString>>;
|
->rpl::producer<std::vector<QString>>;
|
||||||
|
|
||||||
|
void cancel();
|
||||||
void setLoading(bool loading);
|
void setLoading(bool loading);
|
||||||
void stealFocus();
|
void stealFocus();
|
||||||
void returnFocus();
|
void returnFocus();
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 41ee2fb0f05908112c0cd132c7ab7168ba87fe0c
|
Subproject commit 43e9128014c5239a6732ae34bdfe007efb9692c8
|
Loading…
Add table
Reference in a new issue