1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef XGUI_ErrorMgr_H
22 #define XGUI_ErrorMgr_H
26 #include <ModuleBase_IErrorMgr.h>
27 #include <ModelAPI_Feature.h>
30 class ModuleBase_IWorkshop;
31 class ModuleBase_ModelWidget;
38 * \class XGUI_ErrorMgr
40 * \brief Class of Errors manager object
42 class XGUI_EXPORT XGUI_ErrorMgr : public ModuleBase_IErrorMgr
47 /// \param theParent a parent object
48 /// \param theWorkshop a workshop object
49 XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop);
50 /// Virtual destructor
51 virtual ~XGUI_ErrorMgr();
53 /// Update actions for the given feature
54 /// \param theFeature a feature
55 virtual void updateActions(const FeaturePtr& theFeature);
57 /// Update enable state of AcceptAll action if the feature uses it
58 /// \param theFeature a feature
59 void updateAcceptAllAction(const FeaturePtr& theFeature);
61 /// Returns true if the apply is enabled for the current feature
62 bool isApplyEnabled() const;
65 /// Reimplemented from ModuleBase_ErrorMgr::onWidgetChanged().
66 virtual void onWidgetChanged();
69 /// Stores initial values of accept/accept all tool/status tip to internal containers
70 void storeInitialActionValues();
72 /// It disables the propety panel Accept action if the error message is not empty
73 /// The message is set to the header tool tip.
74 /// \param theAction an action to be changed
75 /// \param theError an error state
76 void updateAcceptActionState(const QString& theError);
78 /// It updates the tool tip of the widget controls according to the widget error
79 /// \param theWidget a widget
80 /// \param theError an error state
81 void updateToolTip(ModuleBase_ModelWidget* theWidget, const QString& theError);
83 /// Returns casted workshop
84 XGUI_Workshop* workshop() const;
86 /// Returns an active widget of the current operation
87 /// \return the widget or zero
88 ModuleBase_ModelWidget* activeWidget() const;
91 ModuleBase_IWorkshop* myWorkshop; /// workshop
92 QDialog* myErrorDialog; /// contains the error message
93 QLabel* myErrorLabel; /// contains an error information
94 QString myAcceptToolTip; /// cached tool tip value for enabled Accept action
95 QString myAcceptAllToolTip; /// cached tool tip value for enabled AcceptAll action
96 QString myAcceptStatusTip; /// cached status tip value for enabled Accept action
97 QString myAcceptAllStatusTip; /// cached status tip value for enabled AcceptAll action
100 #endif // XGUI_ErrorMgr_H