Salome HOME
Issue #6 Extended processing of nested actions.
[modules/shaper.git] / src / XGUI / XGUI_PartDataModel.cpp
index f0e1d9f4b7c0d8fc4d7e0c40f5148be514c0a995..ba5bbbea33ddeb56b71e88afd3bc741fe9ec67ff 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <QIcon>
 
-XGUI_TopDataModel::XGUI_TopDataModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent)
+XGUI_TopDataModel::XGUI_TopDataModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent)
   : XGUI_FeaturesModel(theDocument, theParent)
 {
 }
@@ -29,7 +29,7 @@ QVariant XGUI_TopDataModel::data(const QModelIndex& theIndex, int theRole) const
       return tr("Parameters");
     case ParamObject:
       {
-        std::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARAMETERS_GROUP, theIndex.row());
+        boost::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARAMETERS_GROUP, theIndex.row());
         if (aFeature)
           return aFeature->data()->getName().c_str();
       } 
@@ -37,7 +37,7 @@ QVariant XGUI_TopDataModel::data(const QModelIndex& theIndex, int theRole) const
         return tr("Constructions");
     case ConstructObject:
       {
-        std::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(CONSTRUCTIONS_GROUP, theIndex.row());
+        boost::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(CONSTRUCTIONS_GROUP, theIndex.row());
         if (aFeature)
           return aFeature->data()->getName().c_str();
       }
@@ -92,16 +92,16 @@ QModelIndex XGUI_TopDataModel::index(int theRow, int theColumn, const QModelInde
   if (!theParent.isValid()) {
     switch (theRow) {
     case 0:
-      return createIndex(theRow, theColumn, (quintptr) ParamsFolder);
+      return createIndex(theRow, theColumn, (qint32) ParamsFolder);
     case 1:
-      return createIndex(theRow, theColumn, (quintptr) ConstructFolder);
+      return createIndex(theRow, theColumn, (qint32) ConstructFolder);
     }
   } else {
     if (theParent.internalId() == ParamsFolder)
-      return createIndex(theRow, theColumn, (quintptr) ParamObject);
+      return createIndex(theRow, theColumn, (qint32) ParamObject);
 
     if (theParent.internalId() == ConstructFolder)
-      return createIndex(theRow, theColumn, (quintptr) ConstructObject);
+      return createIndex(theRow, theColumn, (qint32) ConstructObject);
   }
   return QModelIndex();
 }
@@ -114,9 +114,9 @@ QModelIndex XGUI_TopDataModel::parent(const QModelIndex& theIndex) const
   case ConstructFolder:
     return QModelIndex();
   case ParamObject:
-    return createIndex(0, 0, (quintptr) ParamsFolder);
+    return createIndex(0, 0, (qint32) ParamsFolder);
   case ConstructObject:
-    return createIndex(1, 0, (quintptr) ConstructFolder);
+    return createIndex(1, 0, (qint32) ConstructFolder);
   }
   return QModelIndex();
 }
@@ -131,33 +131,33 @@ FeaturePtr XGUI_TopDataModel::feature(const QModelIndex& theIndex) const
   switch (theIndex.internalId()) {
   case ParamsFolder:
   case ConstructFolder:
-    return 0;
+    return FeaturePtr();
   case ParamObject:
     return myDocument->feature(PARAMETERS_GROUP, theIndex.row());
   case ConstructObject:
     return myDocument->feature(CONSTRUCTIONS_GROUP, theIndex.row());
   }
-  return 0;
+  return FeaturePtr();
 }
 
 
-QModelIndex XGUI_TopDataModel::findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const
+QModelIndex XGUI_TopDataModel::findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const
 {
   QString aGroup(theFeature->getGroup().c_str());
 
   if (theFeature->getGroup().compare(PARAMETERS_GROUP) == 0)
-    return createIndex(0, 0, (quintptr) ParamsFolder);
+    return createIndex(0, 0, (qint32) ParamsFolder);
   if (theFeature->getGroup().compare(CONSTRUCTIONS_GROUP) == 0)
-    return createIndex(1, 0, (quintptr) ConstructFolder);
+    return createIndex(1, 0, (qint32) ConstructFolder);
   return QModelIndex();
 }
 
 QModelIndex XGUI_TopDataModel::findGroup(const std::string& theGroup) const
 {
   if (theGroup.compare(PARAMETERS_GROUP) == 0)
-    return createIndex(0, 0, (quintptr) ParamsFolder);
+    return createIndex(0, 0, (qint32) ParamsFolder);
   if (theGroup.compare(CONSTRUCTIONS_GROUP) == 0)
-    return createIndex(1, 0, (quintptr) ConstructFolder);
+    return createIndex(1, 0, (qint32) ConstructFolder);
   return QModelIndex();
 }
 
@@ -165,7 +165,7 @@ QModelIndex XGUI_TopDataModel::findGroup(const std::string& theGroup) const
 //******************************************************************
 //******************************************************************
 //******************************************************************
-XGUI_PartDataModel::XGUI_PartDataModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent)
+XGUI_PartDataModel::XGUI_PartDataModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent)
   : XGUI_PartModel(theDocument, theParent)
 {
 }
@@ -183,7 +183,7 @@ QVariant XGUI_PartDataModel::data(const QModelIndex& theIndex, int theRole) cons
     switch (theIndex.internalId()) {
     case MyRoot:
       {
-        std::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARTS_GROUP, myId);
+        boost::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARTS_GROUP, myId);
         if (aFeature)
           return aFeature->data()->getName().c_str();
       }
