]> Creatis software - crea.git/commitdiff
Feature #1711 CreaDevManager application implementation
authorDaniel Gonzalez <daniel@daniel.laptop>
Tue, 25 Jun 2013 11:43:27 +0000 (13:43 +0200)
committerDaniel Gonzalez <daniel@daniel.laptop>
Tue, 25 Jun 2013 11:43:27 +0000 (13:43 +0200)
Feature: Now when compiling the build folder is checked and the context is kept after compilation is done. The default build command line can now be changed in the settings menu.

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

index 8ec696733767b7052c1cf099974a0e5644a013f9..935ce941635e63e787d60b23f8491c8b25bba9ab 100644 (file)
@@ -93,6 +93,13 @@ namespace CDMUtilities
   static std::string TERMINAL = "gnome-terminal";
 #endif
 
+#ifndef _WIN32
+  /**
+   * Build Command
+   */
+  static std::string BUILD_COMMAND = "make";
+#endif
+
   /**
    * Structure that handles the split method for c++
    * It calls the split method to split a string given certain delimiters.
index 7d0b454eda24c40272a78d8ef410d77dfac711aa..dae81a13434f081c9e51f12e8f671dc4e019ef6c 100644 (file)
@@ -45,6 +45,7 @@
 #include "CDMUtilities.h"
 #include "creaWx.h"
 #include "wx/dir.h"
+#include <wx/config.h>
 
 modelCDMProject::modelCDMProject()
 {
@@ -265,7 +266,11 @@ modelCDMLib* modelCDMProject::GetLib() const
 
 std::string modelCDMProject::GetBuildInstruction() const
 {
-  std::string makeComm = "make -C \"" + this->buildPath + "\""; /*> \"" + this->buildPath + CDMUtilities::SLASH + "building.log\" 2>&1";*/
+  wxConfigBase* pConfig =  wxConfigBase::Get();
+  std::string commandline = crea::wx2std(pConfig->Read(wxT("BUILD_COMMAND"), crea::std2wx(CDMUtilities::BUILD_COMMAND)));
+
+
+  std::string makeComm = "cd \"" + this->buildPath + "\";" + commandline;// -C \"" + this->buildPath + "\""; /*> \"" + this->buildPath + CDMUtilities::SLASH + "building.log\" 2>&1";*/
   return makeComm;
 }
 
index 35a98be2edae555c1206e95872204c6e0dca11b9..514d247faf7c32e3728ec5b640a5a4b5f8662232 100755 (executable)
@@ -134,32 +134,46 @@ void wxCDMProjectActionsPanel::OnBtnBuildProject(wxCommandEvent& event)
       return;
     }
 #else
