ecode: Project Build minor fix.

This commit is contained in:
Martín Lucas Golini
2023-04-11 21:26:01 -03:00
parent 2c1811e519
commit 7756ea7d03
2 changed files with 14 additions and 12 deletions

View File

@@ -138,7 +138,12 @@ static ProjectOutputParserTypes outputParserType( const std::string& typeStr ) {
}
bool ProjectBuildManager::load() {
ScopedOp scopedOp( [this]() { mLoading = true; }, [this]() { mLoading = false; } );
ScopedOp scopedOp( [this]() { mLoading = true; },
[this]() {
mLoading = false;
if ( mSidePanel )
mSidePanel->runOnMainThread( [this]() { buildSidePanelTab(); } );
} );
mProjectFile = mProjectRoot + ".ecode/project_build.json";
if ( !FileSystem::fileExists( mProjectFile ) )
@@ -260,10 +265,6 @@ bool ProjectBuildManager::load() {
mBuilds.insert( { build.key(), std::move( b ) } );
}
if ( mSidePanel ) {
mSidePanel->runOnMainThread( [this]() { buildSidePanelTab(); } );
}
mLoaded = true;
return true;
}
@@ -331,17 +332,13 @@ void ProjectBuildManager::setConfig( const ProjectBuildConfiguration& config ) {
void ProjectBuildManager::buildCurrentConfig( StatusBuildOutputController* sboc ) {
if ( sboc && !isBuilding() && !getBuilds().empty() ) {
std::string os = String::toLower( Sys::getPlatform() );
const ProjectBuild* build = nullptr;
for ( const auto& buildIt : getBuilds() ) {
if ( buildIt.second.getName() == mConfig.buildName ) {
for ( const auto& buildIt : getBuilds() )
if ( buildIt.second.getName() == mConfig.buildName )
build = &buildIt.second;
}
}
if ( build ) {
if ( build )
sboc->run( build->getName(), mConfig.buildType, getOutputParser( build->getName() ) );
}
}
}
@@ -555,6 +552,8 @@ void ProjectBuildManager::updateSidePanelTab() {
buildList->removeEventsOfType( Event::OnItemSelected );
buildList->addEventListener( Event::OnItemSelected, [this, buildList]( const Event* ) {
mConfig.buildName = buildList->getListBox()->getItemSelectedText();
mConfig.buildType = "";
updateSidePanelTab();
} );
buildTypeList->removeEventsOfType( Event::OnItemSelected );
@@ -562,6 +561,8 @@ void ProjectBuildManager::updateSidePanelTab() {
mConfig.buildType = buildTypeList->getListBox()->getItemSelectedText();
} );
buildButton->setEnabled( !mConfig.buildName.empty() );
buildButton->addMouseClickListener(
[this]( const Event* ) {
if ( isBuilding() ) {