mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added ability to open calendar from search messages in dialogs.
This commit is contained in:
parent
69e37ad978
commit
38abfacd88
2 changed files with 28 additions and 1 deletions
|
@ -179,6 +179,15 @@ dialogsCancelSearch: CrossButton {
|
||||||
ripple: emptyRippleAnimation;
|
ripple: emptyRippleAnimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dialogCalendar: IconButton(dialogsMenuToggle) {
|
||||||
|
icon: icon {{ "dialogs/dialogs_calendar", lightButtonFg }};
|
||||||
|
iconOver: icon {{ "dialogs/dialogs_calendar", lightButtonFgOver }};
|
||||||
|
iconPosition: point(8px, 9px);
|
||||||
|
|
||||||
|
rippleAreaPosition: point(3px, 3px);
|
||||||
|
rippleAreaSize: 34px;
|
||||||
|
}
|
||||||
|
|
||||||
dialogsChatTypeSkip: 20px;
|
dialogsChatTypeSkip: 20px;
|
||||||
dialogsChatIcon: icon {{ "dialogs/dialogs_chat", dialogsChatIconFg, point(1px, 4px) }};
|
dialogsChatIcon: icon {{ "dialogs/dialogs_chat", dialogsChatIconFg, point(1px, 4px) }};
|
||||||
dialogsChatIconOver: icon {{ "dialogs/dialogs_chat", dialogsChatIconFgOver, point(1px, 4px) }};
|
dialogsChatIconOver: icon {{ "dialogs/dialogs_chat", dialogsChatIconFgOver, point(1px, 4px) }};
|
||||||
|
|
|
@ -97,12 +97,15 @@ public:
|
||||||
void setTotal(int total);
|
void setTotal(int total);
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<Index> showItemRequests() const;
|
[[nodiscard]] rpl::producer<Index> showItemRequests() const;
|
||||||
|
[[nodiscard]] rpl::producer<> showCalendarRequests() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateText(int current);
|
void updateText(int current);
|
||||||
|
|
||||||
base::unique_qptr<Ui::IconButton> _previous;
|
base::unique_qptr<Ui::IconButton> _previous;
|
||||||
base::unique_qptr<Ui::IconButton> _next;
|
base::unique_qptr<Ui::IconButton> _next;
|
||||||
|
|
||||||
|
base::unique_qptr<Ui::IconButton> _jumpToDate;
|
||||||
base::unique_qptr<Ui::FlatLabel> _counter;
|
base::unique_qptr<Ui::FlatLabel> _counter;
|
||||||
|
|
||||||
int _total = -1;
|
int _total = -1;
|
||||||
|
@ -114,6 +117,7 @@ BottomBar::BottomBar(not_null<Ui::RpWidget*> parent)
|
||||||
// Icons are swaped.
|
// Icons are swaped.
|
||||||
, _previous(base::make_unique_q<Ui::IconButton>(this, st::calendarNext))
|
, _previous(base::make_unique_q<Ui::IconButton>(this, st::calendarNext))
|
||||||
, _next(base::make_unique_q<Ui::IconButton>(this, st::calendarPrevious))
|
, _next(base::make_unique_q<Ui::IconButton>(this, st::calendarPrevious))
|
||||||
|
, _jumpToDate(base::make_unique_q<Ui::IconButton>(this, st::dialogCalendar))
|
||||||
, _counter(base::make_unique_q<Ui::FlatLabel>(
|
, _counter(base::make_unique_q<Ui::FlatLabel>(
|
||||||
this,
|
this,
|
||||||
st::defaultSettingsRightLabel)) {
|
st::defaultSettingsRightLabel)) {
|
||||||
|
@ -135,7 +139,12 @@ BottomBar::BottomBar(not_null<Ui::RpWidget*> parent)
|
||||||
(s.height() - _next->height()) / 2);
|
(s.height() - _next->height()) / 2);
|
||||||
|
|
||||||
const auto left = st::topBarActionSkip;
|
const auto left = st::topBarActionSkip;
|
||||||
_counter->moveToLeft(left, (s.height() - _counter->height()) / 2);
|
_jumpToDate->moveToLeft(
|
||||||
|
left,
|
||||||
|
(s.height() - _jumpToDate->height()) / 2);
|
||||||
|
_counter->moveToLeft(
|
||||||
|
_jumpToDate->x() + _jumpToDate->width(),
|
||||||
|
(s.height() - _counter->height()) / 2);
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
paintRequest(
|
paintRequest(
|
||||||
|
@ -195,6 +204,10 @@ rpl::producer<BottomBar::Index> BottomBar::showItemRequests() const {
|
||||||
return _current.changes() | rpl::map(rpl::mappers::_1 - 1);
|
return _current.changes() | rpl::map(rpl::mappers::_1 - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<> BottomBar::showCalendarRequests() const {
|
||||||
|
return _jumpToDate->clicks() | rpl::to_empty;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
class ComposeSearch::Inner final {
|
class ComposeSearch::Inner final {
|
||||||
|
@ -285,6 +298,11 @@ ComposeSearch::Inner::Inner(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, _bottomBar->lifetime());
|
}, _bottomBar->lifetime());
|
||||||
|
|
||||||
|
_bottomBar->showCalendarRequests(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
_window->showCalendar({ _history }, QDate());
|
||||||
|
}, _bottomBar->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComposeSearch::Inner::showAnimated() {
|
void ComposeSearch::Inner::showAnimated() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue