1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef XGUI_ErrorMgr_H
21 #define XGUI_ErrorMgr_H
25 #include <ModuleBase_IErrorMgr.h>
26 #include <ModelAPI_Feature.h>
29 class ModuleBase_IWorkshop;
30 class ModuleBase_ModelWidget;
37 * \class XGUI_ErrorMgr
39 * \brief Class of Errors manager object
41 class XGUI_EXPORT XGUI_ErrorMgr : public ModuleBase_IErrorMgr
46 /// \param theParent a parent object
47 /// \param theWorkshop a workshop object
48 XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop);
49 /// Virtual destructor
50 virtual ~XGUI_ErrorMgr();
52 /// Update actions for the given feature
53 /// \param theFeature a feature
54 virtual void updateActions(const FeaturePtr& theFeature);
56 /// Update enable state of AcceptAll action if the feature uses it
57 /// \param theFeature a feature
58 void updateAcceptAllAction(const FeaturePtr& theFeature);
60 /// Returns true if the apply is enabled for the current feature
61 bool isApplyEnabled() const;
64 /// Reimplemented from ModuleBase_ErrorMgr::onWidgetChanged().
65 virtual void onWidgetChanged();
68 /// Stores initial values of accept/accept all tool/status tip to internal containers
69 void storeInitialActionValues();
71 /// It disables the propety panel Accept action if the error message is not empty
72 /// The message is set to the header tool tip.
73 /// \param theAction an action to be changed
74 /// \param theError an error state
75 void updateAcceptActionState(const QString& theError);
77 /// It updates the tool tip of the widget controls according to the widget error
78 /// \param theWidget a widget
79 /// \param theError an error state
80 void updateToolTip(ModuleBase_ModelWidget* theWidget, const QString& theError);
82 /// Returns casted workshop
83 XGUI_Workshop* workshop() const;
85 /// Returns an active widget of the current operation
86 /// \return the widget or zero
87 ModuleBase_ModelWidget* activeWidget() const;
90 ModuleBase_IWorkshop* myWorkshop; /// workshop
91 QDialog* myErrorDialog; /// contains the error message
92 QLabel* myErrorLabel; /// contains an error information
93 QString myAcceptToolTip; /// cached tool tip value for enabled Accept action
94 QString myAcceptAllToolTip; /// cached tool tip value for enabled AcceptAll action
95 QString myAcceptStatusTip; /// cached status tip value for enabled Accept action
96 QString myAcceptAllStatusTip; /// cached status tip value for enabled AcceptAll action
99 #endif // XGUI_ErrorMgr_H