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

Prompt advanced mode on changing depth units #9794

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 18 additions & 7 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,18 @@ namespace rs2
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, c);
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, c);
float dummy = std::floor(value);
ImGui::DragFloat(id.c_str(), &dummy, 1, 0, 0, text.c_str());
if (ImGui::DragFloat(id.c_str(), &dummy, 1, 0, 0, text.c_str()))
{
// Changing the depth units not on advanced mode is npt allowed,
maloel marked this conversation as resolved.
Show resolved Hide resolved
// prompt the user to switch to advanced mode for chaging it.
if (RS2_OPTION_DEPTH_UNITS == opt)
{
auto advanced = dev->dev.as<advanced_mode>();
if (advanced)
if (!advanced.is_enabled())
dev->draw_advanced_mode_prompt = true;
}
}
ImGui::PopStyleColor(2);
}
}
Expand Down Expand Up @@ -6307,18 +6318,18 @@ namespace rs2

try
{
static bool keep_showing_popup = false;
if (ImGui::Combo(opt_model.id.c_str(), &selected, labels.data(),
static_cast<int>(labels.size())))
{
*opt_model.invalidate_flag = true;

auto advanced = dev.as<advanced_mode>();
if (advanced)
if (!advanced.is_enabled())
keep_showing_popup = true;
sub->draw_advanced_mode_prompt = false;


if (!keep_showing_popup)
if (!sub->draw_advanced_mode_prompt)
{
if (selected < static_cast<int>(labels.size() - files_labels.size()))
{
Expand All @@ -6345,9 +6356,9 @@ namespace rs2
}
}
}
if (keep_showing_popup)
if (sub->draw_advanced_mode_prompt)
{
keep_showing_popup = prompt_toggle_advanced_mode(true, popup_message, restarting_device_info, viewer, window, error_message);
sub->draw_advanced_mode_prompt = prompt_toggle_advanced_mode(true, popup_message, restarting_device_info, viewer, window, error_message);
}
}
catch (const error& e)
Expand Down
1 change: 1 addition & 0 deletions common/model-views.h
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ namespace rs2

bool draw_streams_selector = true;
bool draw_fps_selector = true;
bool draw_advanced_mode_prompt = false;

region_of_interest algo_roi;
bool show_algo_roi = false;
Expand Down