mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Show trace description/filename on titlebar.
This commit is contained in:
parent
0cb6d8588b
commit
57bd63dab6
1
NEWS
1
NEWS
@ -40,6 +40,7 @@ v0.x.x (xxxx-xx-xx)
|
||||
a kind.
|
||||
- Fixed compatibility problems with FreeBSD.
|
||||
- Added support for dynamically loaded Vulkan symbols.
|
||||
- Trace description or filename is now displayed on the window title bar.
|
||||
|
||||
|
||||
v0.9.1 (2023-02-26)
|
||||
|
@ -671,7 +671,7 @@ bool View::DrawImpl()
|
||||
if( !m_titleSet && m_stcb )
|
||||
{
|
||||
m_titleSet = true;
|
||||
m_stcb( m_worker.GetCaptureName().c_str() );
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||
|
@ -363,6 +363,7 @@ private:
|
||||
bool Save( const char* fn, FileWrite::Compression comp, int zlevel, bool buildDict );
|
||||
|
||||
void Attention( bool& alreadyDone );
|
||||
void UpdateTitle();
|
||||
|
||||
unordered_flat_map<uint64_t, bool> m_visibleMsgThread;
|
||||
unordered_flat_map<uint64_t, bool> m_waitStackThread;
|
||||
|
@ -61,6 +61,7 @@ void View::DrawInfo()
|
||||
if( ImGui::InputTextWithHint( "##traceDesc", "Enter description of the trace", buf, 256 ) )
|
||||
{
|
||||
m_userData.SetDescription( buf );
|
||||
if( m_stcb ) UpdateTitle();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -870,4 +870,30 @@ void View::Attention( bool& alreadyDone )
|
||||
}
|
||||
}
|
||||
|
||||
void View::UpdateTitle()
|
||||
{
|
||||
auto captureName = m_worker.GetCaptureName().c_str();
|
||||
const auto& desc = m_userData.GetDescription();
|
||||
if( !desc.empty() )
|
||||
{
|
||||
char buf[1024];
|
||||
snprintf( buf, 1024, "%s (%s)", captureName, desc.c_str() );
|
||||
m_stcb( buf );
|
||||
}
|
||||
else if( !m_filename.empty() )
|
||||
{
|
||||
auto fptr = m_filename.c_str() + m_filename.size() - 1;
|
||||
while( fptr > m_filename.c_str() && *fptr != '/' && *fptr != '\\' ) fptr--;
|
||||
if( *fptr == '/' || *fptr == '\\' ) fptr++;
|
||||
|
||||
char buf[1024];
|
||||
snprintf( buf, 1024, "%s (%s)", captureName, fptr );
|
||||
m_stcb( buf );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stcb( captureName );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user