Returned default icon color for songs without cover art.

Related commit: 9b9531d279.
This commit is contained in:
23rd 2021-01-29 17:58:31 +03:00
parent 5d4e5ed527
commit 6c0553f4d6
5 changed files with 28 additions and 8 deletions

View file

@ -963,7 +963,7 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
} }
const auto icon = &(_isAudio const auto icon = &(_isAudio
? st::historyFileSongPlay ? (_thumbw ? st::historyFileSongPlay : st::historyFileInPlay)
: _isImage : _isImage
? st::historyFileInImage ? st::historyFileInImage
: st::historyFileInDocument); : st::historyFileInDocument);

View file

@ -456,21 +456,21 @@ void Document::draw(
const auto icon = [&] { const auto icon = [&] {
if (_data->waitingForAlbum()) { if (_data->waitingForAlbum()) {
if (_data->isSong()) { if (_data->isSongWithCover()) {
return &(selected return &(selected
? st::historyFileSongWaitingSelected ? st::historyFileSongWaitingSelected
: st::historyFileSongWaiting); : st::historyFileSongWaiting);
} }
return &(outbg ? (selected ? st::historyFileOutWaitingSelected : st::historyFileOutWaiting) : (selected ? st::historyFileInWaitingSelected : st::historyFileInWaiting)); return &(outbg ? (selected ? st::historyFileOutWaitingSelected : st::historyFileOutWaiting) : (selected ? st::historyFileInWaitingSelected : st::historyFileInWaiting));
} else if (!cornerDownload && (_data->loading() || _data->uploading())) { } else if (!cornerDownload && (_data->loading() || _data->uploading())) {
if (_data->isSong()) { if (_data->isSongWithCover()) {
return &(selected return &(selected
? st::historyFileSongCancelSelected ? st::historyFileSongCancelSelected
: st::historyFileSongCancel); : st::historyFileSongCancel);
} }
return &(outbg ? (selected ? st::historyFileOutCancelSelected : st::historyFileOutCancel) : (selected ? st::historyFileInCancelSelected : st::historyFileInCancel)); return &(outbg ? (selected ? st::historyFileOutCancelSelected : st::historyFileOutCancel) : (selected ? st::historyFileInCancelSelected : st::historyFileInCancel));
} else if (showPause) { } else if (showPause) {
if (_data->isSong()) { if (_data->isSongWithCover()) {
return &(selected return &(selected
? st::historyFileSongPauseSelected ? st::historyFileSongPauseSelected
: st::historyFileSongPause); : st::historyFileSongPause);
@ -478,7 +478,7 @@ void Document::draw(
return &(outbg ? (selected ? st::historyFileOutPauseSelected : st::historyFileOutPause) : (selected ? st::historyFileInPauseSelected : st::historyFileInPause)); return &(outbg ? (selected ? st::historyFileOutPauseSelected : st::historyFileOutPause) : (selected ? st::historyFileInPauseSelected : st::historyFileInPause));
} else if (loaded || _dataMedia->canBePlayed()) { } else if (loaded || _dataMedia->canBePlayed()) {
if (_dataMedia->canBePlayed()) { if (_dataMedia->canBePlayed()) {
if (_data->isSong()) { if (_data->isSongWithCover()) {
return &(selected return &(selected
? st::historyFileSongPlaySelected ? st::historyFileSongPlaySelected
: st::historyFileSongPlay); : st::historyFileSongPlay);
@ -489,7 +489,7 @@ void Document::draw(
} }
return &(outbg ? (selected ? st::historyFileOutDocumentSelected : st::historyFileOutDocument) : (selected ? st::historyFileInDocumentSelected : st::historyFileInDocument)); return &(outbg ? (selected ? st::historyFileOutDocumentSelected : st::historyFileOutDocument) : (selected ? st::historyFileInDocumentSelected : st::historyFileInDocument));
} }
if (_data->isSong()) { if (_data->isSongWithCover()) {
return &(selected return &(selected
? st::historyFileSongDownloadSelected ? st::historyFileSongDownloadSelected
: st::historyFileSongDownload); : st::historyFileSongDownload);

View file

@ -896,7 +896,7 @@ void File::paint(Painter &p, const QRect &clip, const PaintContext *context) con
return &st::historyFileInPause; return &st::historyFileInPause;
} else if (_document->isImage()) { } else if (_document->isImage()) {
return &st::historyFileInImage; return &st::historyFileInImage;
} else if (_document->isSong()) { } else if (_document->isSongWithCover()) {
return &st::historyFileSongPlay; return &st::historyFileSongPlay;
} else if (_document->isVoiceMessage() } else if (_document->isVoiceMessage()
|| _document->isAudioFile()) { || _document->isAudioFile()) {

View file

@ -1037,6 +1037,24 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
} }
const auto icon = [&] { const auto icon = [&] {
if (!coverDrawn) {
if (isLoading) {
return &(selected
? _st.voiceCancelSelected
: _st.voiceCancel);
} else if (showPause) {
return &(selected
? _st.voicePauseSelected
: _st.voicePause);
} else if (loaded || _dataMedia->canBePlayed()) {
return &(selected
? _st.voicePlaySelected
: _st.voicePlay);
}
return &(selected
? _st.voiceDownloadSelected
: _st.voiceDownload);
}
if (isLoading) { if (isLoading) {
return &(selected ? _st.songCancelSelected : _st.songCancel); return &(selected ? _st.songCancelSelected : _st.songCancel);
} else if (showPause) { } else if (showPause) {

View file

@ -168,7 +168,9 @@ void SingleFilePreview::paintEvent(QPaintEvent *e) {
} }
auto &icon = _fileIsAudio auto &icon = _fileIsAudio
? st::historyFileSongPlay ? (_fileThumb.isNull()
? st::historyFileInPlay
: st::historyFileSongPlay)
: _fileIsImage : _fileIsImage
? st::historyFileInImage ? st::historyFileInImage
: st::historyFileInDocument; : st::historyFileInDocument;