| 159 | } |
| 160 | |
| 161 | void ToolsDialog::setInputOutputCombo_(const Param &p) |
| 162 | { |
| 163 | String str; |
| 164 | QStringList input_list("<select>"); |
| 165 | QStringList output_list("<select>"); |
| 166 | bool outRequired = false; |
| 167 | for (Param::ParamIterator iter = p.begin(); iter != p.end(); ++iter) |
| 168 | { |
| 169 | // iter.getName() is either of form "ToolName:1:ItemName" or "ToolName:1:NodeName:[...]:ItemName". |
| 170 | // Cut off "ToolName:1:" |
| 171 | str = iter.getName().substr(iter.getName().rfind("1:") + 2, iter.getName().size()); |
| 172 | // Only add items and no nodes |
| 173 | if (!str.empty() && str.find(":") == String::npos) |
| 174 | { |
| 175 | // Only add to input list if item has "input file" tag. |
| 176 | if (iter->tags.find("input file") != iter->tags.end()) |
| 177 | { |
| 178 | input_list << QStringList(str.c_str()); |
| 179 | } |
| 180 | // Only add to output list if item has "output file" tag. |
| 181 | else if (iter->tags.find("output file") != iter->tags.end()) |
| 182 | { |
| 183 | output_list << QStringList(str.c_str()); |
| 184 | // Check whether the item has a required tag i.e. is mandatory. |
| 185 | outRequired = (outRequired) || (iter->tags.find("required") != iter->tags.end()); |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | // Clear and set input combo box |
| 190 | input_combo_->clear(); |
| 191 | output_combo_->clear(); |
| 192 | input_combo_->addItems(input_list); |
| 193 | Int pos = input_list.indexOf("in"); |
| 194 | if (pos != -1) |
| 195 | { |
| 196 | input_combo_->setCurrentIndex(pos); |
| 197 | } |
| 198 | // Clear and set output combo box |
| 199 | output_combo_->addItems(output_list); |
| 200 | pos = output_list.indexOf("out"); |
| 201 | if (pos != -1 && getTool() != "FileInfo" && outRequired) |
| 202 | { |
| 203 | output_combo_->setCurrentIndex(pos); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | QStringList ToolsDialog::createToolsList_() |
| 208 | { |
nothing calls this directly
no test coverage detected