From 9b9531d2798eb0c4624c65ddeee8c87eda23a820 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 24 Jan 2021 09:40:26 +0300 Subject: [PATCH] Replaced icon color for songs with bright one. --- .../SourceFiles/boxes/edit_caption_box.cpp | 2 +- .../view/media/history_view_document.cpp | 25 +++++++++++ .../inline_bot_layout_internal.cpp | 2 + Telegram/SourceFiles/overview/overview.style | 43 +++++++++++++++---- .../SourceFiles/overview/overview_layout.cpp | 10 +++-- .../attach/attach_single_file_preview.cpp | 2 +- Telegram/SourceFiles/ui/chat/chat.style | 11 +++++ 7 files changed, 81 insertions(+), 14 deletions(-) diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index ca9408b30..ace98f86e 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -963,7 +963,7 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) { } const auto icon = &(_isAudio - ? st::historyFileInPlay + ? st::historyFileSongPlay : _isImage ? st::historyFileInImage : st::historyFileInDocument); diff --git a/Telegram/SourceFiles/history/view/media/history_view_document.cpp b/Telegram/SourceFiles/history/view/media/history_view_document.cpp index 4536e7f39..edbee6cd6 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_document.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_document.cpp @@ -456,19 +456,44 @@ void Document::draw( const auto icon = [&] { if (_data->waitingForAlbum()) { + if (_data->isSong()) { + 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()) { + return &(selected + ? st::historyFileSongCancelSelected + : st::historyFileSongCancel); + } return &(outbg ? (selected ? st::historyFileOutCancelSelected : st::historyFileOutCancel) : (selected ? st::historyFileInCancelSelected : st::historyFileInCancel)); } else if (showPause) { + if (_data->isSong()) { + return &(selected + ? st::historyFileSongPauseSelected + : st::historyFileSongPause); + } return &(outbg ? (selected ? st::historyFileOutPauseSelected : st::historyFileOutPause) : (selected ? st::historyFileInPauseSelected : st::historyFileInPause)); } else if (loaded || _dataMedia->canBePlayed()) { if (_dataMedia->canBePlayed()) { + if (_data->isSong()) { + return &(selected + ? st::historyFileSongPlaySelected + : st::historyFileSongPlay); + } return &(outbg ? (selected ? st::historyFileOutPlaySelected : st::historyFileOutPlay) : (selected ? st::historyFileInPlaySelected : st::historyFileInPlay)); } else if (_data->isImage()) { return &(outbg ? (selected ? st::historyFileOutImageSelected : st::historyFileOutImage) : (selected ? st::historyFileInImageSelected : st::historyFileInImage)); } return &(outbg ? (selected ? st::historyFileOutDocumentSelected : st::historyFileOutDocument) : (selected ? st::historyFileInDocumentSelected : st::historyFileInDocument)); } + if (_data->isSong()) { + return &(selected + ? st::historyFileSongDownloadSelected + : st::historyFileSongDownload); + } return &(outbg ? (selected ? st::historyFileOutDownloadSelected : st::historyFileOutDownload) : (selected ? st::historyFileInDownloadSelected : st::historyFileInDownload)); }(); const auto previous = [&]() -> const style::icon* { diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp index a15bea0d8..c6beea47d 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp @@ -896,6 +896,8 @@ 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()) { + return &st::historyFileSongPlay; } else if (_document->isVoiceMessage() || _document->isAudioFile()) { return &st::historyFileInPlay; diff --git a/Telegram/SourceFiles/overview/overview.style b/Telegram/SourceFiles/overview/overview.style index 5cdcd40f1..ac4423d7f 100644 --- a/Telegram/SourceFiles/overview/overview.style +++ b/Telegram/SourceFiles/overview/overview.style @@ -28,6 +28,15 @@ OverviewFileLayout { songDownload: icon; songDownloadSelected: icon; + voicePause: icon; + voicePauseSelected: icon; + voicePlay: icon; + voicePlaySelected: icon; + voiceCancel: icon; + voiceCancelSelected: icon; + voiceDownload: icon; + voiceDownloadSelected: icon; + filePadding: margins; fileThumbSize: pixels; fileNameTop: pixels; @@ -64,14 +73,23 @@ overviewFileExtTop: 24px; overviewFileExtFg: windowFgActive; overviewFileExtFont: font(18px semibold); -overviewSongPause: icon {{ "playlist_pause", historyFileInIconFg }}; -overviewSongPauseSelected: icon {{ "playlist_pause", historyFileInIconFgSelected }}; -overviewSongPlay: icon {{ "playlist_play", historyFileInIconFg }}; -overviewSongPlaySelected: icon {{ "playlist_play", historyFileInIconFgSelected }}; -overviewSongCancel: icon {{ "playlist_cancel", historyFileInIconFg }}; -overviewSongCancelSelected: icon {{ "playlist_cancel", historyFileInIconFgSelected }}; -overviewSongDownload: icon {{ "playlist_download", historyFileInIconFg }}; -overviewSongDownloadSelected: icon {{ "playlist_download", historyFileInIconFgSelected }}; +overviewVoicePause: icon {{ "playlist_pause", historyFileInIconFg }}; +overviewVoicePauseSelected: icon {{ "playlist_pause", historyFileInIconFgSelected }}; +overviewVoicePlay: icon {{ "playlist_play", historyFileInIconFg }}; +overviewVoicePlaySelected: icon {{ "playlist_play", historyFileInIconFgSelected }}; +overviewVoiceCancel: icon {{ "playlist_cancel", historyFileInIconFg }}; +overviewVoiceCancelSelected: icon {{ "playlist_cancel", historyFileInIconFgSelected }}; +overviewVoiceDownload: icon {{ "playlist_download", historyFileInIconFg }}; +overviewVoiceDownloadSelected: icon {{ "playlist_download", historyFileInIconFgSelected }}; + +overviewSongPause: icon {{ "playlist_pause", historyFileThumbIconFg }}; +overviewSongPauseSelected: icon {{ "playlist_pause", historyFileThumbIconFgSelected }}; +overviewSongPlay: icon {{ "playlist_play", historyFileThumbIconFg }}; +overviewSongPlaySelected: icon {{ "playlist_play", historyFileThumbIconFgSelected }}; +overviewSongCancel: icon {{ "playlist_cancel", historyFileThumbIconFg }}; +overviewSongCancelSelected: icon {{ "playlist_cancel", historyFileThumbIconFgSelected }}; +overviewSongDownload: icon {{ "playlist_download", historyFileThumbIconFg }}; +overviewSongDownloadSelected: icon {{ "playlist_download", historyFileThumbIconFgSelected }}; overviewSmallCancel: icon {{ "history_audio_cancel", historyFileInIconFg }}; overviewSmallCancelSelected: icon {{ "history_audio_cancel", historyFileInIconFgSelected }}; overviewSmallDownload: icon {{ "history_audio_download", historyFileInIconFg }}; @@ -93,6 +111,15 @@ overviewFileLayout: OverviewFileLayout { songDownload: overviewSongDownload; songDownloadSelected: overviewSongDownloadSelected; + voicePause: overviewVoicePause; + voicePauseSelected: overviewVoicePauseSelected; + voicePlay: overviewVoicePlay; + voicePlaySelected: overviewVoicePlaySelected; + voiceCancel: overviewVoiceCancel; + voiceCancelSelected: overviewVoiceCancelSelected; + voiceDownload: overviewVoiceDownload; + voiceDownloadSelected: overviewVoiceDownloadSelected; + filePadding: margins(0px, 3px, 16px, 3px); fileThumbSize: 70px; fileNameTop: 7px; diff --git a/Telegram/SourceFiles/overview/overview_layout.cpp b/Telegram/SourceFiles/overview/overview_layout.cpp index d9ee1a862..ad2c727ac 100644 --- a/Telegram/SourceFiles/overview/overview_layout.cpp +++ b/Telegram/SourceFiles/overview/overview_layout.cpp @@ -734,13 +734,15 @@ void Voice::paint(Painter &p, const QRect &clip, TextSelection selection, const const auto icon = [&] { if (_data->loading() || _data->uploading()) { - return &(selected ? _st.songCancelSelected : _st.songCancel); + return &(selected ? _st.voiceCancelSelected : _st.voiceCancel); } else if (showPause) { - return &(selected ? _st.songPauseSelected : _st.songPause); + return &(selected ? _st.voicePauseSelected : _st.voicePause); } else if (_dataMedia->canBePlayed()) { - return &(selected ? _st.songPlaySelected : _st.songPlay); + return &(selected ? _st.voicePlaySelected : _st.voicePlay); } - return &(selected ? _st.songDownloadSelected : _st.songDownload); + return &(selected + ? _st.voiceDownloadSelected + : _st.voiceDownload); }(); icon->paintInCenter(p, inner); } diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_single_file_preview.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_single_file_preview.cpp index c5e0d343e..c479ba93a 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_single_file_preview.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_single_file_preview.cpp @@ -168,7 +168,7 @@ void SingleFilePreview::paintEvent(QPaintEvent *e) { } auto &icon = _fileIsAudio - ? st::historyFileInPlay + ? st::historyFileSongPlay : _fileIsImage ? st::historyFileInImage : st::historyFileInDocument; diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index fdc66f585..dab0e9ba8 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -160,6 +160,17 @@ historyFileOutWaitingSelected: icon {{ "mediaview_save_check", historyFileOutIco historyFileInWaiting: icon {{ "mediaview_save_check", historyFileInIconFg }}; historyFileInWaitingSelected: icon {{ "mediaview_save_check", historyFileInIconFgSelected }}; +historyFileSongPause: icon {{ "history_file_pause", historyFileThumbIconFg }}; +historyFileSongPauseSelected: icon {{ "history_file_pause", historyFileThumbIconFgSelected }}; +historyFileSongPlay: icon {{ "history_file_play", historyFileThumbIconFg }}; +historyFileSongPlaySelected: icon {{ "history_file_play", historyFileThumbIconFgSelected }}; +historyFileSongCancel: icon {{ "history_file_cancel", historyFileThumbIconFg }}; +historyFileSongCancelSelected: icon {{ "history_file_cancel", historyFileThumbIconFgSelected }}; +historyFileSongDownload: icon {{ "history_file_download", historyFileThumbIconFg }}; +historyFileSongDownloadSelected: icon {{ "history_file_download", historyFileThumbIconFgSelected }}; +historyFileSongWaiting: icon {{ "mediaview_save_check", historyFileThumbIconFg }}; +historyFileSongWaitingSelected: icon {{ "mediaview_save_check", historyFileThumbIconFgSelected }}; + historyFileThumbDownload: icon {{ "history_file_download", historyFileThumbIconFg }}; historyFileThumbDownloadSelected: icon {{ "history_file_download", historyFileThumbIconFgSelected }}; historyFileThumbCancel: icon {{ "history_file_cancel", historyFileThumbIconFg }};