Minor improvements

Display hourglass in left panel to inform source is loading and prevent buttons when loading + Varia.
This commit is contained in:
Bruno Herbelin
2024-10-05 01:07:05 +02:00
parent 10e95f5388
commit 3909aa4ab7
5 changed files with 71 additions and 54 deletions

View File

@@ -463,7 +463,15 @@ void ImGuiVisitor::visit (Source& s)
if (s.ready()) { if (s.ready()) {
ImGui::SetCursorPos( ImVec2(pos.x + 0.5f * (preview_width-width), pos.y + 0.5f * (preview_height-height-space)) ); ImGui::SetCursorPos( ImVec2(pos.x + 0.5f * (preview_width-width), pos.y + 0.5f * (preview_height-height-space)) );
ImGui::Image((void*)(uintptr_t) s.frame()->texture(), ImVec2(width, height)); ImGui::Image((void*)(uintptr_t) s.frame()->texture(), ImVec2(width, height));
} else {
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
ImGui::SetCursorPos(
ImVec2(pos.x + (preview_width - ImGui::GetFrameHeight()) * 0.5f,
pos.y + (preview_height - ImGui::GetFrameHeight()) * 0.5f));
ImGui::Text(ICON_FA_HOURGLASS_HALF);
ImGui::PopFont();
} }
// inform on visibility status // inform on visibility status
ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y ) ); ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y ) );
if (s.active()) { if (s.active()) {
@@ -637,9 +645,9 @@ void ImGuiVisitor::visit (Source& s)
ImGui::Image((void*)(uintptr_t) s.frame()->texture(), ImVec2(width, height)); ImGui::Image((void*)(uintptr_t) s.frame()->texture(), ImVec2(width, height));
// centered icon of failed (skull) // centered icon of failed (skull)
ImGui::SetCursorPos( ImVec2(pos.x + (width -ImGui::GetFrameHeightWithSpacing())* 0.5f ,
pos.y + (height -ImGui::GetFrameHeightWithSpacing()) * 0.5f) );
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
ImGui::SetCursorPos( ImVec2(pos.x + (preview_width -ImGui::GetFrameHeight())* 0.5f ,
pos.y + (preview_height -ImGui::GetFrameHeight()) * 0.5f) );
ImGui::Text(ICON_FA_SKULL); ImGui::Text(ICON_FA_SKULL);
ImGui::PopFont(); ImGui::PopFont();
@@ -753,10 +761,12 @@ void ImGuiVisitor::visit (MediaSource& s)
ImGui::SetCursorPos(botom); ImGui::SetCursorPos(botom);
// because sometimes the error comes from gpu decoding // because sometimes the error comes from gpu decoding
if ( Settings::application.render.gpu_decoding && SystemToolkit::file_exists(s.path()) ) if ( Settings::application.render.gpu_decoding &&
SystemToolkit::file_exists(s.path()) &&
!s.mediaplayer()->softwareDecodingForced() )
{ {
// offer to reload the source without hardware decoding // offer to reload the source without hardware decoding
if ( ImGui::Button( ICON_FA_REDO_ALT " Try again without\nhardware decoding", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) { if ( ImGui::Button( ICON_FA_REDO_ALT " Try again ", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) {
// replace current source with one created with a flag forcing software decoding // replace current source with one created with a flag forcing software decoding
Mixer::manager().replaceSource(Mixer::manager().currentSource(), Mixer::manager().replaceSource(Mixer::manager().currentSource(),
Mixer::manager().createSourceFile(s.path(), true)); Mixer::manager().createSourceFile(s.path(), true));
@@ -1420,8 +1430,10 @@ void ImGuiVisitor::visit (PatternSource& s)
{ {
for (uint p = 0; p < Pattern::count(); ++p){ for (uint p = 0; p < Pattern::count(); ++p){
pattern_descriptor pattern = Pattern::get(p); pattern_descriptor pattern = Pattern::get(p);
std::string label = pattern.label + (pattern.animated ? " " ICON_FA_PLAY_CIRCLE : " "); std::string label = pattern.label;
if (pattern.available && ImGui::Selectable( label.c_str(), p == s.pattern()->type() )) { if (pattern.available &&
pattern.animated == s.playable() &&
ImGui::Selectable( label.c_str(), p == s.pattern()->type() )) {
s.setPattern(p, s.pattern()->resolution()); s.setPattern(p, s.pattern()->resolution());
info.reset(); info.reset();
std::ostringstream oss; std::ostringstream oss;
@@ -1448,7 +1460,7 @@ void ImGuiVisitor::visit (PatternSource& s)
top.x += ImGui::GetFrameHeight(); top.x += ImGui::GetFrameHeight();
} }
ImGui::SetCursorPos(top); ImGui::SetCursorPos(top);
if (ImGuiToolkit::IconButton(ICON_FA_COPY, "Copy")) if (ImGuiToolkit::IconButton(ICON_FA_COPY, "Copy gstreamer code"))
ImGui::SetClipboardText(Pattern::get( s.pattern()->type() ).pipeline.c_str()); ImGui::SetClipboardText(Pattern::get( s.pattern()->type() ).pipeline.c_str());
} }
else else

View File

@@ -657,7 +657,7 @@ const char* BlurFilter::method_label[BlurFilter::BLUR_INVALID] = {
}; };
std::vector< FilteringProgram > BlurFilter::programs_ = { std::vector< FilteringProgram > BlurFilter::programs_ = {
FilteringProgram("Gaussian", "shaders/filters/blur_1.glsl", "shaders/filters/blur_2.glsl", { { "Radius", 0.5} }), FilteringProgram("Gaussian", "shaders/filters/blur_1.glsl", "shaders/filters/blur_2.glsl", { { "Radius", 0.55} }),
FilteringProgram("Scattered","shaders/filters/hashedblur.glsl", "", { { "Radius", 0.5}, { "Iterations", 0.25 } }), FilteringProgram("Scattered","shaders/filters/hashedblur.glsl", "", { { "Radius", 0.5}, { "Iterations", 0.25 } }),
FilteringProgram("Opening", "shaders/filters/hashederosion.glsl", "shaders/filters/hasheddilation.glsl", { { "Radius", 0.5} }), FilteringProgram("Opening", "shaders/filters/hashederosion.glsl", "shaders/filters/hasheddilation.glsl", { { "Radius", 0.5} }),
FilteringProgram("Closing", "shaders/filters/hasheddilation.glsl","shaders/filters/hashederosion.glsl", { { "Radius", 0.5} }), FilteringProgram("Closing", "shaders/filters/hasheddilation.glsl","shaders/filters/hashederosion.glsl", { { "Radius", 0.5} }),
@@ -800,7 +800,7 @@ const char* SharpenFilter::method_label[SharpenFilter::SHARPEN_INVALID] = {
}; };
std::vector< FilteringProgram > SharpenFilter::programs_ = { std::vector< FilteringProgram > SharpenFilter::programs_ = {
FilteringProgram("UnsharpMask", "shaders/filters/sharpen_1.glsl", "shaders/filters/sharpen_2.glsl", { { "Amount", 0.5} }), FilteringProgram("UnsharpMask", "shaders/filters/sharpen_1.glsl", "shaders/filters/sharpen_2.glsl", { { "Amount", 0.25} }),
FilteringProgram("Sharpen", "shaders/filters/sharpen.glsl", "", { { "Amount", 0.5} }), FilteringProgram("Sharpen", "shaders/filters/sharpen.glsl", "", { { "Amount", 0.5} }),
FilteringProgram("Sharp Edge", "shaders/filters/sharpenedge.glsl","", { { "Amount", 0.25} }), FilteringProgram("Sharp Edge", "shaders/filters/sharpenedge.glsl","", { { "Amount", 0.25} }),
FilteringProgram("TopHat", "shaders/filters/erosion.glsl", "shaders/filters/tophat.glsl", { { "Radius", 0.5} }), FilteringProgram("TopHat", "shaders/filters/erosion.glsl", "shaders/filters/tophat.glsl", { { "Radius", 0.5} }),

View File

@@ -1446,7 +1446,7 @@ void MediaPlayer::execute_seek_command(GstClockTime target, bool force)
if (seek_event && gst_element_send_event(pipeline_, seek_event) ) { if (seek_event && gst_element_send_event(pipeline_, seek_event) ) {
seeking_ = true; seeking_ = true;
#ifdef MEDIA_PLAYER_DEBUG #ifdef MEDIA_PLAYER_DEBUG
g_printerr("MediaPlayer %s Seek %ld %.1f", std::to_string(id_).c_str(), seek_pos, rate_); g_printerr("MediaPlayer %s Seek %ld %.1f\n", std::to_string(id_).c_str(), seek_pos, rate_);
#endif #endif
} }
else else

View File

@@ -405,7 +405,7 @@ glm::ivec2 TextSource::icon() const
std::string TextSource::info() const std::string TextSource::info() const
{ {
if ( contents()->isSubtitle() ) if ( contents()->isSubtitle() )
return "Subtitle text"; return "Subtitle file";
else else
return "Free text"; return "Text";
} }

View File

@@ -3558,8 +3558,13 @@ void Navigator::RenderSourcePannel(Source *s, const ImVec2 &iconsize)
} }
} }
// clone button ///
/// ACTION BUTTONS PANEL if not loading
///
ImGui::Text(" "); ImGui::Text(" ");
if (s->ready() || s->failed()) {
// clone button
if ( s->failed() ) { if ( s->failed() ) {
ImGuiToolkit::ButtonDisabled( ICON_FA_SHARE_SQUARE " Clone & Filter", ImVec2(ImGui::GetContentRegionAvail().x, 0)); ImGuiToolkit::ButtonDisabled( ICON_FA_SHARE_SQUARE " Clone & Filter", ImVec2(ImGui::GetContentRegionAvail().x, 0));
} }
@@ -3603,7 +3608,7 @@ void Navigator::RenderSourcePannel(Source *s, const ImVec2 &iconsize)
} }
ImGui::PopStyleColor(1); ImGui::PopStyleColor(1);
} }
}
ImGui::End(); ImGui::End();
} }
} }