Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / XGUI / XGUI_DataModel.h
index ed5652d041f24350b8d1df3c1e106f1264aaf351..9052260aa6554d85ea48355e660f655caf69f715 100644 (file)
@@ -1,9 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File:        XGUI_DataModel.h
-// Created:     21 Jul 2015
-// Author:      Vitaly SMETANNIKOV
-
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
 
 #ifndef XGUI_DataModel_H
 #define XGUI_DataModel_H
@@ -125,6 +138,9 @@ public:
   /// Initialises XML data model reader. It must be initialised before DataModel using.
   void setXMLReader(Config_DataModelReader* theReader) { myXMLReader = theReader; }
 
+  /// Do not processing anymore events of model loop
+  //bool blockEventsProcessing(const bool theState);
+
 signals:
   /// Signal about tree had been rebuilt
   void treeRebuilt();
@@ -147,7 +163,7 @@ private:
   /// folders which can not be shown non empty
   /// \param theType Type of the folder
   /// \param theDoc a document which contains this folder
-  int folderId(std::string theType, ModelAPI_Document* theDoc = 0);
+  int folderId(std::string theType, ModelAPI_Document* theDoc = 0) const;
 
   /// Removes a row from branch of tree
   /// \param theStart - start row to update indexes
@@ -160,7 +176,34 @@ private:
   /// \param fromRoot - root document flag
   QStringList listOfShowNotEmptyFolders(bool fromRoot = true) const;
 
+  void addShownFolder(DocumentPtr theDoc, QString theFolder)
+  {
+    if (!myShownFolders.contains(theDoc)) {
+      myShownFolders[theDoc] = QStringList();
+    }
+    myShownFolders[theDoc].append(theFolder);
+  }
+
+  void removeShownFolder(DocumentPtr theDoc, QString theFolder)
+  {
+    if (myShownFolders.contains(theDoc)) {
+      myShownFolders[theDoc].removeAll(theFolder);
+      if (myShownFolders[theDoc].isEmpty())
+        myShownFolders.remove(theDoc);
+    }
+  }
+
+  bool hasShownFolder(DocumentPtr theDoc, QString theFolder) const
+  {
+    if (myShownFolders.contains(theDoc))
+      return myShownFolders[theDoc].contains(theFolder);
+    return false;
+  }
+
   Config_DataModelReader* myXMLReader;
+
+  QMap<DocumentPtr, QStringList> myShownFolders;
+  //bool myIsEventsProcessingBlocked;
 };
 
 #endif
\ No newline at end of file