mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Extract file selector functionality.
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
#include <numeric>
|
||||
|
||||
#ifndef TRACY_NO_FILESELECTOR
|
||||
# include "../nfd/nfd.h"
|
||||
#endif
|
||||
|
||||
#include "TracyImGui.hpp"
|
||||
#include "TracyFileRead.hpp"
|
||||
#include "TracyFileselector.hpp"
|
||||
#include "TracyPrint.hpp"
|
||||
#include "TracyView.hpp"
|
||||
|
||||
@@ -152,14 +149,12 @@ 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() )
|
||||
{
|
||||
nfdu8filteritem_t filter = { "Tracy Profiler trace file", "tracy" };
|
||||
nfdu8char_t* fn;
|
||||
auto res = NFD_OpenDialogU8( &fn, &filter, 1, nullptr );
|
||||
if( res == NFD_OKAY )
|
||||
auto fn = Fileselector::OpenFile( "tracy", "Tracy Profiler trace file" );
|
||||
if( !fn.empty() )
|
||||
{
|
||||
try
|
||||
{
|
||||
auto f = std::shared_ptr<tracy::FileRead>( tracy::FileRead::Open( fn ) );
|
||||
auto f = std::shared_ptr<tracy::FileRead>( tracy::FileRead::Open( fn.c_str() ) );
|
||||
if( f )
|
||||
{
|
||||
m_compare.loadThread = std::thread( [this, f] {
|
||||
@@ -184,7 +179,6 @@ void View::DrawCompare()
|
||||
{
|
||||
m_compare.badVer.state = BadVersionState::ReadError;
|
||||
}
|
||||
NFD_FreePathU8( fn );
|
||||
}
|
||||
}
|
||||
tracy::BadVersion( m_compare.badVer, m_bigFont );
|
||||
|
||||
Reference in New Issue
Block a user