X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/77e28a24d444098399304f0175b1aba43c83017f..6e2b3026c6a496e81642c373796bd39dad33d2a6:/MainWindow.cpp?ds=sidebyside diff --git a/MainWindow.cpp b/MainWindow.cpp index 683ba3d..212e54d 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -24,6 +24,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { try { params->loadBlastConfiguration("blastconfig.xml"); + // first load external sources + params->loadSources(); + if (!QFileInfo::exists(params->refLib)) { params->loadReferencesFromXml(); int ret = QMessageBox::question(this,tr("Building references library"),tr("The reference block library does not exists.\n References have been read directly from the xml descriptions of blocks.\n It can be saved into a library in order to start application faster. "), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok); @@ -319,7 +322,7 @@ void MainWindow::slotLoadProject(){ library->updateComboScene(); 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; @@ -447,8 +450,29 @@ void MainWindow::slotGraphAnalysis() { } void MainWindow::slotGenerateVHDL() { + + QDir baseDir(params->projectPath); + if (!baseDir.exists()) { + cerr << "Project path " << qPrintable(params->projectPath) << " no longer exists. First, recreate it and put the project file within. Then retry to generate." << endl; + return; + } + if (! baseDir.exists("src")) { + baseDir.mkdir("src"); + } + if (! baseDir.exists("testbench")) { + baseDir.mkdir("testbench"); + } + if (! baseDir.exists("Makefile")) { + QFile make("/home/sdomas/Projet/Blast/code/blast/Makefile-isim"); + QString dest = params->projectPath; + dest += "/Makefile"; + make.copy(dest); + } + + QString dest = params->projectPath; + dest += "/src/"; try { - params->getGraph()->generateVHDL(params->projectPath); + params->getGraph()->generateVHDL(dest); } catch(Exception e) { cerr << qPrintable(e.getMessage()) << endl;