Various fixes.

This commit is contained in:
John Preston 2017-11-16 11:45:55 +04:00
parent 5a159d0204
commit 131efa11be
10 changed files with 33 additions and 13 deletions

View File

@ -242,7 +242,7 @@ infoTopBarMenuPosition: point(-2px, 35px);
infoLayerTopBarMenuPosition: point(40px, 37px);
infoMinimalWidth: 324px;
infoDesiredWidth: 430px;
infoDesiredWidth: 392px;
infoMinimalLayerMargin: 48px;
infoTabs: SettingsSlider(defaultTabsSlider) {

View File

@ -111,7 +111,13 @@ bool LayerWidget::takeToThirdSection() {
bool LayerWidget::showSectionInternal(
not_null<Window::SectionMemento*> memento,
const Window::SectionShow &params) {
return _content->showInternal(memento, params);
if (_content->showInternal(memento, params)) {
if (params.activation != anim::activation::background) {
Ui::hideLayer();
}
return true;
}
return false;
}
int LayerWidget::MinimalSupportedWidth() {

View File

@ -518,18 +518,17 @@ void ActionsFiller::addBlockAction(not_null<UserData*> user) {
auto text = Notify::PeerUpdateValue(
user,
Notify::PeerUpdate::Flag::UserIsBlocked)
| rpl::map([user]() -> rpl::producer<QString> {
| rpl::map([user] {
switch (user->blockStatus()) {
case UserData::BlockStatus::Blocked:
return Lang::Viewer(user->botInfo
? lng_profile_unblock_bot
: lng_profile_unblock_user);
case UserData::BlockStatus::NotBlocked:
default:
return Lang::Viewer(user->botInfo
? lng_profile_block_bot
: lng_profile_block_user);
default:
return rpl::single(QString());
}
})
| rpl::flatten_latest()

View File

@ -69,8 +69,10 @@ InnerWidget::InnerWidget(
, _content(setupContent(this)) {
_content->heightValue()
| rpl::start_with_next([this](int height) {
resizeToWidth(width());
_desiredHeight.fire(countDesiredHeight());
if (!_inResize) {
resizeToWidth(width());
updateDesiredHeight();
}
}, lifetime());
}
@ -259,8 +261,12 @@ void InnerWidget::restoreState(not_null<Memento*> memento) {
}
int InnerWidget::resizeGetHeight(int newWidth) {
_inResize = true;
auto guard = gsl::finally([&] { _inResize = false; });
_content->resizeToWidth(newWidth);
_content->moveToLeft(0, 0);
updateDesiredHeight();
return _content->heightNoMargins();
}

View File

@ -77,6 +77,9 @@ private:
object_ptr<RpWidget> setupSharedMedia(not_null<RpWidget*> parent);
int countDesiredHeight() const;
void updateDesiredHeight() {
_desiredHeight.fire(countDesiredHeight());
}
bool canHideDetailsEver() const;
rpl::producer<bool> canHideDetails() const;
@ -93,6 +96,7 @@ private:
Ui::SlideWrap<RpWidget> *_sharedMediaWrap = nullptr;
object_ptr<RpWidget> _content;
bool _inResize = false;
rpl::event_stream<Ui::ScrollToRequest> _scrollToRequests;
rpl::event_stream<int> _desiredHeight;

View File

@ -675,7 +675,7 @@ bool MainWidget::onShareUrl(const PeerId &peer, const QString &url, const QStrin
bool MainWidget::onInlineSwitchChosen(const PeerId &peer, const QString &botAndQuery) {
PeerData *p = App::peer(peer);
if (!peer || p->canWrite()) {
if (!peer || !p->canWrite()) {
Ui::show(Box<InformBox>(lang(lng_inline_switch_cant)));
return false;
}

View File

@ -59,6 +59,9 @@ int VerticalLayout::naturalWidth() const {
}
int VerticalLayout::resizeGetHeight(int newWidth) {
_inResize = true;
auto guard = gsl::finally([&] { _inResize = false; });
auto margins = getMargins();
auto result = 0;
for (auto &row : _rows) {
@ -72,7 +75,7 @@ int VerticalLayout::resizeGetHeight(int newWidth) {
+ row.widget->heightNoMargins()
+ row.margin.bottom();
}
return height() - margins.top() - margins.bottom();
return result - margins.bottom();
}
void VerticalLayout::visibleTopBottomUpdated(
@ -116,7 +119,9 @@ RpWidget *VerticalLayout::addChild(
height() - margins.top() - margins.bottom());
weak->heightValue()
| rpl::start_with_next_done([this, weak] {
childHeightUpdated(weak);
if (!_inResize) {
childHeightUpdated(weak);
}
}, [this, weak] {
removeChild(weak);
}, lifetime());

View File

@ -67,6 +67,7 @@ private:
style::margins margin;
};
std::vector<Row> _rows;
bool _inResize = false;
};

View File

@ -34,8 +34,8 @@ columnMinimalWidthLeft: 260px;
columnMaximalWidthLeft: 540px;
columnMinimalWidthMain: 380px;
columnDesiredWidthMain: 512px;
columnMinimalWidthThird: 292px;//345px;
columnMaximalWidthThird: 430px;//345px;
columnMinimalWidthThird: 292px;
columnMaximalWidthThird: 392px;
adaptiveChatWideWidth: 880px;

View File

@ -446,7 +446,6 @@ void PeerMenuDeleteContact(not_null<UserData*> user) {
lt_contact,
App::peerName(user));
auto deleteSure = [=] {
Ui::showChatsList();
Ui::hideLayer();
MTP::send(
MTPcontacts_DeleteContact(user->inputUser),