mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-17 05:09:58 +01:00
Display transliterated filename in GUI
This commit is contained in:
@@ -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<string> GstToolkit::all_plugins()
|
list<string> GstToolkit::all_plugins()
|
||||||
{
|
{
|
||||||
list<string> pluginlist;
|
list<string> pluginlist;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ typedef enum {
|
|||||||
} time_string_mode;
|
} time_string_mode;
|
||||||
|
|
||||||
std::string time_to_string(guint64 t, time_string_mode m = TIME_STRING_ADJUSTED);
|
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();
|
std::string gst_version();
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ std::map <ImGuiToolkit::font_style, ImFont*>fontmap;
|
|||||||
void ImGuiToolkit::ButtonOpenUrl( const char* url, const ImVec2& size_arg )
|
void ImGuiToolkit::ButtonOpenUrl( const char* url, const ImVec2& size_arg )
|
||||||
{
|
{
|
||||||
char label[512];
|
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) )
|
if ( ImGui::Button(label, size_arg) )
|
||||||
SystemToolkit::open(url);
|
SystemToolkit::open(url);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using namespace std;
|
|||||||
#include "Visitor.h"
|
#include "Visitor.h"
|
||||||
#include "SystemToolkit.h"
|
#include "SystemToolkit.h"
|
||||||
#include "GlmToolkit.h"
|
#include "GlmToolkit.h"
|
||||||
|
#include "GstToolkit.h"
|
||||||
|
|
||||||
#include "MediaPlayer.h"
|
#include "MediaPlayer.h"
|
||||||
|
|
||||||
@@ -186,12 +187,10 @@ static MediaInfo UriDiscoverer_(std::string uri)
|
|||||||
void MediaPlayer::open(string path)
|
void MediaPlayer::open(string path)
|
||||||
{
|
{
|
||||||
// set path
|
// set path
|
||||||
filename_ = path;
|
filename_ = SystemToolkit::transliterate( path );
|
||||||
|
|
||||||
// set uri to open
|
// set uri to open
|
||||||
gchar *uritmp = gst_filename_to_uri(path.c_str(), NULL);
|
uri_ = GstToolkit::filename_to_uri(path);
|
||||||
uri_ = string( uritmp );
|
|
||||||
g_free(uritmp);
|
|
||||||
|
|
||||||
// reset
|
// reset
|
||||||
ready_ = false;
|
ready_ = false;
|
||||||
|
|||||||
@@ -2263,7 +2263,8 @@ void Navigator::RenderNewPannel()
|
|||||||
fileImportFileDialogs.pop_back();
|
fileImportFileDialogs.pop_back();
|
||||||
fileDialogPending_ = false;
|
fileDialogPending_ = false;
|
||||||
// create a source with this file
|
// 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);
|
new_source_preview_.setSource( Mixer::manager().createSourceFile(open_filename), label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2277,7 +2278,8 @@ void Navigator::RenderNewPannel()
|
|||||||
{
|
{
|
||||||
std::string recentpath(*path);
|
std::string recentpath(*path);
|
||||||
if ( SystemToolkit::file_exists(recentpath)) {
|
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() )) {
|
if (ImGui::Selectable( label.c_str() )) {
|
||||||
new_source_preview_.setSource( Mixer::manager().createSourceFile(recentpath.c_str()), label);
|
new_source_preview_.setSource( Mixer::manager().createSourceFile(recentpath.c_str()), label);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user