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

Private GIT Repository
changed ref/impls xsd and xml
[blast.git] / NewProjectDialog.cpp
index 033b686a15d455317e2e5d5d7dbac1309ad4f88a..beed4278fdc4064b0d871643db86c75ed4c1b1e8 100644 (file)
@@ -25,32 +25,62 @@ NewProjectDialog::NewProjectDialog(Parameters *_params, QWidget *parent) : Custo
   layDirProj->addWidget(dirProjEdit);
   layDirProj->addWidget(dirProjButton);
 
   layDirProj->addWidget(dirProjEdit);
   layDirProj->addWidget(dirProjButton);
 
+  QHBoxLayout *layClk = new QHBoxLayout;
+  QLabel* clkLab1 = new QLabel(tr("Main clock freq."));
+  QLabel* clkLab2 = new QLabel(tr("MHz"));
+  clkEdit = new QLineEdit("100");
+  layClk->addWidget(clkLab1);
+  layClk->addWidget(clkEdit);
+  layClk->addWidget(clkLab2);
+
+  QHBoxLayout *layAuto = new QHBoxLayout;
+  autoConnClkCheck = new QCheckBox("Auto-connect blocks to main clock");
+  autoConnClkCheck->setChecked(true);  
+  layAuto->addWidget(autoConnClkCheck);
+
 
   QVBoxLayout *layAll = new QVBoxLayout;
   layAll->addLayout(layNameProj);
   layAll->addLayout(layDirProj);
 
   QVBoxLayout *layAll = new QVBoxLayout;
   layAll->addLayout(layNameProj);
   layAll->addLayout(layDirProj);
+  layAll->addLayout(layClk);
+  layAll->addLayout(layAuto);
 
   setContent(layAll);   
 
   connect(dirProjButton,SIGNAL(clicked()),this,SLOT(chooseProjectPath()));
   connect(nameProjEdit,SIGNAL(textChanged(QString)),this,SLOT(checkProjectName(QString)));
   connect(dirProjEdit,SIGNAL(textChanged(QString)),this,SLOT(checkProjectPath(QString)));
 
   setContent(layAll);   
 
   connect(dirProjButton,SIGNAL(clicked()),this,SLOT(chooseProjectPath()));
   connect(nameProjEdit,SIGNAL(textChanged(QString)),this,SLOT(checkProjectName(QString)));
   connect(dirProjEdit,SIGNAL(textChanged(QString)),this,SLOT(checkProjectPath(QString)));
-
 }
 
 }
 
+
 void NewProjectDialog::checkBeforeAccept() {
 
 void NewProjectDialog::checkBeforeAccept() {
 
-  if ((!nameProjEdit->text().isEmpty()) && (pathOk)) {
-    //cout << "all ok" << endl;
-    params->projectPath = dirProjEdit->text();
-    params->projectFile = params->projectPath + "/" + params->projectName + ".xml";
+  if ((nameProjEdit->text().isEmpty()) || (!pathOk)) {
 
 
-    accept();
+      int ret = QMessageBox::warning(this,"Cannot create the project","Invalid project path");
+      return;
+  }
+  double freq;
+  bool ok = false;
+  freq = clkEdit->text().toDouble(&ok);
+  if (!ok) {
+    int ret = QMessageBox::warning(this,"Cannot create the project","Invalid main clock frequency (in MHz)");
+    return;
   }
   }
-  else {
-    int ret = QMessageBox::warning(this,"Cannot create the project","Invalid project path");
 
 
+  //cout << "all ok" << endl;
+  params->projectPath = dirProjEdit->text();
+  params->projectFile = params->projectPath + "/" + params->projectName + ".xml";
+  params->clocks.append(freq);
+  if (autoConnClkCheck->isChecked()) {
+    params->autoConnMainClk = true;
+  }
+  else {
+    params->autoConnMainClk = false;
   }
   }
+
+  accept();
+
 }
 
 void NewProjectDialog::chooseProjectPath() {
 }
 
 void NewProjectDialog::chooseProjectPath() {