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

Private GIT Repository
finalized analysis with clkconvert + started testbench gen.
[blast.git] / Parameters.cpp
index 23b798f1a47e54d16bb6a91fad8508b7ba31661b..ecf69d9924142ad9b26d6459b61aa43ce070fec8 100644 (file)
@@ -261,6 +261,64 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) {
     }\r
     cout << "project path set to " << qPrintable(projectPath) << endl;\r
   }\r
+\r
+  /**********************************************************\r
+   0 : getting parameters\r
+  ***********************************************************/\r
+  int width = 0;\r
+  int height = 0;\r
+  int lineLength = 0;\r
+  int gapLength = 0;\r
+  QString fontName="";\r
+  int fontSize;\r
+  QString autoConn="";\r
+  QDomNode paramsNode = root.elementsByTagName("parameters").at(0);\r
+\r
+  QDomElement blocksElt = paramsNode.firstChildElement("block_view");\r
+  width = blocksElt.attribute("width","none").toInt(&ok);\r
+  if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
+  height = blocksElt.attribute("height","none").toInt(&ok);\r
+  if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
+  fontName = blocksElt.attribute("font","none");\r
+  if(fontName == "none") throw(Exception(PROJECTFILE_CORRUPTED));\r
+  fontSize = blocksElt.attribute("font_size","none").toInt(&ok);\r
+  if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
+  defaultBlockWidth = width;\r
+  defaultBlockHeight = height;\r
+  defaultBlockFontName = fontName;\r
+  defaultBlockFontSize = fontSize;\r
+  defaultBlockFont = QFont(defaultBlockFontName, defaultBlockFontSize);\r
+\r
+  QDomElement ifacesElt = paramsNode.firstChildElement("interface_view");\r
+  lineLength = ifacesElt.attribute("line_length","none").toInt(&ok);\r
+  if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
+  width = ifacesElt.attribute("width","none").toInt(&ok);\r
+  if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
+  height = ifacesElt.attribute("height","none").toInt(&ok);\r
+  if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
+  fontName = ifacesElt.attribute("font","none");\r
+  if(fontName == "none") throw(Exception(PROJECTFILE_CORRUPTED));\r
+  fontSize = ifacesElt.attribute("font_size","none").toInt(&ok);\r
+  if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
+  arrowLineLength = lineLength;\r
+  arrowWidth = width;\r
+  arrowHeight = height;\r
+  defaultIfaceFontName = fontName;\r
+  defaultIfaceFontSize = fontSize;\r
+  defaultIfaceFont = QFont(defaultIfaceFontName, defaultIfaceFontSize);\r
+\r
+  QDomElement connsElt = paramsNode.firstChildElement("connection_view");\r
+  gapLength = connsElt.attribute("gap_length","none").toInt(&ok);\r
+  if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
+  autoConn = connsElt.attribute("auto_conn","none");\r
+  if (autoConn == "false") {\r
+    autoConnMainClk = false;\r
+  }\r
+  else {\r
+    autoConnMainClk = true;\r
+  }\r
+  connGapLength = gapLength;\r
+\r
   /**********************************************************\r
    1 : getting scene and creating associated group widgets\r
   ***********************************************************/\r
@@ -639,7 +697,7 @@ void Parameters::loadBlastConfiguration(QString confFile) throw(Exception) {
   attributeStr = eltInterfaces.attribute("height", "none");\r
   arrowHeight = attributeStr.toInt(&ok);\r
   if (!ok || arrowHeight < 1) throw(Exception(CONFIGFILE_CORRUPTED));\r
-  attributeStr = eltInterfaces.attribute("linelength", "none");\r
+  attributeStr = eltInterfaces.attribute("line_length", "none");\r
   arrowLineLength = attributeStr.toInt(&ok);\r
   if (!ok || arrowLineLength < 1) throw(Exception(CONFIGFILE_CORRUPTED));\r
   attributeStr = eltInterfaces.attribute("font_size", "none");\r
@@ -651,7 +709,7 @@ void Parameters::loadBlastConfiguration(QString confFile) throw(Exception) {
   defaultIfaceFont = QFont(defaultIfaceFontName, defaultIfaceFontSize);\r
 \r
   QDomElement eltConnections = eltInterfaces.nextSiblingElement("connections");\r
-  attributeStr = eltConnections.attribute("gaplength", "none");\r
+  attributeStr = eltConnections.attribute("gap_length", "none");\r
   connGapLength = attributeStr.toInt(&ok);\r
   if (!ok || connGapLength < 1) throw(Exception(CONFIGFILE_CORRUPTED));\r
 }\r
@@ -1157,6 +1215,33 @@ void Parameters::save(QString confFile) {
     writer.writeStartDocument();\r
 \r
     writer.writeStartElement("blast_project");\r
+\r
+    writer.writeStartElement("parameters");\r
+    writer.writeStartElement("block_view");\r
+    writer.writeAttribute("width",QString::number(defaultBlockWidth));\r
+    writer.writeAttribute("height",QString::number(defaultBlockHeight));\r
+    writer.writeAttribute("font",defaultBlockFontName);\r
+    writer.writeAttribute("font_size",QString::number(defaultBlockFontSize));\r
+    writer.writeEndElement();    //</blocks>\r
+    writer.writeStartElement("interface_view");\r
+    writer.writeAttribute("line_length",QString::number(arrowLineLength));\r
+    writer.writeAttribute("width",QString::number(arrowWidth));\r
+    writer.writeAttribute("height",QString::number(arrowHeight));\r
+    writer.writeAttribute("font",defaultIfaceFontName);\r
+    writer.writeAttribute("font_size",QString::number(defaultIfaceFontSize));\r
+    writer.writeEndElement();    //</interfaces>\r
+    writer.writeStartElement("connection_view");\r
+    writer.writeAttribute("gap_length",QString::number(connGapLength));\r
+    if (autoConnMainClk) {\r
+      writer.writeAttribute("auto_conn","true");\r
+    }\r
+    else {\r
+      writer.writeAttribute("auto_conn","false");\r
+    }\r
+    writer.writeEndElement();    //</connections>\r
+\r
+    writer.writeEndElement();    //</parameters>\r
+\r
     writer.writeStartElement("scenes");\r
 \r
     writer.writeAttribute("count",QString::number(dispatcher->getNumberOfScenes()));\r