MCPcopy Create free account
hub / github.com/SpartanJ/eepp / addBuild

Method addBuild

src/tools/ecode/projectbuild.cpp:261–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261void ProjectBuildManager::addBuild( UIWidget* buildTab ) {
262 mNewBuild = ProjectBuild( mApp->i18n( "new_name", "New Name" ), mProjectRoot );
263 std::string hashName = String::toString( String::hash( "new_name" ) );
264 UIWidget* widget = nullptr;
265 if ( ( widget = buildTab->getUISceneNode()->getRoot()->querySelector( "#build_settings_" +
266 hashName ) ) ) {
267 widget->asType<UITab>()->select();
268 return;
269 }
270 auto ret = mApp->getSplitter()->createWidget(
271 UIBuildSettings::New( mNewBuild, mConfig, true, nullptr ),
272 mApp->i18n( "build_settings", "Build Settings" ) );
273 auto bs = ret.second->asType<UIBuildSettings>();
274 bs->setTab( ret.first );
275 mCbs[bs].insert( bs->on( Event::OnConfirm, [this, bs]( const Event* event ) {
276 event->getNode()->removeEventListener( event->getCallbackId() );
277 mCbs[bs].erase( event->getCallbackId() );
278 addNewBuild();
279 saveAsync();
280 updateSidePanelTab();
281 } ) );
282 mCbs[bs].insert( bs->on( Event::OnClose, [this, bs]( auto ) { mCbs.erase( bs ); } ) );
283 bs->on( Event::OnClear, [this]( const Event* event ) {
284 if ( mBuilds.erase( event->asTextEvent()->getText() ) > 0 ) {
285 if ( mConfig.buildName == event->asTextEvent()->getText() )
286 mConfig.buildName = mBuilds.empty() ? "" : mBuilds.begin()->first;
287 updateSidePanelTab();
288 }
289 } );
290 ret.first->setIcon( mApp->findIcon( "hammer" ) );
291}
292
293void ProjectBuildManager::editBuild( std::string buildName, UIWidget* buildTab ) {
294 if ( buildName.empty() )

Callers

nothing calls this directly

Calls 15

ProjectBuildClass · 0.85
hashFunction · 0.85
querySelectorMethod · 0.80
setTabMethod · 0.80
getNodeMethod · 0.80
getCallbackIdMethod · 0.80
asTextEventMethod · 0.80
toStringFunction · 0.50
NewFunction · 0.50
i18nMethod · 0.45
getRootMethod · 0.45
getUISceneNodeMethod · 0.45

Tested by

no test coverage detected