Use big icons in bad version dialogs.

This commit is contained in:
Bartosz Taudul 2021-11-13 22:20:00 +01:00
parent 46e0584cca
commit be264896f0
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
4 changed files with 14 additions and 5 deletions

View File

@ -787,7 +787,7 @@ static void DrawContents()
if( badVer.state != tracy::BadVersionState::Ok )
{
if( loadThread.joinable() ) { loadThread.join(); }
tracy::BadVersion( badVer );
tracy::BadVersion( badVer, bigFont );
}
#endif

View File

@ -11,7 +11,7 @@ namespace tracy
namespace detail
{
void BadVersionImpl( BadVersionState& badVer )
void BadVersionImpl( BadVersionState& badVer, ImFont* big )
{
assert( badVer.state != BadVersionState::Ok );
@ -35,7 +35,9 @@ void BadVersionImpl( BadVersionState& badVer )
}
if( ImGui::BeginPopupModal( "Bad file", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
{
if( big ) ImGui::PushFont( big );
TextCentered( ICON_FA_EXCLAMATION_TRIANGLE );
if( big ) ImGui::PopFont();
ImGui::Text( "The file you are trying to open is not a Tracy dump." );
ImGui::Separator();
if( ImGui::Button( "Oops" ) )
@ -47,7 +49,9 @@ void BadVersionImpl( BadVersionState& badVer )
}
if( ImGui::BeginPopupModal( "File read error", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
{
if( big ) ImGui::PushFont( big );
TextCentered( ICON_FA_EXCLAMATION_TRIANGLE );
if( big ) ImGui::PopFont();
ImGui::Text( "The file you are trying to open cannot be mapped to memory." );
ImGui::Separator();
if( ImGui::Button( "OK" ) )
@ -59,7 +63,9 @@ void BadVersionImpl( BadVersionState& badVer )
}
if( ImGui::BeginPopupModal( "Unsupported file version", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
{
if( big ) ImGui::PushFont( big );
TextCentered( ICON_FA_CLOUD_DOWNLOAD_ALT );
if( big ) ImGui::PopFont();
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( ICON_FA_DOWNLOAD " Download update" ) )
@ -78,7 +84,9 @@ void BadVersionImpl( BadVersionState& badVer )
}
if( ImGui::BeginPopupModal( "Legacy file version", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
{
if( big ) ImGui::PushFont( big );
TextCentered( ICON_FA_GHOST );
if( big ) ImGui::PopFont();
ImGui::Text( "You are trying to open a file which was created by legacy version %i.%i.%i.\nUse the update utility from an older version of the profiler to convert the file to a supported version.", badVer.version >> 16, ( badVer.version >> 8 ) & 0xFF, badVer.version & 0xFF );
ImGui::Separator();
if( ImGui::Button( "Maybe I don't need it" ) )

View File

@ -1,6 +1,7 @@
#ifndef __TRACYBADVERSION_HPP__
#define __TRACYBADVERSION_HPP__
#include <imgui.h>
#include "../common/TracyForceInline.hpp"
namespace tracy
@ -23,10 +24,10 @@ struct BadVersionState
namespace detail
{
void BadVersionImpl( BadVersionState& badVer );
void BadVersionImpl( BadVersionState& badVer, ImFont* big );
}
tracy_force_inline void BadVersion( BadVersionState& badVer ) { if( badVer.state != BadVersionState::Ok ) detail::BadVersionImpl( badVer ); }
tracy_force_inline void BadVersion( BadVersionState& badVer, ImFont* big ) { if( badVer.state != BadVersionState::Ok ) detail::BadVersionImpl( badVer, big ); }
}

View File

@ -11744,7 +11744,7 @@ void View::DrawCompare()
}
}
}
tracy::BadVersion( m_compare.badVer );
tracy::BadVersion( m_compare.badVer, m_bigFont );
ImGui::End();
return;
}