mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-26 10:31:18 +00:00
Show information about hidden author.
This commit is contained in:
parent
9f0b42bbbd
commit
1cb5ef7476
@ -72,14 +72,6 @@ SublistWidget::SublistWidget(
|
||||
this,
|
||||
controller->chatStyle()->value(lifetime(), st::historyScroll),
|
||||
false))
|
||||
, _openChatButton(std::make_unique<Ui::FlatButton>(
|
||||
this,
|
||||
(_sublist->peer()->isBroadcast()
|
||||
? tr::lng_saved_open_channel(tr::now)
|
||||
: _sublist->peer()->isUser()
|
||||
? tr::lng_saved_open_chat(tr::now)
|
||||
: tr::lng_saved_open_group(tr::now)),
|
||||
st::historyComposeButton))
|
||||
, _cornerButtons(
|
||||
_scroll.get(),
|
||||
controller->chatStyle(),
|
||||
@ -89,6 +81,9 @@ SublistWidget::SublistWidget(
|
||||
_scroll->updateBars();
|
||||
}, _scroll->lifetime());
|
||||
|
||||
setupOpenChatButton();
|
||||
setupAboutHiddenAuthor();
|
||||
|
||||
Window::ChatThemeValueFromPeer(
|
||||
controller,
|
||||
sublist->peer()
|
||||
@ -139,13 +134,24 @@ SublistWidget::SublistWidget(
|
||||
onScroll();
|
||||
}, lifetime());
|
||||
|
||||
setupOpenChatButton();
|
||||
setupTranslateBar();
|
||||
}
|
||||
|
||||
SublistWidget::~SublistWidget() = default;
|
||||
|
||||
void SublistWidget::setupOpenChatButton() {
|
||||
if (_sublist->peer()->isSavedHiddenAuthor()) {
|
||||
return;
|
||||
}
|
||||
_openChatButton = std::make_unique<Ui::FlatButton>(
|
||||
this,
|
||||
(_sublist->peer()->isBroadcast()
|
||||
? tr::lng_saved_open_channel(tr::now)
|
||||
: _sublist->peer()->isUser()
|
||||
? tr::lng_saved_open_chat(tr::now)
|
||||
: tr::lng_saved_open_group(tr::now)),
|
||||
st::historyComposeButton);
|
||||
|
||||
_openChatButton->setClickedCallback([=] {
|
||||
controller()->showPeerHistory(
|
||||
_sublist->peer(),
|
||||
@ -153,6 +159,27 @@ void SublistWidget::setupOpenChatButton() {
|
||||
});
|
||||
}
|
||||
|
||||
void SublistWidget::setupAboutHiddenAuthor() {
|
||||
if (!_sublist->peer()->isSavedHiddenAuthor()) {
|
||||
return;
|
||||
}
|
||||
_aboutHiddenAuthor = std::make_unique<Ui::RpWidget>(this);
|
||||
_aboutHiddenAuthor->paintRequest() | rpl::start_with_next([=] {
|
||||
auto p = QPainter(_aboutHiddenAuthor.get());
|
||||
auto rect = _aboutHiddenAuthor->rect();
|
||||
|
||||
p.fillRect(rect, st::historyReplyBg);
|
||||
|
||||
p.setFont(st::normalFont);
|
||||
p.setPen(st::windowSubTextFg);
|
||||
p.drawText(
|
||||
rect.marginsRemoved(
|
||||
QMargins(st::historySendPadding, 0, st::historySendPadding, 0)),
|
||||
tr::lng_saved_about_hidden(tr::now),
|
||||
style::al_center);
|
||||
}, _aboutHiddenAuthor->lifetime());
|
||||
}
|
||||
|
||||
void SublistWidget::setupTranslateBar() {
|
||||
controller()->adaptive().oneColumnValue(
|
||||
) | rpl::start_with_next([=, raw = _translateBar.get()](bool one) {
|
||||
@ -319,9 +346,17 @@ void SublistWidget::updateControlsGeometry() {
|
||||
_topBar->resizeToWidth(contentWidth);
|
||||
_topBarShadow->resize(contentWidth, st::lineWidth);
|
||||
|
||||
const auto bottom = height() - _openChatButton->height();
|
||||
_openChatButton->resizeToWidth(width());
|
||||
_openChatButton->move(0, bottom);
|
||||
auto bottom = height();
|
||||
if (_openChatButton) {
|
||||
_openChatButton->resizeToWidth(width());
|
||||
bottom -= _openChatButton->height();
|
||||
_openChatButton->move(0, bottom);
|
||||
}
|
||||
if (_aboutHiddenAuthor) {
|
||||
_aboutHiddenAuthor->resize(width(), st::historyUnblock.height);
|
||||
bottom -= _aboutHiddenAuthor->height();
|
||||
_aboutHiddenAuthor->move(0, bottom);
|
||||
}
|
||||
const auto controlsHeight = 0;
|
||||
auto top = _topBar->height();
|
||||
_translateBar->move(0, top);
|
||||
|
@ -163,6 +163,7 @@ private:
|
||||
FullMsgId originId = {});
|
||||
|
||||
void setupOpenChatButton();
|
||||
void setupAboutHiddenAuthor();
|
||||
void setupTranslateBar();
|
||||
|
||||
void confirmDeleteSelected();
|
||||
@ -183,6 +184,7 @@ private:
|
||||
bool _skipScrollEvent = false;
|
||||
std::unique_ptr<Ui::ScrollArea> _scroll;
|
||||
std::unique_ptr<Ui::FlatButton> _openChatButton;
|
||||
std::unique_ptr<Ui::RpWidget> _aboutHiddenAuthor;
|
||||
|
||||
CornerButtons _cornerButtons;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user