-  //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)
+
+  std::string* result;
+  int isDir = wxMessageBox(crea::std2wx("Is this the path of the project compilation?:\n"+this->project->GetBuildPath()), wxT("Project Compilation - CreaDevManager"), wxYES_NO|wxCANCEL);
+  if(isDir != wxCANCEL)
     {
-      std::string buildDlgStr = crea::wx2std(buildDlg->GetValue());
-      //check name
-      if (buildDlgStr != "")
+      wxString file = crea::std2wx(this->project->GetBuildPath());
+      if(isDir == wxNO)
         {
-          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))
+          file = wxDirSelector(
+              wxT("Please select the folder where your project is to be built."),
+              crea::std2wx(this->project->GetBuildPath())
+          );
+        }
+
+      if(!file.IsEmpty())
+        {
+          this->project->SetBuildPath(crea::wx2std(file), result);
+
+          wxTextEntryDialog* buildDlg = new wxTextEntryDialog(
+                this,
+                wxT("Check 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 line
+              if (buildDlgStr != "")
+                {
+                  std::string* result;
+                  if(!this->project->Build(result, buildDlgStr))
+                    {
+                      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"));
         }
     }
 #endif
index 50dc1857fde726a84b75f7dd8b9d50ae95e71af9..5af4e79664d4eaf50adf0a9edbb33a5dba05d13e 100644 (file)
@@ -100,13 +100,15 @@ void wxCDMSettingsDialog::CreateControls()
   wxStaticText* instruction = new wxStaticText(this, wxID_ANY, wxT("Change the values to modify the default behavior of the program."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
   v_sizer1->Add(instruction, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 5);
 
-  wxFlexGridSizer* formItems = new wxFlexGridSizer(4,2,9,15);
+  wxFlexGridSizer* formItems = new wxFlexGridSizer(5,2,9,15);
 
   wxStaticText *stxtTextEditor = new wxStaticText(this, -1, wxT("Text Editor Command"));
   wxStaticText *stxtFileExplorer = new wxStaticText(this, -1, wxT("File Explorer Command"));
   wxStaticText *stxtTerminal = new wxStaticText(this, -1, wxT("Terminal Command"));
   wxStaticText *stxtHelpEnabled = new wxStaticText(this, -1, wxT("Help Enabled"));
-
+#ifndef _WIN32
+  wxStaticText* stxtBuildCommand = new wxStaticText(this, -1, wxT("Build Command"));
+#endif
   wxConfigBase* pConfig = wxConfigBase::Get();
 
   this->textEditor = new wxTextCtrl(this, -1, pConfig->Read(wxT("TEXT_EDITOR"), crea::std2wx(CDMUtilities::TEXT_EDITOR)));
@@ -114,7 +116,9 @@ void wxCDMSettingsDialog::CreateControls()
   this->terminal = new wxTextCtrl(this, -1, pConfig->Read(wxT("TERMINAL"), crea::std2wx(CDMUtilities::TERMINAL)));
   this->helpEnabled = new wxCheckBox(this, -1, wxT(""));
   this->helpEnabled->SetValue(pConfig->Read(wxT("HELP"), true) != 0);
-
+#ifndef _WIN32
+  this->buildCommand = new wxTextCtrl(this, -1, pConfig->Read(wxT("BUILD_COMMAND"), crea::std2wx(CDMUtilities::BUILD_COMMAND)));
+#endif
 
   formItems->Add(stxtTextEditor, 0, wxALIGN_CENTER_VERTICAL);
   formItems->Add(this->textEditor, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL);
@@ -122,10 +126,13 @@ void wxCDMSettingsDialog::CreateControls()
   formItems->Add(this->fileExplorer, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL);
   formItems->Add(stxtTerminal, 0, wxALIGN_CENTER_VERTICAL);
   formItems->Add(this->terminal, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL);
+#ifndef _WIN32
+  formItems->Add(stxtBuildCommand, 0, wxALIGN_CENTER_VERTICAL);
+  formItems->Add(this->buildCommand, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL);
+#endif
   formItems->Add(stxtHelpEnabled, 0, wxALIGN_CENTER_VERTICAL);
   formItems->Add(this->helpEnabled, 1, wxEXPAND);
 
-
   formItems->AddGrowableCol(1,1);
 
   v_sizer1->Add(formItems, 1, wxEXPAND | wxALL, 15);
@@ -149,6 +156,11 @@ void wxCDMSettingsDialog::OnFinish(wxCommandEvent& event)
   pConfig->Write(wxT("TERMINAL"), this->terminal->GetValue());
   pConfig->Write(wxT("FILE_EXPLORER"), this->fileExplorer->GetValue());
   pConfig->Write(wxT("HELP"), this->helpEnabled->GetValue());
+#ifndef _WIN32
+  pConfig->Write(wxT("BUILD_COMMAND"), this->buildCommand->GetValue());
+#endif
+
+  pConfig->Flush();
 
   this->EndModal(wxID_OK);
 }
@@ -163,5 +175,8 @@ void wxCDMSettingsDialog::OnDefaults(wxCommandEvent& event)
   this->textEditor->SetValue(crea::std2wx(CDMUtilities::TEXT_EDITOR));
   this->terminal->SetValue(crea::std2wx(CDMUtilities::TERMINAL));
   this->fileExplorer->SetValue(crea::std2wx(CDMUtilities::FILE_EXPLORER));
+#ifndef _WIN32
+  this->buildCommand->SetValue(crea::std2wx(CDMUtilities::BUILD_COMMAND));
+#endif
   this->helpEnabled->SetValue(true);
 }
index 5f70b6059d5797a6a645be21fc685a07eaee4d55..2e06ae3d8693bc506d50778fddcfdb5bc77bc801 100644 (file)
@@ -61,7 +61,7 @@ public:
       wxWindowID id = wxID_ANY,
       const wxString& caption = wxT("Settings - CreaDevManager  CREATIS"),
       const wxPoint& position = wxDefaultPosition,
-      const wxSize& size = wxSize(350,320),
+      const wxSize& size = wxSize(350,370),
       long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
   );
   /**
@@ -83,7 +83,7 @@ public:
       wxWindowID id = wxID_ANY,
       const wxString& caption = wxT("Settings - CreaDevManager  CREATIS"),
       const wxPoint& position = wxDefaultPosition,
-      const wxSize& size = wxSize(350,320),
+      const wxSize& size = wxSize(350,370),
       long style = wxDEFAULT_DIALOG_STYLE
   );
 
@@ -123,7 +123,10 @@ private:
    * Help Enabled.
    */
   wxCheckBox* helpEnabled;
-
+  /**
+   * Build Command.
+   */
+  wxTextCtrl* buildCommand;
 
   //handlers
 protected: