X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/77e28a24d444098399304f0175b1aba43c83017f..6a0ffdb10d7344d99e04c5518fca2b8295df94be:/NewProjectDialog.cpp diff --git a/NewProjectDialog.cpp b/NewProjectDialog.cpp index 033b686..beed427 100644 --- a/NewProjectDialog.cpp +++ b/NewProjectDialog.cpp @@ -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->clocks.append(freq); + if (autoConnClkCheck->isChecked()) { + params->autoConnMainClk = true; + } + else { + params->autoConnMainClk = false; } + + accept(); + } void NewProjectDialog::chooseProjectPath() {