diff --git a/GstToolkit.cpp b/GstToolkit.cpp index 9a9cfe9..5fbe3f4 100644 --- a/GstToolkit.cpp +++ b/GstToolkit.cpp @@ -56,6 +56,16 @@ string GstToolkit::time_to_string(guint64 t, time_string_mode m) } +std::string GstToolkit::filename_to_uri(std::string path) +{ + // set uri to open + gchar *uritmp = gst_filename_to_uri(path.c_str(), NULL); + std::string uri( uritmp ); + g_free(uritmp); + + return uri; +} + list GstToolkit::all_plugins() { list pluginlist; diff --git a/GstToolkit.h b/GstToolkit.h index 3857501..7616b62 100644 --- a/GstToolkit.h +++ b/GstToolkit.h @@ -16,6 +16,7 @@ typedef enum { } time_string_mode; std::string time_to_string(guint64 t, time_string_mode m = TIME_STRING_ADJUSTED); +std::string filename_to_uri(std::string filename); std::string gst_version(); diff --git a/ImGuiToolkit.cpp b/ImGuiToolkit.cpp index 3a0f903..c1a02b2 100644 --- a/ImGuiToolkit.cpp +++ b/ImGuiToolkit.cpp @@ -32,7 +32,9 @@ std::map fontmap; void ImGuiToolkit::ButtonOpenUrl( const char* url, const ImVec2& size_arg ) { char label[512]; - sprintf( label, "%s %s", ICON_FA_EXTERNAL_LINK_ALT, url ); + + std::string str = SystemToolkit::transliterate( url ); + sprintf( label, "%s %s", ICON_FA_EXTERNAL_LINK_ALT, str.c_str() ); if ( ImGui::Button(label, size_arg) ) SystemToolkit::open(url); diff --git a/MediaPlayer.cpp b/MediaPlayer.cpp index 616c9f3..553b6f8 100644 --- a/MediaPlayer.cpp +++ b/MediaPlayer.cpp @@ -13,6 +13,7 @@ using namespace std; #include "Visitor.h" #include "SystemToolkit.h" #include "GlmToolkit.h" +#include "GstToolkit.h" #include "MediaPlayer.h" @@ -186,12 +187,10 @@ static MediaInfo UriDiscoverer_(std::string uri) void MediaPlayer::open(string path) { // set path - filename_ = path; + filename_ = SystemToolkit::transliterate( path ); // set uri to open - gchar *uritmp = gst_filename_to_uri(path.c_str(), NULL); - uri_ = string( uritmp ); - g_free(uritmp); + uri_ = GstToolkit::filename_to_uri(path); // reset ready_ = false; diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index f9aa375..2449d93 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -15,7 +15,7 @@ using namespace std; #include "imgui_impl_opengl3.h" // Desktop OpenGL function loader -#include +#include // Include glfw3.h after our OpenGL definitions #include @@ -1003,7 +1003,7 @@ void ToolBox::Render() // About and other utility windows if (show_icons_window) - ImGuiToolkit::ShowIconsWindow(&show_icons_window); + ImGuiToolkit::ShowIconsWindow(&show_icons_window); if (show_sandbox) ShowSandbox(&show_sandbox); if (show_demo_window) @@ -2139,7 +2139,7 @@ void Navigator::RenderSourcePannel(Source *s) // ImGui::EndPopup(); // } } - ImGui::End(); + ImGui::End(); } @@ -2263,7 +2263,8 @@ void Navigator::RenderNewPannel() fileImportFileDialogs.pop_back(); fileDialogPending_ = false; // create a source with this file - std::string label = open_filename.substr( open_filename.size() - MIN( 35, open_filename.size()) ); + std::string label = SystemToolkit::transliterate( open_filename ); + label = label.substr( label.size() - MIN( 35, label.size()) ); new_source_preview_.setSource( Mixer::manager().createSourceFile(open_filename), label); } } @@ -2277,7 +2278,8 @@ void Navigator::RenderNewPannel() { std::string recentpath(*path); if ( SystemToolkit::file_exists(recentpath)) { - std::string label = SystemToolkit::trunc_filename(recentpath, 35); + std::string label = SystemToolkit::transliterate( recentpath ); + label = SystemToolkit::trunc_filename(label, 35); if (ImGui::Selectable( label.c_str() )) { new_source_preview_.setSource( Mixer::manager().createSourceFile(recentpath.c_str()), label); }