mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Show information about hidden author.
This commit is contained in:
parent
9f0b42bbbd
commit
1cb5ef7476
2 changed files with 49 additions and 12 deletions
|
@ -72,14 +72,6 @@ SublistWidget::SublistWidget(
|
||||||
this,
|
this,
|
||||||
controller->chatStyle()->value(lifetime(), st::historyScroll),
|
controller->chatStyle()->value(lifetime(), st::historyScroll),
|
||||||
false))
|
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(
|
, _cornerButtons(
|
||||||
_scroll.get(),
|
_scroll.get(),
|
||||||
controller->chatStyle(),
|
controller->chatStyle(),
|
||||||
|
@ -89,6 +81,9 @@ SublistWidget::SublistWidget(
|
||||||
_scroll->updateBars();
|
_scroll->updateBars();
|
||||||
}, _scroll->lifetime());
|
}, _scroll->lifetime());
|
||||||
|
|
||||||
|
setupOpenChatButton();
|
||||||
|
setupAboutHiddenAuthor();
|
||||||
|
|
||||||
Window::ChatThemeValueFromPeer(
|
Window::ChatThemeValueFromPeer(
|
||||||
controller,
|
controller,
|
||||||
sublist->peer()
|
sublist->peer()
|
||||||
|
@ -139,13 +134,24 @@ SublistWidget::SublistWidget(
|
||||||
onScroll();
|
onScroll();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
setupOpenChatButton();
|
|
||||||
setupTranslateBar();
|
setupTranslateBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
SublistWidget::~SublistWidget() = default;
|
SublistWidget::~SublistWidget() = default;
|
||||||
|
|
||||||
void SublistWidget::setupOpenChatButton() {
|
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([=] {
|
_openChatButton->setClickedCallback([=] {
|
||||||
controller()->showPeerHistory(
|
controller()->showPeerHistory(
|
||||||
_sublist->peer(),
|
_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() {
|
void SublistWidget::setupTranslateBar() {
|
||||||
controller()->adaptive().oneColumnValue(
|
controller()->adaptive().oneColumnValue(
|
||||||
) | rpl::start_with_next([=, raw = _translateBar.get()](bool one) {
|
) | rpl::start_with_next([=, raw = _translateBar.get()](bool one) {
|
||||||
|
@ -319,9 +346,17 @@ void SublistWidget::updateControlsGeometry() {
|
||||||
_topBar->resizeToWidth(contentWidth);
|
_topBar->resizeToWidth(contentWidth);
|
||||||
_topBarShadow->resize(contentWidth, st::lineWidth);
|
_topBarShadow->resize(contentWidth, st::lineWidth);
|
||||||
|
|
||||||
const auto bottom = height() - _openChatButton->height();
|
auto bottom = height();
|
||||||
_openChatButton->resizeToWidth(width());
|
if (_openChatButton) {
|
||||||
_openChatButton->move(0, bottom);
|
_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;
|
const auto controlsHeight = 0;
|
||||||
auto top = _topBar->height();
|
auto top = _topBar->height();
|
||||||
_translateBar->move(0, top);
|
_translateBar->move(0, top);
|
||||||
|
|
|
@ -163,6 +163,7 @@ private:
|
||||||
FullMsgId originId = {});
|
FullMsgId originId = {});
|
||||||
|
|
||||||
void setupOpenChatButton();
|
void setupOpenChatButton();
|
||||||
|
void setupAboutHiddenAuthor();
|
||||||
void setupTranslateBar();
|
void setupTranslateBar();
|
||||||
|
|
||||||
void confirmDeleteSelected();
|
void confirmDeleteSelected();
|
||||||
|
@ -183,6 +184,7 @@ private:
|
||||||
bool _skipScrollEvent = false;
|
bool _skipScrollEvent = false;
|
||||||
std::unique_ptr<Ui::ScrollArea> _scroll;
|
std::unique_ptr<Ui::ScrollArea> _scroll;
|
||||||
std::unique_ptr<Ui::FlatButton> _openChatButton;
|
std::unique_ptr<Ui::FlatButton> _openChatButton;
|
||||||
|
std::unique_ptr<Ui::RpWidget> _aboutHiddenAuthor;
|
||||||
|
|
||||||
CornerButtons _cornerButtons;
|
CornerButtons _cornerButtons;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue