Skip to content

Additional filters for file pickers / better way of handling file filters

Pedro Rodrigues requested to merge red/kdenlive:supported-file-types into master

Currently when the user opens a file picker to import clips, the only filtering options available are "All supported files" and "All files". This merge adds additional options when using file pickers as well as a unified way of handling the creation of file filters.

Because Kdenlive support tons of formats, the new filters are split into broad file types:

  • Video files: mp4, webm, mkv ...
  • Audio files: mp3, wav, ogg ...
  • Image files: png, jpeg, tiff ...
  • Other files: kdenlive project files, kdenlive titles, mlt playlists ...
  • User files: user specified files from the settings window

getExtensionsFilter() is gone, replacing it is FileFilter::Builder, this class handles creating filters for QFileDialog and KFileWidget.

auto b = FileFilter::Builder().setCategories({...}) constructs a builder to make w/ the specified categories (see filefilter.h), then calling b.toQFilter() or b.toKFilter() returns a filter that can be used w/ QFileDialog or KIO equivalent respectively.

I also added utils/stringliterals.h, it has UDL for Qt string types, mainly out of laziness for constructing QStrings manually, kinda off-topic for this merge, if you want it removed, let me know.

Notes:

The #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) code path is untested, idk how to build it on my distro.

Merge request reports