]> AND Private Git Repository - blast.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
insert/move/remove block/groups/interface done. Next to fo: loading project file
authorstephane Domas <stephane.domas@univ-fcomte.fr>
Thu, 27 Apr 2017 21:25:12 +0000 (23:25 +0200)
committerstephane Domas <stephane.domas@univ-fcomte.fr>
Thu, 27 Apr 2017 21:25:12 +0000 (23:25 +0200)
20 files changed:
AbstractBlock.h
BoxItem.cpp
ConnectionItem.cpp
ConnectionItem.h
Dispatcher.cpp
Dispatcher.h
FunctionalInterface.cpp
Graph.cpp
Graph.h
GroupBlock.cpp
GroupBlock.h
GroupItem.cpp
GroupScene.h
GroupWidget.cpp
MainWindow.cpp
Parameters.cpp
Parameters.h
ParametersWindow.cpp
blast.creator.user
projectfile.xsd

index 2c89cbf46083901ec11260400febffd7ae369e2e..19209b773bad2081e10be79bbd64aadfb16769f2 100644 (file)
@@ -25,6 +25,7 @@ public:
 \r
   // getters\r
   inline QString getName() { return name; }\r
+  inline int nbParameters() { return params.size(); }\r
   inline QList<BlockParameter *> getParameters() { return params; }\r
   inline QList<AbstractInterface*> getInputs() { return inputs; }\r
   inline QList<AbstractInterface*> getOutputs() { return outputs; }\r
index 0b1cd034bda7230e0ba92901800c37e9f54699af..237c7ee0f843b8f1dd05322791e69cadb3c4f6a6 100644 (file)
@@ -285,7 +285,7 @@ void BoxItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
 
   int mode = getScene()->getEditionMode();
 
