Computer Assited Medical Intervention Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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:
320  void setName(QString name);
321 
323  void setDescription(QString description);
324 
326  void setComponent(QString component);
327 
329  void setFamily(QString family);
330 
332  void addTag(QString tag);
333 
335  void setEmbedded(bool isEmbedded);
336 
338  void setIcon(QPixmap);
339 
341  QWidget *actionWidget;
342 
343 
345 
354  virtual void preProcess();
355 
358  virtual void postProcess();
360 
361 private:
363  QString name;
364 
366  QString description;
367 
369  QString component;
370 
372  QString family;
373 
375  QStringList tags;
376 
379 
382 
384  QPixmap icon;
385 
387  QAction *qAction;
388 
399 
402 
410 
412  bool wasHereBefore(Component * comp);
414 
415 };
416 
417 }
418 
419 // -------------------- declare the interface for QPluginLoader --------------------
420 Q_DECLARE_INTERFACE(camitk::Action, "TIMC-IMAG.Action/2.1") //TODO use svn version?
421 
422 #endif // ACTION_H
423 
424 
425 
426