]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMProjectActionsPanel.cpp
index 1ad28aa5bdbf1d0e831dd5d33c3b7b06bc2b4265..5c92a7965377ae8960c00136bece7cd22cb0aebb 100755 (executable)
 BEGIN_EVENT_TABLE(wxCDMProjectActionsPanel, wxPanel)
 EVT_BUTTON(ID_BUTTON_BUILD_PROJECT, wxCDMProjectActionsPanel::OnBtnBuildProject)
 EVT_BUTTON(ID_BUTTON_CONFIGURE_BUILD, wxCDMProjectActionsPanel::OnBtnConfigureBuild)
-EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMProjectActionsPanel::OnBtnEditCMakeLists)
 EVT_BUTTON(ID_BUTTON_CONNECT_PROJECT, wxCDMProjectActionsPanel::OnBtnConnectProject)
 END_EVENT_TABLE()
 
 wxCDMProjectActionsPanel::wxCDMProjectActionsPanel(
     wxWindow* parent,
+    modelCDMProject* project,
     wxWindowID id,
     const wxString& caption,
     const wxPoint& pos,
@@ -52,6 +52,7 @@ wxCDMProjectActionsPanel::wxCDMProjectActionsPanel(
 )
 {
   wxCDMProjectActionsPanel::Create(parent,id,caption,pos,size,style);
+  this->project = project;
 }
 
 wxCDMProjectActionsPanel::~wxCDMProjectActionsPanel()
@@ -89,30 +90,38 @@ void wxCDMProjectActionsPanel::CreateControls()
   this->GetSizer()->Add(plugbt, 0, wxALL, 5);
 }
 
-void wxCDMProjectActionsPanel::OnBtnBuildProject(wxCommandEvent& event)
-{
-  //TODO: implement method
-  std::cerr << "Event OnBtnBuildProject not implemented" << std::endl;
-  event.Skip();
-}
-
+//configure project
 void wxCDMProjectActionsPanel::OnBtnConfigureBuild(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnConfigureBuild not implemented" << std::endl;
-  event.Skip();
+  std::string* result;
+  if(!this->project->ConfigureBuild(result))
+    {
+      wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Configuration - Error!"));
+      return;
+    }
+  wxMessageBox(crea::std2wx("The configuration was executed successfully."), wxT("Project Configuration"));
 }
 
-void wxCDMProjectActionsPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
+//compile project
+void wxCDMProjectActionsPanel::OnBtnBuildProject(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl;
-  event.Skip();
+  std::string* result;
+  if(!this->project->Build(result))
+    {
+      wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Compilation - Error!"));
+      return;
+    }
+  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)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnConnectProject not implemented" << std::endl;
-  event.Skip();
+  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"));
 }