mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Fixed ButtonOpenUrl
This commit is contained in:
@@ -25,21 +25,18 @@
|
|||||||
#include "ImGuiToolkit.h"
|
#include "ImGuiToolkit.h"
|
||||||
#include "GstToolkit.h"
|
#include "GstToolkit.h"
|
||||||
#include "SystemToolkit.h"
|
#include "SystemToolkit.h"
|
||||||
#include "BaseToolkit.h"
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int textureicons = 0;
|
unsigned int textureicons = 0;
|
||||||
std::map <ImGuiToolkit::font_style, ImFont*>fontmap;
|
std::map <ImGuiToolkit::font_style, ImFont*>fontmap;
|
||||||
|
|
||||||
|
|
||||||
void ImGuiToolkit::ButtonOpenUrl( const char* url, const ImVec2& size_arg )
|
void ImGuiToolkit::ButtonOpenUrl( const char* label, const char* url, const ImVec2& size_arg )
|
||||||
{
|
{
|
||||||
char label[512];
|
char _label[512];
|
||||||
|
sprintf( _label, "%s %s", ICON_FA_EXTERNAL_LINK_ALT, label );
|
||||||
|
|
||||||
std::string str = BaseToolkit::transliterate( url );
|
if ( ImGui::Button(_label, size_arg) )
|
||||||
sprintf( label, "%s %s", ICON_FA_EXTERNAL_LINK_ALT, str.c_str() );
|
|
||||||
|
|
||||||
if ( ImGui::Button(label, size_arg) )
|
|
||||||
SystemToolkit::open(url);
|
SystemToolkit::open(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace ImGuiToolkit
|
|||||||
// utility buttons
|
// utility buttons
|
||||||
bool ButtonToggle (const char* label, bool* toggle);
|
bool ButtonToggle (const char* label, bool* toggle);
|
||||||
bool ButtonSwitch (const char* label, bool* toggle , const char *help = nullptr);
|
bool ButtonSwitch (const char* label, bool* toggle , const char *help = nullptr);
|
||||||
void ButtonOpenUrl (const char* url, const ImVec2& size_arg = ImVec2(0,0));
|
void ButtonOpenUrl (const char* label, const char* url, const ImVec2& size_arg = ImVec2(0,0));
|
||||||
|
|
||||||
void ToolTip (const char* desc, const char* shortcut = nullptr);
|
void ToolTip (const char* desc, const char* shortcut = nullptr);
|
||||||
void HelpMarker (const char* desc, const char* icon = ICON_FA_QUESTION_CIRCLE, const char* shortcut = nullptr);
|
void HelpMarker (const char* desc, const char* icon = ICON_FA_QUESTION_CIRCLE, const char* shortcut = nullptr);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "ImGuiToolkit.h"
|
#include "ImGuiToolkit.h"
|
||||||
|
#include "BaseToolkit.h"
|
||||||
#include "UserInterfaceManager.h"
|
#include "UserInterfaceManager.h"
|
||||||
#include "SystemToolkit.h"
|
#include "SystemToolkit.h"
|
||||||
|
|
||||||
@@ -552,7 +553,12 @@ void ImGuiVisitor::visit (MediaSource& s)
|
|||||||
|
|
||||||
if ( ImGui::Button(IMGUI_TITLE_MEDIAPLAYER, ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
|
if ( ImGui::Button(IMGUI_TITLE_MEDIAPLAYER, ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
|
||||||
UserInterface::manager().showMediaPlayer( s.mediaplayer());
|
UserInterface::manager().showMediaPlayer( s.mediaplayer());
|
||||||
ImGuiToolkit::ButtonOpenUrl( SystemToolkit::path_filename(s.path()).c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) );
|
|
||||||
|
std::string path = SystemToolkit::path_filename(s.path());
|
||||||
|
std::string label = SystemToolkit::trunc_filename(path, 25);
|
||||||
|
label = BaseToolkit::transliterate(label);
|
||||||
|
ImGuiToolkit::ButtonOpenUrl( label.c_str(), path.c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) );
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("Folder");
|
ImGui::Text("Folder");
|
||||||
}
|
}
|
||||||
@@ -583,7 +589,11 @@ void ImGuiVisitor::visit (SessionFileSource& s)
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("File");
|
ImGui::Text("File");
|
||||||
|
|
||||||
ImGuiToolkit::ButtonOpenUrl( SystemToolkit::path_filename(s.path()).c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) );
|
std::string path = SystemToolkit::path_filename(s.path());
|
||||||
|
std::string label = SystemToolkit::trunc_filename(path, 25);
|
||||||
|
label = BaseToolkit::transliterate(label);
|
||||||
|
ImGuiToolkit::ButtonOpenUrl( label.c_str(), path.c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) );
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("Folder");
|
ImGui::Text("Folder");
|
||||||
|
|
||||||
|
|||||||
@@ -1625,7 +1625,7 @@ void UserInterface::RenderAbout(bool* p_open)
|
|||||||
ImGui::Text("\nvimix is licensed under the GNU GPL version 3.\nCopyright 2019-2021 Bruno Herbelin.");
|
ImGui::Text("\nvimix is licensed under the GNU GPL version 3.\nCopyright 2019-2021 Bruno Herbelin.");
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGuiToolkit::ButtonOpenUrl("https://brunoherbelin.github.io/vimix/", ImVec2(ImGui::GetContentRegionAvail().x, 0));
|
ImGuiToolkit::ButtonOpenUrl("Visit vimix website", "https://brunoherbelin.github.io/vimix/", ImVec2(ImGui::GetContentRegionAvail().x, 0));
|
||||||
|
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
@@ -3688,7 +3688,7 @@ void ShowAboutOpengl(bool* p_open)
|
|||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Text("OpenGL is the premier environment for developing portable, \ninteractive 2D and 3D graphics applications.");
|
ImGui::Text("OpenGL is the premier environment for developing portable, \ninteractive 2D and 3D graphics applications.");
|
||||||
ImGuiToolkit::ButtonOpenUrl("https://www.opengl.org");
|
ImGuiToolkit::ButtonOpenUrl("Visit website", "https://www.opengl.org");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
static bool show_opengl_info = false;
|
static bool show_opengl_info = false;
|
||||||
@@ -3752,7 +3752,7 @@ void ShowAboutGStreamer(bool* p_open)
|
|||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Text("A flexible, fast and multiplatform multimedia framework.");
|
ImGui::Text("A flexible, fast and multiplatform multimedia framework.");
|
||||||
ImGui::Text("GStreamer is licensed under the LGPL License.");
|
ImGui::Text("GStreamer is licensed under the LGPL License.");
|
||||||
ImGuiToolkit::ButtonOpenUrl("https://gstreamer.freedesktop.org/");
|
ImGuiToolkit::ButtonOpenUrl("Visit website", "https://gstreamer.freedesktop.org/");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
static bool show_config_info = false;
|
static bool show_config_info = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user