mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix opening _childList from archive.
This commit is contained in:
parent
32491ead5e
commit
1ff53eb585
3 changed files with 76 additions and 25 deletions
|
@ -354,10 +354,10 @@ Widget::Widget(
|
||||||
setupShortcuts();
|
setupShortcuts();
|
||||||
|
|
||||||
_searchForNarrowFilters->setClickedCallback([=] {
|
_searchForNarrowFilters->setClickedCallback([=] {
|
||||||
|
_filter->setFocusFast();
|
||||||
if (_childList) {
|
if (_childList) {
|
||||||
controller->closeForum();
|
controller->closeForum();
|
||||||
}
|
}
|
||||||
_filter->setFocus();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
@ -738,9 +738,8 @@ void Widget::updateControlsVisibility(bool fast) {
|
||||||
_forumReportBar->show();
|
_forumReportBar->show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hasFocus()) {
|
if (hasFocus() && !_childList) {
|
||||||
_filter->setFocus();
|
_filter->setFocusFast();
|
||||||
_filter->finishAnimating();
|
|
||||||
}
|
}
|
||||||
updateLockUnlockVisibility();
|
updateLockUnlockVisibility();
|
||||||
updateJumpToDateVisibility(fast);
|
updateJumpToDateVisibility(fast);
|
||||||
|
@ -754,6 +753,9 @@ void Widget::updateControlsVisibility(bool fast) {
|
||||||
if (_hideChildListCanvas) {
|
if (_hideChildListCanvas) {
|
||||||
_hideChildListCanvas->show();
|
_hideChildListCanvas->show();
|
||||||
}
|
}
|
||||||
|
if (_childList && _filter->hasFocus()) {
|
||||||
|
setInnerFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::changeOpenedSubsection(
|
void Widget::changeOpenedSubsection(
|
||||||
|
@ -1967,12 +1969,17 @@ void Widget::openChildList(
|
||||||
auto copy = params;
|
auto copy = params;
|
||||||
copy.childColumn = false;
|
copy.childColumn = false;
|
||||||
copy.animated = anim::type::instant;
|
copy.animated = anim::type::instant;
|
||||||
_childList = std::make_unique<Widget>(
|
{
|
||||||
this,
|
if (_childList && InFocusChain(_childList.get())) {
|
||||||
controller(),
|
setFocus();
|
||||||
Layout::Child);
|
}
|
||||||
_childList->showForum(forum, copy);
|
_childList = std::make_unique<Widget>(
|
||||||
_childListPeerId = forum->channel()->id;
|
this,
|
||||||
|
controller(),
|
||||||
|
Layout::Child);
|
||||||
|
_childList->showForum(forum, copy);
|
||||||
|
_childListPeerId = forum->channel()->id;
|
||||||
|
}
|
||||||
|
|
||||||
_childListShadow = std::make_unique<Ui::RpWidget>(this);
|
_childListShadow = std::make_unique<Ui::RpWidget>(this);
|
||||||
const auto shadow = _childListShadow.get();
|
const auto shadow = _childListShadow.get();
|
||||||
|
@ -2006,6 +2013,9 @@ void Widget::openChildList(
|
||||||
} else {
|
} else {
|
||||||
_childListShown = 1.;
|
_childListShown = 1.;
|
||||||
}
|
}
|
||||||
|
if (hasFocus()) {
|
||||||
|
setInnerFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::closeChildList(anim::type animated) {
|
void Widget::closeChildList(anim::type animated) {
|
||||||
|
@ -2029,8 +2039,15 @@ void Widget::closeChildList(anim::type animated) {
|
||||||
animation->paintContents(p);
|
animation->paintContents(p);
|
||||||
}, _hideChildListCanvas->lifetime());
|
}, _hideChildListCanvas->lifetime());
|
||||||
}
|
}
|
||||||
|
if (InFocusChain(_childList.get())) {
|
||||||
|
setFocus();
|
||||||
|
}
|
||||||
_childList = nullptr;
|
_childList = nullptr;
|
||||||
_childListShown = 0.;
|
_childListShown = 0.;
|
||||||
|
if (hasFocus()) {
|
||||||
|
setInnerFocus();
|
||||||
|
_filter->finishAnimating();
|
||||||
|
}
|
||||||
if (animated == anim::type::normal) {
|
if (animated == anim::type::normal) {
|
||||||
_hideChildListCanvas->hide();
|
_hideChildListCanvas->hide();
|
||||||
auto newContentCache = Ui::GrabWidget(this, geometry);
|
auto newContentCache = Ui::GrabWidget(this, geometry);
|
||||||
|
@ -2060,6 +2077,9 @@ void Widget::searchInChat(Key chat) {
|
||||||
controller()->closeForum();
|
controller()->closeForum();
|
||||||
}
|
}
|
||||||
if (_openedFolder) {
|
if (_openedFolder) {
|
||||||
|
if (_childList && _childList->setSearchInChat(chat)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
controller()->closeFolder();
|
controller()->closeFolder();
|
||||||
}
|
}
|
||||||
cancelSearch();
|
cancelSearch();
|
||||||
|
@ -2298,7 +2318,7 @@ void Widget::updateControlsGeometry() {
|
||||||
_narrowWidth,
|
_narrowWidth,
|
||||||
_childListShown.current());
|
_childListShown.current());
|
||||||
const auto smallw = st::columnMinimalWidthLeft - _narrowWidth;
|
const auto smallw = st::columnMinimalWidthLeft - _narrowWidth;
|
||||||
const auto smallLayoutRatio = (ratiow < smallw)
|
const auto narrowRatio = (ratiow < smallw)
|
||||||
? ((smallw - ratiow) / float64(smallw - _narrowWidth))
|
? ((smallw - ratiow) / float64(smallw - _narrowWidth))
|
||||||
: 0.;
|
: 0.;
|
||||||
|
|
||||||
|
@ -2313,21 +2333,24 @@ void Widget::updateControlsGeometry() {
|
||||||
auto filterAreaHeight = st::topBarHeight;
|
auto filterAreaHeight = st::topBarHeight;
|
||||||
_searchControls->setGeometry(0, filterAreaTop, ratiow, filterAreaHeight);
|
_searchControls->setGeometry(0, filterAreaTop, ratiow, filterAreaHeight);
|
||||||
if (_subsectionTopBar) {
|
if (_subsectionTopBar) {
|
||||||
_subsectionTopBar->setGeometry(_searchControls->geometry());
|
_subsectionTopBar->setGeometryWithNarrowRatio(
|
||||||
|
_searchControls->geometry(),
|
||||||
|
_narrowWidth,
|
||||||
|
narrowRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto filterTop = (filterAreaHeight - _filter->height()) / 2;
|
auto filterTop = (filterAreaHeight - _filter->height()) / 2;
|
||||||
filterLeft = anim::interpolate(filterLeft, _narrowWidth, smallLayoutRatio);
|
filterLeft = anim::interpolate(filterLeft, _narrowWidth, narrowRatio);
|
||||||
_filter->setGeometryToLeft(filterLeft, filterTop, filterWidth, _filter->height());
|
_filter->setGeometryToLeft(filterLeft, filterTop, filterWidth, _filter->height());
|
||||||
auto mainMenuLeft = anim::interpolate(
|
auto mainMenuLeft = anim::interpolate(
|
||||||
st::dialogsFilterPadding.x(),
|
st::dialogsFilterPadding.x(),
|
||||||
(_narrowWidth - _mainMenuToggle->width()) / 2,
|
(_narrowWidth - _mainMenuToggle->width()) / 2,
|
||||||
smallLayoutRatio);
|
narrowRatio);
|
||||||
_mainMenuToggle->moveToLeft(mainMenuLeft, st::dialogsFilterPadding.y());
|
_mainMenuToggle->moveToLeft(mainMenuLeft, st::dialogsFilterPadding.y());
|
||||||
const auto searchLeft = anim::interpolate(
|
const auto searchLeft = anim::interpolate(
|
||||||
-_searchForNarrowFilters->width(),
|
-_searchForNarrowFilters->width(),
|
||||||
(_narrowWidth - _searchForNarrowFilters->width()) / 2,
|
(_narrowWidth - _searchForNarrowFilters->width()) / 2,
|
||||||
smallLayoutRatio);
|
narrowRatio);
|
||||||
_searchForNarrowFilters->moveToLeft(searchLeft, st::dialogsFilterPadding.y());
|
_searchForNarrowFilters->moveToLeft(searchLeft, st::dialogsFilterPadding.y());
|
||||||
|
|
||||||
auto right = filterLeft + filterWidth;
|
auto right = filterLeft + filterWidth;
|
||||||
|
|
|
@ -421,7 +421,7 @@ void TopBarWidget::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBarWidget::paintTopBar(Painter &p) {
|
void TopBarWidget::paintTopBar(Painter &p) {
|
||||||
if (!_activeChat.key || _narrowMode) {
|
if (!_activeChat.key || _narrowRatio == 1.) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto nameleft = _leftTaken;
|
auto nameleft = _leftTaken;
|
||||||
|
@ -846,12 +846,6 @@ void TopBarWidget::refreshInfoButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBarWidget::resizeEvent(QResizeEvent *e) {
|
void TopBarWidget::resizeEvent(QResizeEvent *e) {
|
||||||
const auto narrowMode = (_activeChat.section == Section::ChatsList)
|
|
||||||
&& (width() < _back->width() + _search->width());
|
|
||||||
if (_narrowMode != narrowMode) {
|
|
||||||
_narrowMode = narrowMode;
|
|
||||||
updateControlsVisibility();
|
|
||||||
}
|
|
||||||
updateSearchVisibility();
|
updateSearchVisibility();
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
}
|
}
|
||||||
|
@ -922,7 +916,10 @@ void TopBarWidget::updateControlsGeometry() {
|
||||||
} else if (_back->isHidden()) {
|
} else if (_back->isHidden()) {
|
||||||
_leftTaken = st::topBarArrowPadding.right();
|
_leftTaken = st::topBarArrowPadding.right();
|
||||||
} else {
|
} else {
|
||||||
_leftTaken = _narrowMode ? (width() - _back->width()) / 2 : 0;
|
_leftTaken = anim::interpolate(
|
||||||
|
0,
|
||||||
|
(_narrowWidth - _back->width()) / 2,
|
||||||
|
_narrowRatio);
|
||||||
_back->moveToLeft(_leftTaken, backButtonTop);
|
_back->moveToLeft(_leftTaken, backButtonTop);
|
||||||
_leftTaken += _back->width();
|
_leftTaken += _back->width();
|
||||||
}
|
}
|
||||||
|
@ -1078,7 +1075,7 @@ void TopBarWidget::updateControlsVisibility() {
|
||||||
}
|
}
|
||||||
_menuToggle->setVisible(hasMenu
|
_menuToggle->setVisible(hasMenu
|
||||||
&& !_chooseForReportReason
|
&& !_chooseForReportReason
|
||||||
&& !_narrowMode);
|
&& (_narrowRatio < 1.));
|
||||||
_infoToggle->setVisible(hasInfo
|
_infoToggle->setVisible(hasInfo
|
||||||
&& !isOneColumn
|
&& !isOneColumn
|
||||||
&& _controller->canShowThirdSection()
|
&& _controller->canShowThirdSection()
|
||||||
|
@ -1349,6 +1346,30 @@ void TopBarWidget::toggleSelectedControls(bool shown) {
|
||||||
anim::easeOutCirc);
|
anim::easeOutCirc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TopBarWidget::setGeometryWithNarrowRatio(
|
||||||
|
QRect geometry,
|
||||||
|
int narrowWidth,
|
||||||
|
float64 narrowRatio) {
|
||||||
|
if (_activeChat.section != Section::ChatsList) {
|
||||||
|
narrowRatio = 0.;
|
||||||
|
narrowWidth = 0;
|
||||||
|
}
|
||||||
|
const auto changed = (_narrowRatio != narrowRatio);
|
||||||
|
const auto started = (_narrowRatio == 0.) != (narrowRatio == 0.);
|
||||||
|
const auto finished = (_narrowRatio == 1.) != (narrowRatio == 1.);
|
||||||
|
const auto resized = (size() != geometry.size());
|
||||||
|
_narrowRatio = narrowRatio;
|
||||||
|
_narrowWidth = narrowWidth;
|
||||||
|
if (started || finished) {
|
||||||
|
updateControlsVisibility();
|
||||||
|
}
|
||||||
|
setGeometry(geometry);
|
||||||
|
if (changed && !resized) {
|
||||||
|
updateSearchVisibility();
|
||||||
|
updateControlsGeometry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool TopBarWidget::showSelectedActions() const {
|
bool TopBarWidget::showSelectedActions() const {
|
||||||
return showSelectedState() && !_chooseForReportReason;
|
return showSelectedState() && !_chooseForReportReason;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,6 +112,11 @@ public:
|
||||||
}
|
}
|
||||||
[[nodiscard]] rpl::producer<> searchRequest() const;
|
[[nodiscard]] rpl::producer<> searchRequest() const;
|
||||||
|
|
||||||
|
void setGeometryWithNarrowRatio(
|
||||||
|
QRect geometry,
|
||||||
|
int narrowWidth,
|
||||||
|
float64 narrowRatio);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void mousePressEvent(QMouseEvent *e) override;
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
@ -226,12 +231,14 @@ private:
|
||||||
object_ptr<TWidget> _membersShowArea = { nullptr };
|
object_ptr<TWidget> _membersShowArea = { nullptr };
|
||||||
rpl::event_stream<bool> _membersShowAreaActive;
|
rpl::event_stream<bool> _membersShowAreaActive;
|
||||||
|
|
||||||
|
float64 _narrowRatio = 0.;
|
||||||
|
int _narrowWidth = 0;
|
||||||
|
|
||||||
Ui::Text::String _titlePeerText;
|
Ui::Text::String _titlePeerText;
|
||||||
bool _titlePeerTextOnline = false;
|
bool _titlePeerTextOnline = false;
|
||||||
int _leftTaken = 0;
|
int _leftTaken = 0;
|
||||||
int _rightTaken = 0;
|
int _rightTaken = 0;
|
||||||
bool _animatingMode = false;
|
bool _animatingMode = false;
|
||||||
bool _narrowMode = false;
|
|
||||||
std::unique_ptr<Ui::InfiniteRadialAnimation> _connecting;
|
std::unique_ptr<Ui::InfiniteRadialAnimation> _connecting;
|
||||||
|
|
||||||
SendActionPainter *_sendAction = nullptr;
|
SendActionPainter *_sendAction = nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue