itom  4.1.0
paramInputParser.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 #ifndef PARAMINPUTPARSER_H
24 #define PARAMINPUTPARSER_H
25 
26 #include "../../common/addInInterface.h"
27 #include "../../common/sharedStructures.h"
28 
29 #include "../global.h"
30 
31 #include <QtGui>
32 #include <qdialog.h>
33 #include <qvector.h>
34 #include <qsharedpointer.h>
35 
36 namespace ito {
37 
38 class ParamInputParser : public QObject
39 {
40  Q_OBJECT
41 
42 public:
43  ParamInputParser(QWidget *canvas);
45 
46  ito::RetVal createInputMask(const QVector<ito::Param> &params);
47  bool validateInput(bool mandatoryValues, ito::RetVal &retValue, bool showMessages = false);
48  ito::RetVal getParameters(QVector<ito::ParamBase> &params);
49 
50  inline int getItemSize() const { return m_params.size(); };
51 
52 protected:
53  QWidget* renderTypeInt(const ito::Param &param, int virtualIndex, QWidget *parent = NULL);
54  QWidget* renderTypeChar(const ito::Param &param, int virtualIndex, QWidget *parent = NULL);
55  QWidget* renderTypeDouble(const ito::Param &param, int virtualIndex, QWidget *parent = NULL);
56  QWidget* renderTypeString(const ito::Param &param, int virtualIndex, QWidget *parent = NULL);
57  QWidget* renderTypeHWRef(const ito::Param &param, int virtualIndex, QWidget *parent = NULL);
58  QWidget* renderTypeIntArray(const ito::Param &param, int virtualIndex, QWidget *parent = NULL);
59  QWidget* renderTypeDoubleArray(const ito::Param &param, int virtualIndex, QWidget *parent = NULL);
60  QWidget* renderTypeCharArray(const ito::Param &param, int virtualIndex, QWidget *parent = NULL);
61  QWidget* renTypeArray(const int virtualIndex, QWidget *parent, const QString name);
62 
63  ito::RetVal getIntValue(ito::ParamBase &param, const ito::Param &orgParam, QWidget *contentWidget, void *internalData, bool mandatory);
64  ito::RetVal getCharValue(ito::ParamBase &param, const ito::Param &orgParam, QWidget *contentWidget, void *internalData, bool mandatory);
65  ito::RetVal getDoubleValue(ito::ParamBase &param, const ito::Param &orgParam, QWidget *contentWidget, void *internalData, bool mandatory);
66  ito::RetVal getStringValue(ito::ParamBase &param, const ito::Param &orgParam, QWidget *contentWidget, void *internalData, bool mandatory);
67  ito::RetVal getHWValue(ito::ParamBase &param, const ito::Param &orgParam, QWidget *contentWidget, void *internalData, bool mandatory);
68  ito::RetVal getIntArray(ito::ParamBase &param, const ito::Param &orgParam, QWidget *contentWidget, void *internalData, bool mandatory);
69  ito::RetVal getDoubleArray(ito::ParamBase &param, const ito::Param &orgParam, QWidget *contentWidget, void *internalData, bool mandatory);
70  ito::RetVal getCharArray(ito::ParamBase &param, const ito::Param &orgParam, QWidget *contentWidget, void *internalData, bool mandatory);
71 
72  QSignalMapper *m_pSignalMapper_browsePluginPicker;
73  QSignalMapper *m_pSignalMapper_browseArrayPicker;
74  QVector<ito::Param> m_params;
75  QVector<void*> m_internalData;
76  QPointer<QWidget> m_canvas;
77  QIcon m_iconInfo;
78 
79 private:
80 
81 private slots:
82  void browsePluginPicker(int i);
83  void browseArrayPicker(int i);
84 };
85 
86 } //end namespace ito
87 
88 #endif
Class for managing status values (like errors or warning)
Definition: retVal.h:54
class for parameter handling e.g. to pass paramters to plugins
Definition: param.h:283
Definition: apiFunctionsGraph.cpp:39
Definition: param.h:67
Definition: paramInputParser.h:38