mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Cleanup extension filename and bugfix session preview
This commit is contained in:
@@ -222,7 +222,7 @@ bool DialogToolkit::MultipleImagesDialog::closed()
|
|||||||
std::string saveSessionFileDialog(const std::string &label, const std::string &path)
|
std::string saveSessionFileDialog(const std::string &label, const std::string &path)
|
||||||
{
|
{
|
||||||
std::string filename = "";
|
std::string filename = "";
|
||||||
char const * save_pattern[1] = { VIMIX_FILES_PATTERN };
|
char const * save_pattern[1] = { VIMIX_FILE_PATTERN };
|
||||||
|
|
||||||
#if USE_TINYFILEDIALOG
|
#if USE_TINYFILEDIALOG
|
||||||
char const * save_file_name;
|
char const * save_file_name;
|
||||||
@@ -273,9 +273,8 @@ std::string saveSessionFileDialog(const std::string &label, const std::string &p
|
|||||||
wait_for_event();
|
wait_for_event();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string extension = filename.substr(filename.find_last_of(".") + 1);
|
if (!filename.empty() && !SystemToolkit::has_extension(filename, VIMIX_FILE_EXT ) )
|
||||||
if (!filename.empty() && extension != "mix")
|
filename += std::string(".") + VIMIX_FILE_EXT;
|
||||||
filename += ".mix";
|
|
||||||
|
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
@@ -285,7 +284,7 @@ std::string openSessionFileDialog(const std::string &label, const std::string &p
|
|||||||
{
|
{
|
||||||
std::string filename = "";
|
std::string filename = "";
|
||||||
std::string startpath = SystemToolkit::file_exists(path) ? path : SystemToolkit::home_path();
|
std::string startpath = SystemToolkit::file_exists(path) ? path : SystemToolkit::home_path();
|
||||||
char const * open_pattern[1] = { VIMIX_FILES_PATTERN };
|
char const * open_pattern[1] = { VIMIX_FILE_PATTERN };
|
||||||
|
|
||||||
#if USE_TINYFILEDIALOG
|
#if USE_TINYFILEDIALOG
|
||||||
char const * open_file_name;
|
char const * open_file_name;
|
||||||
|
|||||||
@@ -6,13 +6,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <future>
|
#include <future>
|
||||||
|
|
||||||
#define VIMIX_FILES_PATTERN "*.mix"
|
|
||||||
#define MEDIA_FILES_PATTERN "*.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,"
|
|
||||||
#define IMAGES_FILES_PATTERN "*.jpg", "*.png", "*.bmp", "*.ppm", "*.gif"
|
|
||||||
|
|
||||||
namespace DialogToolkit
|
namespace DialogToolkit
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -244,8 +244,7 @@ Source * Mixer::createSourceFile(const std::string &path)
|
|||||||
if ( SystemToolkit::file_exists( path ) ) {
|
if ( SystemToolkit::file_exists( path ) ) {
|
||||||
|
|
||||||
// test type of file by extension
|
// test type of file by extension
|
||||||
std::string ext = SystemToolkit::extension_filename(path);
|
if ( SystemToolkit::has_extension(path, VIMIX_FILE_EXT ) )
|
||||||
if ( ext == "mix" )
|
|
||||||
{
|
{
|
||||||
// create a session source
|
// create a session source
|
||||||
SessionFileSource *ss = new SessionFileSource;
|
SessionFileSource *ss = new SessionFileSource;
|
||||||
|
|||||||
@@ -163,6 +163,14 @@ string SystemToolkit::extension_filename(const string& filename)
|
|||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SystemToolkit::has_extension(const std::string& filename, const std::string& extension)
|
||||||
|
{
|
||||||
|
std::string ext = extension_filename(filename);
|
||||||
|
std::transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
|
||||||
|
|
||||||
|
return ext.compare(extension) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
std::string SystemToolkit::home_path()
|
std::string SystemToolkit::home_path()
|
||||||
{
|
{
|
||||||
string homePath;
|
string homePath;
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace SystemToolkit
|
|||||||
|
|
||||||
// extract the extension of a filename
|
// extract the extension of a filename
|
||||||
std::string extension_filename(const std::string& filename);
|
std::string extension_filename(const std::string& filename);
|
||||||
|
bool has_extension(const std::string& filename, const std::string& extension);
|
||||||
|
|
||||||
// tests if dir is a directory and return its path, empty string otherwise
|
// tests if dir is a directory and return its path, empty string otherwise
|
||||||
std::string path_directory(const std::string& path);
|
std::string path_directory(const std::string& path);
|
||||||
|
|||||||
@@ -5166,6 +5166,9 @@ void Navigator::RenderMainPannelVimix()
|
|||||||
|
|
||||||
// fill the session list depending on the mode
|
// fill the session list depending on the mode
|
||||||
static std::list<std::string> sessions_list;
|
static std::list<std::string> sessions_list;
|
||||||
|
static std::list<std::string>::iterator _file_over = sessions_list.end();
|
||||||
|
static std::list<std::string>::iterator _displayed_over = sessions_list.end();
|
||||||
|
|
||||||
// change session list if changed
|
// change session list if changed
|
||||||
if (selection_session_mode_changed || Settings::application.recentSessions.changed || Settings::application.recentFolders.changed) {
|
if (selection_session_mode_changed || Settings::application.recentSessions.changed || Settings::application.recentFolders.changed) {
|
||||||
|
|
||||||
@@ -5179,15 +5182,15 @@ void Navigator::RenderMainPannelVimix()
|
|||||||
// selection MODE 1 : LIST FOLDER
|
// selection MODE 1 : LIST FOLDER
|
||||||
else if ( selection_session_mode == 1) {
|
else if ( selection_session_mode == 1) {
|
||||||
// show list of vimix files in folder
|
// show list of vimix files in folder
|
||||||
sessions_list = SystemToolkit::list_directory( Settings::application.recentFolders.path, { VIMIX_FILES_PATTERN });
|
sessions_list = SystemToolkit::list_directory( Settings::application.recentFolders.path, { VIMIX_FILE_PATTERN });
|
||||||
}
|
}
|
||||||
// indicate the list changed (do not change at every frame)
|
// indicate the list changed (do not change at every frame)
|
||||||
selection_session_mode_changed = false;
|
selection_session_mode_changed = false;
|
||||||
|
_file_over = sessions_list.end();
|
||||||
|
_displayed_over = sessions_list.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
static std::list<std::string>::iterator _file_over = sessions_list.end();
|
|
||||||
static std::list<std::string>::iterator _displayed_over = sessions_list.end();
|
|
||||||
static bool _tooltip = 0;
|
static bool _tooltip = 0;
|
||||||
|
|
||||||
// display the sessions list and detect if one was selected (double clic)
|
// display the sessions list and detect if one was selected (double clic)
|
||||||
|
|||||||
@@ -9,6 +9,14 @@
|
|||||||
#define MAX_RECENT_HISTORY 20
|
#define MAX_RECENT_HISTORY 20
|
||||||
#define MAX_SESSION_LEVEL 3
|
#define MAX_SESSION_LEVEL 3
|
||||||
|
|
||||||
|
#define VIMIX_FILE_EXT "mix"
|
||||||
|
#define VIMIX_FILE_PATTERN "*.mix"
|
||||||
|
#define MEDIA_FILES_PATTERN "*.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,"
|
||||||
|
#define IMAGES_FILES_PATTERN "*.jpg", "*.png", "*.bmp", "*.ppm", "*.gif"
|
||||||
|
|
||||||
#define MINI(a, b) (((a) < (b)) ? (a) : (b))
|
#define MINI(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
#define MAXI(a, b) (((a) > (b)) ? (a) : (b))
|
#define MAXI(a, b) (((a) > (b)) ? (a) : (b))
|
||||||
#define ABS(a) (((a) < 0) ? -(a) : (a))
|
#define ABS(a) (((a) < 0) ? -(a) : (a))
|
||||||
|
|||||||
Reference in New Issue
Block a user