File indexing completed on 2024-05-12 15:28:05

0001 /***************************************************************************
0002     File             : XYDataReductionCurveDock.h
0003     Project          : LabPlot
0004     --------------------------------------------------------------------
0005     Copyright        : (C) 2016 Stefan Gerlach (stefan.gerlach@uni.kn)
0006     Copyright        : (C) 2017 Alexander Semke (alexander.semke@web.de)
0007     Description      : widget for editing properties of data reduction curves
0008 
0009  ***************************************************************************/
0010 
0011 /***************************************************************************
0012  *                                                                         *
0013  *  This program is free software; you can redistribute it and/or modify   *
0014  *  it under the terms of the GNU General Public License as published by   *
0015  *  the Free Software Foundation; either version 2 of the License, or      *
0016  *  (at your option) any later version.                                    *
0017  *                                                                         *
0018  *  This program is distributed in the hope that it will be useful,        *
0019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0021  *  GNU General Public License for more details.                           *
0022  *                                                                         *
0023  *   You should have received a copy of the GNU General Public License     *
0024  *   along with this program; if not, write to the Free Software           *
0025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0026  *   Boston, MA  02110-1301  USA                                           *
0027  *                                                                         *
0028  ***************************************************************************/
0029 
0030 #ifndef XYDATAREDUCTIONCURVEDOCK_H
0031 #define XYDATAREDUCTIONCURVEDOCK_H
0032 
0033 #include "kdefrontend/dockwidgets/XYCurveDock.h"
0034 #include "backend/worksheet/plots/cartesian/XYDataReductionCurve.h"
0035 #include "ui_xydatareductioncurvedockgeneraltab.h"
0036 
0037 class XYAnalysisCurve;
0038 class TreeViewComboBox;
0039 class QStatusBar;
0040 
0041 class XYDataReductionCurveDock : public XYCurveDock {
0042     Q_OBJECT
0043 
0044 public:
0045     explicit XYDataReductionCurveDock(QWidget *parent, QStatusBar *sb);
0046     void setCurves(QList<XYCurve*>);
0047     void setupGeneral() override;
0048 
0049 private:
0050     void initGeneralTab() override;
0051     void showDataReductionResult();
0052     void updateTolerance();
0053     void updateTolerance2();
0054 
0055     Ui::XYDataReductionCurveDockGeneralTab uiGeneralTab;
0056     QStatusBar* statusBar;  // main status bar to display progress
0057     TreeViewComboBox* cbDataSourceCurve{nullptr};
0058     TreeViewComboBox* cbXDataColumn{nullptr};
0059     TreeViewComboBox* cbYDataColumn{nullptr};
0060 
0061     XYDataReductionCurve* m_dataReductionCurve{nullptr};
0062     XYDataReductionCurve::DataReductionData m_dataReductionData;
0063     bool m_dateTimeRange{false};
0064 
0065 protected:
0066     void setModel() override;
0067 
0068 private slots:
0069     //SLOTs for changes triggered in XYDataReductionCurveDock
0070     //general tab
0071     void dataSourceTypeChanged(int);
0072     void dataSourceCurveChanged(const QModelIndex&);
0073     void xDataColumnChanged(const QModelIndex&);
0074     void yDataColumnChanged(const QModelIndex&);
0075     void autoRangeChanged();
0076     void xRangeMinChanged(double);
0077     void xRangeMaxChanged(double);
0078     void xRangeMinDateTimeChanged(const QDateTime&);
0079     void xRangeMaxDateTimeChanged(const QDateTime&);
0080     void typeChanged(int);
0081     void autoToleranceChanged();
0082     void toleranceChanged(double);
0083     void autoTolerance2Changed();
0084     void tolerance2Changed(double);
0085 
0086     void recalculateClicked();
0087     void enableRecalculate() const;
0088 
0089     //SLOTs for changes triggered in XYCurve
0090     //General-Tab
0091     void curveDescriptionChanged(const AbstractAspect*);
0092     void curveDataSourceTypeChanged(XYAnalysisCurve::DataSourceType);
0093     void curveDataSourceCurveChanged(const XYCurve*);
0094     void curveXDataColumnChanged(const AbstractColumn*);
0095     void curveYDataColumnChanged(const AbstractColumn*);
0096     void curveDataReductionDataChanged(const XYDataReductionCurve::DataReductionData&);
0097     void dataChanged();
0098     void curveVisibilityChanged(bool);
0099 };
0100 
0101 #endif