Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Unreadable stream info while multi stream #9688

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 62 additions & 36 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2963,6 +2963,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 @@ -2977,54 +2981,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