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 virtual 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);
47 /// Returns true if the apply is enabled for the current feature
48 bool isApplyEnabled() const;
51 /// Reimplemented from ModuleBase_ErrorMgr::onWidgetChanged().
52 virtual void onWidgetChanged();
55 /// Stores initial values of accept/accept all tool/status tip to internal containers
56 void storeInitialActionValues();
58 /// It disables the propety panel Accept action if the error message is not empty
59 /// The message is set to the header tool tip.
60 /// \param theAction an action to be changed
61 /// \param theError an error state
62 void updateAcceptActionState(const QString& theError);
64 /// It updates the tool tip of the widget controls according to the widget error
65 /// \param theWidget a widget
66 /// \param theError an error state
67 void updateToolTip(ModuleBase_ModelWidget* theWidget, const QString& theError);
69 /// Returns casted workshop
70 XGUI_Workshop* workshop() const;
72 /// Returns an active widget of the current operation
73 /// \return the widget or zero
74 ModuleBase_ModelWidget* activeWidget() const;
77 ModuleBase_IWorkshop* myWorkshop; /// workshop
78 QDialog* myErrorDialog; /// contains the error message
79 QLabel* myErrorLabel; /// contains an error information
80 QString myAcceptToolTip; /// cached tool tip value for enabled Accept action
81 QString myAcceptAllToolTip; /// cached tool tip value for enabled AcceptAll action
82 QString myAcceptStatusTip; /// cached status tip value for enabled Accept action
83 QString myAcceptAllStatusTip; /// cached status tip value for enabled AcceptAll action
86 #endif // XGUI_ErrorMgr_H