Add 5 lines of About to group call context menu.

This commit is contained in:
John Preston 2021-10-22 18:47:36 +04:00
parent d0606a3798
commit 47d957f942
4 changed files with 66 additions and 3 deletions

View File

@ -561,6 +561,11 @@ groupCallMenuCover: ShortInfoCover(shortInfoCover) {
namePosition: point(17px, 28px);
statusPosition: point(17px, 8px);
}
groupCallMenuAbout: FlatLabel(defaultFlatLabel) {
textFg: groupCallMemberNotJoinedStatus;
minWidth: 200px;
maxHeight: 92px;
}
groupCallRecordingTimerPadding: margins(0px, 4px, 0px, 4px);
groupCallRecordingTimerFont: font(12px);

View File

@ -12,9 +12,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_info.h"
namespace Calls {
namespace {
} // namespace
CoverItem::CoverItem(
not_null<RpWidget*> parent,
@ -56,4 +53,40 @@ int CoverItem::contentHeight() const {
return _st.size + st::groupCallMenu.separatorPadding.bottom();
}
AboutItem::AboutItem(
not_null<RpWidget*> parent,
const style::Menu &st,
const QString &about)
: Ui::Menu::ItemBase(parent, st)
, _st(st)
, _text(base::make_unique_q<Ui::FlatLabel>(
this,
about,
st::groupCallMenuAbout))
, _dummyAction(new QAction(parent)) {
setPointerCursor(false);
initResizeHook(parent->sizeValue());
enableMouseSelecting();
enableMouseSelecting(_text.get());
_text->setSelectable(true);
_text->resizeToWidth(st::groupCallMenuAbout.minWidth);
_text->moveToLeft(st.itemPadding.left(), st.itemPadding.top());
}
not_null<QAction*> AboutItem::action() const {
return _dummyAction;
}
bool AboutItem::isEnabled() const {
return false;
}
int AboutItem::contentHeight() const {
return _st.itemPadding.top()
+ _text->height()
+ _st.itemPadding.bottom();
}
} // namespace Calls

View File

@ -45,6 +45,24 @@ private:
const not_null<QAction*> _dummyAction;
const style::ShortInfoCover &_st;
};
class AboutItem final : public Ui::Menu::ItemBase {
public:
AboutItem(
not_null<RpWidget*> parent,
const style::Menu &st,
const QString &about);
not_null<QAction*> action() const override;
bool isEnabled() const override;
private:
int contentHeight() const override;
const style::Menu &_st;
const base::unique_qptr<Ui::FlatLabel> _text;
const not_null<QAction*> _dummyAction;
};

View File

@ -1263,6 +1263,13 @@ base::unique_qptr<Ui::PopupMenu> Members::Controller::createRowContextMenu(
) | rpl::map([](const auto &text) { return text.text; }),
PrepareShortInfoStatus(participantPeer),
PrepareShortInfoUserpic(participantPeer)));
if (const auto about = participantPeer->about(); !about.isEmpty()) {
result->addAction(base::make_unique_q<AboutItem>(
result->menu(),
st::groupCallPopupCoverMenu,
about));
}
}
if (const auto real = _call->lookupReal()) {