mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
version 0.8.20.dev prepared (some fixes)
This commit is contained in:
@@ -2399,12 +2399,39 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, bool selected, i
|
||||
}
|
||||
|
||||
QRect img;
|
||||
if (already || hasdata) {
|
||||
bool showPause = (playing == data) && (playingState == AudioPlayerPlaying || playingState == AudioPlayerResuming || playingState == AudioPlayerStarting);
|
||||
QString statusText;
|
||||
if (data->status == FileFailed) {
|
||||
statusText = lang(lng_attach_failed);
|
||||
img = out ? st::mediaAudioOutImg : st::mediaAudioInImg;
|
||||
} else if (data->status == FileUploading) {
|
||||
if (_uplTextCache.isEmpty() || _uplDone != data->uploadOffset) {
|
||||
_uplDone = data->uploadOffset;
|
||||
_uplTextCache = formatDownloadText(_uplDone, data->size);
|
||||
}
|
||||
statusText = _uplTextCache;
|
||||
img = out ? st::mediaAudioOutImg : st::mediaAudioInImg;
|
||||
} else if (already || hasdata) {
|
||||
bool showPause = false;
|
||||
if (playing == data && playingState != AudioPlayerStopped && playingState != AudioPlayerStoppedAtStart) {
|
||||
statusText = formatDurationText(playingPosition / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)) + qsl(" / ") + formatDurationText(playingDuration / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency));
|
||||
showPause = (playingState == AudioPlayerPlaying || playingState == AudioPlayerResuming || playingState == AudioPlayerStarting);
|
||||
} else {
|
||||
statusText = formatDurationText(data->duration);
|
||||
}
|
||||
img = out ? (showPause ? st::mediaPauseOutImg : st::mediaPlayOutImg) : (showPause ? st::mediaPauseInImg : st::mediaPlayInImg);
|
||||
} else {
|
||||
if (data->loader) {
|
||||
if (_dldTextCache.isEmpty() || _dldDone != data->loader->currentOffset()) {
|
||||
_dldDone = data->loader->currentOffset();
|
||||
_dldTextCache = formatDownloadText(_dldDone, data->size);
|
||||
}
|
||||
statusText = _dldTextCache;
|
||||
} else {
|
||||
statusText = _size;
|
||||
}
|
||||
img = out ? st::mediaAudioOutImg : st::mediaAudioInImg;
|
||||
}
|
||||
|
||||
p.drawPixmap(QPoint(st::mediaPadding.left(), skipy + st::mediaPadding.top()), App::sprite(), img);
|
||||
if (selected) {
|
||||
App::roundRect(p, st::mediaPadding.left(), skipy + st::mediaPadding.top(), st::mediaThumbSize, st::mediaThumbSize, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
@@ -2419,33 +2446,8 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, bool selected, i
|
||||
p.setPen(st::black->c);
|
||||
p.drawText(tleft, skipy + st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, lang(lng_media_audio));
|
||||
|
||||
QString statusText;
|
||||
|
||||
style::color status(selected ? (out ? st::mediaOutSelectColor : st::mediaInSelectColor) : (out ? st::mediaOutColor : st::mediaInColor));
|
||||
p.setPen(status->p);
|
||||
if (data->status == FileFailed) {
|
||||
statusText = lang(lng_attach_failed);
|
||||
} else if (data->status == FileUploading) {
|
||||
if (_uplTextCache.isEmpty() || _uplDone != data->uploadOffset) {
|
||||
_uplDone = data->uploadOffset;
|
||||
_uplTextCache = formatDownloadText(_uplDone, data->size);
|
||||
}
|
||||
statusText = _uplTextCache;
|
||||
} else if (already || hasdata) {
|
||||
if (playing == data && playingState != AudioPlayerStopped && playingState != AudioPlayerStoppedAtStart) {
|
||||
statusText = formatDurationText(playingPosition / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)) + qsl(" / ") + formatDurationText(playingDuration / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency));
|
||||
} else {
|
||||
statusText = formatDurationText(data->duration);
|
||||
}
|
||||
} else if (data->loader) {
|
||||
if (_dldTextCache.isEmpty() || _dldDone != data->loader->currentOffset()) {
|
||||
_dldDone = data->loader->currentOffset();
|
||||
_dldTextCache = formatDownloadText(_dldDone, data->size);
|
||||
}
|
||||
statusText = _dldTextCache;
|
||||
} else {
|
||||
statusText = _size;
|
||||
}
|
||||
int32 texty = skipy + st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->height;
|
||||
p.drawText(tleft, texty + st::mediaFont->ascent, statusText);
|
||||
if (parent->isMediaUnread()) {
|
||||
@@ -2975,7 +2977,7 @@ void HistorySticker::initDimensions(const HistoryItem *parent) {
|
||||
_maxw = qMax(pixw, int16(st::minPhotoSize));
|
||||
_minh = qMax(pixh, int16(st::minPhotoSize));
|
||||
if (const HistoryReply *reply = toHistoryReply(parent)) {
|
||||
_maxw += reply->replyToWidth();
|
||||
_maxw += st::msgReplyPadding.left() + reply->replyToWidth();
|
||||
}
|
||||
_height = _minh;
|
||||
w = qMin(lastw, _maxw);
|
||||
@@ -2989,7 +2991,7 @@ void HistorySticker::draw(QPainter &p, const HistoryItem *parent, bool selected,
|
||||
int32 usew = _maxw, usex = 0;
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
if (reply) {
|
||||
usew -= reply->replyToWidth();
|
||||
usew -= st::msgReplyPadding.left() + reply->replyToWidth();
|
||||
if (parent->out()) {
|
||||
usex = width - usew;
|
||||
}
|
||||
@@ -3052,8 +3054,8 @@ void HistorySticker::draw(QPainter &p, const HistoryItem *parent, bool selected,
|
||||
}
|
||||
|
||||
if (reply) {
|
||||
int32 rw = width - usew, rh = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
int32 rx = parent->out() ? 0 : usew, ry = _height - rh;
|
||||
int32 rw = width - usew - st::msgReplyPadding.left(), rh = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
int32 rx = parent->out() ? 0 : (usew + st::msgReplyPadding.left()), ry = _height - rh;
|
||||
|
||||
App::roundRect(p, rx, ry, rw, rh, selected ? App::msgServiceSelectBg() : App::msgServiceBg(), selected ? ServiceSelectedCorners : ServiceCorners);
|
||||
|
||||
|
Reference in New Issue
Block a user