UX clarification: replace Button to open URL by icon 'Show in Finder'

This commit is contained in:
Bruno Herbelin
2023-03-08 23:52:47 +01:00
parent 8c778e8afb
commit ac97984314

View File

@@ -613,34 +613,38 @@ void ImGuiVisitor::visit (Source& s)
void ImGuiVisitor::visit (MediaSource& s) void ImGuiVisitor::visit (MediaSource& s)
{ {
ImVec2 top = ImGui::GetCursorPos();
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
// Media info // Media info
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN); ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
s.accept(info); s.accept(info);
ImGui::Text("%s", info.str().c_str()); ImGui::Text("%s", info.str().c_str());
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
if (ImGui::IsItemHovered())
ImGuiToolkit::ToolTip( s.path().c_str() );
ImVec2 botom = ImGui::GetCursorPos();
if ( !s.failed() ) { if ( !s.failed() ) {
// icon (>) to open player // icon (>) to open player
if ( s.playable() ) { if ( s.playable() ) {
ImVec2 pos = ImGui::GetCursorPos(); ImGui::SetCursorPos(top);
ImGui::SameLine(0, 0);
ImGui::SameLine(0, 10.f + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player")) if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s); UserInterface::manager().showSourceEditor(&s);
ImGui::SetCursorPos(pos); top.x += ImGui::GetFrameHeight();
} }
} }
else else
info.reset(); info.reset();
// folder ImGui::SetCursorPos(top);
std::string path = SystemToolkit::path_filename(s.path());
std::string label = BaseToolkit::truncated(path, 25);
label = BaseToolkit::transliterate(label);
ImGuiToolkit::ButtonOpenUrl( label.c_str(), path.c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) );
ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::Text("Folder");
if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder"))
SystemToolkit::open(SystemToolkit::path_filename(s.path()));
ImGui::SetCursorPos(botom);
} }
void ImGuiVisitor::visit (SessionFileSource& s) void ImGuiVisitor::visit (SessionFileSource& s)
@@ -648,23 +652,21 @@ void ImGuiVisitor::visit (SessionFileSource& s)
if (s.session() == nullptr) if (s.session() == nullptr)
return; return;
ImVec2 top = ImGui::GetCursorPos();
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
// info // info
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN); ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
s.accept(info); s.accept(info);
ImGui::Text("%s", info.str().c_str()); ImGui::Text("%s", info.str().c_str());
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
if ( !s.failed() ) { if (ImGui::IsItemHovered())
ImGuiToolkit::ToolTip( s.path().c_str() );
// icon (>) to open player ImVec2 botom = ImGui::GetCursorPos();
if ( s.playable() ) {
ImVec2 pos = ImGui::GetCursorPos(); if ( !s.failed() ) {
ImGui::SameLine(0, 0);
ImGui::SameLine(0, 10.f + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
ImGui::SetCursorPos(pos);
}
if ( ImGui::Button( ICON_FA_SIGN_OUT_ALT " Import", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) if ( ImGui::Button( ICON_FA_SIGN_OUT_ALT " Import", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
Mixer::manager().import( &s ); Mixer::manager().import( &s );
@@ -709,22 +711,34 @@ void ImGuiVisitor::visit (SessionFileSource& s)
ImGui::SameLine(0, IMGUI_SAME_LINE); ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::Text("File"); ImGui::Text("File");
botom = ImGui::GetCursorPos();
// icon (>) to open player
if ( s.playable() ) {
ImGui::SetCursorPos(top);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
top.x += ImGui::GetFrameHeight();
}
} }
else else
info.reset(); info.reset();
// file path ImGui::SetCursorPos(top);
std::string path = SystemToolkit::path_filename(s.path());
std::string label = BaseToolkit::truncated(path, 25); if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder"))
label = BaseToolkit::transliterate(label); SystemToolkit::open(SystemToolkit::path_filename(s.path()));
ImGuiToolkit::ButtonOpenUrl( label.c_str(), path.c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) );
ImGui::SameLine(0, IMGUI_SAME_LINE); ImGui::SetCursorPos(botom);
ImGui::Text("Folder");
} }
void ImGuiVisitor::visit (SessionGroupSource& s) void ImGuiVisitor::visit (SessionGroupSource& s)
{ {
ImVec2 top = ImGui::GetCursorPos();
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
Session *session = s.session(); Session *session = s.session();
if (session == nullptr) if (session == nullptr)
return; return;
@@ -735,22 +749,12 @@ void ImGuiVisitor::visit (SessionGroupSource& s)
ImGui::Text("%s", info.str().c_str()); ImGui::Text("%s", info.str().c_str());
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
// icon (>) to open player
if ( s.playable() && !s.failed() ) {
ImVec2 pos = ImGui::GetCursorPos();
ImGui::SameLine(0, 0);
ImGui::SameLine(0, 10.f + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
ImGui::SetCursorPos(pos);
}
// Show list of sources in text bloc (multi line, dark background) // Show list of sources in text bloc (multi line, dark background)
ImGuiTextBuffer info; ImGuiTextBuffer listofsources;
info.append( BaseToolkit::joinned( session->getNameList(), '\n').c_str() ); listofsources.append( BaseToolkit::joinned( session->getNameList(), '\n').c_str() );
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f)); ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f));
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::InputTextMultiline("##sourcesingroup", (char *)info.c_str(), info.size(), ImGui::InputTextMultiline("##sourcesingroup", (char *)listofsources.c_str(), listofsources.size(),
ImVec2(IMGUI_RIGHT_ALIGN, CLAMP(session->size(), 2, 5) * ImGui::GetTextLineHeightWithSpacing()), ImVec2(IMGUI_RIGHT_ALIGN, CLAMP(session->size(), 2, 5) * ImGui::GetTextLineHeightWithSpacing()),
ImGuiInputTextFlags_ReadOnly); ImGuiInputTextFlags_ReadOnly);
ImGui::PopStyleColor(1); ImGui::PopStyleColor(1);
@@ -759,32 +763,59 @@ void ImGuiVisitor::visit (SessionGroupSource& s)
Mixer::manager().import( &s ); Mixer::manager().import( &s );
ImGui::SameLine(0, IMGUI_SAME_LINE); ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::Text("Sources"); ImGui::Text("Sources");
ImVec2 botom = ImGui::GetCursorPos();
if ( !s.failed() ) {
// icon (>) to open player
if ( s.playable() ) {
ImGui::SetCursorPos(top);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
}
}
else
info.reset();
ImGui::SetCursorPos(botom);
} }
void ImGuiVisitor::visit (RenderSource& s) void ImGuiVisitor::visit (RenderSource& s)
{ {
ImVec2 top = ImGui::GetCursorPos();
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
// info // info
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN); ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
s.accept(info); s.accept(info);
ImGui::Text("%s", info.str().c_str()); ImGui::Text("%s", info.str().c_str());
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
// icon (>) to open player // loopback provenance
ImVec2 pos = ImGui::GetCursorPos();
ImGui::SameLine(0, 0);
ImGui::SameLine(0, 10.f + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
ImGui::SameLine();
if (ImGuiToolkit::IconButton(ICON_FA_LAPTOP, "Show Output"))
Settings::application.widget.preview = true;
ImGui::SetCursorPos(pos);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
int m = (int) s.renderingProvenance(); int m = (int) s.renderingProvenance();
if (ImGuiToolkit::ComboIcon("##SelectRender", &m, RenderSource::ProvenanceMethod)) if (ImGuiToolkit::ComboIcon("##SelectRender", &m, RenderSource::ProvenanceMethod))
s.setRenderingProvenance((RenderSource::RenderSourceProvenance)m); s.setRenderingProvenance((RenderSource::RenderSourceProvenance)m);
ImVec2 botom = ImGui::GetCursorPos();
if ( !s.failed() ) {
// icon (>) to open player
if ( s.playable() ) {
ImGui::SetCursorPos(top);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
top.x += ImGui::GetFrameHeight();
}
// icon to open output view
ImGui::SetCursorPos(top);
if (ImGuiToolkit::IconButton(ICON_FA_LAPTOP, "Show Output"))
Settings::application.widget.preview = true;
}
else
info.reset();
ImGui::SetCursorPos(botom);
} }
void ImGuiVisitor::visit (FrameBufferFilter&) void ImGuiVisitor::visit (FrameBufferFilter&)
@@ -1100,22 +1131,15 @@ void ImGuiVisitor::visit (ImageFilter& f)
void ImGuiVisitor::visit (CloneSource& s) void ImGuiVisitor::visit (CloneSource& s)
{ {
ImVec2 top = ImGui::GetCursorPos();
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
// info // info
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN); ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
s.accept(info); s.accept(info);
ImGui::Text("%s", info.str().c_str()); ImGui::Text("%s", info.str().c_str());
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
// icon (>) to open player
if ( s.playable() ) {
ImVec2 pos = ImGui::GetCursorPos();
ImGui::SameLine(0, 0);
ImGui::SameLine(0, 10.f + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
ImGui::SetCursorPos(pos);
}
// link to origin source // link to origin source
if ( !s.failed() ) { if ( !s.failed() ) {
std::string label = std::string(s.origin()->initials()) + " - " + s.origin()->name(); std::string label = std::string(s.origin()->initials()) + " - " + s.origin()->name();
@@ -1156,30 +1180,33 @@ void ImGuiVisitor::visit (CloneSource& s)
// filter options // filter options
s.filter()->accept(*this); s.filter()->accept(*this);
ImVec2 botom = ImGui::GetCursorPos();
if ( !s.failed() ) {
// icon (>) to open player
if ( s.playable() ) {
ImGui::SetCursorPos(top);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
}
}
else
info.reset();
ImGui::SetCursorPos(botom);
} }
void ImGuiVisitor::visit (PatternSource& s) void ImGuiVisitor::visit (PatternSource& s)
{ {
ImVec2 top = ImGui::GetCursorPos();
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
// stream info // stream info
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN); ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
s.accept(info); s.accept(info);
ImGui::Text("%s", info.str().c_str()); ImGui::Text("%s", info.str().c_str());
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
if ( !s.failed() ) {
// icon (>) to open player
if ( s.playable() ) {
ImVec2 pos = ImGui::GetCursorPos();
ImGui::SameLine(0, 0);
ImGui::SameLine(0, IMGUI_SAME_LINE + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
ImGui::SetCursorPos(pos);
}
}
else
info.reset();
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
if (ImGui::BeginCombo("##Patterns", Pattern::get(s.pattern()->type()).label.c_str(), ImGuiComboFlags_HeightLarge) ) if (ImGui::BeginCombo("##Patterns", Pattern::get(s.pattern()->type()).label.c_str(), ImGuiComboFlags_HeightLarge) )
{ {
@@ -1198,29 +1225,33 @@ void ImGuiVisitor::visit (PatternSource& s)
} }
ImGui::SameLine(0, IMGUI_SAME_LINE); ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::Text("Generator"); ImGui::Text("Generator");
}
void ImGuiVisitor::visit (DeviceSource& s) ImVec2 botom = ImGui::GetCursorPos();
{
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
s.accept(info);
ImGui::Text("%s", info.str().c_str());
ImGui::PopTextWrapPos();
if ( !s.failed() ) { if ( !s.failed() ) {
// icon (>) to open player // icon (>) to open player
if ( s.playable() ) { if ( s.playable() ) {
ImVec2 pos = ImGui::GetCursorPos(); ImGui::SetCursorPos(top);
ImGui::SameLine(0, 0);
ImGui::SameLine(0, IMGUI_SAME_LINE + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player")) if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s); UserInterface::manager().showSourceEditor(&s);
ImGui::SetCursorPos(pos);
} }
} }
else else
info.reset(); info.reset();
ImGui::SetCursorPos(botom);
}
void ImGuiVisitor::visit (DeviceSource& s)
{
ImVec2 top = ImGui::GetCursorPos();
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
s.accept(info);
ImGui::Text("%s", info.str().c_str());
ImGui::PopTextWrapPos();
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
if (ImGui::BeginCombo("Device", s.device().c_str())) if (ImGui::BeginCombo("Device", s.device().c_str()))
{ {
@@ -1236,10 +1267,28 @@ void ImGuiVisitor::visit (DeviceSource& s)
} }
ImGui::EndCombo(); ImGui::EndCombo();
} }
ImVec2 botom = ImGui::GetCursorPos();
if ( !s.failed() ) {
// icon (>) to open player
if ( s.playable() ) {
ImGui::SetCursorPos(top);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
}
}
else
info.reset();
ImGui::SetCursorPos(botom);
} }
void ImGuiVisitor::visit (NetworkSource& s) void ImGuiVisitor::visit (NetworkSource& s)
{ {
ImVec2 top = ImGui::GetCursorPos();
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(IMGUI_COLOR_STREAM, 0.9f)); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(IMGUI_COLOR_STREAM, 0.9f));
ImGui::Text("%s", s.connection().c_str()); ImGui::Text("%s", s.connection().c_str());
ImGui::PopStyleColor(1); ImGui::PopStyleColor(1);
@@ -1250,25 +1299,20 @@ void ImGuiVisitor::visit (NetworkSource& s)
ImGui::Text("%s", info.str().c_str()); ImGui::Text("%s", info.str().c_str());
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
ImVec2 botom = ImGui::GetCursorPos();
if ( !s.failed() ) { if ( !s.failed() ) {
// icon (>) to open player // icon (>) to open player
if ( s.playable() ) { if ( s.playable() ) {
ImVec2 pos = ImGui::GetCursorPos(); ImGui::SetCursorPos(top);
ImGui::SameLine(0, 0);
ImGui::SameLine(0, IMGUI_SAME_LINE + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player")) if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s); UserInterface::manager().showSourceEditor(&s);
ImGui::SetCursorPos(pos);
} }
} }
else else
info.reset(); info.reset();
// if ( ImGui::Button( ICON_FA_REPLY " Reconnect", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) ImGui::SetCursorPos(botom);
// {
// s.setConnection(s.connection());
// info.reset();
// }
} }
@@ -1276,24 +1320,18 @@ void ImGuiVisitor::visit (MultiFileSource& s)
{ {
static uint64_t id = 0; static uint64_t id = 0;
ImVec2 top = ImGui::GetCursorPos();
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
// information text // information text
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN); ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
s.accept(info); s.accept(info);
ImGui::Text("%s", info.str().c_str()); ImGui::Text("%s", info.str().c_str());
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
ImVec2 botom = ImGui::GetCursorPos();
if ( !s.failed() ) { if ( !s.failed() ) {
// icon (>) to open player
if ( s.playable() ) {
ImVec2 pos = ImGui::GetCursorPos();
ImGui::SameLine(0, 0);
ImGui::SameLine(0, IMGUI_SAME_LINE + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
ImGui::SetCursorPos(pos);
}
// Filename pattern // Filename pattern
ImGuiTextBuffer info; ImGuiTextBuffer info;
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f)); ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f));
@@ -1310,7 +1348,7 @@ void ImGuiVisitor::visit (MultiFileSource& s)
if (_end < 0 || id != s.id()) if (_end < 0 || id != s.id())
_end = s.end(); _end = s.end();
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::DragIntRange2("Range", &_begin, &_end, 1, s.sequence().min, s.sequence().max); ImGui::DragIntRange2("##Range", &_begin, &_end, 1, s.sequence().min, s.sequence().max);
if (ImGui::IsItemDeactivatedAfterEdit()){ if (ImGui::IsItemDeactivatedAfterEdit()){
s.setRange( _begin, _end ); s.setRange( _begin, _end );
std::ostringstream oss; std::ostringstream oss;
@@ -1318,13 +1356,21 @@ void ImGuiVisitor::visit (MultiFileSource& s)
Action::manager().store(oss.str()); Action::manager().store(oss.str());
_begin = _end = -1; _begin = _end = -1;
} }
ImGui::SameLine(0, 0);
if (ImGuiToolkit::TextButton("Range")) {
s.setRange( s.sequence().min, s.sequence().max );
std::ostringstream oss;
oss << s.name() << ": Range " << s.sequence().min << "-" << s.sequence().max;
Action::manager().store(oss.str());
_begin = _end = -1;
}
// change framerate // change framerate
static int _fps = -1; static int _fps = -1;
if (_fps < 0 || id != s.id()) if (_fps < 0 || id != s.id())
_fps = s.framerate(); _fps = s.framerate();
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::SliderInt("Framerate", &_fps, 1, 30, "%d fps"); ImGui::SliderInt("##Framerate", &_fps, 1, 30, "%d fps");
if (ImGui::IsItemDeactivatedAfterEdit()){ if (ImGui::IsItemDeactivatedAfterEdit()){
s.setFramerate(_fps); s.setFramerate(_fps);
std::ostringstream oss; std::ostringstream oss;
@@ -1332,17 +1378,35 @@ void ImGuiVisitor::visit (MultiFileSource& s)
Action::manager().store(oss.str()); Action::manager().store(oss.str());
_fps = -1; _fps = -1;
} }
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Framerate")) {
s.setFramerate(25);
std::ostringstream oss;
oss << s.name() << ": Framerate 25 fps";
Action::manager().store(oss.str());
_fps = -1;
}
botom = ImGui::GetCursorPos();
// icon (>) to open player
if ( s.playable() ) {
ImGui::SetCursorPos(top);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
top.x += ImGui::GetFrameHeight();
}
} }
else else
info.reset(); info.reset();
// offer to open file browser at location // offer to open file browser at location
std::string path = SystemToolkit::path_filename(s.sequence().location); ImGui::SetCursorPos(top);
std::string label = BaseToolkit::truncated(path, 25); if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder"))
label = BaseToolkit::transliterate(label); SystemToolkit::open(SystemToolkit::path_filename( s.sequence().location ));
ImGuiToolkit::ButtonOpenUrl( label.c_str(), path.c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) );
ImGui::SameLine(0, IMGUI_SAME_LINE); ImGui::SetCursorPos(botom);
ImGui::Text("Folder");
if (id != s.id()) if (id != s.id())
id = s.id(); id = s.id();
@@ -1350,6 +1414,9 @@ void ImGuiVisitor::visit (MultiFileSource& s)
void ImGuiVisitor::visit (GenericStreamSource& s) void ImGuiVisitor::visit (GenericStreamSource& s)
{ {
ImVec2 top = ImGui::GetCursorPos();
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
float w = ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN; float w = ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
// stream info // stream info
@@ -1358,20 +1425,6 @@ void ImGuiVisitor::visit (GenericStreamSource& s)
ImGui::Text("%s", info.str().c_str()); ImGui::Text("%s", info.str().c_str());
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
if ( !s.failed() ) {
// icon (>) to open player
if ( s.playable() ) {
ImVec2 pos = ImGui::GetCursorPos();
ImGui::SameLine(0, 0);
ImGui::SameLine(0, IMGUI_SAME_LINE + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
ImGui::SetCursorPos(pos);
}
}
else
info.reset();
// Prepare display pipeline text // Prepare display pipeline text
static int numlines = 0; static int numlines = 0;
const ImGuiContext& g = *GImGui; const ImGuiContext& g = *GImGui;
@@ -1384,31 +1437,49 @@ void ImGuiVisitor::visit (GenericStreamSource& s)
Action::manager().store( s.name() + ": Change pipeline"); Action::manager().store( s.name() + ": Change pipeline");
} }
ImVec2 botom = ImGui::GetCursorPos();
if ( !s.failed() ) {
// icon (>) to open player
if ( s.playable() ) {
ImGui::SetCursorPos(top);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s);
}
}
else
info.reset();
ImGui::SetCursorPos(botom);
} }
void ImGuiVisitor::visit (SrtReceiverSource& s) void ImGuiVisitor::visit (SrtReceiverSource& s)
{ {
ImVec2 top = ImGui::GetCursorPos();
top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
// network info // network info
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN); ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
s.accept(info); s.accept(info);
ImGui::Text("%s", info.str().c_str()); ImGui::Text("%s", info.str().c_str());
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
ImVec2 botom = ImGui::GetCursorPos();
if ( !s.failed() ) { if ( !s.failed() ) {
// icon (>) to open player // icon (>) to open player
if ( s.playable() ) { if ( s.playable() ) {
ImVec2 pos = ImGui::GetCursorPos(); ImGui::SetCursorPos(top);
ImGui::SameLine(0, 0);
ImGui::SameLine(0, IMGUI_SAME_LINE + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN);
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player")) if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
UserInterface::manager().showSourceEditor(&s); UserInterface::manager().showSourceEditor(&s);
ImGui::SetCursorPos(pos);
} }
} }
else else
info.reset(); info.reset();
ImGui::SetCursorPos(botom);
// if ( ImGui::Button( ICON_FA_REPLY " Reconnect", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) // if ( ImGui::Button( ICON_FA_REPLY " Reconnect", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
// { // {
// s.setConnection(s.connection()); // s.setConnection(s.connection());