X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ErrorMgr.h;h=72fe886a01c8d3400e5c54b8fbbfa98ef0970a5b;hb=d94da58e548165a5a9f9aa04b6df9a3f29605fa2;hp=c339d6cf0bd4c652d9bb82a8f97c4282787ac180;hpb=b070f5d30325537aa8cf883a55f8d3315115c384;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ErrorMgr.h b/src/XGUI/XGUI_ErrorMgr.h index c339d6cf0..72fe886a0 100644 --- a/src/XGUI/XGUI_ErrorMgr.h +++ b/src/XGUI/XGUI_ErrorMgr.h @@ -1,8 +1,21 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: XGUI_ErrorMgr.h -// Created: 22 July 2015 -// Author: Sergey POKHODENKO +// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #ifndef XGUI_ErrorMgr_H #define XGUI_ErrorMgr_H @@ -14,56 +27,73 @@ 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: + /// Constructor + /// \param theParent a parent object + /// \param theWorkshop a workshop object XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop); /// Virtual destructor virtual ~XGUI_ErrorMgr(); - void updateActions(const FeaturePtr& theFeature); + /// Update actions for the given feature + /// \param theFeature a feature + virtual 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); - /// Return true if the feature has no error. If there is an error and the action - /// is not valid, the dialog with the error information is shown. - /// \param theAction an action, which is checked on validity - /// \param theFeature a feature that provides error information - bool canProcessClick(QAction* theAction, const FeaturePtr& theFeature); - -public slots: - /// Reimplemented from ModuleBase_ErrorMgr::onValidationStateChanged(). - //virtual void onValidationStateChanged(); + /// 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 updates the action state according to the given parameter + /// Stores initial values of accept/accept all tool/status tip to internal containers + void storeInitialActionValues(); + + /// It disables the propety panel Accept 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 theFeature an feature that corresponds to the action - void updateActionState(QAction* theAction, const FeaturePtr& theFeature); + /// \param theError an error state + void updateAcceptActionState(const QString& theError); - /// Returns the feature error message - /// \param theFeature a feature - /// \return the error message - //QString getFeatureError(const FeaturePtr& theFeature) const; + /// 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; + 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 + QString myAcceptStatusTip; /// cached status tip value for enabled Accept action + QString myAcceptAllStatusTip; /// cached status tip value for enabled AcceptAll action }; #endif // XGUI_ErrorMgr_H \ No newline at end of file