X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/e45bacc6bd342a1b19e42b62133ddabc99aa9edd..HEAD:/MainWindow.cpp diff --git a/MainWindow.cpp b/MainWindow.cpp index ad36484..6f4716a 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -311,18 +311,24 @@ void MainWindow::save(QString projectFile) { params->save(projectFile); } -void MainWindow::slotLoadProject(){ +void MainWindow::slotLoadProject(QString fileName){ - params->projectFile = QFileDialog::getOpenFileName(0, "select a project file", "save/",tr("sauvegardes (*.xml)")); + if (fileName == "") { + params->projectFile = QFileDialog::getOpenFileName(0, "select a project file", "save/",tr("sauvegardes (*.xml)")); + } + else { + params->projectFile = fileName; + } if(! params->projectFile.isEmpty()){ GroupWidget* topGroup = dispatcher->loadProject(params->projectFile); if (topGroup != NULL) { addTopGroup(topGroup); library->updateComboScene(); + library->updateBoxConn(); params->isCurrentProject = true; enableProjectActions(true, PROJECT_CLOSE | PROJECT_SAVE | PROJECT_SAVEAS | PROJECT_LIB, OP_RAZ); - enableAnalysisActions(true, ANALYSIS_ANALYZE, OP_RAZ); + enableAnalysisActions(true, ANALYSIS_ANALYZE | ANALYSIS_GENERATE, OP_RAZ); } else { QMessageBox msgBox; @@ -344,9 +350,10 @@ void MainWindow::slotNewProject(){ if (ret == 1) { enableProjectActions(true, PROJECT_CLOSE | PROJECT_SAVE | PROJECT_SAVEAS | PROJECT_LIB, OP_RAZ); enableAnalysisActions(true, ANALYSIS_ANALYZE | ANALYSIS_GENERATE, OP_RAZ); - GroupWidget* topGroup = dispatcher->createTopScene(); + GroupWidget* topGroup = dispatcher->createTopScene(Dispatcher::Design, params->mainClock); addTopGroup(topGroup); library->updateComboScene(); + library->updateBoxConn(); library->show(); params->isCurrentProject = true; } @@ -443,15 +450,16 @@ void MainWindow::slotGraphAnalysis() { msg += " is not compatible with its input pattern.\nDo you want to launch automatic modification process to ensure the compatibility ?"; int ret = QMessageBox::question(this,tr("Building references library"),msg, QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok); if (ret == QMessageBox::Ok) { - dispatcher->findGraphModifications(toBlock); + dispatcher->findGraphModifications(Dispatcher::Design, toBlock); } } } } void MainWindow::slotGenerateVHDL() { + try { - params->getGraph()->generateVHDL(params->projectPath); + dispatcher->generateVHDL(Dispatcher::Design); } catch(Exception e) { cerr << qPrintable(e.getMessage()) << endl; @@ -485,7 +493,7 @@ void MainWindow::closeEvent(QCloseEvent *event) { void MainWindow::mousePressEvent(QMouseEvent *e) { if (dispatcher->getCurrentGroup() != NULL) { - dispatcher->setCurrentGroupWidget(dispatcher->getCurrentGroup()); + dispatcher->setCurrentGroupWidget(Dispatcher::Design, dispatcher->getCurrentGroup()); } QMainWindow::mousePressEvent(e); }