-  dispatcher->setCurrentGroupWidget(getScene()->getGroupWindow());
+  dispatcher->setCurrentGroupWidget(getScene()->getGroupWidget());
 
   if ((mode == GroupScene::AddConnection) && (params->cursorState == Parameters::CursorOnInterface)) {
     InterfaceItem *inter = getInterfaceFromCursor(x,y);
@@ -368,6 +368,7 @@ void BoxItem::mouseReleaseEvent(QGraphicsSceneMouseEvent  *event) {
         params->setEditState(Parameters::EditNoOperation);
       }
       else {
+        //QMessageBox::warning(NULL,"Error","Cannot connect selected interfaces", QMessageBox::Ok);
         getScene()->setSelectedInterface(2,NULL);
         params->setEditState(Parameters::EditStartConnection);
       }
@@ -454,9 +455,10 @@ void BoxItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) {
 void BoxItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) {
 
   QMenu menu;
-  QAction* removeAction = menu.addAction("Remove");
-  QAction* duplicateAction = menu.addAction("Duplicate");
-  QAction* renameAction = menu.addAction("Rename");
+  QAction* titleAction = NULL;
+  QAction* removeAction = NULL;
+  QAction* duplicateAction = NULL;
+  QAction* renameAction = NULL;
   QAction* connectToGroup = NULL;
   QAction* disconnectFromGroup = NULL;
   QAction* showProperties = NULL;
@@ -466,48 +468,81 @@ void BoxItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) {
   QAction* showParameters = NULL;
 
   InterfaceItem* ifaceItem = getInterfaceFromCursor(event->pos().x(), event->pos().y());
+  // menu for interface
   if( ifaceItem != NULL){
+
+    titleAction = menu.addAction("Interface operations");
+    titleAction->setEnabled(false);
+    menu.addSeparator();
+
+
     showProperties = menu.addAction("Show properties");
+    renameAction = menu.addAction("Rename");
 
     ConnectedInterface* iface = ifaceItem->refInter;
     ConnectedInterface* ifaceGroup = NULL;
+    bool canRemove = true;
 
 
     if ((iface->getDirection() == AbstractInterface::Input) && (iface->getConnectedFrom() == NULL)) {
         connectToGroup = menu.addAction("Connect to group input");
     }
-    else if ((iface->getDirection() == AbstractInterface::Output) && (!iface->isConnectedTo())) {
+    else if ((iface->getDirection() == AbstractInterface::Output) && (iface->getConnectionToParentGroup() == NULL)) {
       connectToGroup = menu.addAction("Connect to group output");
     }
     else if (iface->getConnectionFromParentGroup() != NULL) {
       ifaceGroup = iface->getConnectionFromParentGroup();
-      if ((!ifaceGroup->isConnectedFrom()) || (!ifaceGroup->isConnectedTo())) {
+      //if ((!ifaceGroup->isConnectedFrom()) || (!ifaceGroup->isConnectedTo())) {
+      if (!ifaceGroup->isConnectedFrom()) {
         disconnectFromGroup = menu.addAction("Disconnect from group");
       }
+      else {
+        canRemove = false;
+      }
     }
     else if (iface->getConnectionToParentGroup() != NULL) {
       ifaceGroup = iface->getConnectionToParentGroup();
-      if ((!ifaceGroup->isConnectedFrom()) || (!ifaceGroup->isConnectedTo())) {
+      //if ((!ifaceGroup->isConnectedFrom()) || (!ifaceGroup->isConnectedTo())) {
+      if (!ifaceGroup->isConnectedTo()) {
         disconnectFromGroup = menu.addAction("Disconnect from group");
       }
+      else {
+        canRemove = false;
+      }
     }
 
     if (iface->isFunctionalInterface()) {
       FunctionalInterface* fi = AI_TO_FUN(ifaceItem->refInter);
       ReferenceInterface* ri = (ReferenceInterface*)(fi->getReference());
       if(ri->getMultiplicity() == -1 || ri->getMultiplicity() > 1){
-        cloneInterface = menu.addAction("Clone interface");
-      }
+        cloneInterface = menu.addAction("Duplicate");
+        if ((canRemove) && (fi->getInterfaceMultiplicity() > 1)) {
+          removeAction = menu.addAction("Remove");
+        }
+      }      
     }
   }
-  if(refBlock->isGroupBlock()){
-    openWindow = menu.addAction("Open/show group window");
-  } else {
-    showRstClkInter = menu.addAction("Show reset/clock interfaces");
-    showRstClkInter->setCheckable(true);
-    showRstClkInter->setChecked(rstClkVisible);
+  // menu for blocks (group or func)
+  else {
+    titleAction = menu.addAction("Block operations");
+    titleAction->setEnabled(false);
+    menu.addSeparator();
+
+    if (refBlock->nbParameters() > 0) {
+      showParameters = menu.addAction("Show parameters");
+    }
+    renameAction = menu.addAction("Rename");
 
-    showParameters = menu.addAction("Show parameters");
+    if(refBlock->isGroupBlock()){
+      openWindow = menu.addAction("Open/show group window");
+    }
+    else {
+      duplicateAction = menu.addAction("Duplicate");
+      showRstClkInter = menu.addAction("Show reset/clock interfaces");
+      showRstClkInter->setCheckable(true);
+      showRstClkInter->setChecked(rstClkVisible);
+    }
+    removeAction = menu.addAction("Remove");
   }
 
   QAction* selectedAction = NULL;
@@ -516,16 +551,21 @@ void BoxItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) {
   if(selectedAction == NULL) return ;
 
   if (selectedAction == removeAction) {
-    dispatcher->removeBlock(this);
+    if(ifaceItem != NULL) {
+     dispatcher->removeBlockInterface(ifaceItem);
+    }
+    else {
+      dispatcher->removeBlock(this);
+    }
   }
   else if (selectedAction == duplicateAction) {
     dispatcher->duplicateBlock(this);
   }
   else if(selectedAction == renameAction){
     if(ifaceItem != NULL)
-      dispatcher->rename(ifaceItem);
+      dispatcher->renameInterface(ifaceItem);
     else
-      dispatcher->rename(this);
+      dispatcher->renameBlockOrGroup(this);
   }
   else if(selectedAction == showProperties){
     dispatcher->showProperties(ifaceItem);
index b6d99a5a42083a0e6dcc5d630786caa7a35e6468..eaf46c22482f751fd926dae6b02dd068f0fc60ec 100644 (file)
@@ -727,13 +727,37 @@ void ConnectionItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
 }
 
 void ConnectionItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) {
-  QMenu menu;
-  QAction* removeAction = menu.addAction("Remove");
-  QAction * selectedAction= menu.exec(event->screenPos());
+  /* have to check if the connection can be removed.
+     If the from or to InterfaceItem is owned by a group item, and this item
+     is both connected to and from, thus it is impossible to remove this connection
+   */
+  bool canRemove = true;
+  InterfaceItem* groupIfaceItem = NULL;
+  if (fromInterfaceItem->getOwner()->isGroupItem()) {
+    groupIfaceItem = fromInterfaceItem;
+  }
+  else if (toInterfaceItem->getOwner()->isGroupItem()) {
+    groupIfaceItem = toInterfaceItem;
+  }
+
+  if (groupIfaceItem != NULL) {
+    ConnectedInterface* ref = groupIfaceItem->refInter;
+    if ((ref->isConnectedFrom()) && (ref->isConnectedTo())) {
+      canRemove = false;
+    }
+  }
 
-  if(selectedAction == removeAction){
-    dispatcher->removeConnection(this);
-    dispatcher->removeUselessGroupInterfaces();
+  if (canRemove) {
+    QMenu menu;
+    QAction* titleAction = menu.addAction("Connection operations");
+    titleAction->setEnabled(false);
+    menu.addSeparator();
+    QAction* removeAction = menu.addAction("Remove");
+    QAction * selectedAction= menu.exec(event->screenPos());
+
+    if(selectedAction == removeAction){
+      dispatcher->removeConnection(this);
+    }
   }
 }
 
index 867e8110d145e38c72484bac002ed7e61620f701..6370c90d31ec3b6ed62effbae538d9e6d703baab 100644 (file)
@@ -10,6 +10,7 @@
 class Dispatcher;
 class Parameters;
 class InterfaceItem;
+class GroupScene;
 
 using namespace std;
 using namespace Qt;
@@ -51,6 +52,7 @@ public:
 
   void prepareChange();
 
+  inline GroupScene* getScene() { return (GroupScene*)(scene()); }
   inline InterfaceItem* getToInterfaceItem(){ return toInterfaceItem; }
   inline void setToInterfaceItem(InterfaceItem *iface){ toInterfaceItem = iface; }
   inline InterfaceItem* getFromInterfaceItem(){ return fromInterfaceItem; }
index 810396ef52e4ac45564c3cf48c233e7bbfb85d91..b191651df14951e2d3a1b3a6bbb7d692163338e6 100644 (file)
@@ -179,10 +179,14 @@ void Dispatcher::changeConnectionMode(int mode){
   */
 }
 
-void Dispatcher::rename(AbstractBoxItem *item){
+void Dispatcher::renameBlockOrGroup(AbstractBoxItem *item){
+  static QString fctName = "Dispatcher::renameBlockOrGroup()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
 
   bool ok;
-  QString text = QInputDialog::getText(NULL, "Rename an element",
+  QString text = QInputDialog::getText(NULL, "Rename an block/group",
                                        "New name:", QLineEdit::Normal,
                                        item->getRefBlock()->getName(), &ok);
 
@@ -204,12 +208,17 @@ void Dispatcher::rename(AbstractBoxItem *item){
       QMessageBox::warning(NULL,"Error in given name",
                            "the element name must be shorter than 30 characters and can't be empty!",
                            QMessageBox::Ok);
-      rename(item);
+      renameBlockOrGroup(item);
     }
   }
 }
 
-void Dispatcher::rename(InterfaceItem *item){
+void Dispatcher::renameInterface(InterfaceItem *item) {
+  static QString fctName = "Dispatcher::renameInterface()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
+
   bool ok;
   QString text = QInputDialog::getText(NULL, "Rename an interface",
                                        "New name:", QLineEdit::Normal,
@@ -232,13 +241,17 @@ void Dispatcher::rename(InterfaceItem *item){
     QMessageBox::warning(NULL,"Error in given name",
                          "the interface name must be shorter than 30 characters and can't be empty!",
                          QMessageBox::Ok);
-    rename(item);
+    renameInterface(item);
   }
 }
 
 void Dispatcher::duplicateBlock(BoxItem *item){
+  static QString fctName = "Dispatcher::duplicateBlock()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
 
-  GroupScene *scene = params->getCurrentScene();
+  GroupScene *scene = item->getScene();
   AbstractBlock* block = item->getRefBlock();  
   AbstractBlock *newBlock;
 
@@ -255,7 +268,12 @@ void Dispatcher::duplicateBlock(BoxItem *item){
   }
 }
 
-void Dispatcher::duplicateInterface(InterfaceItem *item){
+void Dispatcher::duplicateInterface(InterfaceItem *item) {
+  static QString fctName = "Dispatcher::duplicateInterface()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
+
   AbstractInterface *refI = item->refInter;
   if (! refI->isFunctionalInterface()) return;
 
@@ -277,14 +295,25 @@ void Dispatcher::duplicateInterface(InterfaceItem *item){
 
 
 void Dispatcher::addBlock(int idCategory, int idBlock, int idScene) {
+  static QString fctName = "Dispatcher::addBlock()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
 
   GroupScene *scene = searchSceneById(idScene);
-  FunctionalBlock* newOne = params->addFunctionalBlock(idCategory, idBlock);  
+  ReferenceBlock* ref = params->getReferenceBlock(idCategory,idBlock);
+  GroupBlock* group = AB_TO_GRP(scene->getGroupItem()->getRefBlock());
+  FunctionalBlock* newOne = params->getGraph()->addFunctionalBlock(group, ref);
   scene->createBlockItem(newOne);
+  params->unsaveModif = true;
 }
 
 
 GroupWidget *Dispatcher::createTopScene(){
+  static QString fctName = "Dispatcher::createTopScene()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
 
   // creating the model part of the group
   Graph* graph = params->createGraph();
@@ -314,7 +343,32 @@ GroupWidget *Dispatcher::createTopScene(){
   return topGroup;
 }
 
+void Dispatcher::addNewEmptyGroup(GroupScene* scene) {
+  static QString fctName = "Dispatcher::addNewEmptyGroup();";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
+
+  // getting the parent block in the graph
+  GroupBlock* parent = AB_TO_GRP(scene->getGroupItem()->getRefBlock());
+  cout << "new group : parent = "<< qPrintable(parent->getName()) << endl;
+  GroupBlock* groupBlock = params->getGraph()->createChildBlock(parent);
+  cout << "new group : child = "<< qPrintable(groupBlock->getName()) << ", child of " << qPrintable(groupBlock->getParent()->getName()) << endl;
+  // creating the BlockItem in the scene
+  BoxItem* newItem = scene->createBlockItem(groupBlock);
+
+  params->unsaveModif = true;
+
+  GroupWidget* child = createChildScene(scene->getGroupWidget(),newItem);
+  child->show();
+
+}
+
 GroupWidget *Dispatcher::createChildScene(GroupWidget* parentWidget, BoxItem *upperItemOfGroupItem) {
+  static QString fctName = "Dispatcher::createChildScene()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
 
   // getting back the goup block already created
   GroupBlock* groupBlock = NULL;
@@ -337,21 +391,51 @@ GroupWidget *Dispatcher::createChildScene(GroupWidget* parentWidget, BoxItem *up
   return group;
 }
 
-void Dispatcher::showRaiseWindow(AbstractBoxItem *item) {
-  GroupWidget* win = item->getScene()->getGroupWindow();
-  if (win->isTopGroup()) {
-    mainWindow->show();
-    mainWindow->raise();
+void Dispatcher::destroyScene(GroupScene *scene) {
+  foreach(GroupScene* s, scene->getChildrenScene()) {
+    destroyScene(s);
+  }
+
+  if (scene->getNbChildScene() == 0) {
+    // remove scene from the parent list
+    scene->getParentScene()->removeChildScene(scene);
+    // destroy the GroupWidget
+    groupList.removeAll(scene->getGroupWidget());
+    scene->getGroupWidget()->deleteLater();
   }
   else {
-    win->show();
-    win->raise();
+    cerr << "Abnormal case when destroying a scene" << endl;
+  }
+}
+
+void Dispatcher::showRaiseWindow(BoxItem *item) {
+  static QString fctName = "Dispatcher::showRaiseWindow()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
+
+  cout << "raising child scene of " << qPrintable(item->getRefBlock()->getName()) << endl;
+  GroupItem* child = item->getChildGroupItem();
+  if (child == NULL) {
+    cerr << "abnormal case: child group item is null " << endl;
+    return;
   }
+
+  GroupWidget* win = child->getScene()->getGroupWidget();
+
+  win->showNormal();
+  win->raise();
+  win->activateWindow();
+
   currentGroup = win;
   params->setCurrentScene(currentGroup->getScene());
 }
 
 void Dispatcher::showRstClkInter(AbstractBoxItem *item) {
+  static QString fctName = "Dispatcher::showRstClkInter()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
 
   item->setRstClkVisible(!item->isRstClkVisible());
   item->resetInterfacesPosition();
@@ -360,6 +444,11 @@ void Dispatcher::showRstClkInter(AbstractBoxItem *item) {
 }
 
 void Dispatcher::addNewFullGroup() {
+  static QString fctName = "Dispatcher::addNewFullGroup()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
+
 
 #ifdef DEBUG_INCLFUN
 
@@ -515,88 +604,162 @@ void Dispatcher::addNewFullGroup() {
 #endif
 }
 
-void Dispatcher::removeBlock(AbstractBoxItem *item) {
-
-#ifdef DEBUG_INCLFUN
-
-  GroupScene *scene = params->getCurrentScene();
-  AbstractBlock* block = item->getRefBlock();
-  if (block->isReferenceBlock()) return;
-
-  GroupBlock* group = (GroupBlock*)item->getParentItem()->getRefBlock();
+void Dispatcher::removeBlock(BoxItem *item) {
+  static QString fctName = "Dispatcher::removeBlock()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
 
-  removeConnections(item);
+  /* a BoxItem (group of func) can be removed only if none of its
+     interfaces is connected to a group interface that is itself
+     connected to another one.
+  */
+  bool canRemove = true;
 
-  //récupérer l'objet
-  group->removeBlock(block);
+  foreach(InterfaceItem* ifaceItem, item->getInterfaces()) {
+    foreach(ConnectionItem* conn, ifaceItem->connections) {
+      InterfaceItem* other = NULL;
+      if (conn->getFromInterfaceItem() == ifaceItem) {
+        other = conn->getToInterfaceItem();
+      }
+      else {
+        other = conn->getFromInterfaceItem();
+      }
 
-  //remove the associated window
-  if(block->isGroupBlock()){
-    foreach(QWidget *window, params->windows){
-      if(!window->inherits("MainWindow")){
-        if(((GroupWidget*)window)->getScene()->getGroupItem()->getRefBlock() == block){
-          params->removeWindow(window);
-          delete window;
+      if (other->getOwner()->isGroupItem()) {
+        ConnectedInterface* ref = other->refInter;
+        if ((ref->isConnectedFrom()) && (ref->isConnectedTo())) {
+          canRemove = false;
         }
       }
     }
   }
+  if (!canRemove) {
+    QMessageBox::warning(NULL,"Forbidden operation",
+                         "The block has at least one connection to a group interface that is totally connected.",
+                         QMessageBox::Ok);
+    return;
+  }
 
-  delete block;
+  QString msg = "";
+  if (item->getRefBlock()->isFunctionalBlock()) {
+    msg = "Removing block ";
+  }
+  else {
+     msg = "Removing group ";
+  }
+  msg += item->getRefBlock()->getName();
+  msg += " and all its connections.\n\nAre you sure ?";
 
-  //supprimer l'item de la scène
-  cout << "dispatcher : remove item of scene " << params->currentWindow << endl;
-  ((GroupItem *)scene->getGroupItem())->removeBlockItem(item);
-  scene->removeItem(item);
-  scene->removeBlockItem(item);
-  delete item;
+  int ret = QMessageBox::question(NULL,"Removing functional block",msg, QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);
+  if (ret == QMessageBox::Cancel) {
+    return;
+  }
+  removeAllBlockConnections(item);
 
-  ((GroupItem *)scene->getGroupItem())->updateShape();
+  if (item->getRefBlock()->isFunctionalBlock()) {
+    FunctionalBlock* block = AB_TO_FUN(item->getRefBlock());
+    GroupBlock* group = AB_TO_GRP(block->getParent());
+    item->getScene()->removeBlockItem(item);
+    params->getGraph()->removeFunctionalBlock(block,group);
+  }
+  else if (item->getRefBlock()->isGroupBlock()) {
 
-  params->updateToolbar();
-  params->unsaveModif = true;
+    GroupBlock* group = AB_TO_GRP(item->getRefBlock());
 
-#endif
+    // remove all child scenes recursively
+    GroupItem* subgroup = item->getChildGroupItem();
+    destroyScene(subgroup->getScene());
+    // remove the BoxItem
+    item->getScene()->removeBlockItem(item);
+    // remove the group from the graph
+    params->getGraph()->removeGroupBlock(group);
+  }
 }
 
-void Dispatcher::removeAllBlockConnections(AbstractBoxItem *block) {
+void Dispatcher::removeAllBlockConnections(BoxItem *item) {
+  static QString fctName = "Dispatcher::removeAllBlockConnection()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
 
-  GroupScene* scene = block->getScene();
-  // supprimer les connections associées au bloc
-  foreach (ConnectionItem *conn, scene->getConnectionItems()) {
-    if(conn->getToInterfaceItem()->owner == block || conn->getFromInterfaceItem()->owner == block){
+  foreach(InterfaceItem* ifaceItem, item->getInterfaces()) {
+    foreach(ConnectionItem* conn, ifaceItem->connections) {
       removeConnection(conn);
     }
   }
-  scene->getGroupItem()->updateInterfacesAndConnections();
 }
 
 void Dispatcher::removeConnection(ConnectionItem *conn) {
+  static QString fctName = "Dispatcher::removeConnection()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
+  InterfaceItem* fromIfaceItem = conn->getFromInterfaceItem();
+  InterfaceItem* toIfaceItem = conn->getToInterfaceItem();
 
-  GroupScene *scene = params->getCurrentScene();
-  GroupItem* currentGroup = scene->getGroupItem();
+#ifdef DEBUG
+  cout << "remove connection from " << qPrintable(fromIfaceItem->refInter->getName()) << " to " << qPrintable(toIfaceItem->refInter->getName()) << endl;
+#endif
+
+  InterfaceItem* groupIfaceItem = NULL; // in case of one of the two interface belongs to the GroupItem
+  GroupItem* groupItem = NULL;
 
-  conn->getFromInterfaceItem()->unconnectTo(conn->getToInterfaceItem());  
+  if (fromIfaceItem->getOwner()->isGroupItem()) {
+    groupIfaceItem = fromIfaceItem;
+    groupItem = toIfaceItem->getOwner()->getScene()->getGroupItem();
+  }
+  else if (toIfaceItem->getOwner()->isGroupItem()) {
+    groupIfaceItem = toIfaceItem;
+    groupItem = fromIfaceItem->getOwner()->getScene()->getGroupItem();
+  }
+  else {
+    groupItem = fromIfaceItem->getOwner()->getScene()->getGroupItem();
+  }
 
-  scene->removeConnectionItem(conn);
-  delete conn;
+  // removing the connection from graph
+#ifdef DEBUG
+  cout << "removing connections from graph ..." ;
+#endif
+  ConnectedInterface *fromInter = fromIfaceItem->refInter;
+  ConnectedInterface *toInter = toIfaceItem->refInter;
+  if (fromInter->getDirection() == AbstractInterface::InOut) {
+    fromInter->clearConnectedTo();
+    fromInter->clearConnectedFrom();
+    toInter->clearConnectedTo();
+    toInter->clearConnectedFrom();
+  }
+  else {
+    fromInter->removeConnectedTo(toInter);
+    toInter->clearConnectedFrom();
+  }
+#ifdef DEBUG
+  cout << "done." << endl ;
+#endif
 
-  currentGroup->updateInterfacesAndConnections();
-  params->unsaveModif = true;
-}
+  // removing the connection from scene
+#ifdef DEBUG
+  cout << "removing connections from scene ..." ;
+#endif
+  fromIfaceItem->removeConnectionItem(conn);
+  toIfaceItem->removeConnectionItem(conn);
+  groupItem->getScene()->removeConnectionItem(conn);
 
-void Dispatcher::removeUselessGroupInterfaces() {
+#ifdef DEBUG
+  cout << "done." << endl ;
+#endif
 
-  GroupScene *scene = params->getCurrentScene();
-  GroupItem* currentGroup = scene->getGroupItem();
+  if (groupIfaceItem != NULL) {
+    ConnectedInterface* groupInter = groupIfaceItem->refInter;
+    groupItem->removeInterface(groupIfaceItem);
 
-  foreach(InterfaceItem *inter, currentGroup->getInterfaces()) {
-    if(inter->refInter->getConnectedTo().length() == 0) {
-      // NB : remove from view also remove from model
-      currentGroup->removeInterface(inter);           
+    BoxItem* parent2Item = groupItem->getParentItem();
+    if (parent2Item != NULL) {
+      InterfaceItem* group2IfaceItem = parent2Item->searchInterfaceByRef(groupInter);
+      parent2Item->removeInterface(group2IfaceItem);
     }
+    groupInter->getOwner()->removeInterface(groupInter);
   }
-  scene->updateConnectionItemsShape();
 }
 
 void Dispatcher::showBlocksLibrary(){
@@ -691,7 +854,7 @@ void Dispatcher::disconnectInterFromGroup(InterfaceItem *item) {
 
   if (refInter->getDirection() == AbstractInterface::Output) {
     groupInter = refInter->getConnectionToParentGroup(); // must be a single connection to
-    refInter->clearConnectedTo();
+    refInter->removeConnectedTo(groupInter);
     groupInter->clearConnectedFrom();
   }
   else if (refInter->getDirection() == AbstractInterface::Input) {
@@ -768,6 +931,28 @@ void Dispatcher::disconnectInterFromGroup(InterfaceItem *item) {
 #endif
 
 }
+void Dispatcher::removeBlockInterface(InterfaceItem *item) {
+  static QString fctName = "Dispatcher::removeBlockInterface()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
+
+  /* first, remove all connections from item
+     NB:  if there is a connection to a group interface, then this
+     method should not be called if the group interface is also
+     connected to another interface. Normally, this is not possible
+     because such a check is done when creating the contextual menu
+     that allows to remove an interface.
+   */
+  foreach(ConnectionItem* conn, item->connections) {
+    removeConnection(conn);
+  }
+
+  ConnectedInterface* ref = item->refInter;
+  item->getOwner()->removeInterface(item);
+  FunctionalBlock* fun = AB_TO_FUN(ref->getOwner());
+  fun->removeInterface(ref);
+}
 
 void Dispatcher::removeGroupInterface(InterfaceItem *item) {
   static QString fctName = "Dispatcher::removeGroupInterface()";
index fa773600d4e7356a9368838c3768811750126a1d..fd61087b3e0f053624eb540e1ca48e39761d0410 100644 (file)
@@ -37,13 +37,14 @@ public:
   void unselectAllItems(int direction=0);
   void setCurrentGroupWidget(GroupWidget *win);
   void changeConnectionMode(int mode = -1);
-  void rename(AbstractBoxItem* item);
-  void rename(InterfaceItem* item);
+
+
   GroupWidget* createTopScene();
   GroupWidget* createChildScene(GroupWidget* parentWidget, BoxItem* upperItemOfGroupItem = NULL);
-  void showRaiseWindow(AbstractBoxItem *item);
+  void destroyScene(GroupScene* scene);
+  void showRaiseWindow(BoxItem *item);
   void showRstClkInter(AbstractBoxItem *item);
-  void addNewEmptyGroup();
+  void addNewEmptyGroup(GroupScene *scene);
   void addNewFullGroup();  
 
   inline GroupWidget* getCurrentGroup() { return currentGroup; }
@@ -58,21 +59,64 @@ public slots:
   GroupItem* searchGroupItemById(int id);
   InterfaceItem* searchInterfaceItemById(int id);
 
-  void removeBlock(AbstractBoxItem* item);
+  // block ops
+  void addBlock(int idCategory, int idBlock, int idScene);
+  void removeBlock(BoxItem* item);
   void duplicateBlock(BoxItem* item);
+  void renameBlockOrGroup(AbstractBoxItem* item);
+
+  // interface ops
+  /*!
+   * \brief connectInterToGroup
+   * \param item item is always owned by a BoxItem
+   *
+   * This method is called only when the user right clicks on an InterfaceItem (that belongs
+   * to a BoxItem and if it is NOT connected to an InterfaceItem of the GroupItem) and chooses
+   * connect to group in the contextual menu.
+   * Thus, parameter item is always owned by a BoxItem
+   */
+  void connectInterToGroup(InterfaceItem* item);
+  /*!
+   * \brief disconnectInterFromGroup
+   * \param item item is always owned by a BoxItem
+   *
+   * This method is called only when the user right clicks on an InterfaceItem (that belongs
+   * to a BoxItem and if it IS connected to an InterfaceItem of the GroupItem) and chooses
+   * disconnect from group in the contextual menu.
+   * Thus, parameter item is always owned by a BoxItem
+   */
+  void disconnectInterFromGroup(InterfaceItem* item);
+  /*!
+   * \brief removeBlockInterface
+   * \param item item is always owned by a BoxItem
+   *
+   * This method is called only when the user right clicks on an InterfaceItem (that belongs
+   * to a BoxItem and has a multiplicity > 1) and chooses remove in the contextual menu.
+   * Thus, parameter item is always owned by a BoxItem
+   */
+  void removeBlockInterface(InterfaceItem* item);
+  /*!
+   * \brief removeGroupInterface
+   * \param item item is always owned by a GroupItem
+   *
+   * This method is called only when the user right clicks on an InterfaceItem (that belongs
+   * to a GroupItem and if it is connected only to an inner interface) and chooses remove in the contextual menu.
+   * Thus, parameter item is always owned by a GroupItem
+   */
+  void removeGroupInterface(InterfaceItem* item);
   void duplicateInterface(InterfaceItem* item);
-  void addBlock(int idCategory, int idBlock, int idScene);
+  void showProperties(InterfaceItem *inter);
+  void renameInterface(InterfaceItem* item);
+
+  // connection ops
   ConnectionItem *addConnection(InterfaceItem *input, InterfaceItem *output);
-  void removeAllBlockConnections(AbstractBoxItem *block);
+  void removeAllBlockConnections(BoxItem *item);
   void removeConnection(ConnectionItem *conn);
-  void removeUselessGroupInterfaces();
+
+
+  // others
   void showBlocksLibrary();
-  void showProperties(InterfaceItem *inter);
-  void connectInterToGroup(InterfaceItem* item);
-  void disconnectInterFromGroup(InterfaceItem* item);
-  void removeGroupInterface(InterfaceItem* item);
 
-  void addConnection();
 
   void closeCurrentProject();
 
index cc9f7658c7ab083b8fe2bfbb87cea71012e6d2c5..bce7ca1f3d1293d7f66f453a6d22a44cb0966458 100644 (file)
@@ -65,10 +65,10 @@ int FunctionalInterface::getInterfaceMultiplicity() {
     return -1;\r
   }\r
   else if ( reference->getMultiplicity() == -1) {\r
-    return ifaceCount+1;\r
+    return ifaceCount;\r
   }\r
-  else if ( reference->getMultiplicity() > ifaceCount) {\r
-    return ifaceCount+1;\r
+  else if ( ifaceCount < reference->getMultiplicity()) {\r
+    return ifaceCount;\r
   }\r
   return -1;\r
 }\r
@@ -82,7 +82,7 @@ AbstractInterface *FunctionalInterface::clone() {
   inter->setPurpose(purpose);\r
   inter->setLevel(level);  \r
   inter->connectFrom(NULL);\r
-  inter->setName(reference->getName()+"_"+QString::number(id));\r
+  inter->setName(reference->getName()+"_"+QString::number(id+1));\r
   return inter;\r
 }\r
 \r
index 1c8712337d1c771545e8be61a6397ac75e32dfa7..8cd0f99904f7f31f764810ce8a03d9e7615f8bf2 100644 (file)
--- a/Graph.cpp
+++ b/Graph.cpp
@@ -29,3 +29,13 @@ FunctionalBlock* Graph::addFunctionalBlock(GroupBlock* group, ReferenceBlock* re
 
   return newBlock;
 }
+
+bool Graph::removeFunctionalBlock(FunctionalBlock* block, GroupBlock *group) {
+  group->removeBlock(block);
+}
+
+bool Graph::removeGroupBlock(GroupBlock *group) {
+  group->removeAllBlocks();
+  GroupBlock* parent = AB_TO_GRP(group->getParent());
+  parent->removeBlock(group);
+}
diff --git a/Graph.h b/Graph.h
index 7f34682fa35f0cfe732ac4aa39328d3a3178b65d..723e8eb33aaa232fa52ea9144c4f3b72bd02f292 100644 (file)
--- a/Graph.h
+++ b/Graph.h
@@ -26,6 +26,8 @@ public:
 
   GroupBlock* createChildBlock(GroupBlock* parent);
   FunctionalBlock* addFunctionalBlock(GroupBlock *group, ReferenceBlock *ref);
+  bool removeFunctionalBlock(FunctionalBlock* block, GroupBlock *group);
+  bool removeGroupBlock(GroupBlock *group);
 
 private:  
   GroupBlock* topGroup;
index 4ec7f6bbe45d717fc51620a545a9a3d6dc21d51e..74ec197086d458f9e7e0ddb3f2033c6aaba1bb8e 100644 (file)
@@ -40,9 +40,22 @@ void GroupBlock::setParent(AbstractBlock *_parent) {
     topGroup = false;
   }
 }
+void GroupBlock::removeAllBlocks() {
+  foreach(AbstractBlock* block, blocks) {
+    if (block->isGroupBlock()) {
+      GroupBlock* group = AB_TO_GRP(block);
+      group->removeAllBlocks();
+    }
+    removeBlock(block);
+  }
+}
 
 void GroupBlock::removeBlock(AbstractBlock* block) {
-    blocks.removeAll(block);
+  /* CAUTION: no check is done if the block has connected interface
+     or not. Thus, they must be deleted elsewhere.
+  */
+  blocks.removeAll(block);
+  delete block;
 }
 
 void GroupBlock::parametersValidation(QList<AbstractBlock *> *checkedBlocks, QList<AbstractBlock *> *blocksToConfigure) {
index 33166377d639462d47b9dd3d5f0b939cb7e871a5..5a032368946e548d802f251c91931624d4137f49 100644 (file)
@@ -21,7 +21,7 @@ public:
   virtual ~GroupBlock();
 
   // getters
-
+  inline QList<AbstractBlock*> getBlocks() { return blocks; }
   // setters
   void setParent(AbstractBlock *_parent);
 
@@ -32,6 +32,7 @@ public:
   // others
   inline void addBlock(AbstractBlock* block) { blocks.append(block); }
   void removeBlock(AbstractBlock* block);
+  void removeAllBlocks();
   void parametersValidation(QList<AbstractBlock *> *checkedBlocks, QList<AbstractBlock*>* blocksToConfigure);  
   void addGenericParameter(QString name, QString type, QString value);
   void removeGenericParameter(QString name);
@@ -40,7 +41,7 @@ public:
 
 private:  
   bool topGroup;  
-  QList<AbstractBlock*> blocks; // contains instances of FunctionalBlock or GroupBlock
+  QList<AbstractBlock*> blocks; // contains instances of FunctionalBlock or GroupBlock that are children of this group
 
 };
 
index bb26e53b17c42e64995373dfa6f75c91ede37caa..fa341b268d166c1de4bee34a0a2b90f3d9b3e061 100644 (file)
@@ -9,6 +9,7 @@
 #include "AbstractInterface.h"
 #include "ConnectedInterface.h"
 #include "GroupScene.h"
+#include "ParametersWindow.h"
 
 
 GroupItem::GroupItem(BoxItem *_parentItem,
@@ -17,6 +18,9 @@ GroupItem::GroupItem(BoxItem *_parentItem,
                      Parameters *_params) throw(Exception) :AbstractBoxItem( _refBlock, _dispatcher, _params) {
 
   parentItem = _parentItem;
+  if (parentItem != NULL) {
+    parentItem->setChildGroupItem(this);
+  }
 
   /*
   minimumBoxWidth = nameWidth+2*nameMargin;
@@ -337,7 +341,7 @@ void GroupItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
 
   int mode = getScene()->getEditionMode();
 
-  dispatcher->setCurrentGroupWidget(getScene()->getGroupWindow());
+  dispatcher->setCurrentGroupWidget(getScene()->getGroupWidget());
 
   /* NOTE : commneted because group interface are normally
      created and the connected directly to a block within
@@ -500,12 +504,19 @@ void GroupItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
 
 void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
   QMenu menu;
+  QAction* titleAction = NULL;
   QAction* showProperties = NULL;
   QAction* removeAction = NULL;
   QAction* renameAction = NULL;
+  QAction* showParameters = NULL;
 
   InterfaceItem* ifaceItem = getInterfaceFromCursor(event->pos().x(), event->pos().y());
-  if( ifaceItem != NULL){
+
+  // menu for interface
+  if( ifaceItem != NULL) {
+    titleAction = menu.addAction("Interface operations");
+    titleAction->setEnabled(false);
+    menu.addSeparator();
     showProperties = menu.addAction("Show properties");
     renameAction = menu.addAction("Rename");
     menu.addSeparator();
@@ -520,6 +531,13 @@ void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
     }
   }
   else {
+    titleAction = menu.addAction("Block operations");
+    titleAction->setEnabled(false);
+    menu.addSeparator();
+
+    if (refBlock->nbParameters() > 0) {
+      showParameters = menu.addAction("Show parameters");
+    }
     renameAction = menu.addAction("Rename");
   }
   QAction* selectedAction = menu.exec(event->screenPos());
@@ -528,16 +546,19 @@ void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
 
   if(selectedAction == renameAction){
     if(ifaceItem != NULL)
-      dispatcher->rename(ifaceItem);
+      dispatcher->renameInterface(ifaceItem);
     else
-      dispatcher->rename(this);
+      dispatcher->renameBlockOrGroup(this);
   }
   else if(selectedAction == showProperties){
     dispatcher->showProperties(ifaceItem);
-  }
+  }  
   else if (selectedAction == removeAction) {
     dispatcher->removeGroupInterface(ifaceItem);
   }
+  else if(selectedAction == showParameters) {
+    new ParametersWindow(refBlock, params, NULL);
+  }
 }
 
 InterfaceItem* GroupItem::isHoverInterface(QPointF point) {
index 307830529e078d645c8759ae020e7933b743882a..e7b42ecb1c008c792920891b3ed8e1b25223ed15 100644 (file)
@@ -51,7 +51,8 @@ public:
   inline QList<BoxItem*> getBlockItems() { return blockItems; }
   inline QList<ConnectionItem*> getConnectionItems() { return connectionItems; }
   inline QList<GroupScene*> getChildrenScene() { return childrenScene; }
-  inline GroupWidget* getGroupWindow() { return window; }
+  inline GroupScene* getParentScene() { return parentScene; }
+  inline GroupWidget* getGroupWidget() { return window; }
   inline int getId() { return id; }
   inline EditMode getEditionMode() { return editMode; }
   InterfaceItem* getSelectedInterface(int id);
@@ -77,6 +78,8 @@ public:
   void removeConnectionItem(ConnectionItem* item);
   void removeGroupItem();
   inline void addChildScene(GroupScene* child) { childrenScene.append(child); }
+  inline void removeChildScene(GroupScene* child) { childrenScene.removeAll(child); }
+  inline int getNbChildScene() { return childrenScene.size(); }
   void unselecteInterfaces();
 
   QList<AbstractBoxItem*> getGroupAndBlocks();
@@ -94,7 +97,7 @@ public:
 private:
   Dispatcher *dispatcher;
   Parameters *params;
-  GroupScene* parentScene; // the parnet scene, =NULL for top scene
+  GroupScene* parentScene; // the parent scene, =NULL for top scene
   GroupWidget* window; // the GroupWindow that contains that scene
   int id;
   GroupItem *groupItem; // mandatory to be an instance of GroupItem.
index 043561e28c34495b6651725286860d3375335530..2ef7cd1884766de657c2083314afef71d3df05d3 100644 (file)
@@ -95,6 +95,7 @@ void GroupWidget::focusInEvent(QFocusEvent *e) {
 void GroupWidget::closeEvent(QCloseEvent *e) {
   clearFocus();
   focusNextChild();
+
 }
 
 
@@ -222,16 +223,8 @@ void GroupWidget::updateBlockButton() {
 
 void GroupWidget::slotNewEmptyGroup() {
 
-  // creating the GroupBlock in graph model
-  GroupBlock* parent = AB_TO_GRP(scene->getGroupItem()->getRefBlock());
-  cout << "new group : parent = "<< qPrintable(parent->getName()) << endl;
-  GroupBlock* groupBlock = params->getGraph()->createChildBlock(parent);
-  cout << "new group : child = "<< qPrintable(groupBlock->getName()) << ", child of " << qPrintable(groupBlock->getParent()->getName()) << endl;
-  // creating the BlockItem in the scene
-  BoxItem* newItem = scene->createBlockItem(groupBlock);
+  dispatcher->addNewEmptyGroup(scene);
 
-  GroupWidget* child = dispatcher->createChildScene(this,newItem);
-  child->show();
 }
 
 void GroupWidget::slotNewGroup()
index 1f8c1c0375c158f6dcfe356258fe3850da186166..e9f841475ce352d735c9b879b8b83a81571bbeb4 100644 (file)
@@ -291,6 +291,7 @@ void MainWindow::slotNewProject(){
   GroupWidget* topGroup = dispatcher->createTopScene();
   addTopGroup(topGroup);
   library->updateComboScene();
+  params->isCurrentProject = true;
 }
 
 void MainWindow::slotCloseProject(){
index c991e5ff86fd033d5470157f7303d67576c0a6be..fce043506b96dce7c4a8ccb6962ceb386345dd11 100644 (file)
@@ -69,37 +69,23 @@ void Parameters::destroyGraph() {
   delete graph;\r
 }\r
 \r
-GroupBlock* Parameters::addGroupBlock() {\r
-  GroupBlock* parent = AB_TO_GRP(currentScene->getGroupItem()->getRefBlock());\r
-  GroupBlock* newOne = graph->createChildBlock(parent);\r
-  return newOne;\r
-}\r
-\r
-FunctionalBlock* Parameters::addFunctionalBlock(int idCategory, int idBlock) {\r
+ReferenceBlock* Parameters::getReferenceBlock(int idCategory, int idBlock) {\r
 \r
   BlockCategory* blockCat = categoryTree->searchCategory(idCategory);\r
 \r
   if (blockCat == NULL) return NULL;\r
-  GroupBlock* group = AB_TO_GRP(currentScene->getGroupItem()->getRefBlock());\r
   ReferenceBlock* ref = blockCat->getBlock(idBlock);\r
-  if (ref == NULL) return NULL;\r
-\r
-  FunctionalBlock* newOne = graph->addFunctionalBlock(group, ref);\r
-  unsaveModif = true;\r
-\r
-  return newOne;\r
+  return ref;\r
 }\r
 \r
+\r
 FunctionalBlock* Parameters::duplicateFunctionalBlock(FunctionalBlock *block) {\r
 \r
   ReferenceBlock* ref = block->getReference();\r
   GroupBlock* group = AB_TO_GRP(block->getParent());\r
 \r
-  // adding to the group\r
-  FunctionalBlock* newBlock = new FunctionalBlock(group,ref);\r
-  newBlock->populate();\r
-  group->addBlock(newBlock);\r
-\r
+  // adding to the graph\r
+  FunctionalBlock* newBlock = graph->addFunctionalBlock(group,ref);\r
   return newBlock;\r
 }\r
 \r
@@ -1032,11 +1018,11 @@ void Parameters::updateToolbar() {
   int nb = currentScene->getBlockItems().length();\r
   for(int i = 0; i<nb; i++){\r
     if(currentScene->getBlockItems().at(i)->isSelected()){\r
-      currentScene->getGroupWindow()->enableGroupButton(true);\r
+      currentScene->getGroupWidget()->enableGroupButton(true);\r
       return;\r
     }\r
   }\r
-  currentScene->getGroupWindow()->enableGroupButton(false);\r
+  currentScene->getGroupWidget()->enableGroupButton(false);\r
 }\r
 \r
 \r
@@ -1098,9 +1084,6 @@ void Parameters::save(QString confFile) {
     // cross the scene level by level using a FIFO\r
     QList<GroupScene*> fifoScene;\r
     fifoScene.append(topScene);\r
-    foreach(ConnectionItem* item, topScene->getConnectionItems()) {\r
-      allConnections.append(item);\r
-    }\r
 \r
     GroupScene *scene;\r
     while (!fifoScene.isEmpty()) {\r
@@ -1109,11 +1092,12 @@ void Parameters::save(QString confFile) {
       foreach(GroupScene* s, scene->getChildrenScene()) {\r
         fifoScene.append(s);\r
       }\r
-      foreach(ConnectionItem* item, topScene->getConnectionItems()) {\r
+\r
+      foreach(ConnectionItem* item, scene->getConnectionItems()) {\r
         allConnections.append(item);\r
       }\r
     }\r
-\r
+    writer.writeEndElement();    //</scenes>\r
 \r
     writer.writeStartElement("connections");\r
     foreach(ConnectionItem* item, allConnections) {\r
index 69887a9b19f50efa91532fef58378ee43eb7306f..7f14814a7ff904ca663423de50f5515e5b0d44aa 100644 (file)
@@ -35,6 +35,13 @@ class Exception;
 using namespace std;\r
 using namespace Qt;\r
 \r
+/*!\r
+ * \brief The Parameters class\r
+ *\r
+ * Parameters class represents the Model part of blast in MVC paradigm.\r
+ * It contains all data necessary to create a design: the graph of blocks,\r
+ * the scenes, ...\r
+ */\r
 class Parameters {\r
 \r
 public :\r
@@ -113,9 +120,8 @@ public :
 \r
   Graph* createGraph();\r
   void destroyGraph();\r
-  inline Graph* getGraph() { return graph; }\r
-  GroupBlock* addGroupBlock(); // adding an empty GroupBlock to the current group\r
-  FunctionalBlock* addFunctionalBlock(int idCategory, int idBlock); // adding a functional block to current group\r
+  inline Graph* getGraph() { return graph; }  \r
+  ReferenceBlock* getReferenceBlock(int idCategory, int idBlock); // get the reference block from its category and index\r
   FunctionalBlock* duplicateFunctionalBlock(FunctionalBlock* block); // adding a copy of a functional block to current group\r
 \r
 \r
index 07f96fa53536be8e9accb497cc5a44a43d025765..182460df471d9474427d599f4f715a33ba1137d4 100644 (file)
@@ -20,6 +20,7 @@ ParametersWindow::ParametersWindow(AbstractBlock *_block, Parameters *_params, B
 
     comboBox = new QComboBox;
 
+    cout << "block has " <<block->getParameters().size() << " params" << endl;
     foreach(BlockParameter *param, block->getParameters()){
       comboBox->addItem(param->getName());
     }
index 868e2d3cc45ba9cb5fddc2d362acc32e231ef5ec..9930e199a3471549367574c3c58802a07811595c 100755 (executable)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 3.2.1, 2017-04-26T18:51:42. -->
+<!-- Written by QtCreator 3.2.1, 2017-04-27T20:11:44. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
-  <value type="QByteArray">{3701e197-5b6c-48ea-9e98-a6cf6de18672}</value>
+  <value type="QByteArray">{c8006d66-d34f-42be-ad10-d0207752286d}</value>
  </data>
  <data>
   <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -60,7 +60,7 @@
   <valuemap type="QVariantMap">
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
-   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{ed04208c-8774-456b-99b9-4a02094ca7a4}</value>
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{2c9bf876-3476-44eb-8065-1f0844704dda}</value>
    <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
    <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
    <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
index 36fe54e1123fe87c427072817fb40f8debdc1b4e..8a35bc97f28d73e4c446eb0746620651ae4745ff 100644 (file)
     </xs:group>
 
     <xs:group name="block_itemsElmtGroup">
-       <xs:sequence>
-           <xs:element ref="bi_functional" minOccurs="0" maxOccurs="unbounded"/>
-           <xs:element ref="bi_group" minOccurs="0"/>
+      <xs:sequence>
+       <xs:element ref="bi_group" minOccurs="0" maxOccurs="unbounded"/>
+       <xs:element ref="bi_functional" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
     </xs:group>