improve stream manager ui

This commit is contained in:
Green Sky 2024-09-21 15:13:03 +02:00
parent 9b7ba5875c
commit 4d5d708d6d
No known key found for this signature in database
3 changed files with 180 additions and 155 deletions

View File

@ -90,7 +90,7 @@ template<> void ComponentEditorWidget<ObjComp::Ephemeral::File::TransferStats>(e
ObjectStoreUI::ObjectStoreUI( ObjectStoreUI::ObjectStoreUI(
ObjectStore2& os ObjectStore2& os
) : _os(os) { ) : _os(os) {
_ee.show_window = true; _ee.show_window = false;
_ee.registerComponent<ObjectStore::Components::ID>("ID"); _ee.registerComponent<ObjectStore::Components::ID>("ID");
_ee.registerComponent<ObjectStore::Components::DataCompressionType>("DataCompressionType"); _ee.registerComponent<ObjectStore::Components::DataCompressionType>("DataCompressionType");

View File

@ -13,13 +13,36 @@ StreamManagerUI::StreamManagerUI(ObjectStore2& os, StreamManager& sm) : _os(os),
} }
void StreamManagerUI::render(void) { void StreamManagerUI::render(void) {
if (ImGui::Begin("StreamManagerUI")) { { // main window menubar injection
// TODO: node canvas? // assumes the window "tomato" was rendered already by cg
if (ImGui::Begin("tomato")) {
if (ImGui::BeginMenuBar()) {
// TODO: drop all menu sep?
//ImGui::Separator(); // os already exists (very hacky)
if (ImGui::BeginMenu("ObjectStore")) {
if (ImGui::MenuItem("Stream Manger", nullptr, _show_window)) {
_show_window = !_show_window;
}
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}
}
ImGui::End();
}
if (!_show_window) {
return;
}
if (ImGui::Begin("StreamManagerUI", &_show_window)) {
// TODO: node canvas
// by fametype ?? // by fametype ??
ImGui::SeparatorText("Sources"); if (ImGui::CollapsingHeader("Sources")) {
// list sources // list sources
if (ImGui::BeginTable("sources_and_sinks", 4, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_BordersInnerV)) { if (ImGui::BeginTable("sources_and_sinks", 4, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_BordersInnerV)) {
ImGui::TableSetupColumn("id"); ImGui::TableSetupColumn("id");
@ -53,9 +76,9 @@ void StreamManagerUI::render(void) {
ImGui::EndTable(); ImGui::EndTable();
} }
} // sources header
ImGui::SeparatorText("Sinks"); if (ImGui::CollapsingHeader("Sinks")) {
// list sinks // list sinks
if (ImGui::BeginTable("sources_and_sinks", 4, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_BordersInnerV)) { if (ImGui::BeginTable("sources_and_sinks", 4, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_BordersInnerV)) {
ImGui::TableSetupColumn("id"); ImGui::TableSetupColumn("id");
@ -142,9 +165,9 @@ void StreamManagerUI::render(void) {
ImGui::EndTable(); ImGui::EndTable();
} }
} // sink header
ImGui::SeparatorText("Connections"); if (ImGui::CollapsingHeader("Connections", ImGuiTreeNodeFlags_DefaultOpen)) {
// list connections // list connections
if (ImGui::BeginTable("connections", 6, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_BordersInnerV)) { if (ImGui::BeginTable("connections", 6, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_BordersInnerV)) {
ImGui::TableSetupColumn("##id"); // TODO: remove? ImGui::TableSetupColumn("##id"); // TODO: remove?
@ -156,7 +179,6 @@ void StreamManagerUI::render(void) {
ImGui::TableHeadersRow(); ImGui::TableHeadersRow();
//for (const auto& con : _sm._connections) {
for (size_t i = 0; i < _sm._connections.size(); i++) { for (size_t i = 0; i < _sm._connections.size(); i++) {
const auto& con = _sm._connections[i]; const auto& con = _sm._connections[i];
//ImGui::Text("con %d->%d", entt::to_integral(entt::to_entity(con->src.entity())), entt::to_integral(entt::to_entity(con->sink.entity()))); //ImGui::Text("con %d->%d", entt::to_integral(entt::to_entity(con->src.entity())), entt::to_integral(entt::to_entity(con->sink.entity())));
@ -195,6 +217,7 @@ void StreamManagerUI::render(void) {
} }
ImGui::EndTable(); ImGui::EndTable();
} }
} // con header
} }
ImGui::End(); ImGui::End();
} }

View File

@ -7,6 +7,8 @@ class StreamManagerUI {
ObjectStore2& _os; ObjectStore2& _os;
StreamManager& _sm; StreamManager& _sm;
bool _show_window {true};
public: public:
StreamManagerUI(ObjectStore2& os, StreamManager& sm); StreamManagerUI(ObjectStore2& os, StreamManager& sm);