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() {