diff --git a/src/gui/xic_view/xic_widgets/zivywidget.cpp b/src/gui/xic_view/xic_widgets/zivywidget.cpp index 9755c10baae126491383c63061d593ad61c2af1a..e49e207e9af296e84ee8535e5904040d3174b21e 100644 --- a/src/gui/xic_view/xic_widgets/zivywidget.cpp +++ b/src/gui/xic_view/xic_widgets/zivywidget.cpp @@ -29,6 +29,7 @@ #include "zivywidget.h" #include "ui_zivy_widget.h" #include <QDebug> +#include <QSettings> void ZivyParams::setDetectionParameters(pappso::XicDetectionZivy * detect_zivy) const { detect_zivy->setSmoothingHalfEdgeWindows(_smoothing_half_window); @@ -38,6 +39,23 @@ void ZivyParams::setDetectionParameters(pappso::XicDetectionZivy * detect_zivy) detect_zivy->setDetectionThresholdOnMaxmin(_maxmin_threshold); } +void ZivyParams::saveSettings() const { + QSettings settings; + settings.setValue("xic/zivy_maxmin_threshold", QString("%1").arg(_maxmin_threshold)); + settings.setValue("xic/zivy_minmax_threshold", QString("%1").arg(_minmax_threshold)); + settings.setValue("xic/zivy_maxmin_half_window", QString("%1").arg(_maxmin_half_window)); + settings.setValue("xic/zivy_minmax_half_window", QString("%1").arg(_minmax_half_window)); + settings.setValue("xic/zivy_smoothing", QString("%1").arg(_smoothing_half_window)); +} +void ZivyParams::loadSettings() { + QSettings settings; + _maxmin_threshold = settings.value("xic/zivy_maxmin_threshold", QString("%1").arg(_maxmin_threshold)).toDouble(); + _minmax_threshold = settings.value("xic/zivy_minmax_threshold", QString("%1").arg(_minmax_threshold)).toDouble(); + _maxmin_half_window = settings.value("xic/zivy_maxmin_half_window", QString("%1").arg(_maxmin_half_window)).toInt(); + _minmax_half_window = settings.value("xic/zivy_minmax_half_window", QString("%1").arg(_minmax_half_window)).toInt(); + _smoothing_half_window = settings.value("xic/zivy_smoothing", QString("%1").arg(_smoothing_half_window)).toInt(); +} + ZivyWidget::ZivyWidget(QWidget *parent): QWidget(parent), ui(new Ui::ZivyWidget) diff --git a/src/gui/xic_view/xic_widgets/zivywidget.h b/src/gui/xic_view/xic_widgets/zivywidget.h index c6bc0ca934e09823ab53bc33d5a8ad00c727383b..a6f3bbf29013a993ae2b02cc0a2c6dd8e859fd61 100644 --- a/src/gui/xic_view/xic_widgets/zivywidget.h +++ b/src/gui/xic_view/xic_widgets/zivywidget.h @@ -39,6 +39,8 @@ class ZivyWidget; struct ZivyParams { void setDetectionParameters(pappso::XicDetectionZivy * detect_zivy) const; + void saveSettings() const; + void loadSettings(); unsigned int _maxmin_half_window = 3; unsigned int _minmax_half_window = 2; diff --git a/src/gui/xic_view/xicwindow.cpp b/src/gui/xic_view/xicwindow.cpp index e19f78de5aeeda06d4ca81bae22f1acec5d82d09..2fea617297b6908631e0531a2cdbf01b03da4546 100644 --- a/src/gui/xic_view/xicwindow.cpp +++ b/src/gui/xic_view/xicwindow.cpp @@ -47,11 +47,7 @@ XicWindow::XicWindow(ProjectWindow *parent): ZivyParams zivy_params; - zivy_params._maxmin_threshold = settings.value("xic/zivy_maxmin_threshold", "30000").toDouble(); - zivy_params._minmax_threshold = settings.value("xic/zivy_minmax_threshold", "50000").toDouble(); - zivy_params._maxmin_half_window = settings.value("xic/zivy_maxmin_half_window", "2").toInt(); - zivy_params._minmax_half_window = settings.value("xic/zivy_minmax_half_window", "4").toInt(); - zivy_params._smoothing_half_window = settings.value("xic/zivy_smoothing", "1").toInt(); + zivy_params.loadSettings(); zivy_params.setDetectionParameters(&_detect_zivy); @@ -143,6 +139,7 @@ bool XicWindow::isRetentionTimeSeconds() const { void XicWindow::doAcceptedZivyDialog() { _p_zivy_dialog->getZivyParams().setDetectionParameters(&_detect_zivy); + _p_zivy_dialog->getZivyParams().saveSettings(); emit reExtractXicNeeded(); } diff --git a/src/output/masschroqml.cpp b/src/output/masschroqml.cpp index 0280d57fb0287baa5d88be6e5877b25437d5fc55..f993f7359f4d45d8711d96caa52f07ebcea3b1e6 100644 --- a/src/output/masschroqml.cpp +++ b/src/output/masschroqml.cpp @@ -35,7 +35,6 @@ #include <QStringList> #include <QSettings> - struct McqObserved { bool operator ==(const McqObserved &other) const { return (msrun==other.msrun && scan==other.scan && charge==other.charge); @@ -80,12 +79,7 @@ MassChroQml::MassChroQml(const QString & out_filename) _output_stream->setAutoFormatting(true); _output_stream->writeStartDocument("1.0"); - QSettings settings; - _detect_zivy.setSmoothingHalfEdgeWindows(settings.value("xic/zivy_smoothing", "1").toInt()); - _detect_zivy.setMinMaxHalfEdgeWindows(settings.value("xic/zivy_minmax_half_window", "3").toInt()); - _detect_zivy.setMaxMinHalfEdgeWindows(settings.value("xic/zivy_maxmin_half_window", "2").toInt()); - _detect_zivy.setDetectionThresholdOnMinmax(settings.value("xic/zivy_minmax_threshold", "5000").toDouble()); - _detect_zivy.setDetectionThresholdOnMaxmin(settings.value("xic/zivy_maxmin_threshold", "3000").toDouble()); + _detect_zivy.loadSettings(); } @@ -219,11 +213,11 @@ void MassChroQml::writeQuantify() { _output_stream->writeAttribute("mode","post_matching"); _output_stream->writeAttribute("ni_min_abundance","0.8"); if (_sp_project.get()->getLabelingMethodSp().get() != nullptr) { - QStringList isotope_label_ref; - for (const Label * p_label :_sp_project.get()->getLabelingMethodSp().get()->getLabelList()) { - isotope_label_ref << p_label->getXmlId(); - } - _output_stream->writeAttribute("isotope_label_refs",isotope_label_ref.join(" ")); + QStringList isotope_label_ref; + for (const Label * p_label :_sp_project.get()->getLabelingMethodSp().get()->getLabelList()) { + isotope_label_ref << p_label->getXmlId(); + } + _output_stream->writeAttribute("isotope_label_refs",isotope_label_ref.join(" ")); } _output_stream->writeEndElement(); @@ -271,23 +265,23 @@ void MassChroQml::writeQuantificationMethods() { _output_stream->writeStartElement("detection_zivy"); //<mean_filter_half_edge>1</mean_filter_half_edge> _output_stream->writeStartElement("mean_filter_half_edge"); - _output_stream->writeCharacters(QString("%1").arg(_detect_zivy.getSmoothingHalfEdgeWindows())); + _output_stream->writeCharacters(QString("%1").arg(_detect_zivy._smoothing_half_window)); _output_stream->writeEndElement(); //<minmax_half_edge>3</minmax_half_edge> _output_stream->writeStartElement("minmax_half_edge"); - _output_stream->writeCharacters(QString("%1").arg(_detect_zivy.getMinMaxHalfEdgeWindows())); + _output_stream->writeCharacters(QString("%1").arg(_detect_zivy._minmax_half_window)); _output_stream->writeEndElement(); //<maxmin_half_edge>2</maxmin_half_edge> _output_stream->writeStartElement("maxmin_half_edge"); - _output_stream->writeCharacters(QString("%1").arg(_detect_zivy.getMaxMinHalfEdgeWindows())); + _output_stream->writeCharacters(QString("%1").arg(_detect_zivy._maxmin_half_window)); _output_stream->writeEndElement(); //<detection_threshold_on_max>5000</detection_threshold_on_max> _output_stream->writeStartElement("detection_threshold_on_max"); - _output_stream->writeCharacters(QString("%1").arg(_detect_zivy.getDetectionThresholdOnMinmax())); + _output_stream->writeCharacters(QString("%1").arg(_detect_zivy._minmax_threshold)); _output_stream->writeEndElement(); //<detection_threshold_on_min>3000</detection_threshold_on_min> _output_stream->writeStartElement("detection_threshold_on_min"); - _output_stream->writeCharacters(QString("%1").arg(_detect_zivy.getDetectionThresholdOnMaxmin())); + _output_stream->writeCharacters(QString("%1").arg(_detect_zivy._maxmin_threshold)); _output_stream->writeEndElement(); //</detection_zivy> _output_stream->writeEndElement(); diff --git a/src/output/masschroqml.h b/src/output/masschroqml.h index 04031f2e9d1e128e6cbcd4c8bbae52cd2026334e..d46ce93ff91add2ee3b4e251f30f6087dca594b6 100644 --- a/src/output/masschroqml.h +++ b/src/output/masschroqml.h @@ -36,6 +36,7 @@ #include <pappsomspp/xic/detection/xicdetectionzivy.h> #include "../core/project.h" #include "../grouping/groupinggroup.h" +#include "../gui/xic_view/xic_widgets/zivywidget.h" class MassChroQml { @@ -62,7 +63,7 @@ private : QXmlStreamWriter * _output_stream; ProjectSp _sp_project; IdentificationGroup * _p_identification_group; - pappso::XicDetectionZivy _detect_zivy; + ZivyParams _detect_zivy; }; #endif // MASSCHROQML_H