Don't cut name / status unnecessary.
This commit is contained in:
parent
8a1118d9bb
commit
27063167ae
|
@ -1567,34 +1567,49 @@ crl::time PeerListContent::paintRow(
|
||||||
|
|
||||||
p.setPen(st::contactsNameFg);
|
p.setPen(st::contactsNameFg);
|
||||||
|
|
||||||
auto skipRight = _st.item.photoPosition.x();
|
const auto skipRight = _st.item.photoPosition.x();
|
||||||
auto rightActionSize = row->rightActionSize();
|
const auto rightActionSize = row->rightActionSize();
|
||||||
auto rightActionMargins = rightActionSize.isEmpty()
|
const auto rightActionMargins = rightActionSize.isEmpty()
|
||||||
? QMargins()
|
? QMargins()
|
||||||
: row->rightActionMargins();
|
: row->rightActionMargins();
|
||||||
auto &name = row->name();
|
const auto &name = row->name();
|
||||||
auto namex = _st.item.namePosition.x();
|
const auto namex = _st.item.namePosition.x();
|
||||||
|
const auto namey = _st.item.namePosition.y();
|
||||||
auto namew = outerWidth - namex - skipRight;
|
auto namew = outerWidth - namex - skipRight;
|
||||||
if (!rightActionSize.isEmpty()) {
|
if (!rightActionSize.isEmpty()
|
||||||
|
&& (namey < rightActionMargins.top() + rightActionSize.height())
|
||||||
|
&& (namey + _st.item.nameStyle.font->height
|
||||||
|
> rightActionMargins.top())) {
|
||||||
namew -= rightActionMargins.left()
|
namew -= rightActionMargins.left()
|
||||||
+ rightActionSize.width()
|
+ rightActionSize.width()
|
||||||
+ rightActionMargins.right()
|
+ rightActionMargins.right()
|
||||||
- skipRight;
|
- skipRight;
|
||||||
}
|
}
|
||||||
auto statusw = namew;
|
const auto statusx = _st.item.statusPosition.x();
|
||||||
|
const auto statusy = _st.item.statusPosition.y();
|
||||||
|
auto statusw = outerWidth - statusx - skipRight;
|
||||||
|
if (!rightActionSize.isEmpty()
|
||||||
|
&& (statusy < rightActionMargins.top() + rightActionSize.height())
|
||||||
|
&& (statusy + st::contactsStatusFont->height
|
||||||
|
> rightActionMargins.top())) {
|
||||||
|
statusw -= rightActionMargins.left()
|
||||||
|
+ rightActionSize.width()
|
||||||
|
+ rightActionMargins.right()
|
||||||
|
- skipRight;
|
||||||
|
}
|
||||||
namew -= row->paintNameIconGetWidth(
|
namew -= row->paintNameIconGetWidth(
|
||||||
p,
|
p,
|
||||||
[=] { updateRow(row); },
|
[=] { updateRow(row); },
|
||||||
now,
|
now,
|
||||||
namex,
|
namex,
|
||||||
_st.item.namePosition.y(),
|
namey,
|
||||||
name.maxWidth(),
|
name.maxWidth(),
|
||||||
namew,
|
namew,
|
||||||
width(),
|
width(),
|
||||||
selected);
|
selected);
|
||||||
auto nameCheckedRatio = row->disabled() ? 0. : row->checkedRatio();
|
auto nameCheckedRatio = row->disabled() ? 0. : row->checkedRatio();
|
||||||
p.setPen(anim::pen(_st.item.nameFg, _st.item.nameFgChecked, nameCheckedRatio));
|
p.setPen(anim::pen(_st.item.nameFg, _st.item.nameFgChecked, nameCheckedRatio));
|
||||||
name.drawLeftElided(p, namex, _st.item.namePosition.y(), namew, width());
|
name.drawLeftElided(p, namex, namey, namew, width());
|
||||||
|
|
||||||
p.setFont(st::contactsStatusFont);
|
p.setFont(st::contactsStatusFont);
|
||||||
if (row->isSearchResult()
|
if (row->isSearchResult()
|
||||||
|
@ -1613,16 +1628,16 @@ crl::time PeerListContent::paintRow(
|
||||||
highlightedPart = st::contactsStatusFont->elided(highlightedPart, availableWidth);
|
highlightedPart = st::contactsStatusFont->elided(highlightedPart, availableWidth);
|
||||||
}
|
}
|
||||||
p.setPen(_st.item.statusFgActive);
|
p.setPen(_st.item.statusFgActive);
|
||||||
p.drawTextLeft(_st.item.statusPosition.x(), _st.item.statusPosition.y(), width(), highlightedPart);
|
p.drawTextLeft(statusx, statusy, width(), highlightedPart);
|
||||||
} else {
|
} else {
|
||||||
grayedPart = st::contactsStatusFont->elided(grayedPart, availableWidth - highlightedWidth);
|
grayedPart = st::contactsStatusFont->elided(grayedPart, availableWidth - highlightedWidth);
|
||||||
p.setPen(_st.item.statusFgActive);
|
p.setPen(_st.item.statusFgActive);
|
||||||
p.drawTextLeft(_st.item.statusPosition.x(), _st.item.statusPosition.y(), width(), highlightedPart);
|
p.drawTextLeft(statusx, statusy, width(), highlightedPart);
|
||||||
p.setPen(selected ? _st.item.statusFgOver : _st.item.statusFg);
|
p.setPen(selected ? _st.item.statusFgOver : _st.item.statusFg);
|
||||||
p.drawTextLeft(_st.item.statusPosition.x() + highlightedWidth, _st.item.statusPosition.y(), width(), grayedPart);
|
p.drawTextLeft(statusx + highlightedWidth, statusy, width(), grayedPart);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
row->paintStatusText(p, _st.item, _st.item.statusPosition.x(), _st.item.statusPosition.y(), statusw, width(), selected);
|
row->paintStatusText(p, _st.item, statusx, statusy, statusw, width(), selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
row->elementsPaint(
|
row->elementsPaint(
|
||||||
|
|
Loading…
Reference in New Issue