Salome HOME
It removes commented not used code.
[modules/shaper.git] / src / XGUI / XGUI_ErrorMgr.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        XGUI_ErrorMgr.h
4 // Created:     22 July 2015
5 // Author:      Sergey POKHODENKO
6
7 #ifndef XGUI_ErrorMgr_H
8 #define XGUI_ErrorMgr_H
9
10 #include "XGUI.h"
11
12 #include <ModuleBase_IErrorMgr.h>
13 #include <ModelAPI_Feature.h>
14
15 class XGUI_Workshop;
16 class ModuleBase_IWorkshop;
17 class ModuleBase_ModelWidget;
18
19 class QAction;
20 class QDialog;
21 class QLabel;
22
23 /**
24  * \class XGUI_ErrorMgr
25  * \ingroup GUI
26  * \brief Class of Errors manager object
27  */
28 class XGUI_EXPORT XGUI_ErrorMgr : public ModuleBase_IErrorMgr
29 {
30   Q_OBJECT
31 public:
32   /// Constructor
33   /// \param theParent a parent object
34   /// \param theWorkshop a workshop object
35   XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop);
36   /// Virtual destructor
37   virtual ~XGUI_ErrorMgr();
38
39   /// Update actions for the given feature
40   /// \param theFeature a feature
41   void updateActions(const FeaturePtr& theFeature);
42
43   /// Update enable state of AcceptAll action if the feature uses it
44   /// \param theFeature a feature
45   void updateAcceptAllAction(const FeaturePtr& theFeature);
46
47 protected slots:
48   /// Reimplemented from ModuleBase_ErrorMgr::onWidgetChanged().
49   virtual void onWidgetChanged();
50
51 private:
52   /// It disables the action if the error message is not empty
53   /// The message is set to the header tool tip.
54   /// \param theAction an action to be changed
55   /// \param theError an error state
56   void updateActionState(QAction* theAction, const QString& theError);
57
58   /// It updates the tool tip of the widget controls according to the widget error
59   /// \param theWidget a widget
60   /// \param theError an error state
61   void updateToolTip(ModuleBase_ModelWidget* theWidget, const QString& theError);
62
63   /// Returns casted workshop
64   XGUI_Workshop* workshop() const;
65
66   /// Returns an active widget of the current operation
67   /// \return the widget or zero
68   ModuleBase_ModelWidget* activeWidget() const;
69
70 private:
71   ModuleBase_IWorkshop* myWorkshop; /// workshop
72   QDialog* myErrorDialog; /// contains the error message
73   QLabel* myErrorLabel; /// contains an error information
74 };
75
76 #endif // XGUI_ErrorMgr_H