MCPcopy Create free account
hub / github.com/KDE/labplot / readingTypeChanged

Method readingTypeChanged

src/frontend/dockwidgets/LiveDataDock.cpp:430–463  ·  view source on GitHub ↗

! * \brief Handles the change of the reading type in the dock widget * \param idx */

Source from the content-addressed store, hash-verified

428 * \param idx
429 */
430void LiveDataDock::readingTypeChanged(int idx) {
431 if (m_liveDataSource) {
432 const auto type = static_cast<LiveDataSource::ReadingType>(idx);
433 const auto sourceType = m_liveDataSource->sourceType();
434 const auto updateType = m_liveDataSource->updateType();
435
436 if (sourceType == LiveDataSource::SourceType::NetworkTCPSocket || sourceType == LiveDataSource::SourceType::LocalSocket
437 || sourceType == LiveDataSource::SourceType::SerialPort || type == LiveDataSource::ReadingType::TillEnd
438 || type == LiveDataSource::ReadingType::WholeFile || updateType == LiveDataSource::UpdateType::NewData) {
439 ui.lSampleSize->hide();
440 ui.sbSampleSize->hide();
441 } else {
442 ui.lSampleSize->show();
443 ui.sbSampleSize->show();
444 }
445
446 m_liveDataSource->setReadingType(type);
447 }
448#ifdef HAVE_MQTT
449 else if (m_mqttClient) {
450 auto type = static_cast<MQTTClient::ReadingType>(idx);
451
452 if (type == MQTTClient::ReadingType::TillEnd) {
453 ui.lSampleSize->hide();
454 ui.sbSampleSize->hide();
455 } else {
456 ui.lSampleSize->show();
457 ui.sbSampleSize->show();
458 }
459
460 m_mqttClient->setReadingType(type);
461 }
462#endif
463}
464
465/*!
466 * \brief Modifies the update interval of the live data source

Callers

nothing calls this directly

Calls 4

showMethod · 0.80
sourceTypeMethod · 0.45
updateTypeMethod · 0.45
setReadingTypeMethod · 0.45

Tested by

no test coverage detected