From 53eacd3dc22aedca98626d1fbedcb826312ceb31 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 18 Nov 2020 01:23:46 +0100 Subject: [PATCH] Add lost connection popup. --- server/TracyView.cpp | 22 ++++++++++++++++++++++ server/TracyView.hpp | 1 + 2 files changed, 23 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 09c5d5b9..93da6257 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -131,6 +131,7 @@ View::View( void(*cbMainThread)(std::function), const char* addr, uint16 , m_frames( nullptr ) , m_messagesScrollBottom( true ) , m_reactToCrash( true ) + , m_reactToLostConnection( true ) , m_smallFont( smallFont ) , m_bigFont( bigFont ) , m_stcb( stcb ) @@ -1121,6 +1122,27 @@ bool View::DrawImpl() 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; } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index feda3cc5..84e3abd3 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -365,6 +365,7 @@ private: DecayValue m_drawThreadHighlight = 0; Annotation* m_selectedAnnotation = nullptr; bool m_reactToCrash = false; + bool m_reactToLostConnection = false; ImGuiTextFilter m_statisticsFilter; ImGuiTextFilter m_statisticsImageFilter;