Filechooser: multiple sets of patterns


#1

Hi,

The FileChooser allows you to give you a set of patterns to match for the file name like this. Eg. for choosing an image:

  •  Image files (*.png, *.jpg, *.jpeg, *.tiff)

Another common use case which is not in JUCE is giving more than one set of those patterns:

  • Image files (*.png, *.jpg, *.jpeg, *.tiff)
  • PNG files (*.png)
  • JPEG files (*.jpg, *.jpeg)
  • TIFF files (*.tiff)

I would expect most platforms will implement that kind of option in the native file chooser. It implemented on Windows, and used by almost every single application.

Any thoughts about (1) is it meaningful to allow this directly in JUCE, and (2) how would we add it to the FileChooser class?

Mine are: (1) yes, and (2) the FileChooser currently takes all its options in the constructor. As a comparison DialogWindow::LaunchOptions has an empty constructor, and all options are set by modifying public members. It could be done this way too for the FileChooser: construct, then set some more options, then open the dialog. So we could have an addFilePatternsGroup(String), or a setFilePatternGroups(StringArray) method if you're not happy with a single pattern.

--
Roeland


#2

Good FR, we'll add it to our list, but researching/implementing/testing this kind of thing on all platforms is quite time-consuming so I can't promise we'll get around to it very soon.


#3

I can imagine that.

I'm not sure if what would be needed on the mobile platforms. Android apps normally have separate buttons to load/import different file types. (Some of them also have that horrible habit of showing all images on my phone in one single “handy” flat list, but that's an entirely different story)

Anyway thanks for considering.


#4

I have done this for Windows and Linux/Zanity platform. Native dialogs do not support this by design.

I've described solution here:

http://www.juce.com/forum/topic/filechooser-filter-problems-and-fix-windows-and-linux/zanity

 

Too bad this was not added to main source.