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

Private GIT Repository
moved clocks list to graph
[blast.git] / NewProjectDialog.cpp
index 033b686a15d455317e2e5d5d7dbac1309ad4f88a..d8e72f651db892b067e59a63d20421f62f1b33d7 100644 (file)
@@ -25,32 +25,62 @@ NewProjectDialog::NewProjectDialog(Parameters *_params, QWidget *parent) : Custo
   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);
+  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)));
-
 }
 
+
 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->mainClock = freq;
+  if (autoConnClkCheck->isChecked()) {
+    params->autoConnMainClk = true;
+  }
+  else {
+    params->autoConnMainClk = false;
   }
+
+  accept();
+
 }
 
 void NewProjectDialog::chooseProjectPath() {