1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: XGUI_ErrorMgr.h
4 // Created: 22 July 2015
5 // Author: Sergey POKHODENKO
7 #ifndef XGUI_ErrorMgr_H
8 #define XGUI_ErrorMgr_H
12 #include <ModuleBase_IErrorMgr.h>
13 #include <ModelAPI_Feature.h>
16 class ModuleBase_IWorkshop;
21 class XGUI_EXPORT XGUI_ErrorMgr : public ModuleBase_IErrorMgr
25 XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop);
26 /// Virtual destructor
27 virtual ~XGUI_ErrorMgr();
29 void updateActions(const FeaturePtr& theFeature);
31 /// Update enable state of AcceptAll action if the feature uses it
32 /// \param theFeature a feature
33 void updateAcceptAllAction(const FeaturePtr& theFeature);
35 /// Return true if the feature has no error. If there is an error and the action
36 /// is not valid, the dialog with the error information is shown.
37 /// \param theAction an action, which is checked on validity
38 /// \param theFeature a feature that provides error information
39 bool canProcessClick(QAction* theAction, const FeaturePtr& theFeature);
42 /// Reimplemented from ModuleBase_ErrorMgr::onValidationStateChanged().
43 //virtual void onValidationStateChanged();
46 /// Reimplemented from ModuleBase_ErrorMgr::onWidgetChanged().
47 virtual void onWidgetChanged();
50 /// It updates the action state according to the given parameter
51 /// \param theAction an action to be changed
52 /// \param theFeature an feature that corresponds to the action
53 void updateActionState(QAction* theAction, const FeaturePtr& theFeature);
55 /// Returns the feature error message
56 /// \param theFeature a feature
57 /// \return the error message
58 //QString getFeatureError(const FeaturePtr& theFeature) const;
60 /// Returns casted workshop
61 XGUI_Workshop* workshop() const;
64 ModuleBase_IWorkshop* myWorkshop;
65 QDialog* myErrorDialog; /// contains the error message
66 QLabel* myErrorLabel; /// contains an error information
69 #endif // XGUI_ErrorMgr_H