Fix layout glitches in sessions list.

Fixes #4794.
This commit is contained in:
John Preston 2018-06-04 23:25:21 +03:00
parent 294ed1bb17
commit 4559888113

View File

@ -71,8 +71,9 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
_shortPollRequest = 0;
setLoading(false);
auto availCurrent = st::boxWideWidth - st::sessionPadding.left() - st::sessionTerminateSkip;
auto availOther = availCurrent - st::sessionTerminate.iconPosition.x();// -st::sessionTerminate.width - st::sessionTerminateSkip;
const auto availCurrent = st::boxWideWidth - st::sessionPadding.left() - st::sessionTerminateSkip;
const auto availOther = availCurrent - st::sessionTerminate.iconPosition.x();
const auto availInfo = availCurrent - st::sessionTerminate.width;
_list.clear();
if (result.type() != mtpc_account_authorizations) {
@ -165,8 +166,8 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
data.nameWidth = st::sessionNameFont->width(data.name);
}
data.infoWidth = st::sessionInfoFont->width(data.info);
if (data.infoWidth > availOther) {
data.info = st::sessionInfoFont->elided(data.info, availOther);
if (data.infoWidth > availInfo) {
data.info = st::sessionInfoFont->elided(data.info, availInfo);
data.infoWidth = st::sessionInfoFont->width(data.info);
}
data.ipWidth = st::sessionInfoFont->width(data.ip);
@ -243,8 +244,8 @@ void SessionsBox::Inner::paintEvent(QPaintEvent *e) {
return;
}
p.translate(0, st::sessionCurrentPadding.top());
if (r.y() <= st::sessionCurrentHeight) {
p.translate(0, st::sessionCurrentPadding.top());
p.setFont(st::sessionNameFont);
p.setPen(st::sessionNameFg);
p.drawTextLeft(x, st::sessionPadding.top(), w, _current->name, _current->nameWidth);