2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

new flat boxes started

This commit is contained in:
John Preston
2015-10-03 13:09:09 +03:00
parent bd4d43daaf
commit e3e774176e
62 changed files with 785 additions and 645 deletions

View File

@@ -115,13 +115,13 @@ void DialogsInner::paintRegion(Painter &p, const QRegion &region, bool paintingO
}
QString first = (_hashtagFilter.size() < 2) ? QString() : ('#' + hashtagResults.at(from).mid(0, _hashtagFilter.size() - 1)), second = (_hashtagFilter.size() < 2) ? ('#' + hashtagResults.at(from)) : hashtagResults.at(from).mid(_hashtagFilter.size() - 1);
int32 firstwidth = st::mentionFont->m.width(first), secondwidth = st::mentionFont->m.width(second);
int32 firstwidth = st::mentionFont->width(first), secondwidth = st::mentionFont->width(second);
if (htagwidth < firstwidth + secondwidth) {
if (htagwidth < firstwidth + st::mentionFont->elidew) {
first = st::mentionFont->m.elidedText(first + second, Qt::ElideRight, htagwidth);
first = st::mentionFont->elided(first + second, htagwidth);
second = QString();
} else {
second = st::mentionFont->m.elidedText(second, Qt::ElideRight, htagwidth - firstwidth);
second = st::mentionFont->elided(second, htagwidth - firstwidth);
}
}
@@ -251,19 +251,19 @@ void DialogsInner::peopleResultPaint(PeerData *peer, Painter &p, int32 w, bool a
QString username = peer->userName();
if (!act && username.toLower().startsWith(peopleQuery)) {
QString first = '@' + username.mid(0, peopleQuery.size()), second = username.mid(peopleQuery.size());
int32 w = st::dlgHistFont->m.width(first);
int32 w = st::dlgHistFont->width(first);
if (w >= tr.width()) {
p.setPen(st::dlgSystemColor->p);
p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->m.elidedText(first, Qt::ElideRight, tr.width()));
p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->elided(first, tr.width()));
} else {
p.setPen(st::dlgSystemColor->p);
p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, first);
p.setPen(st::dlgTextColor->p);
p.drawText(tr.left() + w, tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->m.elidedText(second, Qt::ElideRight, tr.width() - w));
p.drawText(tr.left() + w, tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->elided(second, tr.width() - w));
}
} else {
p.setPen((act ? st::dlgActiveColor : st::dlgSystemColor)->p);
p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->m.elidedText('@' + username, Qt::ElideRight, tr.width()));
p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->elided('@' + username, tr.width()));
}
p.setPen((act ? st::dlgActiveColor : st::dlgNameColor)->p);
@@ -293,7 +293,7 @@ void DialogsInner::searchInPeerPaint(Painter &p, int32 w, bool onlyBackground) c
QRect tr(nameleft, st::dlgPaddingVer + st::dlgFont->height + st::dlgSep, namewidth, st::dlgFont->height);
p.setFont(st::dlgHistFont->f);
p.setPen(st::dlgTextColor->p);
p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->m.elidedText(lang(lng_dlg_search_chat), Qt::ElideRight, tr.width()));
p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->elided(lang(lng_dlg_search_chat), tr.width()));
p.setPen(st::dlgNameColor->p);
_searchInPeer->nameText.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
@@ -484,7 +484,7 @@ void DialogsInner::dlgUpdated(DialogRow *row) {
}
}
void DialogsInner::dlgUpdated(History *history) {
void DialogsInner::dlgUpdated(History *history, MsgId msgId) {
if (_state == DefaultState) {
DialogRow *row = 0;
DialogsList::RowByPeer::iterator i = dialogs.list.rowByPeer.find(history->peer->id);
@@ -518,7 +518,7 @@ void DialogsInner::dlgUpdated(History *history) {
if (!searchResults.isEmpty()) {
int32 cnt = 0, add = searchedOffset();
for (SearchResults::const_iterator i = searchResults.cbegin(), e = searchResults.cend(); i != e; ++i) {
if ((*i)->_item->history() == history) {
if ((*i)->_item->history() == history && (*i)->_item->id == msgId) {
update(0, add + cnt * st::dlgHeight, fullWidth(), st::dlgHeight);
break;
}
@@ -1558,8 +1558,8 @@ void DialogsWidget::dlgUpdated(DialogRow *row) {
_inner.dlgUpdated(row);
}
void DialogsWidget::dlgUpdated(History *row) {
_inner.dlgUpdated(row);
void DialogsWidget::dlgUpdated(History *row, MsgId msgId) {
_inner.dlgUpdated(row, msgId);
}
void DialogsWidget::dialogsToUp() {