Add lost connection popup.

This commit is contained in:
Bartosz Taudul 2020-11-18 01:23:46 +01:00
parent d98fbd60e5
commit 53eacd3dc2
2 changed files with 23 additions and 0 deletions

View File

@ -131,6 +131,7 @@ View::View( void(*cbMainThread)(std::function<void()>), const char* addr, uint16
, m_frames( nullptr ) , m_frames( nullptr )
, m_messagesScrollBottom( true ) , m_messagesScrollBottom( true )
, m_reactToCrash( true ) , m_reactToCrash( true )
, m_reactToLostConnection( true )
, m_smallFont( smallFont ) , m_smallFont( smallFont )
, m_bigFont( bigFont ) , m_bigFont( bigFont )
, m_stcb( stcb ) , m_stcb( stcb )
@ -1121,6 +1122,27 @@ bool View::DrawImpl()
ImGui::EndPopup(); ImGui::EndPopup();
} }
if( m_reactToLostConnection && !m_worker.IsConnected() )
{
m_reactToLostConnection = false;
if( m_worker.GetSendInFlight() > 0 )
{
ImGui::OpenPopup( "Connection lost!" );
}
}
if( ImGui::BeginPopupModal( "Connection lost!", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
{
TextCentered( ICON_FA_PLUG );
ImGui::TextUnformatted(
"Connection to the profiled application was lost\n"
"before all required profiling data could be retrieved.\n"
"This will result in missing source locations,\n"
"unresolved stack frames, etc." );
ImGui::Separator();
if( ImGui::Button( "Dismiss" ) ) ImGui::CloseCurrentPopup();
ImGui::EndPopup();
}
return keepOpen; return keepOpen;
} }

View File

@ -365,6 +365,7 @@ private:
DecayValue<uint64_t> m_drawThreadHighlight = 0; DecayValue<uint64_t> m_drawThreadHighlight = 0;
Annotation* m_selectedAnnotation = nullptr; Annotation* m_selectedAnnotation = nullptr;
bool m_reactToCrash = false; bool m_reactToCrash = false;
bool m_reactToLostConnection = false;
ImGuiTextFilter m_statisticsFilter; ImGuiTextFilter m_statisticsFilter;
ImGuiTextFilter m_statisticsImageFilter; ImGuiTextFilter m_statisticsImageFilter;