Computer Assited Medical Intervention Tool Kit  version 5.0
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-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, TIMC, 38000 Grenoble, France
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 "ActionViewerAPI.h"
30 
31 #include <Viewer.h>
32 #include <Action.h>
33 #include <Component.h>
34 
35 #include <QWidget>
36 #include <QComboBox>
37 #include <QLabel>
38 #include <QVBoxLayout>
39 #include <QPushButton>
40 #include <QStackedWidget>
41 #include <QCompleter>
42 #include <QLineEdit>
43 
64  Q_OBJECT
65 
66 public:
69  Q_INVOKABLE ActionViewer(QString name);
72 
74  virtual ~ActionViewer();
75 
77 
78  virtual void refresh(Viewer* whoIsAsking = nullptr) override;
80 
82  virtual QWidget* getWidget() override;
84 
86  virtual void setSearchPanelVisible(bool);
88 
89 protected slots :
91  void changeName();
92 
94  void changeFamily();
95 
97  void changeTag();
98 
99 private:
101  enum UpdateReason {ActionFamilyChanged, ActionNameChanged, ActionTagChanged, ViewerRefresh};
102 
104 
105  virtual void updateActionWidget(camitk::Action*);
107 
109  void updateSearchPanel(UpdateReason);
110 
112  QWidget* myWidget;
113 
115  QComboBox* familyComboBox;
116 
118  QComboBox* nameComboBox;
119 
121  camitk::Action* action;
122 
124  QLineEdit* tagLineEdit;
125 
127  QStackedWidget* actionWidgetStack;
128 
130  QFrame* searchFramePanel;
131 
133  int emptyActionWidgetIndex;
134 
136  QMap<camitk::ComponentList, camitk::Action*> widgetHistory;
137 
139  camitk::ComponentList currentlySelected;
140 };
141 
142 
143 #endif // ACTIONVIEWER_H
ActionViewer::getWidget
virtual QWidget * getWidget() override
get the viewer widget
Definition: ActionViewer.cpp:70
ActionViewer::currentlySelected
camitk::ComponentList currentlySelected
Used to evaluate modification of the list while execution.
Definition: ActionViewer.h:162
ActionViewer::changeTag
void changeTag()
Method used to change the tag.
Definition: ActionViewer.cpp:146
camitk::Viewer::setDescription
void setDescription(QString)
set the viewer's description
Definition: Viewer.cpp:104
ActionViewer::changeName
void changeName()
Method used to change the action selected.
Definition: ActionViewer.cpp:140
ActionViewer::~ActionViewer
virtual ~ActionViewer()
destructor
Definition: ActionViewer.cpp:60
ActionViewer::setSearchPanelVisible
virtual void setSearchPanelVisible(bool)
show/hide the search panel (hidden by default)
Definition: ActionViewer.cpp:120
ActionViewer.h
ActionViewer::changeFamily
void changeFamily()
Method used to change the action family selected.
Definition: ActionViewer.cpp:151
camitk::Viewer::setComponents
void setComponents(QStringList)
set the list of component class names managed by this viewer
Definition: Viewer.cpp:94
ActionViewer::nameComboBox
QComboBox * nameComboBox
Action name combo box.
Definition: ActionViewer.h:141
camitk::Action::getName
QString getName() const
get the name of the action
Definition: Action.h:338
Action.h
ActionViewer::searchFramePanel
QFrame * searchFramePanel
the search panel
Definition: ActionViewer.h:153
ActionViewer::myWidget
QWidget * myWidget
Main action widget of the viewer.
Definition: ActionViewer.h:135
camitk::ActionList
QList< Action * > ActionList
A list of Action.
Definition: CamiTKAPI.h:136
ActionViewer::updateSearchPanel
void updateSearchPanel(UpdateReason)
method used to update the viewer for a given update field
Definition: ActionViewer.cpp:178
camitk::Viewer::setIcon
void setIcon(QPixmap icon)
set the default icon for the viewer extension
Definition: Viewer.cpp:84
ActionViewer::ActionNameChanged
@ ActionNameChanged
Definition: ActionViewer.h:124
camitk::Action::updateTargets
void updateTargets()
update the target list using the currently selected components
Definition: Action.cpp:171
camitk::Action::getFamily
QString getFamily() const
the name of the family in which this action is associated
Definition: Action.h:353
ActionViewer::tagLineEdit
QLineEdit * tagLineEdit
action tags line edit
Definition: ActionViewer.h:147
ActionViewer::ActionFamilyChanged
@ ActionFamilyChanged
Definition: ActionViewer.h:124
ActionViewerAPI.h
camitk::Action
Action class is an abstract class that enables you to build a action (generally on a component)....
Definition: Action.h:231
ActionViewer::updateActionWidget
virtual void updateActionWidget(camitk::Action *)
embed an action widget in the stacked widget if needed
Definition: ActionViewer.cpp:316
ActionViewer::widgetHistory
QMap< camitk::ComponentList, camitk::Action * > widgetHistory
this map stores the list of selected component and the corresponding stack index of their embedded ac...
Definition: ActionViewer.h:159
ACTIONVIEWER_API
#define ACTIONVIEWER_API
Definition: ActionViewerAPI.h:54
camitk::Action::trigger
camitk::Action::ApplyStatus trigger(QWidget *parent=nullptr)
This method triggers the action.
Definition: Action.cpp:218
ActionViewer
ActionViewer is the viewer used to manage the actions.
Definition: ActionViewer.h:63
ActionViewer::refresh
virtual void refresh(Viewer *whoIsAsking=nullptr) override
refresh the view (can be interesting to know which other viewer is calling this)
Definition: ActionViewer.cpp:64
camitk::Action::getEmbedded
bool getEmbedded() const
argument use to know if the widget is embedded or not
Definition: Action.h:366
camitk::ComponentList
QList< Component * > ComponentList
A list of Component.
Definition: CamiTKAPI.h:127
ActionViewer::ActionTagChanged
@ ActionTagChanged
Definition: ActionViewer.h:124
ActionViewer::actionWidgetStack
QStackedWidget * actionWidgetStack
actions stacked widget of the viewer
Definition: ActionViewer.h:150
camitk::Action::getTag
QStringList getTag() const
the name of the tag called this action
Definition: Action.h:361
camitk::Viewer
Viewer is an abstract class that is the base class for all viewers.
Definition: Viewer.h:180
ActionViewer::UpdateReason
UpdateReason
Enum the different fields of the action viewwer.
Definition: ActionViewer.h:124
camitk::Viewer::getWidget
virtual QWidget * getWidget()=0
get the viewer widget.
ActionViewer::emptyActionWidgetIndex
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:156
ActionViewer::action
camitk::Action * action
Current action.
Definition: ActionViewer.h:144
Viewer.h
operator<
bool operator<(const ComponentList &l1, const ComponentList &l2)
Definition: ActionViewer.cpp:156
camitk::Viewer::refresh
virtual void refresh(Viewer *whoIsAsking=nullptr)=0
refresh the view (can be interesting to know which other viewer is calling this)
camitk::Action::getWidget
virtual QWidget * getWidget()
This method has to be redefined in your Action only if:
Definition: Action.cpp:185
ActionViewer::ViewerRefresh
@ ViewerRefresh
Definition: ActionViewer.h:124
ActionViewer::familyComboBox
QComboBox * familyComboBox
Family combo box.
Definition: ActionViewer.h:138
ActionViewer::ActionViewer
Q_INVOKABLE ActionViewer(QString name)
Definition: ActionViewer.cpp:44
Application.h
camitk
Definition: Action.cpp:35