Fixed back button when opening channels. Fixed profile buttons layout.

This commit is contained in:
John Preston 2016-09-01 21:37:30 -04:00
parent be02ef563c
commit 263448bfb2
7 changed files with 12 additions and 12 deletions

View File

@ -8377,7 +8377,7 @@ void GoToMessageClickHandler::onClickImpl() const {
if (current && current->history()->peer->id == peer()) {
App::main()->pushReplyReturn(current);
}
Ui::showPeerHistory(peer(), msgid());
Ui::showPeerHistory(peer(), msgid(), Ui::ShowWay::Forward);
}
}

View File

@ -3451,7 +3451,7 @@ void MainWidget::usernameResolveDone(QPair<MsgId, QString> msgIdAndStartToken, c
_history->resizeEvent(0);
}
}
Ui::showPeerHistory(peer->id, msgId);
Ui::showPeerHistory(peer->id, msgId, Ui::ShowWay::Forward);
}
}

View File

@ -98,15 +98,15 @@ Ui::LeftOutlineButton *ActionsWidget::addButton(const QString &text, const char
result->show();
int top = buttonsBottom() + skipHeight;
resizeButton(result, top);
resizeButton(result, width(), top);
_buttons.push_back(result);
return result;
};
void ActionsWidget::resizeButton(Ui::LeftOutlineButton *button, int top) {
void ActionsWidget::resizeButton(Ui::LeftOutlineButton *button, int newWidth, int top) {
int left = defaultOutlineButtonLeft();
int availableWidth = width() - left - st::profileBlockMarginRight;
int availableWidth = newWidth - left - st::profileBlockMarginRight;
accumulate_min(availableWidth, st::profileBlockOneLineWidthMax);
button->resizeToWidth(availableWidth);
button->moveToLeft(left, top);
@ -242,7 +242,7 @@ void ActionsWidget::refreshLeaveChannel() {
int ActionsWidget::resizeGetHeight(int newWidth) {
for_const (auto button, _buttons) {
resizeButton(button, button->y());
resizeButton(button, newWidth, button->y());
}
return buttonsBottom();
}

View File

@ -73,7 +73,7 @@ private:
Ui::LeftOutlineButton *addButton(const QString &text, const char *slot
, const style::OutlineButton &st = st::defaultLeftOutlineButton, int skipHeight = 0);
void resizeButton(Ui::LeftOutlineButton *button, int top);
void resizeButton(Ui::LeftOutlineButton *button, int newWidth, int top);
QString getBlockButtonText() const;
bool hasBotCommand(const QString &command) const;

View File

@ -84,7 +84,7 @@ void SharedMediaWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) {
int SharedMediaWidget::resizeGetHeight(int newWidth) {
int newHeight = contentTop();
resizeButtons(&newHeight);
resizeButtons(newWidth, &newHeight);
return newHeight;
}
@ -135,11 +135,11 @@ void SharedMediaWidget::onMediaChosen() {
}
}
void SharedMediaWidget::resizeButtons(int *top) {
void SharedMediaWidget::resizeButtons(int newWidth, int *top) {
t_assert(top != nullptr);
int left = defaultOutlineButtonLeft();
int availableWidth = width() - left - st::profileBlockMarginRight;
int availableWidth = newWidth - left - st::profileBlockMarginRight;
accumulate_min(availableWidth, st::profileBlockOneLineWidthMax);
for_const (auto button, _mediaButtons) {
if (!button) continue;

View File

@ -53,7 +53,7 @@ private:
void refreshButton(MediaOverviewType type);
void refreshVisibility();
void resizeButtons(int *top);
void resizeButtons(int newWidth, int *top);
Ui::LeftOutlineButton *_mediaButtons[OverviewCount] = { nullptr };
History *_history;

View File

@ -1636,7 +1636,7 @@ void PeerOpenClickHandler::onClickImpl() const {
if (!peer()->asChannel()->isPublic() && !peer()->asChannel()->amIn()) {
Ui::showLayer(new InformBox(lang((peer()->isMegagroup()) ? lng_group_not_accessible : lng_channel_not_accessible)));
} else {
Ui::showPeerHistory(peer(), ShowAtUnreadMsgId);
Ui::showPeerHistory(peer(), ShowAtUnreadMsgId, Ui::ShowWay::Forward);
}
} else {
Ui::showPeerProfile(peer());