diff --git a/common/device-model.cpp b/common/device-model.cpp index 55f4178d92..3b9e3d35b5 100644 --- a/common/device-model.cpp +++ b/common/device-model.cpp @@ -1213,11 +1213,11 @@ namespace rs2 textual_icon button_icon = is_recording ? textual_icons::stop : textual_icons::circle; const float icons_width = 78.0f; const ImVec2 device_panel_icons_size{ icons_width, 25 }; - std::string recorod_button_name = rsutils::string::from() << button_icon << "##" << id; + std::string record_button_name = rsutils::string::from() << button_icon << "##" << id; auto record_button_color = is_recording ? light_blue : light_grey; ImGui::PushStyleColor(ImGuiCol_Text, record_button_color); ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, record_button_color); - if (ImGui::ButtonEx(recorod_button_name.c_str(), device_panel_icons_size, (!is_streaming || is_playback_device) ? ImGuiButtonFlags_Disabled : 0)) + if (ImGui::ButtonEx(record_button_name.c_str(), device_panel_icons_size, (disable_record_button_logic(is_streaming, is_playback_device)) ? ImGuiButtonFlags_Disabled : 0)) { if (is_recording) //is_recording is changed inside stop/start_recording { @@ -1249,7 +1249,7 @@ namespace rs2 } if (ImGui::IsItemHovered()) { - std::string record_button_hover_text = (!is_streaming ? "Start streaming to enable recording" : (is_recording ? "Stop Recording" : "Start Recording")); + std::string record_button_hover_text = get_record_button_hover_text(is_streaming); ImGui::SetTooltip("%s", record_button_hover_text.c_str()); if (is_streaming) window.link_hovered(); } @@ -3274,6 +3274,25 @@ namespace rs2 //TODO: Move under hour glass } + bool device_model::disable_record_button_logic(bool is_streaming, bool is_playback_device) + { + return (!is_streaming || is_playback_device); + } + + std::string device_model::get_record_button_hover_text(bool is_streaming) + { + std::string record_button_hover_text; + if (!is_streaming) + { + record_button_hover_text = "Start streaming to enable recording"; + } + else + { + record_button_hover_text = is_recording ? "Stop Recording" : "Start Recording"; + } + return record_button_hover_text; + } + std::vector> get_devices_names(const device_list& list) { std::vector> device_names; diff --git a/common/device-model.h b/common/device-model.h index 18e7d50976..bd7f0f69c6 100644 --- a/common/device-model.h +++ b/common/device-model.h @@ -367,6 +367,8 @@ namespace rs2 viewer_model& viewer, std::string& error_message); void begin_update_unsigned(viewer_model& viewer, std::string& error_message); void check_for_device_updates(viewer_model& viewer, bool activated_by_user = false); + bool disable_record_button_logic(bool is_streaming, bool is_playback_device); + std::string get_record_button_hover_text(bool is_streaming); std::shared_ptr< atomic_objects_in_frame > get_detected_objects() const { return _detected_objects; }