Require attention on failure popups.

This commit is contained in:
Bartosz Taudul 2022-10-13 20:39:43 +02:00
parent 94fd3b664e
commit 8dec765f5f
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 17 additions and 0 deletions

View File

@ -227,18 +227,22 @@ static const char* CompressionDesc[] = {
static_assert( sizeof( CompressionName ) == sizeof( CompressionDesc ), "Unmatched compression names and descriptions" ); static_assert( sizeof( CompressionName ) == sizeof( CompressionDesc ), "Unmatched compression names and descriptions" );
bool View::Draw() bool View::Draw()
{ {
HandshakeStatus status = (HandshakeStatus)m_worker.GetHandshakeStatus(); HandshakeStatus status = (HandshakeStatus)m_worker.GetHandshakeStatus();
switch( status ) switch( status )
{ {
case HandshakeProtocolMismatch: case HandshakeProtocolMismatch:
Attention( m_attnProtoMismatch );
ImGui::OpenPopup( "Protocol mismatch" ); ImGui::OpenPopup( "Protocol mismatch" );
break; break;
case HandshakeNotAvailable: case HandshakeNotAvailable:
Attention( m_attnNotAvailable );
ImGui::OpenPopup( "Client not ready" ); ImGui::OpenPopup( "Client not ready" );
break; break;
case HandshakeDropped: case HandshakeDropped:
Attention( m_attnDropped );
ImGui::OpenPopup( "Client disconnected" ); ImGui::OpenPopup( "Client disconnected" );
break; break;
default: default:
@ -248,6 +252,7 @@ bool View::Draw()
const auto& failure = m_worker.GetFailureType(); const auto& failure = m_worker.GetFailureType();
if( failure != Worker::Failure::None ) if( failure != Worker::Failure::None )
{ {
Attention( m_attnFailure );
ImGui::OpenPopup( "Instrumentation failure" ); ImGui::OpenPopup( "Instrumentation failure" );
} }
@ -262,6 +267,7 @@ bool View::Draw()
{ {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
ImGui::EndPopup(); ImGui::EndPopup();
m_attnProtoMismatch = false;
return false; return false;
} }
ImGui::SameLine(); ImGui::SameLine();
@ -270,6 +276,7 @@ bool View::Draw()
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
ImGui::EndPopup(); ImGui::EndPopup();
m_reconnectRequested = true; m_reconnectRequested = true;
m_attnProtoMismatch = false;
return false; return false;
} }
ImGui::EndPopup(); ImGui::EndPopup();
@ -286,6 +293,7 @@ bool View::Draw()
{ {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
ImGui::EndPopup(); ImGui::EndPopup();
m_attnNotAvailable = false;
return false; return false;
} }
ImGui::SameLine(); ImGui::SameLine();
@ -294,6 +302,7 @@ bool View::Draw()
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
ImGui::EndPopup(); ImGui::EndPopup();
m_reconnectRequested = true; m_reconnectRequested = true;
m_attnNotAvailable = false;
return false; return false;
} }
ImGui::EndPopup(); ImGui::EndPopup();
@ -310,6 +319,7 @@ bool View::Draw()
{ {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
ImGui::EndPopup(); ImGui::EndPopup();
m_attnDropped = false;
return false; return false;
} }
ImGui::SameLine(); ImGui::SameLine();
@ -318,6 +328,7 @@ bool View::Draw()
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
ImGui::EndPopup(); ImGui::EndPopup();
m_reconnectRequested = true; m_reconnectRequested = true;
m_attnDropped = false;
return false; return false;
} }
ImGui::EndPopup(); ImGui::EndPopup();
@ -490,6 +501,7 @@ bool View::Draw()
{ {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
m_worker.ClearFailure(); m_worker.ClearFailure();
m_attnFailure = false;
} }
ImGui::EndPopup(); ImGui::EndPopup();
} }

View File

@ -834,6 +834,11 @@ private:
} m_sendQueueWarning; } m_sendQueueWarning;
std::vector<std::pair<int, int>> m_cpuUsageBuf; std::vector<std::pair<int, int>> m_cpuUsageBuf;
bool m_attnProtoMismatch = false;
bool m_attnNotAvailable = false;
bool m_attnDropped = false;
bool m_attnFailure = false;
}; };
} }