Show participants count in the subtitle.

This commit is contained in:
John Preston 2020-12-17 14:19:33 +04:00
parent 9dc6f117a7
commit bb8647dd4c
5 changed files with 47 additions and 22 deletions

View file

@ -512,7 +512,10 @@ groupCallMultiSelect: MultiSelect(defaultMultiSelect) {
} }
} }
groupCallMembersHeader: 47px; groupCallMembersTop: 62px;
groupCallTitleTop: 14px;
groupCallSubtitleTop: 33px;
groupCallMembersMargin: margins(16px, 16px, 16px, 28px); groupCallMembersMargin: margins(16px, 16px, 16px, 28px);
groupCallAddMember: SettingsButton(defaultSettingsButton) { groupCallAddMember: SettingsButton(defaultSettingsButton) {
textFg: groupCallMemberNotJoinedStatus; textFg: groupCallMemberNotJoinedStatus;
@ -529,14 +532,16 @@ groupCallAddMember: SettingsButton(defaultSettingsButton) {
} }
groupCallAddMemberIcon: icon {{ "info_add_member", groupCallMemberInactiveIcon, point(0px, 3px) }}; groupCallAddMemberIcon: icon {{ "info_add_member", groupCallMemberInactiveIcon, point(0px, 3px) }};
groupCallAddMemberIconLeft: 16px; groupCallAddMemberIconLeft: 16px;
groupCallHeaderPosition: point(16px, 16px); groupCallSubtitleLabel: FlatLabel(defaultFlatLabel) {
groupCallHeaderLabel: FlatLabel(defaultFlatLabel) {
maxHeight: 18px; maxHeight: 18px;
textFg: groupCallMemberNotJoinedStatus;
}
groupCallTitleLabel: FlatLabel(groupCallSubtitleLabel) {
textFg: groupCallMembersFg; textFg: groupCallMembersFg;
style: TextStyle(defaultTextStyle) { style: TextStyle(defaultTextStyle) {
font: semiboldFont; font: font(semibold 14px);
linkFont: semiboldFont; linkFont: font(semibold 14px);
linkFontOver: semiboldFont; linkFontOver: font(semibold 14px);
} }
} }
groupCallAddButtonPosition: point(10px, 7px); groupCallAddButtonPosition: point(10px, 7px);
@ -729,8 +734,8 @@ groupCallTitleCloseIconOver: icon {
}; };
groupCallTitle: WindowTitle(defaultWindowTitle) { groupCallTitle: WindowTitle(defaultWindowTitle) {
height: 0px; height: 0px;
bg: groupCallBg; bg: transparent;
bgActive: groupCallBg; bgActive: transparent;
fg: transparent; fg: transparent;
fgActive: transparent; fgActive: transparent;
minimize: IconButton(groupCallTitleButton) { minimize: IconButton(groupCallTitleButton) {

View file

@ -220,6 +220,8 @@ GroupPanel::GroupPanel(not_null<GroupCall*> call)
_layerBg->setStyleOverrides(&st::groupCallBox, &st::groupCallLayerBox); _layerBg->setStyleOverrides(&st::groupCallBox, &st::groupCallLayerBox);
_settings->setColorOverrides(_mute->colorOverrides()); _settings->setColorOverrides(_mute->colorOverrides());
_window->setTitleStyle(st::groupCallTitle);
SubscribeToMigration( SubscribeToMigration(
_peer, _peer,
_window->lifetime(), _window->lifetime(),
@ -576,22 +578,22 @@ void GroupPanel::initGeometry() {
} }
int GroupPanel::computeMembersListTop() const { int GroupPanel::computeMembersListTop() const {
#ifdef Q_OS_WIN if (computeTitleRect().has_value()) {
return st::callTitleButton.height + st::groupCallMembersMargin.top() / 2; return st::groupCallMembersTop;
#elif defined Q_OS_MAC // Q_OS_WIN }
return st::groupCallMembersMargin.top() * 2; return st::groupCallMembersTop
#else // Q_OS_WIN || Q_OS_MAC - (st::groupCallSubtitleTop - st::groupCallTitleTop);
return st::groupCallMembersMargin.top();
#endif // Q_OS_WIN || Q_OS_MAC
} }
std::optional<QRect> GroupPanel::computeTitleRect() const { std::optional<QRect> GroupPanel::computeTitleRect() const {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
const auto controls = _controls->geometry(); const auto controls = _controls->geometry();
return QRect(0, 0, controls.x(), controls.height()); return QRect(0, 0, controls.x(), controls.height());
#else // Q_OS_WIN #elif Q_OS_MAC // Q_OS_WIN
return QRect(70, 0, widget()->width() - 70, 28);
#else // Q_OS_WIN || Q_OS_MAC
return std::nullopt; return std::nullopt;
#endif // Q_OS_WIN #endif // Q_OS_WIN || Q_OS_MAC
} }
void GroupPanel::updateControlsGeometry() { void GroupPanel::updateControlsGeometry() {
@ -636,12 +638,13 @@ void GroupPanel::refreshTitle() {
_title.create( _title.create(
widget(), widget(),
Info::Profile::NameValue(_peer), Info::Profile::NameValue(_peer),
st::groupCallHeaderLabel); st::groupCallTitleLabel);
_title->show();
_title->setAttribute(Qt::WA_TransparentForMouseEvents); _title->setAttribute(Qt::WA_TransparentForMouseEvents);
} }
const auto best = _title->naturalWidth(); const auto best = _title->naturalWidth();
const auto from = (widget()->width() - best) / 2; const auto from = (widget()->width() - best) / 2;
const auto top = (computeMembersListTop() - _title->height()) / 2; const auto top = st::groupCallTitleTop;
const auto left = titleRect->x(); const auto left = titleRect->x();
if (from >= left && from + best <= left + titleRect->width()) { if (from >= left && from + best <= left + titleRect->width()) {
_title->resizeToWidth(best); _title->resizeToWidth(best);
@ -659,6 +662,23 @@ void GroupPanel::refreshTitle() {
} else if (_title) { } else if (_title) {
_title.destroy(); _title.destroy();
} }
if (!_subtitle) {
_subtitle.create(
widget(),
tr::lng_group_call_members(
lt_count_decimal,
_members->fullCountValue() | tr::to_count()),
st::groupCallSubtitleLabel);
_subtitle->show();
_subtitle->setAttribute(Qt::WA_TransparentForMouseEvents);
}
const auto middle = _title
? (_title->x() + _title->width() / 2)
: (widget()->width() / 2);
const auto top = _title
? st::groupCallSubtitleTop
: st::groupCallTitleTop;
_subtitle->moveToLeft(middle - (_subtitle->width() / 2), top);
} }
void GroupPanel::paint(QRect clip) { void GroupPanel::paint(QRect clip) {

View file

@ -221,7 +221,7 @@ void GroupCallBar::paint(Painter &p) {
p.setPen(st::defaultMessageBar.textFg); p.setPen(st::defaultMessageBar.textFg);
p.setFont(st::defaultMessageBar.title.font); p.setFont(st::defaultMessageBar.title.font);
p.drawTextLeft(left, titleTop, width, tr::lng_group_call_title(tr::now)); p.drawTextLeft(left, titleTop, width, tr::lng_group_call_title(tr::now));
p.setPen(st::historyComposeAreaFgService); p.setPen(st::historyStatusFg);
p.setFont(st::defaultMessageBar.text.font); p.setFont(st::defaultMessageBar.text.font);
p.drawTextLeft( p.drawTextLeft(
left, left,

@ -1 +1 @@
Subproject commit 931f6a49c531995d4daf64f8357042a1eeeef43f Subproject commit 37d98e984fd6fa389262307db826d52ab86c8241

@ -1 +1 @@
Subproject commit a21d24aeb755f2c975eced1dcb101b6520614e15 Subproject commit 178983f72312ca8bd422bc73810fd63f1a89bd9d