! Depending on the selected file type, activates the corresponding options in the data portion tab and populates the combobox with the available pre-defined filter settings for the selected type. */
| 1255 | and populates the combobox with the available pre-defined filter settings for the selected type. |
| 1256 | */ |
| 1257 | void ImportFileWidget::fileTypeChanged(int /*index*/) { |
| 1258 | auto fileType = currentFileType(); |
| 1259 | DEBUG(Q_FUNC_INFO << ", " << ENUM_TO_STRING(AbstractFileFilter, FileType, fileType)); |
| 1260 | Q_EMIT error(QString()); // clear the potential error message that was shown for the previous file type |
| 1261 | initOptionsWidget(); |
| 1262 | |
| 1263 | // enable the options widgets, should be avaible for all types where there is no "automatic" vs "custom", |
| 1264 | // will be disabled for "automatic" for the relevant data types |
| 1265 | ui.swOptions->setEnabled(true); |
| 1266 | |
| 1267 | // default |
| 1268 | hidePropertyWidgets(); |
| 1269 | ui.lFilter->hide(); |
| 1270 | ui.cbFilter->hide(); |
| 1271 | m_templateHandler->hide(); |
| 1272 | |
| 1273 | // different file types show different number of tabs in ui.tabWidget. |
| 1274 | // when switching from the previous file type we re-set the tab widget to its original state |
| 1275 | // and remove/add the required tabs further below |
| 1276 | for (int i = 0; i < ui.tabWidget->count(); ++i) |
| 1277 | ui.tabWidget->removeTab(0); |
| 1278 | |
| 1279 | ui.tabWidget->addTab(ui.tabDataFormat, i18n("Data Format")); |
| 1280 | ui.tabWidget->addTab(ui.tabDataPreview, i18n("Preview")); |
| 1281 | if (!m_liveDataSource) |
| 1282 | ui.tabWidget->addTab(ui.tabDataPortion, i18n("Data Portion to Read")); |
| 1283 | |
| 1284 | ui.lPreviewLines->show(); |
| 1285 | ui.sbPreviewLines->show(); |
| 1286 | ui.lStartColumn->show(); |
| 1287 | ui.sbStartColumn->show(); |
| 1288 | ui.lEndColumn->show(); |
| 1289 | ui.sbEndColumn->show(); |
| 1290 | |
| 1291 | showJsonModel(false); |
| 1292 | |
| 1293 | ui.lMcapTopics->hide(); |
| 1294 | ui.cbMcapTopics->hide(); |
| 1295 | |
| 1296 | switch (fileType) { |
| 1297 | case AbstractFileFilter::FileType::Ascii: |
| 1298 | ui.lFilter->show(); |
| 1299 | ui.cbFilter->show(); |
| 1300 | m_templateHandler->show(); |
| 1301 | m_templateHandler->setClassName(QLatin1String("AsciiFilter")); |
| 1302 | break; |
| 1303 | case AbstractFileFilter::FileType::Binary: |
| 1304 | ui.lFilter->show(); |
| 1305 | ui.cbFilter->show(); |
| 1306 | m_templateHandler->show(); |
| 1307 | m_templateHandler->setClassName(QLatin1String("BinaryFilter")); |
| 1308 | ui.lStartColumn->hide(); |
| 1309 | ui.sbStartColumn->hide(); |
| 1310 | ui.lEndColumn->hide(); |
| 1311 | ui.sbEndColumn->hide(); |
| 1312 | break; |
| 1313 | case AbstractFileFilter::FileType::ROOT: |
| 1314 | ui.tabWidget->removeTab(1); |
nothing calls this directly
no test coverage detected