X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/1b7818e18ed7bcf3464e307b97c6e0e6d72cc69b..4327c2b8817b627249d98d889835726217c81a4e:/Parameters.cpp?ds=inline diff --git a/Parameters.cpp b/Parameters.cpp index 60d7971..23b798f 100644 --- a/Parameters.cpp +++ b/Parameters.cpp @@ -9,7 +9,7 @@ #include "GroupScene.h" #include "GroupItem.h" #include "BoxItem.h" -#include "SourceItem.h" +#include "StimuliItem.h" #include "InterfaceItem.h" #include "ConnectionItem.h" @@ -52,6 +52,8 @@ Parameters::Parameters() { projectPath = ""; projectName = ""; projectFile = ""; + + graph = new Graph(); } Parameters::~Parameters() { @@ -69,13 +71,14 @@ void Parameters::clear() { refPathes.clear(); } -Graph* Parameters::createGraph(bool createTopGroupIfaces) { - graph = new Graph(createTopGroupIfaces); +Graph* Parameters::initGraph(bool createTopGroupIfaces) { + graph->createTopGroup(createTopGroupIfaces); return graph; } void Parameters::destroyGraph() { delete graph; + graph = new Graph(); } ReferenceBlock* Parameters::getReferenceBlock(int idCategory, int idBlock) { @@ -95,6 +98,7 @@ ReferenceBlock* Parameters::getHiddenReferenceBlock(QString blockName) { return ref; } + void Parameters::createDelayBlock() { delayRef = new ReferenceBlock("no.xml"); delayRef->addCategory(100); @@ -272,6 +276,14 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { if(!ok) throw(Exception(PROJECTFILE_CORRUPTED)); if (idUpperScene == -1) { + QString clkList = currentSceneNode.attribute("clklist","none"); + if (clkList == "none") throw(Exception(PROJECTFILE_CORRUPTED)); + QStringList clks = clkList.split(","); + for(int j=0;jaddClock(freq); + } topGroup = dispatcher->createTopScene(Dispatcher::Load); topScene->setId(idScene); groupItem = topScene->getGroupItem(); @@ -280,6 +292,11 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { else { cout << "trying to create scene n°" << idScene << " with upper scene n°" <addNewEmptyGroup(Dispatcher::Load, upperScene,false); groupWidget->getScene()->setId(idScene); groupItem = groupWidget->getScene()->getGroupItem(); @@ -325,7 +342,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { cout << "top scene has " << sourceNodes.length() << " sources" << endl; for(int j=0; jload(currentSBNode); } @@ -334,7 +351,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { } cout << "source item has been read, add it to the scene" << endl; // add the block to the GroupScene - currentScene->addSourceItem(sourceItem); + currentScene->addStimuliItem(sourceItem); } } /********************************************************** @@ -452,12 +469,16 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { int to = currentConnectionNode.attribute("to","none").toInt(&ok); if(!ok) throw(Exception(PROJECTFILE_CORRUPTED)); - + bool showConn = true; + QString visStr = currentConnectionNode.attribute("visible","none"); + if (visStr == "false") { + showConn = false; + } InterfaceItem *iface1 = searchInterfaceItemById(from,topScene); InterfaceItem *iface2 = searchInterfaceItemById(to,topScene); if(iface1 != NULL && iface2 != NULL){ - dispatcher->createConnection(Dispatcher::Load, iface1,iface2); + dispatcher->createConnection(Dispatcher::Load, iface1,iface2,showConn); } else { cout << "interfaces not found, connect canceled!" << endl; } @@ -1165,7 +1186,9 @@ void Parameters::save(QString confFile) { writer.writeAttribute("from",QString::number(item->getFromInterfaceItem()->getId())); writer.writeAttribute("to", QString::number(item->getToInterfaceItem()->getId())); - + if (!item->isVisible()) { + writer.writeAttribute("visible","false"); + } writer.writeEndElement(); } @@ -1303,7 +1326,7 @@ InterfaceItem* Parameters::searchInterfaceItemById(int id, GroupScene* scene) { } } if (scene->isTopScene()) { - foreach(SourceItem *block, scene->getSourceItems()){ + foreach(StimuliItem *block, scene->getSourceItems()){ foreach(InterfaceItem *item, block->getInterfaces()){ if(item->getId() == id){ return item;