| 877 | } |
| 878 | |
| 879 | void UIBuildSettings::runSetup() { |
| 880 | if ( mBuild.mRun.empty() ) { |
| 881 | mBuild.mRun.push_back( std::make_unique<ProjectBuildStep>() ); |
| 882 | mBuild.mRun.back()->name = i18n( "custom_executable", "Custom Executable" ); |
| 883 | } |
| 884 | |
| 885 | UIBuildStep::New( UIBuildStep::StepType::Run, this, 0, mBuild.mRun[runIndex()].get() ) |
| 886 | ->setParent( find( "run_cont" ) ); |
| 887 | |
| 888 | UIDropDownList* runList = find( "run_list" )->asType<UIDropDownList>(); |
| 889 | auto panelRunListDDL = getUISceneNode() |
| 890 | ->getRoot() |
| 891 | ->querySelector( "#build_tab_view #run_config_list" ) |
| 892 | ->asType<UIDropDownList>(); |
| 893 | |
| 894 | auto runName = mConfig.runName; |
| 895 | runUpdate( true, runList, panelRunListDDL ); |
| 896 | mConfig.runName = std::move( runName ); |
| 897 | |
| 898 | runList->getListBox()->setSelected( runIndex() ); |
| 899 | if ( panelRunListDDL ) |
| 900 | panelRunListDDL->getListBox()->setSelected( runIndex() ); |
| 901 | |
| 902 | runSelect( runIndex() ); |
| 903 | |
| 904 | runList->on( Event::OnItemSelected, [this, runList, panelRunListDDL]( auto ) { |
| 905 | mConfig.runName = runList->getListBox()->getItemSelectedText().toUtf8(); |
| 906 | runSelect( runIndex() ); |
| 907 | if ( panelRunListDDL ) |
| 908 | panelRunListDDL->getListBox()->setSelected( mConfig.runName ); |
| 909 | } ); |
| 910 | |
| 911 | if ( panelRunListDDL ) { |
| 912 | mCbs[panelRunListDDL].push_back( panelRunListDDL->on( |
| 913 | Event::OnItemSelected, [this, runList, panelRunListDDL]( const Event* ) { |
| 914 | mConfig.runName = panelRunListDDL->getListBox()->getItemSelectedText().toUtf8(); |
| 915 | if ( runList ) |
| 916 | runList->getListBox()->setSelected( mConfig.runName ); |
| 917 | } ) ); |
| 918 | mCbs[panelRunListDDL].push_back( panelRunListDDL->on( |
| 919 | Event::OnClose, [this, panelRunListDDL]( auto ) { mCbs.erase( panelRunListDDL ); } ) ); |
| 920 | } |
| 921 | |
| 922 | find( "run_add" )->onClick( [this, runList, panelRunListDDL]( auto ) { |
| 923 | UIMessageBox* msgBox = UIMessageBox::New( |
| 924 | UIMessageBox::INPUT, i18n( "run_configuration_name", "Run configuration name:" ) ); |
| 925 | msgBox->setTitle( i18n( "run_settings", "Run Settings" ) ); |
| 926 | msgBox->setCloseShortcut( { KEY_ESCAPE, KEYMOD_NONE } ); |
| 927 | msgBox->showWhenReady(); |
| 928 | msgBox->on( Event::OnConfirm, [this, msgBox, runList, panelRunListDDL]( auto ) { |
| 929 | bool unique = true; |
| 930 | auto newName = msgBox->getTextInput()->getText().toUtf8(); |
| 931 | for ( const auto& run : mBuild.mRun ) { |
| 932 | if ( newName == run->name ) { |
| 933 | unique = false; |
| 934 | break; |
| 935 | } |
| 936 | } |
nothing calls this directly
no test coverage detected