itom
Loading...
Searching...
No Matches
paramInputParser.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität 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
36namespace ito {
37
38class ParamInputParser : public QObject
39{
40 Q_OBJECT
41
42public:
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
52protected:
53 QWidget* renderTypeInt(const ito::Param &param, int virtualIndex, QWidget *parent = nullptr);
54 QWidget* renderTypeChar(const ito::Param &param, int virtualIndex, QWidget *parent = nullptr);
55 QWidget* renderTypeDouble(const ito::Param &param, int virtualIndex, QWidget *parent = nullptr);
56 QWidget* renderTypeString(const ito::Param &param, int virtualIndex, QWidget *parent = nullptr);
57 QWidget* renderTypeHWRef(const ito::Param &param, int virtualIndex, QWidget *parent = nullptr);
58 QWidget* renderTypeGenericArray(const ito::Param &param, const int virtualIndex, QWidget *parent, int paramType);
59 QString getTypeGenericArrayPreview(const ito::Param &param) const;
60
61 QString arrayTypeObjectName(int paramType, int index) const;
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
69 QVector<ito::Param> m_params;
70 QVector<void*> m_internalData;
71 QPointer<QWidget> m_canvas;
72 QIcon m_iconInfo;
73
74private:
75
76private slots:
77 void browsePluginPicker(int i);
78 void browseArrayPicker(int i);
79};
80
81} //end namespace ito
82
83#endif
<
Definition param.h:95
class for parameter handling e.g. to pass parameters to plugins
Definition param.h:477
Definition paramInputParser.h:39
Class for managing status values (like errors or warning)
Definition retVal.h:54
Definition apiFunctionsGraph.cpp:40