Display trace parameters only when the connection is active.

This commit is contained in:
Bartosz Taudul 2019-11-26 00:57:06 +01:00
parent 7963617f86
commit cc87cebee3

View File

@ -1070,46 +1070,49 @@ bool View::DrawConnection()
ImGui::EndPopup(); ImGui::EndPopup();
} }
const auto& params = m_worker.GetParameters(); if( m_worker.IsConnected() )
if( !params.empty() )
{ {
ImGui::Separator(); const auto& params = m_worker.GetParameters();
if( ImGui::TreeNode( "Trace parameters" ) ) if( !params.empty() )
{ {
ImGui::Columns( 2 );
ImGui::TextUnformatted( "Name" );
ImGui::NextColumn();
ImGui::TextUnformatted( "Value" );
ImGui::NextColumn();
ImGui::Separator(); ImGui::Separator();
size_t idx = 0; if( ImGui::TreeNode( "Trace parameters" ) )
for( auto& p : params )
{ {
ImGui::TextUnformatted( m_worker.GetString( p.name ) ); ImGui::Columns( 2 );
ImGui::TextUnformatted( "Name" );
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::PushID( idx ); ImGui::TextUnformatted( "Value" );
if( p.isBool )
{
bool val = p.val;
if( ImGui::Checkbox( "", &val ) )
{
m_worker.SetParameter( idx, int32_t( val ) );
}
}
else
{
auto val = int( p.val );
if( ImGui::InputInt( "", &val, 1, 100, ImGuiInputTextFlags_EnterReturnsTrue ) )
{
m_worker.SetParameter( idx, int32_t( val ) );
}
}
ImGui::PopID();
ImGui::NextColumn(); ImGui::NextColumn();
idx++; ImGui::Separator();
size_t idx = 0;
for( auto& p : params )
{
ImGui::TextUnformatted( m_worker.GetString( p.name ) );
ImGui::NextColumn();
ImGui::PushID( idx );
if( p.isBool )
{
bool val = p.val;
if( ImGui::Checkbox( "", &val ) )
{
m_worker.SetParameter( idx, int32_t( val ) );
}
}
else
{
auto val = int( p.val );
if( ImGui::InputInt( "", &val, 1, 100, ImGuiInputTextFlags_EnterReturnsTrue ) )
{
m_worker.SetParameter( idx, int32_t( val ) );
}
}
ImGui::PopID();
ImGui::NextColumn();
idx++;
}
ImGui::EndColumns();
ImGui::TreePop();
} }
ImGui::EndColumns();
ImGui::TreePop();
} }
} }