* Clears the gui parameters and sets the batch list information at line i as * the new parameters * * @param i The line number to retrieve parameter information from * * @throws Isis::IException::User - Invalid command line */
| 143 | * @throws Isis::IException::User - Invalid command line |
| 144 | */ |
| 145 | void UserInterface::SetBatchList(int i) { |
| 146 | //Clear all parameters currently in the gui |
| 147 | for (int k = 0; k < NumGroups(); k++) { |
| 148 | for (int j = 0; j < NumParams(k); j++) { |
| 149 | Clear( ParamName(k, j) ); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | //Load the new parameters into the gui |
| 154 | cout << p_progName << " "; |
| 155 | |
| 156 | for (unsigned int currArgument = 1; currArgument < p_cmdline.size(); currArgument ++) { |
| 157 | QString paramName; |
| 158 | vector<QString> paramValue; |
| 159 | |
| 160 | |
| 161 | try { |
| 162 | getNextParameter(currArgument, paramName, paramValue); |
| 163 | |
| 164 | if (paramName[0] == '-') |
| 165 | continue; |
| 166 | |
| 167 | for (unsigned int value = 0; value < paramValue.size(); value++) { |
| 168 | IString thisValue = paramValue[value]; |
| 169 | QString token = thisValue.Token("$").ToQt(); |
| 170 | |
| 171 | QString newValue; |
| 172 | |
| 173 | while (thisValue != "") { |
| 174 | newValue += token; |
| 175 | try { |
| 176 | int j = toInt( thisValue.substr(0, 1).c_str() ) - 1; |
| 177 | newValue += p_batchList[i][j]; |
| 178 | thisValue.replace(0, 1, ""); |
| 179 | token = thisValue.Token("$").ToQt(); |
| 180 | } |
| 181 | catch (IException &e) { |
| 182 | // Let the variable be parsed by the application |
| 183 | newValue += "$"; |
| 184 | token = thisValue.Token("$").ToQt(); |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | if (token != "") |
| 189 | newValue += token; |
| 190 | |
| 191 | paramValue[value] = newValue; |
| 192 | } |
| 193 | } |
| 194 | // can't test with unit test - command line is already parsed before SetBatchList() is called |
| 195 | catch (IException &e) { |
| 196 | throw IException(IException::User, "Invalid command line", _FILEINFO_); |
| 197 | } |
| 198 | |
| 199 | PutAsString(paramName, paramValue); |
| 200 | |
| 201 | cout << paramName; |
| 202 |