diff --git a/DeviceSource.cpp b/DeviceSource.cpp index b459e5d..40e9013 100644 --- a/DeviceSource.cpp +++ b/DeviceSource.cpp @@ -220,7 +220,7 @@ Device::Device() g_list_free(devices); // Add config for plugged screen - src_name_.push_back("Screen"); + src_name_.push_back("Screen capture"); src_description_.push_back(gst_plugin_vidcap); // Try to auto find resolution diff --git a/ImGuiVisitor.cpp b/ImGuiVisitor.cpp index a4aeb28..2e4f7ce 100644 --- a/ImGuiVisitor.cpp +++ b/ImGuiVisitor.cpp @@ -433,10 +433,9 @@ void ImGuiVisitor::visit (MediaSource& s) ImGuiToolkit::Icon(18,13); ImGui::SameLine(0, 10); ImGui::Text("Video File"); - if ( ImGui::Button(IMGUI_TITLE_MEDIAPLAYER, ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) { - UserInterface::manager().showMediaPlayer( s.mediaplayer()); - } } + if ( ImGui::Button(IMGUI_TITLE_MEDIAPLAYER, ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) + UserInterface::manager().showMediaPlayer( s.mediaplayer()); ImGuiToolkit::ButtonOpenUrl( SystemToolkit::path_filename(s.path()).c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) ); } @@ -445,6 +444,7 @@ void ImGuiVisitor::visit (SessionSource& s) ImGuiToolkit::Icon(s.icon().x, s.icon().y); ImGui::SameLine(0, 10); ImGui::Text("Session File"); + ImGui::Text("%s", SystemToolkit::base_filename(s.path()).c_str()); if (ImGuiToolkit::ButtonIcon(3, 2)) s.session()->setFading(0.f); float f = s.session()->fading(); @@ -537,14 +537,16 @@ void ImGuiVisitor::visit (NetworkSource& s) { ImGuiToolkit::Icon(s.icon().x, s.icon().y); ImGui::SameLine(0, 10); - ImGui::Text("Network connection"); + ImGui::Text("Network stream"); - ImGui::Text("Connection to %s", s.connection().c_str()); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(IMGUI_COLOR_STREAM, 0.9f)); + ImGui::Text("%s", s.connection().c_str()); + ImGui::PopStyleColor(1); NetworkStream *ns = s.networkStream(); - ImGui::Text(" - %s (%dx%d)\n - Network host %s:%d", NetworkToolkit::protocol_name[ns->protocol()], - ns->resolution().x, ns->resolution().y, ns->IP().c_str(), ns->port()); + ImGui::Text(" - %s (%dx%d)\n - Server address %s", NetworkToolkit::protocol_name[ns->protocol()], + ns->resolution().x, ns->resolution().y, ns->serverAddress().c_str()); - if ( ImGui::Button("Reconnect", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) + if ( ImGui::Button( ICON_FA_REPLY " Reconnect", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) { // TODO : reload ? s.setConnection(s.connection()); diff --git a/NetworkSource.cpp b/NetworkSource.cpp index 306af63..61c323d 100644 --- a/NetworkSource.cpp +++ b/NetworkSource.cpp @@ -78,6 +78,17 @@ glm::ivec2 NetworkStream::resolution() const return glm::ivec2(config_.width, config_.height); } + +std::string NetworkStream::clientAddress() const +{ + return config_.client_address + ":" + std::to_string(config_.port); +} + +std::string NetworkStream::serverAddress() const +{ + return streamer_.address; +} + void wait_for_stream_(UdpListeningReceiveSocket *receiver) { receiver->Run(); diff --git a/NetworkSource.h b/NetworkSource.h index 7022c74..bb4857f 100644 --- a/NetworkSource.h +++ b/NetworkSource.h @@ -39,8 +39,8 @@ public: glm::ivec2 resolution() const; inline NetworkToolkit::Protocol protocol() const { return config_.protocol; } - inline std::string IP() const { return config_.client_address; } - inline uint port() const { return config_.port; } + std::string clientAddress() const; + std::string serverAddress() const; private: // connection information diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index b324bc7..44c2401 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -1139,7 +1139,7 @@ void UserInterface::RenderPreview() { // Stop recording menu if main recorder already exists if (rec) { - ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0, 0.05, 0.05, 0.8f)); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(IMGUI_COLOR_RECORD, 0.8f)); if ( ImGui::MenuItem( ICON_FA_SQUARE " Stop Record", CTRL_MOD "R") ) { rec->stop(); video_recorder_ = 0; @@ -1151,7 +1151,7 @@ void UserInterface::RenderPreview() // detecting the absence of video recorder but the variable is still not 0: fix this! if (video_recorder_ > 0) video_recorder_ = 0; - ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0, 0.05, 0.05, 0.9f)); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(IMGUI_COLOR_RECORD, 0.9f)); if ( ImGui::MenuItem( ICON_FA_CIRCLE " Record", CTRL_MOD "R") ) { FrameGrabber *fg = new VideoRecorder; video_recorder_ = fg->id(); @@ -1205,7 +1205,7 @@ void UserInterface::RenderPreview() } if (ImGui::BeginMenu("Stream")) { - ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.05, 0.8, 1.0, 0.9f)); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(IMGUI_COLOR_STREAM, 0.9f)); if ( ImGui::MenuItem( ICON_FA_SHARE_ALT " Accept connections", NULL, &Settings::application.accept_connections) ) { Streaming::manager().enable(Settings::application.accept_connections); } @@ -1214,12 +1214,12 @@ void UserInterface::RenderPreview() { static char dummy_str[512]; sprintf(dummy_str, "%s", Connection::manager().info().name.c_str()); - ImGui::InputText("My network name", dummy_str, IM_ARRAYSIZE(dummy_str), ImGuiInputTextFlags_ReadOnly); + ImGui::InputText("My network ID", dummy_str, IM_ARRAYSIZE(dummy_str), ImGuiInputTextFlags_ReadOnly); std::vector ls = Streaming::manager().listStreams(); if (ls.size()>0) { ImGui::Separator(); - ImGui::MenuItem("Active connections", nullptr, false, false); + ImGui::MenuItem("Active streams", nullptr, false, false); for (auto it = ls.begin(); it != ls.end(); it++) ImGui::Text(" %s", (*it).c_str() ); } @@ -1252,7 +1252,7 @@ void UserInterface::RenderPreview() float r = ImGui::GetTextLineHeightWithSpacing(); ImGui::SetCursorScreenPos(ImVec2(draw_pos.x + r, draw_pos.y + r)); ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); - ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0, 0.05, 0.05, 0.8f)); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(IMGUI_COLOR_RECORD, 0.8f)); ImGui::Text(ICON_FA_CIRCLE " %s", rec->info().c_str() ); ImGui::PopStyleColor(1); ImGui::PopFont(); @@ -1264,9 +1264,9 @@ void UserInterface::RenderPreview() ImGui::SetCursorScreenPos(ImVec2(draw_pos.x + width - 2.f * r, draw_pos.y + r)); ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); if ( Streaming::manager().busy()) - ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.05, 0.8, 1.0, 0.8f)); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(IMGUI_COLOR_STREAM, 0.8f)); else - ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.05, 0.8, 1.0, 0.2f)); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(IMGUI_COLOR_STREAM, 0.2f)); ImGui::Text(ICON_FA_SHARE_ALT_SQUARE); ImGui::PopStyleColor(1); ImGui::PopFont(); @@ -2118,10 +2118,10 @@ void Navigator::RenderNewPannel() static const char* origin_names[4] = { ICON_FA_PHOTO_VIDEO " File", ICON_FA_SYNC " Internal", ICON_FA_COG " Generated", - ICON_FA_PLUG " External" + ICON_FA_PLUG " Connected" }; // TODO IMPLEMENT EXTERNAL SOURCES static const char* origin_names[3] = { ICON_FA_FILE " File", ICON_FA_SITEMAP " Internal", ICON_FA_PLUG " External" }; - if (ImGui::Combo("Origin", &Settings::application.source.new_type, origin_names, IM_ARRAYSIZE(origin_names)) ) + if (ImGui::Combo("##Origin", &Settings::application.source.new_type, origin_names, IM_ARRAYSIZE(origin_names)) ) new_source_preview_.setSource(); // File Source creation @@ -2140,7 +2140,7 @@ void Navigator::RenderNewPannel() // Indication ImGui::SameLine(); - ImGuiToolkit::HelpMarker("Create a source from a file:\n- Video (*.mpg, *mov, *.avi, etc.)\n- Image (*.jpg, *.png, etc.)\n- Vector graphics (*.svg)\n- vimix session (*.mix)\n\nEquivalent to dropping the file in the workspace."); + ImGuiToolkit::HelpMarker("Create a source from a file:\n- video (*.mpg, *mov, *.avi, etc.)\n- image (*.jpg, *.png, etc.)\n- vector graphics (*.svg)\n- vimix session (*.mix)\n\n(Equivalent to dropping the file in the workspace)"); // if a file dialog future was registered if ( !fileImportFileDialogs.empty() ) { @@ -2254,7 +2254,7 @@ void Navigator::RenderNewPannel() ImGui::SetCursorPosY(2.f * width_); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); - if (ImGui::BeginCombo("##External", "Select source")) + if (ImGui::BeginCombo("##External", "Select device")) { for (int d = 0; d < Device::manager().numDevices(); ++d){ std::string namedev = Device::manager().name(d); @@ -2274,7 +2274,7 @@ void Navigator::RenderNewPannel() // Indication ImGui::SameLine(); - ImGuiToolkit::HelpMarker("Create a source with images from external devices or network."); + ImGuiToolkit::HelpMarker("Create a source getting images from connected devices or machines;\n- webcams or frame grabbers\n- screen capture\n- vimix stream from connected machines"); } diff --git a/defines.h b/defines.h index 91ee39a..3c82957 100644 --- a/defines.h +++ b/defines.h @@ -50,9 +50,11 @@ #define IMGUI_TITLE_SHADEREDITOR ICON_FA_CODE " Code" #define IMGUI_TITLE_PREVIEW ICON_FA_DESKTOP " Ouput" #define IMGUI_TITLE_DELETE ICON_FA_BROOM " Delete?" -#define IMGUI_LABEL_RECENT_FILES " Recent files" +#define IMGUI_LABEL_RECENT_FILES " Select recent" #define IMGUI_RIGHT_ALIGN -3.5f * ImGui::GetTextLineHeightWithSpacing() #define IMGUI_COLOR_OVERLAY IM_COL32(5, 5, 5, 150) +#define IMGUI_COLOR_RECORD 1.0, 0.05, 0.05 +#define IMGUI_COLOR_STREAM 0.05, 0.8, 1.0 #define IMGUI_NOTIFICATION_DURATION 1.5f #ifdef APPLE #define CTRL_MOD "Cmd+"