X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ErrorMgr.h;h=23012267b30a52f781cadcbc07c71b12d27f05b5;hb=1a59f21be05badd17bcac9ce82b2857b961f1d2e;hp=36644798c5b87ba33f59042a9ff8c99aa9f72d3e;hpb=eecc1410339bbfe9a7ba175a7555c4030bb4a80a;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ErrorMgr.h b/src/XGUI/XGUI_ErrorMgr.h index 36644798c..23012267b 100644 --- a/src/XGUI/XGUI_ErrorMgr.h +++ b/src/XGUI/XGUI_ErrorMgr.h @@ -10,22 +10,72 @@ #include "XGUI.h" #include +#include +class XGUI_Workshop; +class ModuleBase_IWorkshop; +class ModuleBase_ModelWidget; + +class QAction; +class QDialog; +class QLabel; + +/** + * \class XGUI_ErrorMgr + * \ingroup GUI + * \brief Class of Errors manager object + */ class XGUI_EXPORT XGUI_ErrorMgr : public ModuleBase_IErrorMgr { Q_OBJECT public: - XGUI_ErrorMgr(QObject* theParent = 0); + /// Constructor + /// \param theParent a parent object + /// \param theWorkshop a workshop object + XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop); /// Virtual destructor virtual ~XGUI_ErrorMgr(); -public slots: - /// Reimplemented from ModuleBase_ErrorMgr::onValidationStateChanged(). - virtual void onValidationStateChanged(); + /// Update actions for the given feature + /// \param theFeature a feature + void updateActions(const FeaturePtr& theFeature); + + /// Update enable state of AcceptAll action if the feature uses it + /// \param theFeature a feature + void updateAcceptAllAction(const FeaturePtr& theFeature); + + /// Returns true if the apply is enabled for the current feature + bool isApplyEnabled() const; protected slots: /// Reimplemented from ModuleBase_ErrorMgr::onWidgetChanged(). virtual void onWidgetChanged(); + +private: + /// It disables the action if the error message is not empty + /// The message is set to the header tool tip. + /// \param theAction an action to be changed + /// \param theError an error state + void updateActionState(QAction* theAction, const QString& theError); + + /// It updates the tool tip of the widget controls according to the widget error + /// \param theWidget a widget + /// \param theError an error state + void updateToolTip(ModuleBase_ModelWidget* theWidget, const QString& theError); + + /// Returns casted workshop + XGUI_Workshop* workshop() const; + + /// Returns an active widget of the current operation + /// \return the widget or zero + ModuleBase_ModelWidget* activeWidget() const; + +private: + ModuleBase_IWorkshop* myWorkshop; /// workshop + QDialog* myErrorDialog; /// contains the error message + QLabel* myErrorLabel; /// contains an error information + QString myAcceptToolTip; /// cached tool tip value for enabled Accept action + QString myAcceptAllToolTip; /// cached tool tip value for enabled AcceptAll action }; #endif // XGUI_ErrorMgr_H \ No newline at end of file