@@ -193,14 +193,14 @@ QVariant XGUI_PartDataModel::data(const QModelIndex& theIndex, int theRole) cons
       return tr("Constructions");
     case ParamObject:
       {
-        std::shared_ptr<ModelAPI_Feature> aFeature = 
+        boost::shared_ptr<ModelAPI_Feature> aFeature = 
           featureDocument()->feature(PARAMETERS_GROUP, theIndex.row());
         if (aFeature)
           return aFeature->data()->getName().c_str();
       }
     case ConstructObject:
       {
-        std::shared_ptr<ModelAPI_Feature> aFeature = 
+        boost::shared_ptr<ModelAPI_Feature> aFeature = 
           featureDocument()->feature(CONSTRUCTIONS_GROUP, theIndex.row());
         if (aFeature)
           return aFeature->data()->getName().c_str();
@@ -258,21 +258,21 @@ int XGUI_PartDataModel::columnCount(const QModelIndex &parent) const
 QModelIndex XGUI_PartDataModel::index(int theRow, int theColumn, const QModelIndex &theParent) const
 {
   if (!theParent.isValid())
-    return createIndex(theRow, 0, (quintptr) MyRoot);
+    return createIndex(theRow, 0, (qint32) MyRoot);
 
   int aId = (int)theParent.internalId();
   switch (aId) {
   case MyRoot:
     switch (theRow) {
     case 0:
-      return createIndex(0, 0, (quintptr) ParamsFolder);
+      return createIndex(0, 0, (qint32) ParamsFolder);
     case 1:
-      return createIndex(1, 0, (quintptr) ConstructFolder);
+      return createIndex(1, 0, (qint32) ConstructFolder);
     }
   case ParamsFolder:
-    return createIndex(theRow, 0, (quintptr) ParamObject);
+    return createIndex(theRow, 0, (qint32) ParamObject);
   case ConstructFolder:
-    return createIndex(theRow, 0, (quintptr) ConstructObject);
+    return createIndex(theRow, 0, (qint32) ConstructObject);
   }
   return QModelIndex();
 }
@@ -284,11 +284,11 @@ QModelIndex XGUI_PartDataModel::parent(const QModelIndex& theIndex) const
     return QModelIndex();
   case ParamsFolder:
   case ConstructFolder:
-    return createIndex(0, 0, (quintptr) MyRoot);
+    return createIndex(0, 0, (qint32) MyRoot);
   case ParamObject:
-    return createIndex(0, 0, (quintptr) ParamsFolder);
+    return createIndex(0, 0, (qint32) ParamsFolder);
   case ConstructObject:
-    return createIndex(1, 0, (quintptr) ConstructFolder);
+    return createIndex(1, 0, (qint32) ConstructFolder);
   }
   return QModelIndex();
 }
@@ -299,9 +299,9 @@ bool XGUI_PartDataModel::hasChildren(const QModelIndex& theParent) const
 }
 
 
-std::shared_ptr<ModelAPI_Document> XGUI_PartDataModel::featureDocument() const
+boost::shared_ptr<ModelAPI_Document> XGUI_PartDataModel::featureDocument() const
 {
-  std::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARTS_GROUP, myId);
+  boost::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARTS_GROUP, myId);
   return aFeature->data()->docRef("PartDocument")->value();
 }
 
@@ -312,37 +312,37 @@ FeaturePtr XGUI_PartDataModel::feature(const QModelIndex& theIndex) const
     return myDocument->feature(PARTS_GROUP, myId);
   case ParamsFolder:
   case ConstructFolder:
-    return 0;
+    return FeaturePtr();
   case ParamObject:
     return featureDocument()->feature(PARAMETERS_GROUP, theIndex.row());
   case ConstructObject:
     return featureDocument()->feature(CONSTRUCTIONS_GROUP, theIndex.row());
   }
-  return 0;
+  return FeaturePtr();
 }
 
-bool XGUI_PartDataModel::hasDocument(const std::shared_ptr<ModelAPI_Document>& theDoc) const
+bool XGUI_PartDataModel::hasDocument(const boost::shared_ptr<ModelAPI_Document>& theDoc) const
 {
   return (featureDocument() == theDoc);
 }
 
 
-QModelIndex XGUI_PartDataModel::findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const
+QModelIndex XGUI_PartDataModel::findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const
 {
   QString aGroup(theFeature->getGroup().c_str());
 
   if (theFeature->getGroup().compare(PARAMETERS_GROUP) == 0)
-    return createIndex(0, 0, (quintptr) ParamsFolder);
+    return createIndex(0, 0, (qint32) ParamsFolder);
   if (theFeature->getGroup().compare(CONSTRUCTIONS_GROUP) == 0)
-    return createIndex(1, 0, (quintptr) ConstructFolder);
+    return createIndex(1, 0, (qint32) ConstructFolder);
   return QModelIndex();
 }
 
 QModelIndex XGUI_PartDataModel::findGroup(const std::string& theGroup) const
 {
   if (theGroup.compare(PARAMETERS_GROUP) == 0)
-    return createIndex(0, 0, (quintptr) ParamsFolder);
+    return createIndex(0, 0, (qint32) ParamsFolder);
   if (theGroup.compare(CONSTRUCTIONS_GROUP) == 0)
-    return createIndex(1, 0, (quintptr) ConstructFolder);
+    return createIndex(1, 0, (qint32) ConstructFolder);
   return QModelIndex();
-}
\ No newline at end of file
+}