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);
groupCallAddMember: SettingsButton(defaultSettingsButton) {
textFg: groupCallMemberNotJoinedStatus;
@ -529,14 +532,16 @@ groupCallAddMember: SettingsButton(defaultSettingsButton) {
}
groupCallAddMemberIcon: icon {{ "info_add_member", groupCallMemberInactiveIcon, point(0px, 3px) }};
groupCallAddMemberIconLeft: 16px;
groupCallHeaderPosition: point(16px, 16px);
groupCallHeaderLabel: FlatLabel(defaultFlatLabel) {
groupCallSubtitleLabel: FlatLabel(defaultFlatLabel) {
maxHeight: 18px;
textFg: groupCallMemberNotJoinedStatus;
}
groupCallTitleLabel: FlatLabel(groupCallSubtitleLabel) {
textFg: groupCallMembersFg;
style: TextStyle(defaultTextStyle) {
font: semiboldFont;
linkFont: semiboldFont;
linkFontOver: semiboldFont;
font: font(semibold 14px);
linkFont: font(semibold 14px);
linkFontOver: font(semibold 14px);
}
}
groupCallAddButtonPosition: point(10px, 7px);
@ -729,8 +734,8 @@ groupCallTitleCloseIconOver: icon {
};
groupCallTitle: WindowTitle(defaultWindowTitle) {
height: 0px;
bg: groupCallBg;
bgActive: groupCallBg;
bg: transparent;
bgActive: transparent;
fg: transparent;
fgActive: transparent;
minimize: IconButton(groupCallTitleButton) {

View File

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

View File

@ -221,7 +221,7 @@ void GroupCallBar::paint(Painter &p) {
p.setPen(st::defaultMessageBar.textFg);
p.setFont(st::defaultMessageBar.title.font);
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.drawTextLeft(
left,

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

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