Skip to content

libobs: Add filter for save file path property - #10190

Open
FiniteSingularity wants to merge 1 commit into
obsproject:masterfrom
FiniteSingularity:bugfix/ui-file-save-filter
Open

libobs: Add filter for save file path property#10190
FiniteSingularity wants to merge 1 commit into
obsproject:masterfrom
FiniteSingularity:bugfix/ui-file-save-filter

Conversation

@FiniteSingularity

Copy link
Copy Markdown
Contributor

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:

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

@RytoEX RytoEX added kind/bug Categorizes issue or PR as related to a bug. kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. and removed kind/bug Categorizes issue or PR as related to a bug. labels Feb 3, 2024
@WizardCM

WizardCM commented Feb 3, 2024

Copy link
Copy Markdown
Member

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

@FiniteSingularity
FiniteSingularity force-pushed the bugfix/ui-file-save-filter branch from 011210e to daa92e3 Compare February 4, 2024 16:44
@FiniteSingularity

Copy link
Copy Markdown
Contributor Author

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

@Warchamp7 Warchamp7 added this to the OBS Studio 32.2 milestone May 6, 2026
@RytoEX
RytoEX requested review from PatTheMav, RytoEX and Warchamp7 May 8, 2026 18:43
Comment on lines +190 to +192
that the user can browse. If type is a save path,
then describes the file types the file can be
saved as. Items are separated via double semicolons.

@PatTheMav PatTheMav Jun 1, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this functionality actually prohibit the user from choosing a custom filename with a different extension than the one provided by the filter?

I've seen multiple variants how save dialogs like this can behave, some just add the "correct" file extension to whatever the user provided (so if I choose to save a text file as test.jpg but the file format is "Plain Text" I end up with test.jpg.txt), others parse the file extension from the file name and block saving, yet others just ignore it completely and allow me to save a text file as test.jpg.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This opens a native dialog on all operating systems I think, so that's a concern of the OS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.

Projects

Status: Ready For Review

Development

Successfully merging this pull request may close these issues.

5 participants