Skip to content

Commit

Permalink
PR #9688 from SergeySPF: Fixed Unreadable stream info while multi stream
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel authored Sep 9, 2021
2 parents 889ccc9 + ce8c405 commit 8273a0f
Showing 1 changed file with 62 additions and 36 deletions.
98 changes: 62 additions & 36 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2967,6 +2967,10 @@ namespace rs2
ImGui::PushStyleColor(ImGuiCol_ButtonActive, header_window_bg);

float line_y = curr_info_rect.y + 8;
float tail_w = curr_info_rect.w - 20;
float min_w = ImGui::CalcTextSize("0").x;
auto ctx = ImGui::GetCurrentContext();
float space_w = ctx->Style.ItemSpacing.x;

if (show_stream_details && !show_metadata)
{
Expand All @@ -2981,54 +2985,76 @@ namespace rs2

if (timestamp_domain == RS2_TIMESTAMP_DOMAIN_SYSTEM_TIME) label = to_string() << textual_icons::exclamation_triangle << label;

ImGui::Text("%s", label.c_str());
tail_w -= ImGui::CalcTextSize(label.c_str()).x;
if (tail_w > min_w)
{
ImGui::Text("%s", label.c_str());

if (timestamp_domain == RS2_TIMESTAMP_DOMAIN_SYSTEM_TIME) ImGui::PopStyleColor();
if (timestamp_domain == RS2_TIMESTAMP_DOMAIN_SYSTEM_TIME) ImGui::PopStyleColor();

if (ImGui::IsItemHovered())
{
if (timestamp_domain == RS2_TIMESTAMP_DOMAIN_SYSTEM_TIME)
{
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(450.0f);
ImGui::TextUnformatted("Timestamp Domain: System Time. Hardware Timestamps unavailable!\nPlease refer to frame_metadata.md for more information");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
else if (timestamp_domain == RS2_TIMESTAMP_DOMAIN_GLOBAL_TIME)
{
ImGui::SetTooltip("Timestamp: Global Time");
}
else
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("Timestamp: Hardware Clock");
if (timestamp_domain == RS2_TIMESTAMP_DOMAIN_SYSTEM_TIME)
{
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(450.0f);
ImGui::TextUnformatted("Timestamp Domain: System Time. Hardware Timestamps unavailable!\nPlease refer to frame_metadata.md for more information");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
else if (timestamp_domain == RS2_TIMESTAMP_DOMAIN_GLOBAL_TIME)
{
ImGui::SetTooltip("Timestamp: Global Time");
}
else
{
ImGui::SetTooltip("Timestamp: Hardware Clock");
}
}
}

ImGui::SameLine();
ImGui::SameLine();
tail_w -= space_w;
}

label = to_string() << " Frame: " << std::left << frame_number;
ImGui::Text("%s", label.c_str());
if (tail_w > min_w)
{
label = to_string() << " Frame: " << std::left << frame_number;
tail_w -= ImGui::CalcTextSize(label.c_str()).x;
if (tail_w > min_w)
ImGui::Text("%s", label.c_str());

ImGui::SameLine();
ImGui::SameLine();
tail_w -= space_w;
}

std::string res;
if (profile.as<rs2::video_stream_profile>())
res = to_string() << size.x << "x" << size.y << ", ";
label = to_string() << res << truncate_string(rs2_format_to_string(profile.format()), 9) << ", ";
ImGui::Text("%s", label.c_str());
if (ImGui::IsItemHovered())
if (tail_w > min_w)
{
ImGui::SetTooltip("%s", "Stream Resolution, Format");
}
std::string res;
if (profile.as<rs2::video_stream_profile>())
res = to_string() << size.x << "x" << size.y << ", ";
label = to_string() << res << truncate_string(rs2_format_to_string(profile.format()), 9) << ", ";
tail_w -= ImGui::CalcTextSize(label.c_str()).x;
if (tail_w > min_w)
ImGui::Text("%s", label.c_str());
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", "Stream Resolution, Format");
}

ImGui::SameLine();
ImGui::SameLine();
tail_w -= space_w;
}

label = to_string() << "FPS: " << std::setprecision(2) << std::setw(7) << std::fixed << fps.get_fps();
ImGui::Text("%s", label.c_str());
if (ImGui::IsItemHovered())
if (tail_w > min_w)
{
ImGui::SetTooltip("%s", "FPS is calculated based on timestamps and not viewer time");
label = to_string() << "FPS: " << std::setprecision(2) << std::setw(7) << std::fixed << fps.get_fps();
tail_w -= ImGui::CalcTextSize(label.c_str()).x;
if (tail_w > min_w)
ImGui::Text("%s", label.c_str());
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", "FPS is calculated based on timestamps and not viewer time");
}
}

line_y += ImGui::GetTextLineHeight() + 5;
Expand Down

0 comments on commit 8273a0f

Please sign in to comment.