mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Move connection window into a popup when connected.
This commit is contained in:
parent
eed7039853
commit
b24ac75111
@ -422,11 +422,7 @@ bool View::DrawImpl()
|
|||||||
bool keepOpen = true;
|
bool keepOpen = true;
|
||||||
bool* keepOpenPtr = nullptr;
|
bool* keepOpenPtr = nullptr;
|
||||||
(void)keepOpenPtr;
|
(void)keepOpenPtr;
|
||||||
if( !m_staticView )
|
if( m_staticView )
|
||||||
{
|
|
||||||
if( !DrawConnection() ) return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
keepOpenPtr = &keepOpen;
|
keepOpenPtr = &keepOpen;
|
||||||
}
|
}
|
||||||
@ -463,6 +459,14 @@ bool View::DrawImpl()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::shared_lock<std::shared_mutex> lock( m_worker.GetDataLock() );
|
std::shared_lock<std::shared_mutex> lock( m_worker.GetDataLock() );
|
||||||
|
#if defined TRACY_EXTENDED_FONT
|
||||||
|
const char* buttonTitle = ICON_FA_WIFI;
|
||||||
|
#else
|
||||||
|
const char* buttonTitle = "Connection";
|
||||||
|
#endif
|
||||||
|
if ( ImGui::Button( buttonTitle ) )
|
||||||
|
ImGui::OpenPopup( "TracyConnectionPopup" );
|
||||||
|
ImGui::SameLine();
|
||||||
if( !m_worker.IsDataStatic() )
|
if( !m_worker.IsDataStatic() )
|
||||||
{
|
{
|
||||||
if( m_worker.IsConnected() )
|
if( m_worker.IsConnected() )
|
||||||
@ -678,6 +682,19 @@ bool View::DrawImpl()
|
|||||||
|
|
||||||
DrawFrames();
|
DrawFrames();
|
||||||
DrawZones();
|
DrawZones();
|
||||||
|
|
||||||
|
if( ImGui::BeginPopup( "TracyConnectionPopup" ) )
|
||||||
|
{
|
||||||
|
bool wasDisconnectIssued = m_disconnectIssued;
|
||||||
|
bool discardData = !DrawConnection();
|
||||||
|
bool disconnectIssuedJustNow = m_disconnectIssued != wasDisconnectIssued;
|
||||||
|
if( discardData )
|
||||||
|
keepOpen = false;
|
||||||
|
if( disconnectIssuedJustNow || discardData )
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
m_zoneHighlight = nullptr;
|
m_zoneHighlight = nullptr;
|
||||||
@ -737,7 +754,6 @@ bool View::DrawConnection()
|
|||||||
std::shared_lock<std::shared_mutex> lock( m_worker.GetMbpsDataLock() );
|
std::shared_lock<std::shared_mutex> lock( m_worker.GetMbpsDataLock() );
|
||||||
char tmp[2048];
|
char tmp[2048];
|
||||||
sprintf( tmp, "%s###Connection", m_worker.GetAddr().c_str() );
|
sprintf( tmp, "%s###Connection", m_worker.GetAddr().c_str() );
|
||||||
ImGui::Begin( tmp, nullptr, ImGuiWindowFlags_AlwaysAutoResize );
|
|
||||||
const auto& mbpsVector = m_worker.GetMbpsData();
|
const auto& mbpsVector = m_worker.GetMbpsData();
|
||||||
const auto mbps = mbpsVector.back();
|
const auto mbps = mbpsVector.back();
|
||||||
char buf[64];
|
char buf[64];
|
||||||
@ -855,7 +871,6 @@ bool View::DrawConnection()
|
|||||||
{
|
{
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
ImGui::End();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ImGui::SameLine( 0, ty * 2 );
|
ImGui::SameLine( 0, ty * 2 );
|
||||||
@ -866,7 +881,6 @@ bool View::DrawConnection()
|
|||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::End();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user