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;
17 class ModuleBase_ModelWidget;
24 * \class XGUI_ErrorMgr
26 * \brief Class of Errors manager object
28 class XGUI_EXPORT XGUI_ErrorMgr : public ModuleBase_IErrorMgr
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();
39 /// Update actions for the given feature
40 /// \param theFeature a feature
41 void updateActions(const FeaturePtr& theFeature);
43 /// Update enable state of AcceptAll action if the feature uses it
44 /// \param theFeature a feature
45 void updateAcceptAllAction(const FeaturePtr& theFeature);
48 /// Reimplemented from ModuleBase_ErrorMgr::onValidationStateChanged().
49 //virtual void onValidationStateChanged();
52 /// Reimplemented from ModuleBase_ErrorMgr::onWidgetChanged().
53 virtual void onWidgetChanged();
56 /// It disables the action if the error message is not empty
57 /// The message is set to the header tool tip.
58 /// \param theAction an action to be changed
59 /// \param theError an error state
60 void updateActionState(QAction* theAction, const QString& theError);
62 /// It updates the tool tip of the widget controls according to the widget error
63 /// \param theWidget a widget
64 /// \param theError an error state
65 void updateToolTip(ModuleBase_ModelWidget* theWidget, const QString& theError);
67 /// Returns casted workshop
68 XGUI_Workshop* workshop() const;
70 /// Returns an active widget of the current operation
71 /// \return the widget or zero
72 ModuleBase_ModelWidget* activeWidget() const;
75 ModuleBase_IWorkshop* myWorkshop; /// workshop
76 QDialog* myErrorDialog; /// contains the error message
77 QLabel* myErrorLabel; /// contains an error information
80 #endif // XGUI_ErrorMgr_H