QtiPlot  0.9.8.2
FitDialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : FitDialog.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2004 - 2011 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : Fit Wizard
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef FITDIALOG_H
30 #define FITDIALOG_H
31 
32 #include <Graph.h>
33 #include <QDoubleSpinBox>
34 #include <QCheckBox>
35 
36 class QPushButton;
37 class QLineEdit;
38 class QComboBox;
39 class QStackedWidget;
40 class QWidget;
41 class QTextEdit;
42 class QListWidget;
43 class QTableWidget;
44 class QSpinBox;
45 class QLabel;
46 class QRadioButton;
47 class QLineEdit;
48 class ColorButton;
49 class Fit;
50 class Table;
51 class DoubleSpinBox;
52 class FunctionCurve;
53 class MdiSubWindow;
54 class ScriptEdit;
55 
57 class FitDialog : public QDialog
58 {
59  Q_OBJECT
60 
61 public:
62  FitDialog(Graph *g, QWidget* parent = 0);
63 
64  void setSrcTables(QList<MdiSubWindow*> tables);
65 
66 protected:
67  void closeEvent (QCloseEvent * e );
68  void initFitPage();
69  void initEditPage();
70  void initAdvancedPage();
71  void chooseFitModelsFolder();
72  void choosePluginsFolder();
73 
74 private slots:
75  void accept();
77  void resetFunction();
78  void showFitPage();
79  void showEditPage();
80  void showAdvancedPage();
81  void showFunctionsList(int category);
82  void showParseFunctions();
83  void showExpression(int function);
84  void addFunction();
85  void addFunctionName();
86  void setFunction(bool ok);
87  void saveUserFunction();
88  void removeUserFunction();
89  void setGraph(Graph *g);
90  void activateCurve(const QString&);
91  void chooseFolder();
92  void changeDataRange();
93  void selectSrcTable(int tabnr);
94  void enableWeightingParameters(int index);
95  void showPointsBox(bool);
96  void showParametersTable();
97  void showCovarianceMatrix();
98  void showResiduals();
99  void showConfidenceLimits();
100  void showPredictionLimits();
101 
103  void applyChanges();
104 
106  void deleteFitCurves();
107 
109  void enableApplyChanges(int = 0);
110  void setNumPeaks(int peaks);
111  void saveInitialGuesses();
112  void loadInitialGuesses();
113  void guessInitialValues();
114  void returnToFitPage();
115  void updatePreview();
116  void updatePreviewColor(const QColor &);
117  void showPreview(bool on);
118  void showParameterRange(bool);
119  void guessParameters();
120 
121 private:
122  void loadPlugins();
123  void loadUserFunctions();
124  void initBuiltInFunctions();
125  void modifyGuesses(double* initVal);
126  QStringList builtInFunctionNames();
127  QStringList userFunctionNames();
128  QStringList plugInNames();
129  QString parseFormula(const QString& s);
130  void setEditorTextColor(const QColor& c);
131  void setCurrentFit(int);
132 
135  QPointer <Table> d_param_table;
137  QList <QwtPlotCurve*> d_result_curves;
138  QList <MdiSubWindow*> srcTables;
140 
141  QCheckBox* boxUseBuiltIn;
142  QStackedWidget* tw;
143  QPushButton* buttonOk;
144  QPushButton* buttonCancel1;
145  QPushButton* buttonCancel2;
146  QPushButton* buttonCancel3;
147  QPushButton* buttonAdvanced;
148  QPushButton* buttonClear;
149  QPushButton* buttonPlugins;
150  QPushButton* btnBack;
152  QComboBox* boxCurve;
153  QComboBox* boxAlgorithm;
154  QTableWidget* boxParams;
161  QTextEdit *explainBox, *boxFunction;
162  QListWidget *categoryBox, *funcBox;
163  QLineEdit *boxName;
176  QCheckBox *previewBox;
177 };
178 #endif // FITDIALOG_H