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

Rework processing bad files.

This commit is contained in:
Bartosz Taudul
2019-08-12 12:04:27 +02:00
parent 9b6328f962
commit a9b41eb657
5 changed files with 38 additions and 19 deletions
+14 -10
View File
@@ -10,29 +10,33 @@ namespace tracy
namespace detail
{
void BadVersionImpl( int& badVer )
void BadVersionImpl( BadVersionState& badVer )
{
assert( badVer != 0 );
assert( badVer.state != BadVersionState::Ok );
if( badVer > 0 )
{
ImGui::OpenPopup( "Unsupported file version" );
}
else
switch( badVer.state )
{
case BadVersionState::BadFile:
ImGui::OpenPopup( "Bad file" );
break;
case BadVersionState::UnsupportedVersion:
ImGui::OpenPopup( "Unsupported file version" );
break;
default:
assert( false );
break;
}
if( ImGui::BeginPopupModal( "Unsupported file version", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
{
#ifdef TRACY_EXTENDED_FONT
TextCentered( ICON_FA_CLOUD_DOWNLOAD_ALT );
#endif
ImGui::Text( "The file you are trying to open is unsupported.\nYou should update to tracy %i.%i.%i or newer and try again.", badVer >> 16, ( badVer >> 8 ) & 0xFF, badVer & 0xFF );
ImGui::Text( "The file you are trying to open is unsupported.\nYou should update to tracy %i.%i.%i or newer and try again.", badVer.version >> 16, ( badVer.version >> 8 ) & 0xFF, badVer.version & 0xFF );
ImGui::Separator();
if( ImGui::Button( "I understand" ) )
{
ImGui::CloseCurrentPopup();
badVer = 0;
badVer.state = BadVersionState::Ok;
}
ImGui::EndPopup();
}
@@ -46,7 +50,7 @@ void BadVersionImpl( int& badVer )
if( ImGui::Button( "Oops" ) )
{
ImGui::CloseCurrentPopup();
badVer = 0;
badVer.state = BadVersionState::Ok;
}
ImGui::EndPopup();
}