]> AND Private Git Repository - blast.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
added new project dialog
authorstephane Domas <stephane.domas@univ-fcomte.fr>
Mon, 5 Mar 2018 09:54:36 +0000 (10:54 +0100)
committerstephane Domas <stephane.domas@univ-fcomte.fr>
Mon, 5 Mar 2018 09:54:36 +0000 (10:54 +0100)
18 files changed:
AbstractBlock.cpp
AbstractBlock.h
AbstractInterface.cpp
CustomDialog.cpp [new file with mode: 0644]
CustomDialog.h [new file with mode: 0644]
Graph.cpp
Graph.h
GroupBlock.cpp
MainWindow.cpp
MainWindow.h
NewProjectDialog.cpp [new file with mode: 0644]
NewProjectDialog.h [new file with mode: 0644]
Parameters.cpp
Parameters.h
blast.creator.user
blast.files
lib/implementations/impls.bmf
object-files.txt

index cdde69fcdc9b6051c396c62559a84f4151b60e04..90031d9c29c3fa31adce2d82569b81b808420872 100644 (file)
@@ -3,6 +3,7 @@
 #include <QMessageBox>\r
 #include "AbstractInterface.h"\r
 #include "BlockParameter.h"\r
 #include <QMessageBox>\r
 #include "AbstractInterface.h"\r
 #include "BlockParameter.h"\r
