Display list of sources in Session Group UI panel

This commit is contained in:
Bruno Herbelin
2022-04-03 23:18:14 +02:00
parent 49ebc17334
commit 74d0d851ca
3 changed files with 18 additions and 6 deletions

View File

@@ -175,8 +175,11 @@ std::list<std::string> BaseToolkit::splitted(const std::string& str, char delim)
std::string BaseToolkit::joinned(std::list<std::string> strlist, char separator)
{
std::string str;
for (auto it = strlist.cbegin(); it != strlist.cend(); ++it)
str += (*it) + separator;
for (auto it = strlist.cbegin(); it != strlist.cend(); ++it) {
if (it != strlist.cbegin())
str += separator;
str += (*it);
}
return str;
}

View File

@@ -579,7 +579,7 @@ void ImGuiVisitor::visit (Source& s)
ImGuiToolkit::Icon(s.icon().x, s.icon().y);
ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::Text(s.info().c_str());
ImGui::Text("%s", s.info().c_str());
}
void ImGuiVisitor::visit (MediaSource& s)
@@ -663,7 +663,8 @@ void ImGuiVisitor::visit (SessionFileSource& s)
void ImGuiVisitor::visit (SessionGroupSource& s)
{
if (s.session() == nullptr)
Session *session = s.session();
if (session == nullptr)
return;
// info
@@ -682,7 +683,15 @@ void ImGuiVisitor::visit (SessionGroupSource& s)
ImGui::SetCursorPos(pos);
}
// Show list of sources in text bloc (multi line, dark background)
ImGuiTextBuffer info;
info.append( BaseToolkit::joinned( session->getNameList(), '\n').c_str() );
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f));
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::InputTextMultiline("##sourcesingroup", (char *)info.c_str(), info.size(),
ImVec2(IMGUI_RIGHT_ALIGN, CLAMP(session->numSource(), 2, 5) * ImGui::GetTextLineHeightWithSpacing()),
ImGuiInputTextFlags_ReadOnly);
ImGui::PopStyleColor(1);
if ( ImGui::Button( ICON_FA_SIGN_OUT_ALT " Import", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
Mixer::manager().import( &s );

View File

@@ -6171,7 +6171,7 @@ void Navigator::RenderNewPannel()
ImGui::InputText("##url", bufurl, IM_ARRAYSIZE(bufurl), ImGuiInputTextFlags_ReadOnly);
ImGui::PopStyleColor(1);
ImGui::SameLine(0); ImGuiToolkit::Indication("URL for connecting to a stream on Secure Reliable Transport (SRT) protocol, waiting for connections in listener mode.", ICON_SOURCE_SRT);
ImGui::SameLine(0); ImGuiToolkit::Indication("URL for connecting with Secure Reliable Transport (SRT) protocol to a broadcaster that is waiting for connections (listener mode).", ICON_SOURCE_SRT);
if ( ImGui::Button("Call", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) {
new_source_preview_.setSource( Mixer::manager().createSourceSrt(Settings::application.custom_connect_ip, Settings::application.custom_connect_port), bufurl);