1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Change file selector to work with callbacks.

This commit is contained in:
Bartosz Taudul
2022-10-06 17:35:07 +02:00
parent a4e39f3d5f
commit ec0757c03a
6 changed files with 82 additions and 94 deletions
+4 -6
View File
@@ -149,12 +149,10 @@ void View::DrawCompare()
ImGui::TextWrapped( "Please load a second trace to compare results." );
if( ImGui::Button( ICON_FA_FOLDER_OPEN " Open second trace" ) && !m_compare.loadThread.joinable() )
{
auto fn = Fileselector::OpenFile( "tracy", "Tracy Profiler trace file" );
if( !fn.empty() )
{
Fileselector::OpenFile( "tracy", "Tracy Profiler trace file", [this]( const char* fn ) {
try
{
auto f = std::shared_ptr<tracy::FileRead>( tracy::FileRead::Open( fn.c_str() ) );
auto f = std::shared_ptr<tracy::FileRead>( tracy::FileRead::Open( fn ) );
if( f )
{
m_compare.loadThread = std::thread( [this, f] {
@@ -168,7 +166,7 @@ void View::DrawCompare()
m_compare.badVer.state = BadVersionState::UnsupportedVersion;
m_compare.badVer.version = e.version;
}
} );
} );
}
}
catch( const tracy::NotTracyDump& )
@@ -179,7 +177,7 @@ void View::DrawCompare()
{
m_compare.badVer.state = BadVersionState::ReadError;
}
}
} );
}
tracy::BadVersion( m_compare.badVer, m_bigFont );
ImGui::End();