+#include "Parameters.h"\r
 \r
 AbstractBlock::AbstractBlock() {\r
   name = "";\r
 \r
 AbstractBlock::AbstractBlock() {\r
   name = "";\r
@@ -10,7 +11,7 @@ AbstractBlock::AbstractBlock() {
 }\r
 \r
 AbstractBlock::AbstractBlock(const QString& _name) {\r
 }\r
 \r
 AbstractBlock::AbstractBlock(const QString& _name) {\r
-  name = normalizeName(_name);\r
+  name = Parameters::normalizeName(_name);\r
   parent = NULL;\r
 }\r
 \r
   parent = NULL;\r
 }\r
 \r
@@ -25,7 +26,7 @@ AbstractBlock::~AbstractBlock() {
 }\r
 \r
 void AbstractBlock::setName(const QString& str) {\r
 }\r
 \r
 void AbstractBlock::setName(const QString& str) {\r
-  name = normalizeName(str);\r
+  name = Parameters::normalizeName(str);\r
 }\r
 \r
 void AbstractBlock::setParent(AbstractBlock* _parent) {\r
 }\r
 \r
 void AbstractBlock::setParent(AbstractBlock* _parent) {\r
@@ -235,11 +236,6 @@ QList<BlockParameter *> AbstractBlock::getWishboneParameters() {
   return lst;\r
 }\r
 \r
   return lst;\r
 }\r
 \r
-QString AbstractBlock::normalizeName(const QString &name) {\r
-  QString s = name;\r
-  s.replace(QRegularExpression("[^a-zA-Z0-9_]"),"_");\r
-  s.replace(QRegularExpression("[_]+"),"_");\r
-  return s;\r
-}\r
+\r
 \r
 \r
 \r
 \r
index 042a59883b90d4bcf5339a8f491ce3e0ca98234d..ebb1560e26f7b496ba731b634337e8d7a0bd78cd 100644 (file)
@@ -56,7 +56,6 @@ public:
   bool isWBConfigurable();\r
 \r
   // others\r
   bool isWBConfigurable();\r
 \r
   // others\r
-  static QString normalizeName(const QString& name);\r
 \r
   virtual void parametersValidation(QList<AbstractBlock*>* checkedBlocks, QList<AbstractBlock*>* blocksToConfigure) = 0; // ugly but usefull   \r
 \r
 \r
   virtual void parametersValidation(QList<AbstractBlock*>* checkedBlocks, QList<AbstractBlock*>* blocksToConfigure) = 0; // ugly but usefull   \r
 \r
index 1d1e41d15c4ffa4bce34c1e6f7e5764a573a4665..a32f78e6d8c0d5130bcfc1ea48f977a01574bd02 100644 (file)
@@ -1,6 +1,7 @@
 #include "AbstractInterface.h"
 #include "BlockParameterPort.h"
 #include "AbstractBlock.h"
 #include "AbstractInterface.h"
 #include "BlockParameterPort.h"
 #include "AbstractBlock.h"
+#include "Parameters.h"
 
 AbstractInterface::AbstractInterface(AbstractBlock* _owner) {
 
 
 AbstractInterface::AbstractInterface(AbstractBlock* _owner) {
 
@@ -18,7 +19,7 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner) {
 AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _purpose, const QString& _type, const QString& _width, int _endianess) {
 
   owner = _owner;  
 AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _purpose, const QString& _type, const QString& _width, int _endianess) {
 
   owner = _owner;  
-  name = AbstractBlock::normalizeName(_name);
+  name = Parameters::normalizeName(_name);
   width = _width;
   direction = _direction;
   purpose = _purpose;
   width = _width;
   direction = _direction;
   purpose = _purpose;
@@ -29,7 +30,7 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name
 
 AbstractInterface::AbstractInterface(AbstractInterface* other) {
   owner = NULL;
 
 AbstractInterface::AbstractInterface(AbstractInterface* other) {
   owner = NULL;
-  name = AbstractBlock::normalizeName(other->name);
+  name = Parameters::normalizeName(other->name);
   type = other->type;
   width = other->width;
   direction = other->direction;
   type = other->type;
   width = other->width;
   direction = other->direction;
@@ -39,7 +40,7 @@ AbstractInterface::AbstractInterface(AbstractInterface* other) {
 }
 
 void AbstractInterface::setName(const QString& _name) {
 }
 
 void AbstractInterface::setName(const QString& _name) {
-  name = AbstractBlock::normalizeName(_name);
+  name = Parameters::normalizeName(_name);
 }
 
 AbstractInterface::~AbstractInterface() {
 }
 
 AbstractInterface::~AbstractInterface() {
diff --git a/CustomDialog.cpp b/CustomDialog.cpp
new file mode 100644 (file)
index 0000000..5a91cf4
--- /dev/null
@@ -0,0 +1,53 @@
+/*-==============================================================-
+
+file : CustomDialog.cpp
+
+creation date : 08/02/2012
+
+author : S. Domas (sdomas@iut-bm.univ-fcomte.fr)
+
+description : 
+
+supp. infos : saved in UTF-8 [éè]
+
+-==============================================================-*/
+#include "CustomDialog.h"
+
+CustomDialog::CustomDialog(const QString &dialogTitle, const QString &boxTitle, QWidget *_parent) : QDialog(_parent) {
+
+  setWindowTitle(dialogTitle);
+  box = new QGroupBox(boxTitle);
+
+  okButton = new QPushButton(tr("OK"));
+  cancelButton = new QPushButton(tr("Cancel"));
+
+  layBottom = new QHBoxLayout;
+  layBottom->addStretch();
+  layBottom->addWidget(okButton);
+  layBottom->addWidget(cancelButton);
+
+  connect(okButton,SIGNAL(clicked()),this, SLOT(checkBeforeAccept()));
+  connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
+}
+
+void CustomDialog::checkBeforeAccept() { 
+  accept();
+}
+
+bool CustomDialog::confirmAccept() {
+
+  int ret = QMessageBox::question(NULL,tr("Confirmation"),tr("Are you sure ?"),QMessageBox::Ok | QMessageBox::Cancel,QMessageBox::Ok);
+  if (ret == QMessageBox::Ok) return true;
+  return false;
+}
+
+void CustomDialog::setContent(QVBoxLayout *boxLayout) {
+  box->setLayout(boxLayout);
+
+  QVBoxLayout *layAll = new QVBoxLayout;
+
+  layAll->addWidget(box);
+  layAll->addLayout(layBottom);
+
+  setLayout(layAll);
+}
diff --git a/CustomDialog.h b/CustomDialog.h
new file mode 100644 (file)
index 0000000..6494ae8
--- /dev/null
@@ -0,0 +1,51 @@
+/*-==============================================================-
+
+file : CustomDialog.hpp
+
+creation date : 08/02/2012
+
+author : S. Domas (sdomas@iut-bm.univ-fcomte.fr)
+
+description : 
+
+supp. infos : saved in UTF-8 [éè]
+
+-==============================================================-*/
+#ifndef __CUSTOMDIALOG_H__
+#define __CUSTOMDIALOG_H__
+
+#include <iostream>
+#include <fstream>
+
+#include <QtCore>
+#include <QtGui>
+#include <QtWidgets>
+
+using namespace std;
+using namespace Qt;
+
+class CustomDialog : public QDialog {
+
+  Q_OBJECT
+
+public:
+
+  CustomDialog(const QString &dialogTitle, const QString &boxTitle, QWidget *_parent = NULL);
+
+protected:
+
+  QGroupBox *box;
+  QPushButton *okButton;
+  QPushButton *cancelButton;
+
+  void setContent(QVBoxLayout *boxLayout);
+
+private:
+  QHBoxLayout *layBottom;
+
+protected slots:
+  virtual void checkBeforeAccept();
+  virtual bool confirmAccept();
+
+};
+#endif //__CUSTOMDIALOG_H__
index bd1eb70feeabe6f3c132fc395c5f804546427690..5b491b07ea15c5cd24d06daff89e90ff1bc814fa 100644 (file)
--- a/Graph.cpp
+++ b/Graph.cpp
@@ -192,3 +192,12 @@ void Graph::computeOutputPatterns(int nbExec) throw(Exception) {
     throw(e);
   }
 }
     throw(e);
   }
 }
+
+void Graph::generateVHDL(const QString &path) throw(Exception) {
+  try {
+    topGroup->generateVHDL(path);
+  }
+  catch(Exception e) {
+    throw(e);
+  }
+}
diff --git a/Graph.h b/Graph.h
index b9c598ae3c294d0dbe613552f5b69facb863184d..e7ff3e283b2393370300da91bf1c6f2d1b83ac31 100644 (file)
--- a/Graph.h
+++ b/Graph.h
@@ -55,7 +55,8 @@ public:
   void resetPatternComputed();
   void computeOutputPatterns(int nbExec) throw(Exception);
   
   void resetPatternComputed();
   void computeOutputPatterns(int nbExec) throw(Exception);
   
-  
+  void generateVHDL(const QString& path) throw(Exception);
+
 private:  
   GroupBlock* topGroup;
   QList<GroupBlock *> groups; //! usefull to avoid recursive methods to find a particular group.
 private:  
   GroupBlock* topGroup;
   QList<GroupBlock *> groups; //! usefull to avoid recursive methods to find a particular group.
index 6950b30fbdae11113e9237cad9b66e17e946be87..0ba203dba5c6bb00f73774b41806afd94541ff3c 100644 (file)
@@ -5,6 +5,7 @@
 #include "GroupInterface.h"
 #include "string.h"
 #include <sstream>
 #include "GroupInterface.h"
 #include "string.h"
 #include <sstream>
+#include "Parameters.h"
 
 int GroupBlock::counter = 1;
 
 
 int GroupBlock::counter = 1;
 
@@ -268,7 +269,7 @@ void GroupBlock::generateVHDL(const QString& path) throw(Exception) {
   QString coreFile = "";
 
   coreFile = path;
   QString coreFile = "";
 
   coreFile = path;
-  coreFile.append(normalizeName(name));
+  coreFile.append(Parameters::normalizeName(name));
   coreFile.append(".vhd");
 
   QFile vhdlCore(coreFile);
   coreFile.append(".vhd");
 
   QFile vhdlCore(coreFile);
index 79bc6f9708943e5930308f71694528839bdec15c..683ba3d03c2e4d0154eb489634d9aee4ed084451 100644 (file)
@@ -11,6 +11,7 @@
 #include <QDomElement>
 #include <QDomText>
 #include <sstream>
 #include <QDomElement>
 #include <QDomText>
 #include <sstream>
+#include "NewProjectDialog.h"
 
 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
 
 
 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
 
@@ -223,6 +224,12 @@ void MainWindow::enableAnalysisActions(bool enbMenu, quint16 mask, quint8 op) {
   else {
     graphAnalysis->setEnabled(false);
   }
   else {
     graphAnalysis->setEnabled(false);
   }
+  if (analysisMenuEnb & ANALYSIS_GENERATE) {
+    generateVHDL->setEnabled(true);
+  }
+  else {
+    generateVHDL->setEnabled(false);
+  }
 }
 
 void MainWindow::createMenus(){
 }
 
 void MainWindow::createMenus(){
@@ -241,6 +248,7 @@ void MainWindow::createMenus(){
   projectMenu->addAction(openLibrary);
 
   analysisMenu->addAction(graphAnalysis);
   projectMenu->addAction(openLibrary);
 
   analysisMenu->addAction(graphAnalysis);
+  analysisMenu->addAction(generateVHDL);
 
   toolsMenu->addAction(vhdlToXmlAct);
 
 
   toolsMenu->addAction(vhdlToXmlAct);
 
@@ -284,23 +292,28 @@ void MainWindow::createActions() {
   vhdlToXmlAct->setStatusTip(tr("Create a new XML generator"));
   connect(vhdlToXmlAct, SIGNAL(triggered()), this, SLOT(slotVHDLToXml()));
 
   vhdlToXmlAct->setStatusTip(tr("Create a new XML generator"));
   connect(vhdlToXmlAct, SIGNAL(triggered()), this, SLOT(slotVHDLToXml()));
 
-  graphAnalysis = new QAction(tr("&graph validation"), this);
+  graphAnalysis = new QAction(tr("&graph analysis"), this);
   graphAnalysis->setIcon(QPixmap::fromImage(QImage("icons/new.ico")));
   graphAnalysis->setStatusTip(tr("validate the graph"));
   connect(graphAnalysis, SIGNAL(triggered()), this, SLOT(slotGraphAnalysis()));
 
   graphAnalysis->setIcon(QPixmap::fromImage(QImage("icons/new.ico")));
   graphAnalysis->setStatusTip(tr("validate the graph"));
   connect(graphAnalysis, SIGNAL(triggered()), this, SLOT(slotGraphAnalysis()));
 
+  generateVHDL = new QAction(tr("generate &VHDL"), this);
+  generateVHDL->setIcon(QPixmap::fromImage(QImage("icons/new.ico")));
+  generateVHDL->setStatusTip(tr("generate the VHDL code for the whole design"));
+  connect(generateVHDL, SIGNAL(triggered()), this, SLOT(slotGenerateVHDL()));
+
 }
 
 }
 
-void MainWindow::save(QString absoluteFilename) {
-  params->save(absoluteFilename);
+void MainWindow::save(QString projectFile) {
+  params->save(projectFile);
 }
 
 void MainWindow::slotLoadProject(){
 
 }
 
 void MainWindow::slotLoadProject(){
 
-  absoluteFilename = QFileDialog::getOpenFileName(0, "select a project file", "save/",tr("sauvegardes (*.xml)"));
+  params->projectFile = QFileDialog::getOpenFileName(0, "select a project file", "save/",tr("sauvegardes (*.xml)"));
 
 
-  if(! absoluteFilename.isEmpty()){
-    GroupWidget* topGroup = dispatcher->loadProject(absoluteFilename);
+  if(! params->projectFile.isEmpty()){
+    GroupWidget* topGroup = dispatcher->loadProject(params->projectFile);
     if (topGroup != NULL) {
       addTopGroup(topGroup);
       library->updateComboScene();
     if (topGroup != NULL) {
       addTopGroup(topGroup);
       library->updateComboScene();
@@ -322,13 +335,18 @@ void MainWindow::slotLoadProject(){
 
 void MainWindow::slotNewProject(){
 
 
 void MainWindow::slotNewProject(){
 
-  enableProjectActions(true, PROJECT_CLOSE | PROJECT_SAVE | PROJECT_SAVEAS | PROJECT_LIB, OP_RAZ);
-  enableAnalysisActions(true, ANALYSIS_ANALYZE, OP_RAZ);
-  GroupWidget* topGroup = dispatcher->createTopScene();
-  addTopGroup(topGroup);
-  library->updateComboScene();
-  library->show();
-  params->isCurrentProject = true;
+  NewProjectDialog* dialog = new NewProjectDialog(params);
+  int ret = dialog->exec();
+
+  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();
+    addTopGroup(topGroup);
+    library->updateComboScene();
+    library->show();
+    params->isCurrentProject = true;
+  }
 }
 
 bool MainWindow::slotCloseProject(){
 }
 
 bool MainWindow::slotCloseProject(){
@@ -368,7 +386,7 @@ bool MainWindow::slotCloseProject(){
 
       params->isCurrentProject = false;
       params->unsaveModif = false;
 
       params->isCurrentProject = false;
       params->unsaveModif = false;
-      absoluteFilename = QString();
+      params->projectFile = QString();
 
       initialize();
     }
 
       initialize();
     }
@@ -382,8 +400,8 @@ void MainWindow::slotVHDLToXml() {
 }
 
 void MainWindow::slotSaveProject(){
 }
 
 void MainWindow::slotSaveProject(){
-  if(absoluteFilename != QString()){
-    save(absoluteFilename);
+  if(params->projectFile != QString()){
+    save(params->projectFile);
   } else {
     slotSaveAsProject();
   }
   } else {
     slotSaveAsProject();
   }
@@ -395,9 +413,9 @@ void MainWindow::slotSaveAsProject(){
     dial.setDefaultSuffix(".xml");
     dial.setAcceptMode(QFileDialog::AcceptSave);
     if(dial.exec() == QFileDialog::AcceptSave){
     dial.setDefaultSuffix(".xml");
     dial.setAcceptMode(QFileDialog::AcceptSave);
     if(dial.exec() == QFileDialog::AcceptSave){
-      absoluteFilename = dial.selectedFiles().at(0);
-      if(absoluteFilename != QString())
-        save(absoluteFilename);
+      params->projectFile = dial.selectedFiles().at(0);
+      if(params->projectFile != QString())
+        save(params->projectFile);
     }
   }
 }
     }
   }
 }
@@ -428,6 +446,15 @@ void MainWindow::slotGraphAnalysis() {
   }
 }
 
   }
 }
 
+void MainWindow::slotGenerateVHDL() {
+  try {
+    params->getGraph()->generateVHDL(params->projectPath);
+  }
+  catch(Exception e) {
+    cerr << qPrintable(e.getMessage()) << endl;
+  }
+}
+
 void MainWindow::addTopGroup(GroupWidget *_topGroup) {
   topGroup = _topGroup;
   stackedWidget->addWidget(topGroup);
 void MainWindow::addTopGroup(GroupWidget *_topGroup) {
   topGroup = _topGroup;
   stackedWidget->addWidget(topGroup);
index 9664a9660615235f9f67a6cf1965fb0d35d0f023..96fab67769428f4a8e14a11698c19dfb620d9830 100644 (file)
@@ -38,6 +38,7 @@ class Graph;
 #define PROJECT_LIB (quint16)32
 
 #define ANALYSIS_ANALYZE (quint16)1
 #define PROJECT_LIB (quint16)32
 
 #define ANALYSIS_ANALYZE (quint16)1
+#define ANALYSIS_GENERATE (quint16)2
 
 #define OP_ADD (quint8)0
 #define OP_REM (quint8)1
 
 #define OP_ADD (quint8)0
 #define OP_REM (quint8)1
@@ -107,6 +108,7 @@ private:
 
   // actions for graph analysis
   QAction *graphAnalysis;
 
   // actions for graph analysis
   QAction *graphAnalysis;
+  QAction *generateVHDL;
 
   // actions for tools
   QAction *vhdlToXmlAct;
 
   // actions for tools
   QAction *vhdlToXmlAct;
@@ -129,6 +131,7 @@ private slots:
   void slotOpenBlockLibrary();
 
   void slotGraphAnalysis();
   void slotOpenBlockLibrary();
 
   void slotGraphAnalysis();
+  void slotGenerateVHDL();
 
   void slotVHDLToXml();
 
 
   void slotVHDLToXml();
 
diff --git a/NewProjectDialog.cpp b/NewProjectDialog.cpp
new file mode 100644 (file)
index 0000000..033b686
--- /dev/null
@@ -0,0 +1,79 @@
+#include "NewProjectDialog.h"
+
+NewProjectDialog::NewProjectDialog(Parameters *_params, QWidget *parent) : CustomDialog(tr("Create a new project"),tr("Location"), parent) {
+
+  params = _params;
+
+  QHBoxLayout *layNameProj = new QHBoxLayout;
+  QLabel *nameProjLab = new QLabel(tr("Name :"));
+  nameProjEdit = new QLineEdit();
+  nameProjEdit->setMaxLength(100);
+  nameProjEdit->setText("");
+
+  layNameProj->addWidget(nameProjLab);
+  layNameProj->addWidget(nameProjEdit);
+
+  QHBoxLayout *layDirProj = new QHBoxLayout;
+  QLabel *dirProjLab = new QLabel(tr("Path :"));
+  dirProjEdit = new QLineEdit("");
+  dirProjEdit->setMaxLength(500);
+  dirProjButton = new QPushButton(QIcon(":/images/filefind.png"),"");
+  dirProjButton->setFixedWidth(30);
+  pathOk = false;
+
+  layDirProj->addWidget(dirProjLab);
+  layDirProj->addWidget(dirProjEdit);
+  layDirProj->addWidget(dirProjButton);
+
+
+  QVBoxLayout *layAll = new QVBoxLayout;
+  layAll->addLayout(layNameProj);
+  layAll->addLayout(layDirProj);
+
+  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";
+
+    accept();
+  }
+  else {
+    int ret = QMessageBox::warning(this,"Cannot create the project","Invalid project path");
+
+  }
+}
+
+void NewProjectDialog::chooseProjectPath() {
+
+  QString where;
+  where = QDir::currentPath();
+  QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),where);
+  dirProjEdit->setText(dir);
+}
+
+void NewProjectDialog::checkProjectPath(QString name) {
+  QDir dir(name);
+  if (dir.exists()) {
+    pathOk = true;
+  }
+  else {
+    pathOk = false;
+  }
+}
+
+void NewProjectDialog::checkProjectName(QString name) {
+  params->projectName = Parameters::normalizeName(name);
+  if (name != params->projectName) {
+    nameProjEdit->setText(params->projectName);
+  }
+}
diff --git a/NewProjectDialog.h b/NewProjectDialog.h
new file mode 100644 (file)
index 0000000..cad5c06
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef __NEWPROJECTDIALOG_H__
+#define __NEWPROJECTDIALOG_H__
+
+#include <iostream>
+#include <fstream>
+
+#include <QtCore>
+#include <QtGui>
+
+#include "CustomDialog.h"
+#include "Parameters.h"
+
+using namespace std;
+using namespace Qt;
+
+class NewProjectDialog : public CustomDialog {
+
+  Q_OBJECT
+
+public:
+
+  NewProjectDialog(Parameters *_params, QWidget *parent = NULL);
+
+private:
+
+  Parameters *params;
+
+  QLineEdit *nameProjEdit;  
+  QLineEdit *dirProjEdit;
+  QPushButton *dirProjButton;
+  bool pathOk;
+
+private slots:
+  void checkBeforeAccept();
+  void chooseProjectPath();
+  void checkProjectPath(QString name);
+  void checkProjectName(QString name);
+
+
+};
+
+#endif //__NEWPROJECTDIALOG_H__ 
index c60a927cf26715e20991f9d3559bc2c29a7c83f8..46437c34bc0dcd1aa3cd36bca0ce9cf98379648f 100644 (file)
@@ -46,10 +46,12 @@ Parameters::Parameters() {
 \r
   unsaveModif = false;\r
   isRstClkShown = false;\r
 \r
   unsaveModif = false;\r
   isRstClkShown = false;\r
-\r
-  projectPath = QDir::currentPath();\r
   \r
   validityExtension = "_enb";\r
   \r
   validityExtension = "_enb";\r
+\r
+  projectPath = "";\r
+  projectName = "";\r
+  projectFile = "";\r
 }\r
 \r
 Parameters::~Parameters() {\r
 }\r
 \r
 Parameters::~Parameters() {\r
@@ -1222,3 +1224,10 @@ InterfaceItem* Parameters::searchInterfaceItemById(int id, GroupScene* scene) {
   }\r
   return NULL;\r
 }\r
   }\r
   return NULL;\r
 }\r
+\r
+QString Parameters::normalizeName(const QString &name) {\r
+  QString s = name;\r
+  s.replace(QRegularExpression("[^a-zA-Z0-9_]"),"_");\r
+  s.replace(QRegularExpression("[_]+"),"_");\r
+  return s;\r
+}\r
index ccd24ff92b35fc1196cb6f3d7d55159741bd9e11..f03ca0a1f9363d4b821b4df3c9fbf4fe1cb4fab0 100644 (file)
@@ -78,6 +78,11 @@ public :
   inline void setCursorState(CursorState state) { cursorState = state; }\r
   inline void setDispatcher(Dispatcher* _dispatcher) { dispatcher = _dispatcher;}\r
 \r
   inline void setCursorState(CursorState state) { cursorState = state; }\r
   inline void setDispatcher(Dispatcher* _dispatcher) { dispatcher = _dispatcher;}\r
 \r
+  // testers\r
+\r
+  // others\r
+  static QString normalizeName(const QString& name);\r
+\r
   /***************************************************\r
     attributes that are general to the application\r
   ***************************************************/  \r
   /***************************************************\r
     attributes that are general to the application\r
   ***************************************************/  \r
@@ -125,6 +130,9 @@ public :
   bool unsaveModif;\r
   bool isRstClkShown;\r
   QMap<FunctionalBlock*, BoxItem*> blockToItem; // allow to retrieve a box item from a functionnal block\r
   bool unsaveModif;\r
   bool isRstClkShown;\r
   QMap<FunctionalBlock*, BoxItem*> blockToItem; // allow to retrieve a box item from a functionnal block\r
+  QString projectPath;\r
+  QString projectName;\r
+  QString projectFile; // equals to projectPath/projectName.xml\r
 \r
   Graph* createGraph();\r
   void destroyGraph();\r
 \r
   Graph* createGraph();\r
   void destroyGraph();\r
@@ -165,7 +173,7 @@ public :
   void save(QString confFile);\r
 \r
 \r
   void save(QString confFile);\r
 \r
 \r
-  QString projectPath;\r
+\r
 \r
 private:\r
   Graph* graph; // the graph model of blocks\r
 \r
 private:\r
   Graph* graph; // the graph model of blocks\r
index 76fb27170a5f021301e2a6fd2189eb4171e677d7..2d89560b84152122fd247d0486e54c0339055e30 100755 (executable)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.2.0, 2018-01-24T18:18:10. -->
+<!-- Written by QtCreator 4.2.0, 2018-02-12T16:51:17. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
-  <value type="QByteArray">{3701e197-5b6c-48ea-9e98-a6cf6de18672}</value>
+  <value type="QByteArray">{94112477-caab-4897-8f75-5f412f2c883a}</value>
  </data>
  <data>
   <variable>ProjectExplorer.Project.ActiveTarget</variable>
  </data>
  <data>
   <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -19,7 +19,7 @@
    <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
     <value type="QString" key="language">Cpp</value>
     <valuemap type="QVariantMap" key="value">
    <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
     <value type="QString" key="language">Cpp</value>
     <valuemap type="QVariantMap" key="value">
-     <value type="QByteArray" key="CurrentPreferences">qt2</value>
+     <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
     </valuemap>
    </valuemap>
    <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
     </valuemap>
    </valuemap>
    <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
@@ -31,7 +31,7 @@
    <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
    <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
    <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
    <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
    <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
    <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
-   <value type="int" key="EditorConfiguration.IndentSize">2</value>
+   <value type="int" key="EditorConfiguration.IndentSize">4</value>
    <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
    <value type="int" key="EditorConfiguration.MarginColumn">80</value>
    <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
    <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
    <value type="int" key="EditorConfiguration.MarginColumn">80</value>
    <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
    <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
    <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
    <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
    <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
    <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
    <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
-   <value type="int" key="EditorConfiguration.TabSize">4</value>
-   <value type="bool" key="EditorConfiguration.UseGlobal">false</value>
+   <value type="int" key="EditorConfiguration.TabSize">8</value>
+   <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
    <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
    <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
    <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
    <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
    <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
    <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
-   <value type="bool" key="EditorConfiguration.cleanWhitespace">false</value>
+   <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
    <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
   </valuemap>
  </data>
    <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
   </valuemap>
  </data>
@@ -61,7 +61,7 @@
   <valuemap type="QVariantMap">
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
   <valuemap type="QVariantMap">
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
-   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{ed04208c-8774-456b-99b9-4a02094ca7a4}</value>
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{c934e180-ebc6-41ed-be82-502cc94f41f6}</value>
    <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
    <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
    <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
    <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
    <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
    <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
    <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
     <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
     <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
    <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
     <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
     <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
-    <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">0</value>
+    <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
     <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
     <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
     <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
     <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
     <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
     <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
     <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
     <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
     <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
     <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
     <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
     <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
-    <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
     <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
     <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
-    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Exécutable personnalisé</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
     <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
     <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
index 3c08c8736f43bbc3259edbd9e9bcc0a97e9c73b3..2ef276801fc588e1f66db71501cb25907d0d5923 100755 (executable)
@@ -1,3 +1,7 @@
+CustomDialog.h
+CustomDialog.cpp
+NewProjectDialog.h
+NewProjectDialog.cpp
 Exception.h
 Exception.cpp
 AbstractInputModifier.h
 Exception.h
 Exception.cpp
 AbstractInputModifier.h
index 2115cfcb4513070ae45b9cc0b35026aed97f7a8c..1d8c695ca0ae47323573d8acc1705f47d7c816bf 100644 (file)
Binary files a/lib/implementations/impls.bmf and b/lib/implementations/impls.bmf differ
index 9a90873a74c01ab33d7d5e6f02216833866b2e81..4df5ed741545c8678eb071b448033e2450b26eca 100644 (file)
@@ -48,4 +48,8 @@ COMMON-OBJ = $(BUILDPATH)/AbstractBlock.o \
            $(BUILDPATH)/moc_ParametersWindow.o \
            $(BUILDPATH)/InterfacePropertiesWindow.o \
            $(BUILDPATH)/moc_InterfacePropertiesWindow.o \
            $(BUILDPATH)/moc_ParametersWindow.o \
            $(BUILDPATH)/InterfacePropertiesWindow.o \
            $(BUILDPATH)/moc_InterfacePropertiesWindow.o \
+          $(BUILDPATH)/CustomDialog.o \
+          $(BUILDPATH)/moc_CustomDialog.o \
+          $(BUILDPATH)/NewProjectDialog.o \
+          $(BUILDPATH)/moc_NewProjectDialog.o \
            $(BUILDPATH)/blast.o
            $(BUILDPATH)/blast.o