| 32 | } |
| 33 | |
| 34 | crl::time PeerListWidgets::paintRow( |
| 35 | Painter &p, |
| 36 | crl::time now, |
| 37 | bool selected, |
| 38 | not_null<PeerListRow*> row) { |
| 39 | const auto &st = row->computeSt(_st.item); |
| 40 | |
| 41 | row->lazyInitialize(st); |
| 42 | const auto outerWidth = _content->width(); |
| 43 | const auto w = outerWidth; |
| 44 | |
| 45 | auto refreshStatusAt = row->refreshStatusTime(); |
| 46 | if (refreshStatusAt > 0 && now >= refreshStatusAt) { |
| 47 | row->refreshStatus(); |
| 48 | refreshStatusAt = row->refreshStatusTime(); |
| 49 | } |
| 50 | const auto refreshStatusIn = (refreshStatusAt > 0) |
| 51 | ? std::max(refreshStatusAt - now, crl::time(1)) |
| 52 | : 0; |
| 53 | |
| 54 | row->paintUserpic( |
| 55 | p, |
| 56 | st, |
| 57 | st.photoPosition.x(), |
| 58 | st.photoPosition.y(), |
| 59 | outerWidth); |
| 60 | |
| 61 | p.setPen(st::contactsNameFg); |
| 62 | |
| 63 | const auto skipRight = st.photoPosition.x(); |
| 64 | const auto rightActionSize = row->rightActionSize(); |
| 65 | const auto rightActionMargins = rightActionSize.isEmpty() |
| 66 | ? QMargins() |
| 67 | : row->rightActionMargins(); |
| 68 | const auto &name = row->name(); |
| 69 | const auto namePosition = st.namePosition; |
| 70 | const auto namex = namePosition.x(); |
| 71 | const auto namey = namePosition.y(); |
| 72 | auto namew = outerWidth - namex - skipRight; |
| 73 | if (!rightActionSize.isEmpty() |
| 74 | && (namey < rightActionMargins.top() + rightActionSize.height()) |
| 75 | && (namey + st.nameStyle.font->height |
| 76 | > rightActionMargins.top())) { |
| 77 | namew -= rightActionMargins.left() |
| 78 | + rightActionSize.width() |
| 79 | + rightActionMargins.right() |
| 80 | - skipRight; |
| 81 | } |
| 82 | const auto statusx = st.statusPosition.x(); |
| 83 | const auto statusy = st.statusPosition.y(); |
| 84 | auto statusw = outerWidth - statusx - skipRight; |
| 85 | if (!rightActionSize.isEmpty() |
| 86 | && (statusy < rightActionMargins.top() + rightActionSize.height()) |
| 87 | && (statusy + st::contactsStatusFont->height |
| 88 | > rightActionMargins.top())) { |
| 89 | statusw -= rightActionMargins.left() |
| 90 | + rightActionSize.width() |
| 91 | + rightActionMargins.right() |
nothing calls this directly
no test coverage detected