| 259 | } |
| 260 | |
| 261 | void 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 | |
| 293 | void ProjectBuildManager::editBuild( std::string buildName, UIWidget* buildTab ) { |
| 294 | if ( buildName.empty() ) |
nothing calls this directly
no test coverage detected