Salome HOME
Update of pictures by ABA
[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 QAction;
16 class QDialog;
17 class QLabel;
18
19 class XGUI_EXPORT XGUI_ErrorMgr : public ModuleBase_IErrorMgr
20 {
21   Q_OBJECT
22 public:
23   XGUI_ErrorMgr(QObject* theParent = 0);
24   /// Virtual destructor
25   virtual ~XGUI_ErrorMgr();
26
27   /// It updates the action state according to the given parameter
28   /// \param theAction an action to be changed
29   /// \param theFeature an feature that corresponds to the action
30   /// \param theEnabled an enable state
31   void updateActionState(QAction* theAction, const FeaturePtr& theFeature,
32                          const bool theEnabled);
33
34   /// Return true if the feature has no error. If there is an error and the action
35   /// is not valid, the dialog with the error information is shown.
36   /// \param theAction an action, which is checked on validity
37   /// \param theFeature a feature that provides error information
38   bool canProcessClick(QAction* theAction, const FeaturePtr& theFeature);
39
40 public slots:
41   /// Reimplemented from ModuleBase_ErrorMgr::onValidationStateChanged().
42   //virtual void onValidationStateChanged();
43
44 protected slots:
45   /// Reimplemented from ModuleBase_ErrorMgr::onWidgetChanged().
46   virtual void onWidgetChanged();
47
48 private:
49   /// Returns the feature error message
50   /// \param theFeature a feature
51   /// \return the error message
52   QString getFeatureError(const FeaturePtr& theFeature) const;
53
54 private:
55   QDialog* myErrorDialog; /// contains the error message
56   QLabel* myErrorLabel; /// contains an error information
57 };
58
59 #endif // XGUI_ErrorMgr_H