From 85a25a0a391b1dffc1712901de949687deda0bb0 Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Sat, 25 Mar 2023 20:33:30 +0100 Subject: [PATCH] Improved report of Media Player error --- src/ImGuiVisitor.cpp | 8 +++++++- src/MediaPlayer.cpp | 10 +++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ImGuiVisitor.cpp b/src/ImGuiVisitor.cpp index 1101b68..da94f97 100644 --- a/src/ImGuiVisitor.cpp +++ b/src/ImGuiVisitor.cpp @@ -642,10 +642,16 @@ void ImGuiVisitor::visit (MediaSource& s) info.reset(); ImGui::SetCursorPos(top); - if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder")) SystemToolkit::open(SystemToolkit::path_filename(s.path())); + if ( info.str().size() > 150 ) { + top.y += 2.f * ImGui::GetFrameHeight(); + ImGui::SetCursorPos(top); + if (ImGuiToolkit::IconButton(ICON_FA_COPY, "Copy")) + ImGui::SetClipboardText(info.str().c_str()); + } + ImGui::SetCursorPos(botom); } diff --git a/src/MediaPlayer.cpp b/src/MediaPlayer.cpp index 4f9221c..da9998c 100644 --- a/src/MediaPlayer.cpp +++ b/src/MediaPlayer.cpp @@ -136,22 +136,22 @@ MediaInfo MediaPlayer::UriDiscoverer(const std::string &uri) GstDiscovererResult result = gst_discoverer_info_get_result (info); switch (result) { case GST_DISCOVERER_URI_INVALID: - video_stream_info.log = "Invalid URI"; + video_stream_info.log = "\nInvalid URI"; break; case GST_DISCOVERER_ERROR: - video_stream_info.log = err->message; + video_stream_info.log = std::string( "\nError; " ) + err->message; break; case GST_DISCOVERER_TIMEOUT: - video_stream_info.log = "Timeout loading"; + video_stream_info.log = "\nTimeout loading"; break; case GST_DISCOVERER_BUSY: - video_stream_info.log = "Busy"; + video_stream_info.log = "\nBusy"; break; case GST_DISCOVERER_MISSING_PLUGINS: { const GstStructure *s = gst_discoverer_info_get_misc (info); gchar *str = gst_structure_to_string (s); - video_stream_info.log = "Unknown format " + std::string(str); + video_stream_info.log = std::string( "\nUnknown format; " ) + std::string(str); g_free (str); } break;