Move config setup to a separate function.

This commit is contained in:
Bartosz Taudul 2024-06-30 20:11:25 +02:00
parent 4a933d0174
commit 938ab3b8ea
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 8 additions and 3 deletions

View File

@ -59,8 +59,7 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), const char*
, m_achievements( config.achievements ) , m_achievements( config.achievements )
{ {
InitTextEditor(); InitTextEditor();
SetupConfig( config );
m_vd.frameTarget = config.targetFps;
} }
View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, SetScaleCallback sscb, AttentionCallback acb, const Config& config, AchievementsMgr* amgr ) View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, SetScaleCallback sscb, AttentionCallback acb, const Config& config, AchievementsMgr* amgr )
@ -97,7 +96,7 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f
if( m_worker.GetCallstackFrameCount() == 0 ) m_showUnknownFrames = false; if( m_worker.GetCallstackFrameCount() == 0 ) m_showUnknownFrames = false;
if( m_worker.GetCallstackSampleCount() == 0 ) m_showAllSymbols = true; if( m_worker.GetCallstackSampleCount() == 0 ) m_showAllSymbols = true;
m_vd.frameTarget = config.targetFps; SetupConfig( config );
Achieve( "loadTrace" ); Achieve( "loadTrace" );
} }
@ -123,6 +122,11 @@ void View::InitTextEditor()
m_sourceViewFile = nullptr; m_sourceViewFile = nullptr;
} }
void View::SetupConfig( const Config& config )
{
m_vd.frameTarget = config.targetFps;
}
void View::Achieve( const char* id ) void View::Achieve( const char* id )
{ {
if( !m_achievements || !m_achievementsMgr ) return; if( !m_achievements || !m_achievementsMgr ) return;

View File

@ -224,6 +224,7 @@ private:
}; };
void InitTextEditor(); void InitTextEditor();
void SetupConfig( const Config& config );
void Achieve( const char* id ); void Achieve( const char* id );
bool DrawImpl(); bool DrawImpl();