X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/d43174d0eb3d293b3bb5fbe76662241134e74d0d..cfe8322b50c9ef08ffbc3e52b0849bca4cd1d0bf:/Parameters.cpp?ds=sidebyside diff --git a/Parameters.cpp b/Parameters.cpp index 4fd583d..c12fead 100644 --- a/Parameters.cpp +++ b/Parameters.cpp @@ -43,6 +43,8 @@ Parameters::Parameters() { isRstClkShown = false; projectPath = QDir::currentPath(); + + validityExtension = "_enb"; } Parameters::~Parameters() { @@ -79,15 +81,6 @@ ReferenceBlock* Parameters::getReferenceBlock(int idCategory, int idBlock) { } -FunctionalBlock* Parameters::duplicateFunctionalBlock(FunctionalBlock *block) { - - ReferenceBlock* ref = block->getReference(); - GroupBlock* group = AB_TO_GRP(block->getParent()); - - // adding to the graph - FunctionalBlock* newBlock = graph->addFunctionalBlock(group,ref); - return newBlock; -} void Parameters::validateXmlFile(const QString& xmlFileName, const QString& xsdFileName, XmlFileType fileType) throw(Exception) { // opening configFile @@ -269,7 +262,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { throw(err); } // add the block to the GroupScene - currentScene->addBlockItem(funcItem); + currentScene->addBoxItem(funcItem); } } cout << "functional blocks loaded and created succefully!" << endl; @@ -315,7 +308,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { BoxItem* upperItem = NULL; if(insideGroup == NULL) cout << "group null" << endl; // now search within the scene which BoxItem has a childItem that is = to insideGroup - QList lst = currentScene->getBlockItems(); + QList lst = currentScene->getBoxItems(); foreach(BoxItem* item, lst) { if (item->getChildGroupItem() == insideGroup) { upperItem = item; @@ -349,10 +342,10 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { double position = currentInterfaceNode.attribute("position","none").toDouble(&ok); if(!ok) throw(Exception(PROJECTFILE_CORRUPTED)); - ConnectedInterface *refInter = insideGroup->searchInterfaceByName(refName)->refInter; + ConnectedInterface *refInter = insideGroup->searchInterfaceItemByName(refName)->refInter; InterfaceItem *ifaceItem = new InterfaceItem(position, orientation, refInter, upperItem, this); ifaceItem->setId(id); - upperItem->addInterface(ifaceItem); + upperItem->addInterfaceItem(ifaceItem); } } } @@ -374,7 +367,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { InterfaceItem *iface2 = searchInterfaceItemById(to,topScene); if(iface1 != NULL && iface2 != NULL){ - dispatcher->connect(iface1,iface2); + dispatcher->createConnection(iface1,iface2); } else { cout << "interfaces not found, connect canceled!" << endl; } @@ -529,7 +522,7 @@ void Parameters::loadReferencesFromXml() throw(Exception) { blockXML.close(); try { - validateXmlFile(fileName,"block.xsd",Reference); + validateXmlFile(fileName,"reference.xsd",Reference); } catch(Exception err) { throw(err); @@ -665,14 +658,14 @@ void Parameters::loadImplementationsFromXml() throw(Exception) { implXML.close(); cout << "OK" << endl; cout << "reading " << qPrintable(fileName) << " content ..."; - /* + try { - validateXmlFile(fileName,"block.xsd",Implementation); + validateXmlFile(fileName,"implementation.xsd",Implementation); } catch(Exception e) { throw(e); } - */ + // reading in into QDomDocument QDomDocument document ("FileXML"); if (!implXML.open(QIODevice::ReadOnly)) { @@ -844,9 +837,9 @@ QList Parameters::getBlocksToConfigure() { void Parameters::updateToolbar() { - int nb = currentScene->getBlockItems().length(); + int nb = currentScene->getBoxItems().length(); for(int i = 0; igetBlockItems().at(i)->isSelected()){ + if(currentScene->getBoxItems().at(i)->isSelected()){ currentScene->getGroupWidget()->enableGroupButton(true); return; } @@ -996,7 +989,7 @@ GroupItem* Parameters::searchGroupItemById(int id, GroupScene *scene) { BoxItem* Parameters::searchBlockItemById(int id, GroupScene *scene) { - foreach(BoxItem *item, scene->getBlockItems()){ + foreach(BoxItem *item, scene->getBoxItems()){ if(item->getId() == id){ return item; } @@ -1017,7 +1010,7 @@ InterfaceItem* Parameters::searchInterfaceItemById(int id, GroupScene* scene) { return item; } } - foreach(BoxItem *block, scene->getBlockItems()){ + foreach(BoxItem *block, scene->getBoxItems()){ foreach(InterfaceItem *item, block->getInterfaces()){ if(item->getId() == id){ return item;