]> Creatis software - crea.git/commitdiff
Feature #1711
authorDaniel Gonzalez <daniel.gonzalez@creatis.insa-lyon.fr>
Tue, 15 Jan 2013 14:52:00 +0000 (15:52 +0100)
committerDaniel Gonzalez <daniel.gonzalez@creatis.insa-lyon.fr>
Tue, 15 Jan 2013 14:52:00 +0000 (15:52 +0100)
CreaDevManager application implementation

-Allow user to configure command line to excecute for compilation before perform it.
-Now the compilation output is shown in a second terminal.

lib/creaDevManagerLib/modelCDMProject.cpp
lib/creaDevManagerLib/modelCDMProject.h
lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp

index 50f6cc24373699ddd13a1fd8113b4daa23edad6b..501d059d9892e0bbc0742f8cfe82ccba3426263c 100644 (file)
@@ -248,6 +248,12 @@ modelCDMLib* modelCDMProject::GetLib() const
   return this->lib;
 }
 
+std::string modelCDMProject::GetBuildInstruction() const
+{
+  std::string makeComm = "make -C \"" + this->buildPath + "\""; /*> \"" + this->buildPath + CDMUtilities::SLASH + "building.log\" 2>&1";*/
+  return makeComm;
+}
+
 bool modelCDMProject::SetVersion(const std::string& version, std::string*& result)
 {
 
@@ -706,7 +712,7 @@ bool modelCDMProject::ConfigureBuild(std::string*& result)
   return true;
 }
 
-bool modelCDMProject::Build(std::string*& result)
+bool modelCDMProject::Build(std::string*& result, const std::string& line)
 {
   //TODO: adjust for windows and mac
 #ifdef _WIN32
@@ -725,7 +731,25 @@ bool modelCDMProject::Build(std::string*& result)
       return false;
     }
   //create make command
-  std::string makeComm = "make -C \"" + this->buildPath + "\" > \"" + this->buildPath + CDMUtilities::SLASH + "building.log\" 2>&1";
+  std::string makeComm = "gnome-terminal -e \"bash -c \\\"";
+  for (int i = 0; i < line.size(); i++)
+    {
+      if(line[i] == '"')
+        {
+          makeComm+="\\\\\\\"";
+        }
+      else if(line[i] == '\\')
+        {
+          makeComm+="\\\\\\\\";
+        }
+      else
+        {
+          makeComm.push_back(line[i]);
+        }
+    }
+  makeComm += "; echo -e '\\a'; bash";
+  makeComm += "\\\"\"";
+
   std::cout << "executing '" << makeComm << "'" << std::endl;
   //execute make command
   if(system(makeComm.c_str()))
@@ -763,7 +787,7 @@ bool modelCDMProject::Connect(std::string*& result)
     if(system(plugComm.c_str()))
       {
         //if there was an error then report it
-        result = new std::string("There was an error plugging the packages of the project, please check the \"plugging.log\" file located in the build folder to read more about the problem.");
+        result = new std::string("There was an error plugging the packages of the project, please check the console to read more about the problem.");
         return false;
       }
   #endif
index e4ab0ca9d5557db2a847d3630ff3d7b10eac2161..87d1d3717a7f8db3b65df0f4f1938e7deea562a6 100644 (file)
@@ -117,6 +117,12 @@ public:
    */
   modelCDMLib* GetLib() const;
 
+  /**
+   * Retrieves the default make instruction to compile the project.
+   * @return The make instruction to compile.
+   */
+  std::string GetBuildInstruction() const;
+
 
   //Setters
   /**
@@ -229,7 +235,7 @@ public:
    * @param result Result message for building the project.
    * @return if any of the commands cannot be executed it return false.
    */
-  bool Build(std::string*& result);
+  bool Build(std::string*& result, const std::string& line);
 
   /**
    * Launches in console the bbPlugPackage command to connect the project to the .bbtk folder in the hard drive.
index 5b5cc09279986c0f70abb1e7ea993c82910a77eb..2d89a2df0f05e76a7fa4dbccbcbc89033138cf1e 100755 (executable)
@@ -107,27 +107,43 @@ void wxCDMProjectActionsPanel::OnBtnConfigureBuild(wxCommandEvent& event)
 //compile project
 void wxCDMProjectActionsPanel::OnBtnBuildProject(wxCommandEvent& event)
 {
-  std::string* result;
-  //wxProgressDialog* loadBar = new wxProgressDialog(wxT("Compiling"), wxT("Please wait while the compilation is executing..."), 100, this);
-  //loadBar->Pulse();
-  if(!this->project->Build(result))
+  //get author from user
+  wxTextEntryDialog* buildDlg = new wxTextEntryDialog(
+      this,
+      wxT("Enter the compilation instruction:"),
+      wxT("Project Compilation- creaDevManager"),
+      crea::std2wx(this->project->GetBuildInstruction()),
+      wxTE_MULTILINE | wxOK | wxCANCEL
+  );
+
+  if (buildDlg->ShowModal() == wxID_OK)
     {
-      //loadBar->Destroy();
-      wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Compilation - Error!"));
-      return;
+      std::string buildDlgStr = crea::wx2std(buildDlg->GetValue());
+      //check name
+      if (buildDlgStr != "")
+        {
+          std::string* result;
+          //wxProgressDialog* loadBar = new wxProgressDialog(wxT("Compiling"), wxT("Please wait while the compilation is executing..."), 100, this);
+          //loadBar->Pulse();
+          if(!this->project->Build(result, buildDlgStr))
+            {
+              //loadBar->Destroy();
+              wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Compilation - Error!"));
+              return;
+            }
+          //loadBar->Destroy();
+          //wxMessageBox(crea::std2wx("The compilation was executed successfully. Please check the \"building.log\" file located in the build folder to check the compilation result."), wxT("Project Compilation"));
+        }
     }
-  //loadBar->Destroy();
-  wxMessageBox(crea::std2wx("The compilation was executed successfully. Please check the \"building.log\" file located in the build folder to check the compilation result."), wxT("Project Compilation"));
 }
-
 //plug packages
 void wxCDMProjectActionsPanel::OnBtnConnectProject(wxCommandEvent& event)
 {
   std::string* result;
   if(!this->project->Connect(result))
-      {
-        wxMessageBox(crea::std2wx(result->c_str()), wxT("Plug Packages - Error!"));
-        return;
-      }
-    wxMessageBox(crea::std2wx("The connection was executed successfully. Please check the \"plugging.log\" file located in the build folder to check the compilation result."), wxT("Plug Package"));
+    {
+      wxMessageBox(crea::std2wx(result->c_str()), wxT("Plug Packages - Error!"));
+      return;
+    }
+  wxMessageBox(crea::std2wx("The connection was executed successfully. Please check the \"plugging.log\" file located in the build folder to check the compilation result."), wxT("Plug Package"));
 }