Computer Assited Medical Intervention Tool Kit  version 4.1
ActionViewer.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2018 Univ. Grenoble Alpes, 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 ACTIONVIEWER_H
27 #define ACTIONVIEWER_H
28 
29 #include <QWidget>
30 #include <QComboBox>
31 #include <QLabel>
32 #include <QVBoxLayout>
33 #include <QPushButton>
34 #include <QStackedWidget>
35 #include <QCompleter>
36 #include <QLineEdit>
37 
38 #include "Viewer.h"
39 #include "Action.h"
40 #include "Component.h"
41 
42 namespace camitk {
57 class CAMITK_API ActionViewer : public Viewer {
58  Q_OBJECT
59 
60 public:
63  ActionViewer();
66 
68  ~ActionViewer() override = default;
69 
71  static ActionViewer* getInstance();
73 
75 
76  unsigned int numberOfViewedComponent() {
78  return 0;
79  };
80 
82  void refresh(Viewer* whoIsAsking = nullptr) override;
83 
85  QWidget* getWidget(QWidget* parent = nullptr) override;
87 
89 
90  void embedActionWidget(Action*);
92 
94  void setSearchPanelVisible(bool);
96 
97 protected slots :
99  void changeName();
100 
102  void changeFamily();
103 
105  void changeTag();
106 
107 private:
109  enum UpdateReason {ActionFamilyChanged, ActionNameChanged, ActionTagChanged, ViewerRefresh};
110 
112  void updateActionViewer(UpdateReason);
113 
115  QWidget* myWidget;
116 
118  QComboBox* familyComboBox;
119 
121  QComboBox* nameComboBox;
122 
125 
127  QLineEdit* tagLineEdit;
128 
130  QStackedWidget* actionWidgetStack;
131 
134 
137 
139  QMap<ComponentList, Action*> widgetHistory;
140 
143 };
144 }
145 
146 #endif // ACTIONVIEWER_H
QComboBox * familyComboBox
Family combo box.
Definition: ActionViewer.h:118
Action class is an abstract class that enables you to build a action (generally on a component)...
Definition: Action.h:207
Viewer is an abstract viewer.
Definition: Viewer.h:55
QFrame * searchFramePanel
the search panel
Definition: ActionViewer.h:133
Definition: Action.cpp:36
#define CAMITK_API
Definition: CamiTKAPI.h:49
QWidget * myWidget
Main action widget of the viewer.
Definition: ActionViewer.h:115
QLineEdit * tagLineEdit
action tags line edit
Definition: ActionViewer.h:127
ActionViewer is the viewer used to manage the actions.
Definition: ActionViewer.h:57
ComponentList currentlySelected
Used to evaluate modification of the list while execution.
Definition: ActionViewer.h:142
QList< Component * > ComponentList
A list of Component.
Definition: CamiTKAPI.h:89
QComboBox * nameComboBox
Action name combo box.
Definition: ActionViewer.h:121
int emptyActionWidgetIndex
index of the empty widget, used when no action is active or when no action has been used for the curr...
Definition: ActionViewer.h:136
Action * action
Current action.
Definition: ActionViewer.h:124
QMap< ComponentList, Action * > widgetHistory
this map stores the list of selected component and the corresponding stack index of their embedded ac...
Definition: ActionViewer.h:139
QStackedWidget * actionWidgetStack
actions stacked widget of the viewer
Definition: ActionViewer.h:130
UpdateReason
Enum the different fields of the action viewwer.
Definition: ActionViewer.h:109