[Libreoffice-commits] core.git: avmedia/source cui/source include/avmedia
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 18 17:18:17 UTC 2019
avmedia/source/viewer/mediawindow.cxx | 69 ++++++++++++++--------------------
cui/source/dialogs/cuigaldlg.cxx | 3 -
include/avmedia/mediawindow.hxx | 2
3 files changed, 31 insertions(+), 43 deletions(-)
New commits:
commit e9dad737b086537803210987ccbd9a59651c4613
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Oct 18 16:43:47 2019 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Oct 18 19:17:01 2019 +0200
Simplify MediaWindow::getMediaFilters
Change-Id: I6c2ed432d2d5472ec984ea6e48aa3435c464067f
Reviewed-on: https://gerrit.libreoffice.org/81053
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx
index 81b8d968a36e..521c4151f98f 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -173,41 +173,34 @@ vcl::Window* MediaWindow::getWindow() const
}
-void MediaWindow::getMediaFilters( FilterNameVector& rFilterNameVector )
+FilterNameVector MediaWindow::getMediaFilters()
{
- static const char* pFilters[] = { "Advanced Audio Coding", "aac",
- "AIF Audio", "aif;aiff",
- "Advanced Systems Format", "asf;wma;wmv",
- "AU Audio", "au",
- "AC3 Audio", "ac3",
- "AVI", "avi",
- "CD Audio", "cda",
- "Digital Video", "dv",
- "FLAC Audio", "flac",
- "Flash Video", "flv",
- "Matroska Media", "mkv",
- "MIDI Audio", "mid;midi",
- "MPEG Audio", "mp2;mp3;mpa;m4a",
- "MPEG Video", "mpg;mpeg;mpv;mp4;m4v",
- "Ogg Audio", "ogg;oga;opus",
- "Ogg Video", "ogv;ogx",
- "Real Audio", "ra",
- "Real Media", "rm",
- "RMI MIDI Audio", "rmi",
- "SND (SouND) Audio", "snd",
- "Quicktime Video", "mov",
- "Vivo Video", "viv",
- "WAVE Audio", "wav",
- "WebM Video", "webm",
- "Windows Media Audio", "wma",
- "Windows Media Video", "wmv"};
-
- for( size_t i = 0; i < SAL_N_ELEMENTS(pFilters); i += 2 )
- {
- rFilterNameVector.push_back( std::make_pair< OUString, OUString >(
- OUString::createFromAscii(pFilters[i]),
- OUString::createFromAscii(pFilters[i+1]) ) );
- }
+ return {{"Advanced Audio Coding", "aac"},
+ {"AIF Audio", "aif;aiff"},
+ {"Advanced Systems Format", "asf;wma;wmv"},
+ {"AU Audio", "au"},
+ {"AC3 Audio", "ac3"},
+ {"AVI", "avi"},
+ {"CD Audio", "cda"},
+ {"Digital Video", "dv"},
+ {"FLAC Audio", "flac"},
+ {"Flash Video", "flv"},
+ {"Matroska Media", "mkv"},
+ {"MIDI Audio", "mid;midi"},
+ {"MPEG Audio", "mp2;mp3;mpa;m4a"},
+ {"MPEG Video", "mpg;mpeg;mpv;mp4;m4v"},
+ {"Ogg Audio", "ogg;oga;opus"},
+ {"Ogg Video", "ogv;ogx"},
+ {"Real Audio", "ra"},
+ {"Real Media", "rm"},
+ {"RMI MIDI Audio", "rmi"},
+ {"SND (SouND) Audio", "snd"},
+ {"Quicktime Video", "mov"},
+ {"Vivo Video", "viv"},
+ {"WAVE Audio", "wav"},
+ {"WebM Video", "webm"},
+ {"Windows Media Audio", "wma"},
+ {"Windows Media Video", "wmv"}};
}
@@ -218,15 +211,13 @@ bool MediaWindow::executeMediaURLDialog(weld::Window* pParent, OUString& rURL, b
: ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
FileDialogFlags::NONE, pParent);
static const char aWildcard[] = "*.";
- FilterNameVector aFilters;
+ FilterNameVector aFilters = getMediaFilters();
static const char aSeparator[] = ";";
OUStringBuffer aAllTypes;
aDlg.SetTitle( AvmResId( o_pbLink != nullptr
? AVMEDIA_STR_INSERTMEDIA_DLG : AVMEDIA_STR_OPENMEDIA_DLG ) );
- getMediaFilters( aFilters );
-
for( FilterNameVector::size_type i = 0; i < aFilters.size(); ++i )
{
for( sal_Int32 nIndex = 0; nIndex >= 0; )
@@ -337,11 +328,9 @@ bool MediaWindow::isMediaURL( const OUString& rURL, const OUString& rReferer, bo
}
else
{
- FilterNameVector aFilters;
+ FilterNameVector aFilters = getMediaFilters();
const OUString aExt( aURL.getExtension() );
- getMediaFilters( aFilters );
-
for( FilterNameVector::size_type i = 0; i < aFilters.size(); ++i )
{
for( sal_Int32 nIndex = 0; nIndex >= 0; )
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index acac953f5a36..ab63f7073a7e 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -711,8 +711,7 @@ void TPGalleryThemeProperties::FillFilterList()
#if HAVE_FEATURE_AVMEDIA
// media filters
static const char aWildcard[] = "*.";
- ::avmedia::FilterNameVector aFilters;
- ::avmedia::MediaWindow::getMediaFilters( aFilters );
+ ::avmedia::FilterNameVector aFilters= ::avmedia::MediaWindow::getMediaFilters();
for(const std::pair<OUString,OUString> & aFilter : aFilters)
{
diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx
index 1a84a810576d..78e0b1a299a3 100644
--- a/include/avmedia/mediawindow.hxx
+++ b/include/avmedia/mediawindow.hxx
@@ -93,7 +93,7 @@ namespace avmedia
public:
- static void getMediaFilters( FilterNameVector& rFilterNameVector );
+ static FilterNameVector getMediaFilters();
/// @param o_pbLink if not 0, this is an "insert" dialog: display link
/// checkbox and store its state in *o_pbLink
static bool executeMediaURLDialog(weld::Window* pParent, OUString& rURL, bool *const o_pbLink);
More information about the Libreoffice-commits
mailing list