X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/c85843afb9bd492b46d6fe87a8287157097483f5..HEAD:/NewProjectDialog.cpp?ds=sidebyside diff --git a/NewProjectDialog.cpp b/NewProjectDialog.cpp index 033b686..d8e72f6 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->mainClock = freq; + if (autoConnClkCheck->isChecked()) { + params->autoConnMainClk = true; + } + else { + params->autoConnMainClk = false; } + + accept(); + } void NewProjectDialog::chooseProjectPath() {