Extract crash tooltip to a separate function.

This commit is contained in:
Bartosz Taudul 2019-06-26 21:01:54 +02:00
parent 281dcf7c1f
commit b8794f64be
2 changed files with 11 additions and 5 deletions

View File

@ -1926,11 +1926,7 @@ void View::DrawZones()
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( px - (ty - to) * 0.5 - 1, oldOffset ), wpos + ImVec2( px + (ty - to) * 0.5 + 1, oldOffset + ty ) ) )
{
ImGui::BeginTooltip();
TextFocused( "Time:", TimeToString( crash.time - m_worker.GetTimeBegin() ) );
TextFocused( "Reason:", m_worker.GetString( crash.message ) );
ImGui::EndTooltip();
CrashTooltip();
if( ImGui::IsMouseClicked( 0 ) )
{
m_showInfo = true;
@ -10543,6 +10539,15 @@ void View::CallstackTooltip( uint32_t idx )
ImGui::EndTooltip();
}
void View::CrashTooltip()
{
auto& crash = m_worker.GetCrashEvent();
ImGui::BeginTooltip();
TextFocused( "Time:", TimeToString( crash.time - m_worker.GetTimeBegin() ) );
TextFocused( "Reason:", m_worker.GetString( crash.message ) );
ImGui::EndTooltip();
}
const ZoneEvent* View::GetZoneParent( const ZoneEvent& zone ) const
{
for( const auto& thread : m_worker.GetThreadData() )

View File

@ -168,6 +168,7 @@ private:
void ZoneTooltip( const ZoneEvent& ev );
void ZoneTooltip( const GpuEvent& ev );
void CallstackTooltip( uint32_t idx );
void CrashTooltip();
const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const;
const GpuEvent* GetZoneParent( const GpuEvent& zone ) const;