obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

libobs: Add filter for save file path property

Open FiniteSingularity opened this issue 2 years ago • 2 comments

Description

File path properties allow for filters to be set that limit the file types shown in the file select dialog. QT allows the same filters to be used in a File Save dialog, to limit the file types/extensions a user can save a file as. This PR uses the provided filter value in the obs_properties_add_path to limit the save-as file types/extensions in the file save dialog. This can be seen in the sample dialog below, where the save as type of Preset (*.snoise) is populated in the dropdown. This has the added benefit of automatically adding the file extension provided to the saved file. Currently for OBS_PATH_FILE_SAVE dialogs, the filters are silently ignored. image

Motivation and Context

This feature is useful for plugin authors, as it will allow limiting the file types and extensions for any file saved through the save dialog box.

How Has This Been Tested?

This has been tested on Windows 11 with the latest HEAD of obs studio for a save file dialog being developed in an upcoming plugin I am working on.

Types of changes

  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [x] I have included updates to all appropriate documentation.

FiniteSingularity avatar Feb 02 '24 22:02 FiniteSingularity

Please squash your commits into one, as the documentation change is directly tied to the code change.

WizardCM avatar Feb 03 '24 23:02 WizardCM

@WizardCM- Squashed the commits, and pushed the update. Please let me know if there is anything else you need.

FiniteSingularity avatar Feb 04 '24 16:02 FiniteSingularity