1 /** -*- mode: c++ ; c-basic-offset: 2 -*-
2 * @file AbstractParameter.cpp
3 * @author Sebastien Fourey
4 * @date Nov 2014
5 *
6 * @brief Declaration of the class AbstractParameter
7 *
8 * This file is part of the ZArt software's source code.
9 *
10 * Copyright Sebastien Fourey / GREYC Ensicaen (2010-...)
11 *
12 * https://foureys.users.greyc.fr/
13 *
14 * This software is a computer program whose purpose is to demonstrate
15 * the possibilities of the GMIC image processing language by offering the
16 * choice of several manipulations on a video stream acquired from a webcam. In
17 * other words, ZArt is a GUI for G'MIC real-time manipulations on the output
18 * of a webcam.
19 *
20 * This software is governed by the CeCILL license under French law and
21 * abiding by the rules of distribution of free software. You can use,
22 * modify and/ or redistribute the software under the terms of the CeCILL
23 * license as circulated by CEA, CNRS and INRIA at the following URL
24 * "http://www.cecill.info". See also the directory "Licence" which comes
25 * with this source code for the full text of the CeCILL license.
26 *
27 * As a counterpart to the access to the source code and rights to copy,
28 * modify and redistribute granted by the license, users are provided only
29 * with a limited warranty and the software's author, the holder of the
30 * economic rights, and the successive licensors have only limited
31 * liability.
32 *
33 * In this respect, the user's attention is drawn to the risks associated
34 * with loading, using, modifying and/or developing or reproducing the
35 * software by the user in light of its specific status of free software,
36 * that may mean that it is complicated to manipulate, and that also
37 * therefore means that it is reserved for developers and experienced
38 * professionals having in-depth computer knowledge. Users are therefore
39 * encouraged to load and test the software's suitability as regards their
40 * requirements in conditions enabling the security of their systems and/or
41 * data to be ensured and, more generally, to use and operate it in the
42 * same conditions as regards security.
43 *
44 * The fact that you are presently reading this means that you have had
45 * knowledge of the CeCILL license and that you accept its terms.
46 */
47 #include "AbstractParameter.h"
48 #include "BoolParameter.h"
49 #include "ChoiceParameter.h"
50 #include "ColorParameter.h"
51 #include "ConstParameter.h"
52 #include "FileParameter.h"
53 #include "FloatParameter.h"
54 #include "FolderParameter.h"
55 #include "IntParameter.h"
56 #include "LinkParameter.h"
57 #include "NoteParameter.h"
58 #include "PointParameter.h"
59 #include "SeparatorParameter.h"
60 #include "TextParameter.h"
61
AbstractParameter(QObject * parent)62 AbstractParameter::AbstractParameter(QObject * parent) : QObject(parent) {}
63
~AbstractParameter()64 AbstractParameter::~AbstractParameter() {}
65
isVisible() const66 bool AbstractParameter::isVisible() const
67 {
68 return true;
69 }
70
unquotedTextValue() const71 QString AbstractParameter::unquotedTextValue() const
72 {
73 return textValue();
74 }
75
addToKeypointList(KeypointList &) const76 void AbstractParameter::addToKeypointList(KeypointList &) const {}
77
extractPositionFromKeypointList(KeypointList &)78 void AbstractParameter::extractPositionFromKeypointList(KeypointList &) {}
79
createFromNode(QDomNode node,QObject * parent)80 AbstractParameter * AbstractParameter::createFromNode(QDomNode node, QObject * parent)
81 {
82 QString name = node.nodeName();
83 if (name == "int") {
84 return new IntParameter(node, parent);
85 }
86 if (name == "float") {
87 return new FloatParameter(node, parent);
88 }
89 if (name == "bool") {
90 return new BoolParameter(node, parent);
91 }
92 if (name == "choice") {
93 return new ChoiceParameter(node, parent);
94 }
95 if (name == "color") {
96 return new ColorParameter(node, parent);
97 }
98 if (name == "separator") {
99 return new SeparatorParameter(node, parent);
100 }
101 if (name == "note") {
102 return new NoteParameter(node, parent);
103 }
104 if (name == "file") {
105 return new FileParameter(node, parent);
106 }
107 if (name == "folder") {
108 return new FolderParameter(node, parent);
109 }
110 if (name == "text") {
111 return new TextParameter(node, parent);
112 }
113 if (name == "link") {
114 return new LinkParameter(node, parent);
115 }
116 if (name == "value") {
117 return new ConstParameter(node, parent);
118 }
119 if (name == "point") {
120 return new PointParameter(node, parent);
121 }
122 return 0;
123 }
124