| 2323 | } |
| 2324 | |
| 2325 | void ImportFileWidget::sourceTypeChanged(int idx) { |
| 2326 | const auto sourceType = static_cast<LiveDataSource::SourceType>(idx); |
| 2327 | |
| 2328 | #ifdef HAVE_MQTT |
| 2329 | // when switching from mqtt to another source type, make sure we disconnect from |
| 2330 | // the current broker, if connected, in order not to get any notification anymore |
| 2331 | if (sourceType != LiveDataSource::SourceType::MQTT) |
| 2332 | disconnectMqttConnection(); |
| 2333 | #endif |
| 2334 | |
| 2335 | // enable/disable "on new data"-option |
| 2336 | const auto* model = qobject_cast<const QStandardItemModel*>(ui.cbUpdateType->model()); |
| 2337 | auto* item = model->item(static_cast<int>(LiveDataSource::UpdateType::NewData)); |
| 2338 | |
| 2339 | ui.gbOptions->setEnabled(true); |
| 2340 | |
| 2341 | switch (sourceType) { |
| 2342 | case LiveDataSource::SourceType::FileOrPipe: |
| 2343 | ui.lFileName->show(); |
| 2344 | m_cbFileName->show(); |
| 2345 | ui.bFileInfo->show(); |
| 2346 | ui.bOpen->show(); |
| 2347 | if (m_liveDataSource) { |
| 2348 | ui.lRelativePath->show(); |
| 2349 | ui.chbRelativePath->show(); |
| 2350 | } |
| 2351 | ui.chbLinkFile->show(); |
| 2352 | |
| 2353 | // option for sample size are available for "continuously fixed" and "from end" reading options |
| 2354 | if (ui.cbReadingType->currentIndex() < 2) { |
| 2355 | ui.lSampleSize->show(); |
| 2356 | ui.sbSampleSize->show(); |
| 2357 | } else { |
| 2358 | ui.lSampleSize->hide(); |
| 2359 | ui.sbSampleSize->hide(); |
| 2360 | } |
| 2361 | |
| 2362 | ui.cbBaudRate->hide(); |
| 2363 | ui.lBaudRate->hide(); |
| 2364 | ui.lHost->hide(); |
| 2365 | ui.leHost->hide(); |
| 2366 | ui.lPort->hide(); |
| 2367 | ui.lePort->hide(); |
| 2368 | ui.cbSerialPort->hide(); |
| 2369 | ui.lSerialPort->hide(); |
| 2370 | |
| 2371 | item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); |
| 2372 | |
| 2373 | fileNameChanged(fileName()); |
| 2374 | ui.cbFileType->show(); |
| 2375 | ui.lFileType->show(); |
| 2376 | setMQTTVisible(false); |
| 2377 | break; |
| 2378 | case LiveDataSource::SourceType::NetworkTCPSocket: |
| 2379 | case LiveDataSource::SourceType::NetworkUDPSocket: |
| 2380 | ui.lHost->show(); |
| 2381 | ui.leHost->show(); |
| 2382 | ui.lePort->show(); |
nothing calls this directly
no test coverage detected