mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Cleaner file patterns for dialogs
This commit is contained in:
@@ -60,8 +60,10 @@ void add_filter_file_dialog( GtkWidget *dialog, int const countfilterPatterns, c
|
||||
GtkFileFilter *filter;
|
||||
filter = gtk_file_filter_new();
|
||||
gtk_file_filter_set_name( filter, filterDescription );
|
||||
for (int i = 0; i < countfilterPatterns; i++ )
|
||||
gtk_file_filter_add_pattern( filter, filterPatterns[i] );
|
||||
for (int i = 0; i < countfilterPatterns; i++ ) {
|
||||
gtk_file_filter_add_pattern( filter, g_ascii_strdown(filterPatterns[i], -1) );
|
||||
gtk_file_filter_add_pattern( filter, g_ascii_strup(filterPatterns[i], -1) );
|
||||
}
|
||||
gtk_file_chooser_add_filter( GTK_FILE_CHOOSER(dialog), filter );
|
||||
}
|
||||
|
||||
@@ -215,12 +217,12 @@ bool DialogToolkit::MultipleImagesDialog::closed()
|
||||
std::string saveSessionFileDialog(const std::string &label, const std::string &path)
|
||||
{
|
||||
std::string filename = "";
|
||||
char const * save_pattern[2] = { "*.mix", "*.MIX" };
|
||||
char const * save_pattern[1] = { VIMIX_FILES_PATTERN };
|
||||
|
||||
#if USE_TINYFILEDIALOG
|
||||
char const * save_file_name;
|
||||
|
||||
save_file_name = tinyfd_saveFileDialog( label.c_str(), path.c_str(), 2, save_pattern, "vimix session");
|
||||
save_file_name = tinyfd_saveFileDialog( label.c_str(), path.c_str(), 1, save_pattern, "vimix session");
|
||||
|
||||
if (save_file_name)
|
||||
filename = std::string(save_file_name);
|
||||
@@ -237,7 +239,7 @@ std::string saveSessionFileDialog(const std::string &label, const std::string &p
|
||||
gtk_file_chooser_set_do_overwrite_confirmation( GTK_FILE_CHOOSER(dialog), TRUE );
|
||||
|
||||
// set file filters
|
||||
add_filter_file_dialog(dialog, 2, save_pattern, "vimix session");
|
||||
add_filter_file_dialog(dialog, 1, save_pattern, "vimix session");
|
||||
add_filter_any_file_dialog(dialog);
|
||||
|
||||
// Set the default path
|
||||
@@ -277,11 +279,11 @@ std::string openSessionFileDialog(const std::string &label, const std::string &p
|
||||
{
|
||||
std::string filename = "";
|
||||
std::string startpath = SystemToolkit::file_exists(path) ? path : SystemToolkit::home_path();
|
||||
char const * open_pattern[2] = { "*.mix", "*.MIX" };
|
||||
char const * open_pattern[1] = { VIMIX_FILES_PATTERN };
|
||||
|
||||
#if USE_TINYFILEDIALOG
|
||||
char const * open_file_name;
|
||||
open_file_name = tinyfd_openFileDialog( label.c_str(), startpath.c_str(), 2, open_pattern, "vimix session", 0);
|
||||
open_file_name = tinyfd_openFileDialog( label.c_str(), startpath.c_str(), 1, open_pattern, "vimix session", 0);
|
||||
|
||||
if (open_file_name)
|
||||
filename = std::string(open_file_name);
|
||||
@@ -297,7 +299,7 @@ std::string openSessionFileDialog(const std::string &label, const std::string &p
|
||||
"_Open", GTK_RESPONSE_ACCEPT, NULL );
|
||||
|
||||
// set file filters
|
||||
add_filter_file_dialog(dialog, 2, open_pattern, "vimix session");
|
||||
add_filter_file_dialog(dialog, 1, open_pattern, "vimix session");
|
||||
add_filter_any_file_dialog(dialog);
|
||||
|
||||
// Set the default path
|
||||
@@ -333,17 +335,11 @@ std::string openMediaFileDialog(const std::string &label, const std::string &pat
|
||||
{
|
||||
std::string filename = "";
|
||||
std::string startpath = SystemToolkit::file_exists(path) ? path : SystemToolkit::home_path();
|
||||
char const * open_pattern[52] = { "*.mix", "*.mp4", "*.mpg", "*.mpeg", "*.m2v", "*.m4v", "*.avi", "*.mov",
|
||||
"*.mkv", "*.webm", "*.mod", "*.wmv", "*.mxf", "*.ogg",
|
||||
"*.flv", "*.hevc", "*.asf", "*.jpg", "*.png", "*.gif",
|
||||
"*.tif", "*.tiff", "*.webp", "*.bmp", "*.ppm", "*.svg,"
|
||||
"*.MIX", "*.MP4", "*.MPG", "*.MPEG","*.M2V", "*.M4V", "*.AVI", "*.MOV",
|
||||
"*.MKV", "*.WEBM", "*.MOD", "*.WMV", "*.MXF", "*.OGG",
|
||||
"*.FLV", "*.HEVC", "*.ASF", "*.JPG", "*.PNG", "*.GIF",
|
||||
"*.TIF", "*.TIFF", "*.WEBP", "*.BMP", "*.PPM", "*.SVG" };
|
||||
char const * open_pattern[26] = { MEDIA_FILES_PATTERN };
|
||||
|
||||
#if USE_TINYFILEDIALOG
|
||||
char const * open_file_name;
|
||||
open_file_name = tinyfd_openFileDialog( label.c_str(), startpath.c_str(), 18, open_pattern, "All supported formats", 0);
|
||||
open_file_name = tinyfd_openFileDialog( label.c_str(), startpath.c_str(), 26, open_pattern, "All supported formats", 0);
|
||||
|
||||
if (open_file_name)
|
||||
filename = std::string(open_file_name);
|
||||
@@ -360,7 +356,7 @@ std::string openMediaFileDialog(const std::string &label, const std::string &pat
|
||||
"_Open", GTK_RESPONSE_ACCEPT, NULL );
|
||||
|
||||
// set file filters
|
||||
add_filter_file_dialog(dialog, 52, open_pattern, "Supported formats (videos, images, sessions)");
|
||||
add_filter_file_dialog(dialog, 26, open_pattern, "Supported formats (videos, images, sessions)");
|
||||
add_filter_any_file_dialog(dialog);
|
||||
|
||||
// Set the default path
|
||||
@@ -396,11 +392,11 @@ std::string openImageFileDialog(const std::string &label, const std::string &pat
|
||||
{
|
||||
std::string filename = "";
|
||||
std::string startpath = SystemToolkit::file_exists(path) ? path : SystemToolkit::home_path();
|
||||
char const * open_pattern[10] = { "*.jpg", "*.png", "*.bmp", "*.ppm", "*.gif",
|
||||
"*.JPG", "*.PNG", "*.BMP", "*.PPM", "*.GIF"};
|
||||
char const * open_pattern[5] = { IMAGES_FILES_PATTERN };
|
||||
|
||||
#if USE_TINYFILEDIALOG
|
||||
char const * open_file_name;
|
||||
open_file_name = tinyfd_openFileDialog( label.c_str(), startpath.c_str(), 4, open_pattern, "Image JPG or PNG", 0);
|
||||
open_file_name = tinyfd_openFileDialog( label.c_str(), startpath.c_str(), 5, open_pattern, "Image (JPG, PNG, BMP, PPM, GIF)", 0);
|
||||
|
||||
if (open_file_name)
|
||||
filename = std::string(open_file_name);
|
||||
@@ -417,7 +413,7 @@ std::string openImageFileDialog(const std::string &label, const std::string &pat
|
||||
"_Open", GTK_RESPONSE_ACCEPT, NULL );
|
||||
|
||||
// set file filters
|
||||
add_filter_file_dialog(dialog, 10, open_pattern, "Image (JPG, PNG, BMP, PPM, GIF)");
|
||||
add_filter_file_dialog(dialog, 5, open_pattern, "Image (JPG, PNG, BMP, PPM, GIF)");
|
||||
add_filter_any_file_dialog(dialog);
|
||||
|
||||
// Set the default path
|
||||
@@ -506,12 +502,11 @@ std::list<std::string> selectImagesFileDialog(const std::string &label,const std
|
||||
std::list<std::string> files;
|
||||
|
||||
std::string startpath = SystemToolkit::file_exists(path) ? path : SystemToolkit::home_path();
|
||||
char const * open_pattern[6] = { "*.jpg", "*.png", "*.tif",
|
||||
"*.JPG", "*.PNG", "*.TIF" };
|
||||
char const * open_pattern[6] = { "*.jpg", "*.png", "*.tif" };
|
||||
|
||||
#if USE_TINYFILEDIALOG
|
||||
char const * open_file_names;
|
||||
open_file_names = tinyfd_openFileDialog(label.c_str(), startpath.c_str(), 6, open_pattern, "Images", 1);
|
||||
open_file_names = tinyfd_openFileDialog(label.c_str(), startpath.c_str(), 3, open_pattern, "Images (JPG, PNG, TIF)", 1);
|
||||
|
||||
if (open_file_names) {
|
||||
|
||||
@@ -547,7 +542,7 @@ std::list<std::string> selectImagesFileDialog(const std::string &label,const std
|
||||
"_Open", GTK_RESPONSE_ACCEPT, NULL );
|
||||
|
||||
// set file filters
|
||||
add_filter_file_dialog(dialog, 6, open_pattern, "Images (JPG, PNG, TIF)");
|
||||
add_filter_file_dialog(dialog, 3, open_pattern, "Images (JPG, PNG, TIF)");
|
||||
add_filter_any_file_dialog(dialog);
|
||||
|
||||
// multiple files
|
||||
|
||||
Reference in New Issue
Block a user