mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 02:40:00 +01:00
Transliteration of source name
This commit is contained in:
@@ -395,6 +395,7 @@ IF(APPLE)
|
|||||||
set(PLATFORM_LIBS
|
set(PLATFORM_LIBS
|
||||||
"-framework CoreFoundation"
|
"-framework CoreFoundation"
|
||||||
"-framework Appkit"
|
"-framework Appkit"
|
||||||
|
"-licuio -licui18n -licuuc"
|
||||||
)
|
)
|
||||||
|
|
||||||
ELSE(APPLE)
|
ELSE(APPLE)
|
||||||
@@ -404,7 +405,7 @@ ELSE(APPLE)
|
|||||||
${IMGUITEXTEDIT_SRC}
|
${IMGUITEXTEDIT_SRC}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PLATFORM_LIBS ""
|
set(PLATFORM_LIBS "-licuio -licui18n -licuuc"
|
||||||
)
|
)
|
||||||
|
|
||||||
ENDIF(APPLE)
|
ENDIF(APPLE)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ static ShadingProgram imageShadingProgram("shaders/image.vs", "shaders/image.fs"
|
|||||||
const char* MaskShader::mask_names[4] = { ICON_FA_EXPAND, ICON_FA_CIRCLE, ICON_FA_MINUS_CIRCLE, ICON_FA_SQUARE };
|
const char* MaskShader::mask_names[4] = { ICON_FA_EXPAND, ICON_FA_CIRCLE, ICON_FA_MINUS_CIRCLE, ICON_FA_SQUARE };
|
||||||
std::vector< ShadingProgram* > MaskShader::mask_programs;
|
std::vector< ShadingProgram* > MaskShader::mask_programs;
|
||||||
|
|
||||||
ImageShader::ImageShader(): Shader(), /*mask(0), custom_textureindex(0),*/ stipple(0.0)
|
ImageShader::ImageShader(): Shader(), stipple(0.0)
|
||||||
{
|
{
|
||||||
// static program shader
|
// static program shader
|
||||||
program_ = &imageShadingProgram;
|
program_ = &imageShadingProgram;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <locale>
|
||||||
#include <glm/gtc/matrix_access.hpp>
|
#include <glm/gtc/matrix_access.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
|
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "SearchVisitor.h"
|
#include "SearchVisitor.h"
|
||||||
#include "ImageShader.h"
|
#include "ImageShader.h"
|
||||||
#include "ImageProcessingShader.h"
|
#include "ImageProcessingShader.h"
|
||||||
|
#include "SystemToolkit.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Mixer.h"
|
#include "Mixer.h"
|
||||||
|
|
||||||
@@ -246,10 +247,10 @@ Source::~Source()
|
|||||||
|
|
||||||
void Source::setName (const std::string &name)
|
void Source::setName (const std::string &name)
|
||||||
{
|
{
|
||||||
name_ = name;
|
name_ = SystemToolkit::transliterate(name);
|
||||||
|
|
||||||
initials_[0] = std::toupper( name_.front() );
|
initials_[0] = std::toupper( name_.front(), std::locale("en_US.utf8") );
|
||||||
initials_[1] = std::toupper( name_.back() );
|
initials_[1] = std::toupper( name_.back(), std::locale("en_US.utf8") );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Source::accept(Visitor& v)
|
void Source::accept(Visitor& v)
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
#include <locale>
|
||||||
|
#include <unicode/ustream.h>
|
||||||
|
#include <unicode/translit.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -355,4 +359,23 @@ void SystemToolkit::execute(const string& command)
|
|||||||
// "gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec ! autovideosink").detach();;
|
// "gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec ! autovideosink").detach();;
|
||||||
|
|
||||||
|
|
||||||
|
// Using ICU transliteration :
|
||||||
|
// https://unicode-org.github.io/icu/userguide/transforms/general/#icu-transliterators
|
||||||
|
|
||||||
|
std::string SystemToolkit::transliterate(std::string input)
|
||||||
|
{
|
||||||
|
auto ucs = icu_67::UnicodeString::fromUTF8(input);
|
||||||
|
|
||||||
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
|
icu::Transliterator *firstTrans = icu::Transliterator::createInstance(
|
||||||
|
"any-NFKD ; [:Nonspacing Mark:] Remove; NFKC; Latin", UTRANS_FORWARD, status);
|
||||||
|
firstTrans->transliterate(ucs);
|
||||||
|
|
||||||
|
icu::Transliterator *secondTrans = icu::Transliterator::createInstance(
|
||||||
|
"any-NFKD ; [:Nonspacing Mark:] Remove; [@!#$*%~] Remove; NFKC", UTRANS_FORWARD, status);
|
||||||
|
secondTrans->transliterate(ucs);
|
||||||
|
|
||||||
|
std::ostringstream output;
|
||||||
|
output << ucs;
|
||||||
|
return output.str();
|
||||||
|
}
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ namespace SystemToolkit
|
|||||||
|
|
||||||
// try to open the file with system
|
// try to open the file with system
|
||||||
void open(const std::string& path);
|
void open(const std::string& path);
|
||||||
|
|
||||||
// try to execute a command
|
// try to execute a command
|
||||||
void execute(const std::string& command);
|
void execute(const std::string& command);
|
||||||
|
|
||||||
@@ -74,6 +75,9 @@ namespace SystemToolkit
|
|||||||
|
|
||||||
// get a string to display memory size with unit KB, MB, GB, TB
|
// get a string to display memory size with unit KB, MB, GB, TB
|
||||||
std::string byte_to_string(long b);
|
std::string byte_to_string(long b);
|
||||||
|
|
||||||
|
// get a transliteration to Latin of any string
|
||||||
|
std::string transliterate(std::string input);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SYSTEMTOOLKIT_H
|
#endif // SYSTEMTOOLKIT_H
|
||||||
|
|||||||
@@ -2759,129 +2759,95 @@ void ShowSandbox(bool* p_open)
|
|||||||
|
|
||||||
ImGui::Text("Testing sandox");
|
ImGui::Text("Testing sandox");
|
||||||
|
|
||||||
const guint64 duration = GST_SECOND * 6;
|
// const guint64 duration = GST_SECOND * 6;
|
||||||
const guint64 step = GST_MSECOND * 20;
|
// const guint64 step = GST_MSECOND * 20;
|
||||||
static guint64 t = 0;
|
// static guint64 t = 0;
|
||||||
|
|
||||||
// bool slider_pressed = ImGuiToolkit::TimelineSlider("timeline", &t, duration, step);
|
// static float *arr_lines = nullptr;
|
||||||
|
// static float *arr_histo = nullptr;
|
||||||
|
// static uint array_size = 200;
|
||||||
|
|
||||||
static float *arr_lines = nullptr;
|
// if (arr_lines == nullptr) {
|
||||||
static float *arr_histo = nullptr;
|
|
||||||
// static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f,
|
|
||||||
// 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f, 0.f, 1.f, 0.4f };
|
|
||||||
|
|
||||||
static uint array_size = 200;
|
// arr_lines = (float *) malloc(array_size * sizeof(float));
|
||||||
|
// arr_histo = (float *) malloc(array_size * sizeof(float));
|
||||||
|
|
||||||
// MediaPlayer *mp_ = nullptr;
|
// for (int i = 0; i < array_size; ++i) {
|
||||||
// auto po = MediaPlayer::begin();
|
// arr_lines[i] = 1.f;
|
||||||
// if (po != MediaPlayer::end())
|
// arr_histo[i] = 0.f;
|
||||||
// mp_ = *po;
|
// }
|
||||||
// if (mp_) {
|
|
||||||
// }
|
|
||||||
//// duration = mp_->duration();
|
|
||||||
//// step = mp_->frameDuration();
|
|
||||||
//// t = mp_->position();
|
|
||||||
|
|
||||||
//// arr = mp_->timelineArray();
|
|
||||||
//// array_size = mp_->timelineArraySize();
|
|
||||||
|
|
||||||
if (arr_lines == nullptr) {
|
|
||||||
|
|
||||||
arr_lines = (float *) malloc(array_size * sizeof(float));
|
|
||||||
arr_histo = (float *) malloc(array_size * sizeof(float));
|
|
||||||
|
|
||||||
for (int i = 0; i < array_size; ++i) {
|
|
||||||
arr_lines[i] = 1.f;
|
|
||||||
arr_histo[i] = 0.f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// scrolling sub-window
|
|
||||||
ImGui::BeginChild("##scrolling",
|
|
||||||
ImVec2(ImGui::GetContentRegionAvail().x, 250),
|
|
||||||
false, ImGuiWindowFlags_HorizontalScrollbar);
|
|
||||||
|
|
||||||
|
|
||||||
if (arr_lines != nullptr)
|
|
||||||
{
|
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(1, 1));
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.f);
|
|
||||||
|
|
||||||
ImVec2 size = ImGui::CalcItemSize(ImVec2(-FLT_MIN, 0.0f), ImGui::CalcItemWidth(), 40);
|
|
||||||
size.x *= 1.f;
|
|
||||||
|
|
||||||
// // draw position when entering
|
|
||||||
// ImVec2 draw_pos = ImGui::GetCursorPos();
|
|
||||||
|
|
||||||
//// // capture user input
|
|
||||||
//// uint press_index = array_size-1;
|
|
||||||
//// float val = 0.f;
|
|
||||||
//// bool pressed = false;
|
|
||||||
|
|
||||||
//// uint starting_index = press_index;
|
|
||||||
//// pressed = ImGuiToolkit::InvisibleDoubleSliderFloat("test", &press_index, &val, 0, array_size-1, size);
|
|
||||||
//// if (pressed)
|
|
||||||
//// {
|
|
||||||
//// for (int i = MIN(starting_index, press_index); i < MAX(starting_index, press_index); ++i)
|
|
||||||
//// arr[i] = val;
|
|
||||||
|
|
||||||
////// starting_index = press_index;
|
|
||||||
//// }
|
|
||||||
|
|
||||||
// float x = -1.f;
|
|
||||||
// float y = -1.f;
|
|
||||||
// bool clicked = ImGuiToolkit::InvisibleCoordinatesFloat("test", &x, &y, size);
|
|
||||||
// if (clicked) {
|
|
||||||
// Log::Info("clic %f %f in [%f %f]", x, y, size.x, size.y);
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// // scrolling sub-window
|
||||||
|
// ImGui::BeginChild("##scrolling",
|
||||||
|
// ImVec2(ImGui::GetContentRegionAvail().x, 250),
|
||||||
|
// false, ImGuiWindowFlags_HorizontalScrollbar);
|
||||||
|
|
||||||
// // back to
|
|
||||||
// ImGui::SetCursorPos(draw_pos);
|
|
||||||
// // plot lines
|
|
||||||
// ImGui::PlotLines("Lines", arr, array_size-1, 0, NULL, 0.0f, 1.0f, size);
|
|
||||||
|
|
||||||
//// size.y = 20;
|
// if (arr_lines != nullptr)
|
||||||
//// ImGui::PlotHistogram("Hisfd", arr, array_size-1, 0, NULL, 0.0f, 1.0f, size);
|
// {
|
||||||
bool r = false;
|
|
||||||
ImGuiToolkit::EditPlotHistoLines("Alpha", arr_histo, arr_lines, array_size, 0.f, 1.f, &r, size);
|
|
||||||
|
|
||||||
bool slider_pressed = ImGuiToolkit::TimelineSlider("timeline", &t, 0, duration, step, size.x);
|
// ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(1, 1));
|
||||||
|
// ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.f);
|
||||||
|
|
||||||
ImGui::PopStyleVar(2);
|
// ImVec2 size = ImGui::CalcItemSize(ImVec2(-FLT_MIN, 0.0f), ImGui::CalcItemWidth(), 40);
|
||||||
|
// size.x *= 1.f;
|
||||||
|
|
||||||
ImGui::Text("Timeline t %" GST_STIME_FORMAT "\n", GST_STIME_ARGS(t));
|
//// // draw position when entering
|
||||||
ImGui::Text("Timeline Pressed %s", slider_pressed ? "on" : "off");
|
//// ImVec2 draw_pos = ImGui::GetCursorPos();
|
||||||
|
|
||||||
static int w = 0;
|
////// // capture user input
|
||||||
ImGui::SetNextItemWidth(size.x);
|
////// uint press_index = array_size-1;
|
||||||
ImGui::SliderInt("##int", &w, 0, array_size-1);
|
////// float val = 0.f;
|
||||||
|
////// bool pressed = false;
|
||||||
|
|
||||||
}
|
////// uint starting_index = press_index;
|
||||||
|
////// pressed = ImGuiToolkit::InvisibleDoubleSliderFloat("test", &press_index, &val, 0, array_size-1, size);
|
||||||
|
////// if (pressed)
|
||||||
|
////// {
|
||||||
|
////// for (int i = MIN(starting_index, press_index); i < MAX(starting_index, press_index); ++i)
|
||||||
|
////// arr[i] = val;
|
||||||
|
|
||||||
ImGui::EndChild();
|
//////// starting_index = press_index;
|
||||||
|
////// }
|
||||||
|
|
||||||
|
//// float x = -1.f;
|
||||||
|
//// float y = -1.f;
|
||||||
|
//// bool clicked = ImGuiToolkit::InvisibleCoordinatesFloat("test", &x, &y, size);
|
||||||
|
//// if (clicked) {
|
||||||
|
//// Log::Info("clic %f %f in [%f %f]", x, y, size.x, size.y);
|
||||||
|
//// }
|
||||||
|
|
||||||
|
|
||||||
|
//// // back to
|
||||||
|
//// ImGui::SetCursorPos(draw_pos);
|
||||||
|
//// // plot lines
|
||||||
|
//// ImGui::PlotLines("Lines", arr, array_size-1, 0, NULL, 0.0f, 1.0f, size);
|
||||||
|
|
||||||
|
////// size.y = 20;
|
||||||
|
////// ImGui::PlotHistogram("Hisfd", arr, array_size-1, 0, NULL, 0.0f, 1.0f, size);
|
||||||
|
// bool r = false;
|
||||||
|
// ImGuiToolkit::EditPlotHistoLines("Alpha", arr_histo, arr_lines, array_size, 0.f, 1.f, &r, size);
|
||||||
|
|
||||||
|
// bool slider_pressed = ImGuiToolkit::TimelineSlider("timeline", &t, 0, duration, step, size.x);
|
||||||
|
|
||||||
|
// ImGui::PopStyleVar(2);
|
||||||
|
|
||||||
|
// ImGui::Text("Timeline t %" GST_STIME_FORMAT "\n", GST_STIME_ARGS(t));
|
||||||
|
// ImGui::Text("Timeline Pressed %s", slider_pressed ? "on" : "off");
|
||||||
|
|
||||||
|
// static int w = 0;
|
||||||
|
// ImGui::SetNextItemWidth(size.x);
|
||||||
|
// ImGui::SliderInt("##int", &w, 0, array_size-1);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// ImGui::EndChild();
|
||||||
|
|
||||||
|
static char str0[128] = "àöäüèáû вторая строчка";
|
||||||
|
ImGui::InputText("input text", str0, IM_ARRAYSIZE(str0));
|
||||||
|
std::string tra = SystemToolkit::transliterate(std::string(str0));
|
||||||
|
ImGui::Text("Transliteration: '%s'", tra.c_str());
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user