]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_ErrorMgr.h
Salome HOME
656b2ca3a41ecfcdff06bdc6eb4e134bd2edb92f
[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 QAction;
18 class QDialog;
19 class QLabel;
20
21 class XGUI_EXPORT XGUI_ErrorMgr : public ModuleBase_IErrorMgr
22 {
23   Q_OBJECT
24 public:
25   XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop);
26   /// Virtual destructor
27   virtual ~XGUI_ErrorMgr();
28
29   void updateActions(const FeaturePtr& theFeature);
30
31   /// Return true if the feature has no error. If there is an error and the action
32   /// is not valid, the dialog with the error information is shown.
33   /// \param theAction an action, which is checked on validity
34   /// \param theFeature a feature that provides error information
35   bool canProcessClick(QAction* theAction, const FeaturePtr& theFeature);
36
37 public slots:
38   /// Reimplemented from ModuleBase_ErrorMgr::onValidationStateChanged().
39   //virtual void onValidationStateChanged();
40
41 protected slots:
42   /// Reimplemented from ModuleBase_ErrorMgr::onWidgetChanged().
43   virtual void onWidgetChanged();
44
45 private:
46   /// It updates the action state according to the given parameter
47   /// \param theAction an action to be changed
48   /// \param theFeature an feature that corresponds to the action
49   void updateActionState(QAction* theAction, const FeaturePtr& theFeature);
50
51   /// Returns the feature error message
52   /// \param theFeature a feature
53   /// \return the error message
54   //QString getFeatureError(const FeaturePtr& theFeature) const;
55
56   /// Returns casted workshop
57   XGUI_Workshop* workshop() const;
58
59 private:
60   ModuleBase_IWorkshop* myWorkshop;
61   QDialog* myErrorDialog; /// contains the error message
62   QLabel* myErrorLabel; /// contains an error information
63 };
64
65 #endif // XGUI_ErrorMgr_H