From 627a105ba9955910004ba2b3bc361708222df25b Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 5 Jan 2020 23:37:41 +0300 Subject: [PATCH] Moved album files filter to FileDialog namespace. --- Telegram/SourceFiles/boxes/edit_caption_box.cpp | 6 +++--- Telegram/SourceFiles/boxes/send_files_box.cpp | 2 +- Telegram/SourceFiles/core/file_utilities.cpp | 4 ++++ Telegram/SourceFiles/core/file_utilities.h | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index 97adb77177..7c76d3d056 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -518,12 +518,12 @@ void EditCaptionBox::createEditMediaButton() { const auto buttonCallback = [=] { const auto filters = _isAlbum - ? QStringList(qsl("Image and Video Files (*.png *.jpg *.mp4)")) - : QStringList(FileDialog::AllFilesFilter()); + ? FileDialog::AlbumFilesFilter() + : FileDialog::AllFilesFilter(); FileDialog::GetOpenPath( this, tr::lng_choose_file(tr::now), - filters.join(qsl(";;")), + filters, crl::guard(this, callback)); }; diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index f615f3632c..ce5b585d7b 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -1667,7 +1667,7 @@ void SendFilesBox::addThumbButtonHandlers() { FileDialog::GetOpenPath( this, tr::lng_choose_file(tr::now), - qsl("Image and Video Files (*.png *.jpg *.mp4)"), + FileDialog::AlbumFilesFilter(), crl::guard(this, callback)); }, _albumPreview->lifetime()); diff --git a/Telegram/SourceFiles/core/file_utilities.cpp b/Telegram/SourceFiles/core/file_utilities.cpp index a90ee52b99..5236bf2365 100644 --- a/Telegram/SourceFiles/core/file_utilities.cpp +++ b/Telegram/SourceFiles/core/file_utilities.cpp @@ -295,6 +295,10 @@ QString AllFilesFilter() { #endif // Q_OS_WIN } +QString AlbumFilesFilter() { + return qsl("Image and Video Files (*.png *.jpg *.mp4 *.jpeg)"); +} + namespace internal { void InitLastPathDefault() { diff --git a/Telegram/SourceFiles/core/file_utilities.h b/Telegram/SourceFiles/core/file_utilities.h index 8e25f691e5..7a0b4c74ff 100644 --- a/Telegram/SourceFiles/core/file_utilities.h +++ b/Telegram/SourceFiles/core/file_utilities.h @@ -82,6 +82,7 @@ void GetFolder( Fn failed = Fn()); QString AllFilesFilter(); +QString AlbumFilesFilter(); namespace internal {