00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef FITDIALOG_H
00030 #define FITDIALOG_H
00031
00032 #include "Graph.h"
00033 #include <QDoubleSpinBox>
00034 #include <QCheckBox>
00035
00036 class QPushButton;
00037 class QLineEdit;
00038 class QComboBox;
00039 class QStackedWidget;
00040 class QWidget;
00041 class QTextEdit;
00042 class QListWidget;
00043 class QTableWidget;
00044 class QSpinBox;
00045 class QLabel;
00046 class QRadioButton;
00047 class QLineEdit;
00048 class ColorBox;
00049 class Fit;
00050 class Table;
00051 class DoubleSpinBox;
00052 class QwtPlotCurve;
00053
00055 class FitDialog : public QDialog
00056 {
00057 Q_OBJECT
00058
00059 public:
00060 FitDialog(Graph *g, QWidget* parent = 0, Qt::WFlags fl = 0 );
00061
00062 void setSrcTables(QWidgetList* tables);
00063
00064 protected:
00065 void closeEvent (QCloseEvent * e );
00066 void initFitPage();
00067 void initEditPage();
00068 void initAdvancedPage();
00069
00070 private slots:
00071 void accept();
00073 void resetFunction();
00074 void showFitPage();
00075 void showEditPage();
00076 void showAdvancedPage();
00077 void showFunctionsList(int category);
00078 void showParseFunctions();
00079 void showExpression(int function);
00080 void addFunction();
00081 void addFunctionName();
00082 void setFunction(bool ok);
00083 void saveUserFunction();
00084 void removeUserFunction();
00085 void setGraph(Graph *g);
00086 void activateCurve(const QString& curveName);
00087 void chooseFolder();
00088 void changeDataRange();
00089 void selectSrcTable(int tabnr);
00090 void enableWeightingParameters(int index);
00091 void showPointsBox(bool);
00092 void showParametersTable();
00093 void showCovarianceMatrix();
00094
00096 void applyChanges();
00097
00099 void deleteFitCurves();
00100
00102 void enableApplyChanges(int = 0);
00103 void setNumPeaks(int peaks);
00104 void saveInitialGuesses();
00105 void returnToFitPage();
00106 void updatePreview();
00107 void showParameterRange(bool);
00108
00109 private:
00110 void loadPlugins();
00111 void loadUserFunctions();
00112 void initBuiltInFunctions();
00113 void modifyGuesses(double* initVal);
00114 QStringList builtInFunctionNames();
00115 QStringList userFunctionNames();
00116 QStringList plugInNames();
00117 QString parseFormula(const QString& s);
00118
00119 Fit *d_current_fit;
00120 Graph *d_graph;
00121 Table *d_param_table;
00122 QList <Fit*> d_user_functions, d_built_in_functions, d_plugins;
00123 QWidgetList *srcTables;
00124 QwtPlotCurve *d_preview_curve;
00125
00126 QCheckBox* boxUseBuiltIn;
00127 QStackedWidget* tw;
00128 QPushButton* buttonOk;
00129 QPushButton* buttonCancel1;
00130 QPushButton* buttonCancel2;
00131 QPushButton* buttonCancel3;
00132 QPushButton* buttonAdvanced;
00133 QPushButton* buttonClear;
00134 QPushButton* buttonPlugins;
00135 QPushButton* btnBack;
00136 QPushButton* btnSaveGuesses;
00137 QComboBox* boxCurve;
00138 QComboBox* boxAlgorithm;
00139 QTableWidget* boxParams;
00140 DoubleSpinBox* boxFrom;
00141 DoubleSpinBox* boxTo;
00142 DoubleSpinBox* boxTolerance;
00143 QSpinBox* boxPoints, *generatePointsBox, *boxPrecision, *polynomOrderBox;
00144 QWidget *fitPage, *editPage, *advancedPage;
00145 QTextEdit *editBox, *explainBox, *boxFunction;
00146 QListWidget *categoryBox, *funcBox;
00147 QLineEdit *boxName, *boxParam;
00148 QLabel *lblFunction, *lblPoints, *polynomOrderLabel;
00149 QPushButton *btnAddFunc, *btnDelFunc, *btnContinue, *btnApply;
00150 QPushButton *buttonEdit, *btnAddTxt, *btnAddName, *btnDeleteFitCurves;
00151 ColorBox* boxColor;
00152 QComboBox *boxWeighting, *tableNamesBox, *colNamesBox;
00153 QRadioButton *generatePointsBtn, *samePointsBtn;
00154 QPushButton *btnParamTable, *btnCovMatrix, *btnParamRange;
00155 QLineEdit *covMatrixName, *paramTableName;
00156 QCheckBox *plotLabelBox, *logBox, *scaleErrorsBox, *globalParamTableBox;
00157 QCheckBox *previewBox;
00158 };
00159 #endif // FITDIALOG_H