Computer Assited Medical Intervention Tool Kit  version 3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Action.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef ACTION_H
27 #define ACTION_H
28 
29 // -- Core stuff
30 #include "CamiTKAPI.h"
31 
32 #include <QSet>
33 #include <QWidget>
34 #include <QString>
35 #include <QAction>
36 
37 
38 namespace camitk {
39 
40 class ActionExtension;
41 
165 class CAMITK_API Action : public QObject {
166  Q_OBJECT
167 
168 public:
169 
172 
174  virtual ~Action();
175 
177  enum ApplyStatus {
182  TRIGGERED
183  };
184 
185 public slots:
190  ApplyStatus trigger(QWidget * parent = NULL);
191 
196  virtual ApplyStatus apply() = 0;
197 
198 public:
199 
202 
211  virtual ApplyStatus applyInPipeline();
212 
216  virtual void setInputComponents(ComponentList inputs);
217 
219  virtual void setInputComponent(Component * input);
220 
222  virtual ComponentList getOutputComponents();
223 
225  virtual Component * getOutputComponent();
227 
231 
239  QAction *getQAction();
240 
242  QString getName() const {
243  return name;
244  };
245 
247  QString getDescription() const {
248  return description;
249  };
250 
252  QString getComponent() const {
253  return component;
254  };
255 
257  QString getFamily() const {
258  return family;
259  };
260 
262  QString getExtensionName() const;
263 
265  QStringList getTag() const {
266  return tags;
267  };
268 
270  bool getEmbedded() const {
271  return isEmbedded;
272  };
274 
277 
299  virtual QWidget * getWidget();
300 
302  virtual QPixmap getIcon();
303 
305  const ComponentList getTargets() const;
307 
309  bool getAutoUpdateProperties() const;
310 
312  void setAutoUpdateProperties(bool);
313 
314 protected:
319  void setName(QString name);
322 
324  void setDescription(QString description);
325 
327  void setComponent(QString component);
328 
330  void setFamily(QString family);
331 
333  void addTag(QString tag);
334 
336  void setEmbedded(bool isEmbedded);
337 
339  void setIcon(QPixmap);
340 
342  QWidget *actionWidget;
343 
344 
346 
352 
357  virtual void preProcessInPipeline();
358 
361  virtual void postProcessInPipeline();
363 
364 private:
366  QString name;
367 
369  QString description;
370 
372  QString component;
373 
375  QString family;
376 
378  QStringList tags;
379 
382 
385 
387  QPixmap icon;
388 
390  QAction *qAction;
391 
402 
405 
413 
415 
416 };
417 
418 }
419 
420 // -------------------- declare the interface for QPluginLoader --------------------
421 Q_DECLARE_INTERFACE(camitk::Action, "TIMC-IMAG.Action/2.1") //TODO use svn version?
422 
423 #endif // ACTION_H
424 
425 
426 
427 
ComponentList aliveBeforeComponents
Definition: Action.h:410
QStringList getTag() const
the name of the tag called this action
Definition: Action.h:265
QString name
the name of the action
Definition: Action.h:366
QPixmap icon
the Action pixmap icon
Definition: Action.h:387
bool autoUpdateProperties
Should the properties/parameters of this action be automatically updated when the user change somethi...
Definition: Action.h:404
apply() failed : an error occured (usually it means that the apply() was interrupted) ...
Definition: Action.h:179
Action class is an abstract class that enables you to build a action (generally on a component)...
Definition: Action.h:165
bool getEmbedded() const
argument use to know if the widget is embedded or not
Definition: Action.h:270
everything went according to plan
Definition: Action.h:178
ActionExtension * extension
the extension in which this action is declared and registered
Definition: Action.h:384
QAction * qAction
the corresponding QAction
Definition: Action.h:390
some (partial) error occured during the application of the algorithm
Definition: Action.h:180
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: Component.h:287
QString getName() const
get the name of the action
Definition: Action.h:242
CAMITK_API QList< Component * > ComponentList
A list of Component.
Definition: CamiTKAPI.h:87
#define CAMITK_API
Definition: CamiTKAPI.h:49
This class describes what is a generic Action extension.
Definition: ActionExtension.h:57
QString component
the name of the component class that can be used by this action
Definition: Action.h:372
QString getFamily() const
the name of the family in which this action is associated
Definition: Action.h:257
QString description
the descriptionof the action
Definition: Action.h:369
ApplyStatus
describes what happened during the application of an algorithm (i.e. results of the apply method) ...
Definition: Action.h:177
ComponentList outputComponents
List returned by getOutputComponents()
Definition: Action.h:412
QWidget * actionWidget
the action widget
Definition: Action.h:342
ComponentList targetComponents
The list of valid (regarding the component property) components for which this action is called...
Definition: Action.h:401
bool isEmbedded
is the widget embedded or not
Definition: Action.h:381
QString getDescription() const
the description of the action
Definition: Action.h:247
QString getComponent() const
the name of the component class that can be used by this action
Definition: Action.h:252
QString family
the name of the family in which this action is associated
Definition: Action.h:375
QStringList tags
the name of the tag called this action
Definition: Action.h:378
the action was aborted before completion
Definition: Action.h:181