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

Method saveSettings

src/frontend/datasources/ImportFileWidget.cpp:675–721  ·  view source on GitHub ↗

! saves the settings to the data source \c source. */

Source from the content-addressed store, hash-verified

673 saves the settings to the data source \c source.
674*/
675void ImportFileWidget::saveSettings(LiveDataSource* source) const {
676 // file type
677 const auto fileType = currentFileType();
678 source->setFileType(fileType);
679 source->setFilter(m_currentFilter.release()); // pass ownership of the filter to the LiveDataSource
680
681 // source type
682 const auto sourceType = currentSourceType();
683 source->setSourceType(sourceType);
684 switch (sourceType) {
685 case LiveDataSource::SourceType::FileOrPipe:
686 source->setFileName(fileName());
687 source->setFileLinked(ui.chbLinkFile->isChecked());
688 source->setComment(fileName());
689 if (m_liveDataSource)
690 source->setUseRelativePath(ui.chbRelativePath->isChecked());
691 break;
692 case LiveDataSource::SourceType::LocalSocket:
693 source->setFileName(fileName());
694 source->setLocalSocketName(fileName());
695 source->setComment(fileName());
696 break;
697 case LiveDataSource::SourceType::NetworkTCPSocket:
698 case LiveDataSource::SourceType::NetworkUDPSocket:
699 source->setHost(host());
700 source->setPort((quint16)port().toInt());
701 break;
702 case LiveDataSource::SourceType::SerialPort:
703 source->setBaudRate(ui.cbBaudRate->currentText().toInt());
704 source->setSerialPort(ui.cbSerialPort->currentText());
705 break;
706 case LiveDataSource::SourceType::MQTT:
707 break;
708 }
709
710 // reading options
711 const auto readingType = static_cast<LiveDataSource::ReadingType>(ui.cbReadingType->currentData().toInt());
712 const auto updateType = static_cast<LiveDataSource::UpdateType>(ui.cbUpdateType->currentIndex());
713 source->setReadingType(readingType);
714 source->setKeepNValues(ui.sbKeepNValues->value());
715 source->setUpdateType(updateType);
716 if (updateType == LiveDataSource::UpdateType::TimeInterval)
717 source->setUpdateInterval(ui.sbUpdateInterval->value());
718
719 if (readingType != LiveDataSource::ReadingType::TillEnd)
720 source->setSampleSize(ui.sbSampleSize->value());
721}
722
723/*!
724 returns the currently used file type.

Callers 1

~ImportFileWidgetMethod · 0.45

Calls 15

setFileTypeMethod · 0.80
setSourceTypeMethod · 0.80
setFileLinkedMethod · 0.80
setCommentMethod · 0.80
setUseRelativePathMethod · 0.80
setLocalSocketNameMethod · 0.80
setHostMethod · 0.80
setPortMethod · 0.80
setBaudRateMethod · 0.80
currentTextMethod · 0.80
setSerialPortMethod · 0.80
setFilterMethod · 0.45

Tested by

no test coverage detected