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
? st::historyFileSongPlay
? (_thumbw ? st::historyFileSongPlay : st::historyFileInPlay)
: _isImage
? st::historyFileInImage
: st::historyFileInDocument);

View file

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

View file

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

View file

@ -1037,6 +1037,24 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
}
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) {
return &(selected ? _st.songCancelSelected : _st.songCancel);
} else if (showPause) {

View file

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