mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
version 0.8.20.dev prepared (some fixes)
This commit is contained in:
@@ -824,6 +824,7 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) {
|
||||
if (_current.isNull() && _currentGif.isNull()) {
|
||||
if (_doc->thumb->isNull()) {
|
||||
style::sprite thumbs[] = { st::mvDocBlue, st::mvDocGreen, st::mvDocRed, st::mvDocYellow };
|
||||
style::color colors[] = { st::mvDocBlueColor, st::mvDocGreenColor, st::mvDocRedColor, st::mvDocYellowColor };
|
||||
QString name = _doc->name.toLower(), mime = _doc->mime.toLower();
|
||||
if (name.endsWith(QLatin1String(".doc")) ||
|
||||
name.endsWith(QLatin1String(".txt")) ||
|
||||
@@ -831,17 +832,20 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) {
|
||||
mime.startsWith(QLatin1String("text/"))
|
||||
) {
|
||||
_docIcon = thumbs[0];
|
||||
_docIconColor = colors[0];
|
||||
} else if (
|
||||
name.endsWith(QLatin1String(".xls")) ||
|
||||
name.endsWith(QLatin1String(".csv"))
|
||||
) {
|
||||
_docIcon = thumbs[1];
|
||||
_docIconColor = colors[1];
|
||||
} else if (
|
||||
name.endsWith(QLatin1String(".pdf")) ||
|
||||
name.endsWith(QLatin1String(".ppt")) ||
|
||||
name.endsWith(QLatin1String(".key"))
|
||||
) {
|
||||
_docIcon = thumbs[2];
|
||||
_docIconColor = colors[2];
|
||||
} else if (
|
||||
name.endsWith(QLatin1String(".zip")) ||
|
||||
name.endsWith(QLatin1String(".rar")) ||
|
||||
@@ -851,10 +855,12 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) {
|
||||
name.endsWith(QLatin1String(".avi"))
|
||||
) {
|
||||
_docIcon = thumbs[3];
|
||||
_docIconColor = colors[3];
|
||||
} else {
|
||||
int ext = name.lastIndexOf('.');
|
||||
QChar ch = (ext >= 0 && ext + 1 < name.size()) ? name.at(ext + 1) : (name.isEmpty() ? (mime.isEmpty() ? '0' : mime.at(0)) : name.at(0));
|
||||
_docIcon = thumbs[ch.unicode() % 4];
|
||||
_docIconColor = colors[ch.unicode() % 4];
|
||||
}
|
||||
} else {
|
||||
_doc->thumb->load();
|
||||
@@ -1074,11 +1080,13 @@ void MediaView::paintEvent(QPaintEvent *e) {
|
||||
if (_docIconRect.intersects(r)) {
|
||||
icon = true;
|
||||
if (_doc->thumb->isNull()) {
|
||||
p.drawPixmap(_docIconRect.topLeft(), App::sprite(), _docIcon);
|
||||
if (!_doc->already().isEmpty() && (!_docRadialStart || _docRadialOpacity < 1)) {
|
||||
p.drawPixmap(_docIconRect.topLeft(), App::sprite(), _docIcon);
|
||||
p.setPen(st::mvDocExtColor->p);
|
||||
p.setFont(st::mvDocExtFont->f);
|
||||
p.drawText(_docIconRect.x() + (_docIconRect.width() - _docExtWidth) / 2, _docIconRect.y() + st::mvDocExtTop + st::mvDocExtFont->ascent, _docExt);
|
||||
} else {
|
||||
p.fillRect(_docIconRect, _docIconColor->b);
|
||||
}
|
||||
} else {
|
||||
int32 rf(cIntRetinaFactor());
|
||||
|
Reference in New Issue
Block a user