Salome HOME
Updated copyright comment
[modules/shaper.git] / src / ParametersPlugin / ParametersPlugin_WidgetParamsMgr.h
index 4fe132ed730dbd751b153472c6e13140000fb0e8..3ed8de8686dc6729cbddb4868d80ee5c4b95bef3 100644 (file)
@@ -1,13 +1,26 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File:        ParametersPlugin_WidgetParamsMgr.h
-// Created:     11 Apr 2016
-// Author:      Vitaly SMETANNIKOV
+// Copyright (C) 2014-2024  CEA, EDF
+//
+// 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 ParametersPlugin_WidgetParamsMgr_H_
 #define ParametersPlugin_WidgetParamsMgr_H_
 
-#include <ModuleBase_ModelWidget.h>
+#include <ModuleBase_ModelDialogWidget.h>
 #include <QModelIndex>
 #include <QAbstractItemDelegate>
 #include <QTreeWidget>
@@ -16,7 +29,7 @@ class QTreeWidgetItem;
 class ParametersPlugin_ItemDelegate;
 class QPushButton;
 class QToolButton;
-
+class ModuleBase_IWorkshop;
 
 /*!
  * \ingroup GUI
@@ -43,12 +56,13 @@ protected slots:
  * \ingroup GUI
  * Represent a content of the property panel to show/modify parameters of some feature.
  */
-class ParametersPlugin_WidgetParamsMgr : public ModuleBase_ModelWidget
+class ParametersPlugin_WidgetParamsMgr : public ModuleBase_ModelDialogWidget
 {
  Q_OBJECT
 public:
   /// Constructs a model widget
-  ParametersPlugin_WidgetParamsMgr(QWidget* theParent, const Config_WidgetAPI* theData);
+  ParametersPlugin_WidgetParamsMgr(QWidget* theParent, const Config_WidgetAPI* theData,
+    ModuleBase_IWorkshop* theWorkshop);
 
   /// Destructs the model widget
   virtual ~ParametersPlugin_WidgetParamsMgr() {}
@@ -57,6 +71,10 @@ public:
   /// \return a control list
   virtual QList<QWidget*> getControls() const;
 
+  /// Set general buttons from dialog
+  /// \param theButtons the dialog buttons
+  virtual void setDialogButtons(QDialogButtonBox* theButtons);
+
 protected:
   /// Saves the internal parameters to the given feature
   /// \return True in success
@@ -68,6 +86,10 @@ protected:
   /// The method called when widget is activated
   virtual void activateCustom();
 
+  virtual void showEvent(QShowEvent* theEvent);
+
+  virtual void hideEvent(QHideEvent* theEvent);
+
 private slots:
   /// Slot for reaction on double click in the table (start editing)
   /// \param theIndex the clicked index
@@ -87,6 +109,9 @@ private slots:
   /// Slot for reaction on remove parameter
   void onRemove();
 
+  /// Slot for reaction on import parameter
+  void onImport();
+
   /// Slot for reaction on shift up
   void onUp();
 
@@ -99,6 +124,9 @@ private slots:
   /// Slot for reaction on selection in the table
   void onSelectionChanged();
 
+  // A slot for show preview button
+  void onShowPreview();
+
 private:
   /// Creates a new parameter feature
   FeaturePtr createParameter() const;
@@ -119,19 +147,23 @@ private:
 
   void updateParametersPart();
 
+  /// Returns true if values in the widget are valid
+  bool isValid();
+
   /// Returns true if parameter with the given name already exists
-  bool hasName(const QString& theName) const;
+  bool hasName(const QString& theName, int theIndex) const;
 
   /// Enable or disable buttons for parameters managemnt
   void enableButtons(bool theEnable);
 
-  bool checkIsValid();
-
-  QList<QStringList> featuresItems(const QList<FeaturePtr>& theFeatures) const;
+  QList<QStringList> featuresItems(const QList<FeaturePtr>& theFeatures,
+                                   QList<FeaturePtr>& theFeatureList) const;
   QList<QStringList> parametersItems(const QList<FeaturePtr>& theFeatures) const;
 
   void updateParametersFeatures();
 
+  ModuleBase_IWorkshop* myWorkshop;
+
   ParametersPlugin_TreeWidget* myTable;
   QTreeWidgetItem* myFeatures;
   QTreeWidgetItem* myParameters;
@@ -144,8 +176,11 @@ private:
   QPushButton* myAddBtn;
   QPushButton* myInsertBtn;
   QPushButton* myRemoveBtn;
+  QPushButton* myImportBtn;
   QToolButton* myUpBtn;
   QToolButton* myDownBtn;
+
+  bool isUpplyBlocked;
 };