MorphoGraphX  2.0-1-227
ProcessParms.hpp
Go to the documentation of this file.
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2019 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef PROCESS_PARMS_HPP
12 #define PROCESS_PARMS_HPP
13 
14 #include <Config.hpp>
15 #include <Hash.hpp>
16 #include <Misc.hpp>
17 
18 #include <QStringList>
19 #include <QHash>
20 #include <QIcon>
21 #include <unordered_map>
22 
23 namespace mgx
24 {
31  typedef QList<QStringList> ParmChoiceList;
32 
33  class mgx_EXPORT ProcessParms
34  {
35  public:
37  {
38  setIcon(QIcon(":images/Process.png"));
39  }
40  virtual ~ProcessParms() {}
41 
49  QString name() const;
50 
54  QString description() const;
55 
61  QStringList parmNames() const;
62 
68  QStringList parmDescs() const;
69 
73  QStringList parmDefaults() const;
74 
79  ParmChoiceList parmChoice() const;
83  static QStringList booleanChoice() { return QStringList() << "Yes" << "No"; }
87  static QStringList storeChoice() { return QStringList() << "Main" << "Work"; }
91  static QStringList stackChoice() { return QStringList() << "Stack 1" << "Stack 2" << "Current" << "Other"; }
95  static QStringList meshChoice() { return QStringList() << "Mesh 1" << "Mesh 2" << "Current" << "Other"; }
99  static QStringList dimensionChoice() { return QStringList() << "Vertices" << "Edges" << "Faces" << "Volumes"; }
103  static QStringList dimChoice() { return QStringList() << "Vertices" << "Faces" << "Volumes" << "All"; }
104 
111  QIcon icon() const;
112 
116  QString parm(const QString &name) const;
117 
121  const QStringList &getParms();
122 
126  bool setName(const QString &name);
127 
131  bool setDesc(const QString &description);
132 
136  bool addParm(const QString &parmName, const QString &desc, const QString &def, const QStringList &choices = QStringList());
137 
141  bool insertParm(const QString &parmName, const QString &desc, const QString &def, int pos, const QStringList &choices = QStringList());
142 
146  bool setParm(const QString &parmName, const QString &parm);
147 
151  bool setParms(const QStringList &parms);
152 
156  bool setParmDesc(const QString &parmName, const QString &desc);
157 
161  bool setParmDefault(const QString &parmName, const QString &def);
162 
166  bool setParmChoices(const QString &parmName, const QStringList &choices);
167 
171  bool setIcon(const QIcon &icon);
172 
176  QStringList parmList(const QString &key = QString()) const;
177 
178  private:
179  QString _name;
180  QString _description;
181  QStringList _parms;
182  std::unordered_map<QString, int> _parmIdx;
183  QStringList _parmNames;
184  QStringList _parmDescs;
185  QStringList _parmDefaults;
186  ParmChoiceList _parmChoices;
187  QIcon _icon;
188  };
189 }
190 #endif
mgx::ProcessParms::booleanChoice
static QStringList booleanChoice()
Helper function that provides a list of choices for a boolean argument.
Definition: ProcessParms.hpp:83
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::ProcessParms::meshChoice
static QStringList meshChoice()
Helper function that provides a list of choices for choosing between stack 1 and 2.
Definition: ProcessParms.hpp:95
mgx::ParmChoiceList
QList< QStringList > ParmChoiceList
Type of the dictionary giving the list of possible strings for each argument.
Definition: ProcessParms.hpp:31
mgx::ProcessParms::dimChoice
static QStringList dimChoice()
Helper function that provides a list of choices for choosing the dimension.
Definition: ProcessParms.hpp:103
Hash.hpp
mgx::ProcessParms::stackChoice
static QStringList stackChoice()
Helper function that provides a list of choices for choosing between stack 1 and 2.
Definition: ProcessParms.hpp:91
mgx::ProcessParms::dimensionChoice
static QStringList dimensionChoice()
Helper function that provides a list of choices for choosing the dimension.
Definition: ProcessParms.hpp:99
Misc.hpp
mgx::ProcessParms::storeChoice
static QStringList storeChoice()
Helper function that provides a list of choices for choosing from the main or work stack.
Definition: ProcessParms.hpp:87
mgx::ProcessParms::~ProcessParms
virtual ~ProcessParms()
Definition: ProcessParms.hpp:40
mgx::ProcessParms
Definition: ProcessParms.hpp:33
mgx::ProcessParms::ProcessParms
ProcessParms()
Definition: ProcessParms.hpp:36