#include<vector>
#include<string>
+#include <cstdlib>
namespace CDMUtilities
{
return pathFixed;
}
+
+ int openTextEditor(const std::string& file)
+ {
+ std::string command = TEXT_EDITOR;
+
+ if(file != "")
+ command += " \"" + file + "\" &";
+
+ return system(command.c_str());
+ }
+
+ int openFileExplorer(const std::string& file)
+ {
+ std::string command = FILE_EXPLORER;
+
+ if(file != "")
+ command += " \"" + file + "\" &";
+
+ return system(command.c_str());
+ }
+
}
namespace CDMUtilities
{
+ //text editor program
+#ifdef _WIN32
+ // ------ Windows
+ //TODO: implementation for windows
+#elif __APPLE__
+ // ------ Apple
+ //TODO: implementation for apple
+#else
+ static std::string TEXT_EDITOR = "gedit";
+#endif
+
+ //file explorer program
+#ifdef _WIN32
+ // ------ Windows
+ //TODO: implementation for windows
+#elif __APPLE__
+ // ------ Apple
+ //TODO: implementation for apple
+#else
+ static std::string FILE_EXPLORER = "nautilus";
+#endif
+
+
struct splitter
{
enum empties_t { empties_ok, no_empties };
template <typename Container>
- static Container& split
- (
- Container& result,
- const typename Container::value_type& s,
- const typename Container::value_type& delimiters,
- empties_t empties = empties_ok
- );
+ static Container& split
+ (
+ Container& result,
+ const typename Container::value_type& s,
+ const typename Container::value_type& delimiters,
+ empties_t empties = empties_ok
+ );
};
const std::string fixPath(const std::string& path);
+
+ int openTextEditor(const std::string& file = "");
+ int openFileExplorer(const std::string& file = "");
};
#endif /* CDMUTILITIES_H_ */
const std::string& path
)
{
- //copy template library folder with new name
+ //copy template application folder with new name
//TODO: fix for windows
std::string copyCommand = "cp -r " + this->path + "/template_appli " + this->path + "/" + name;
if(system(copyCommand.c_str()))
return true;
}
+modelCDMCMakeListsFile* modelCDMFolder::GetCMakeLists() const
+{
+ return this->CMakeLists;
+}
+
+std::vector<modelCDMFolder*> modelCDMFolder::GetFolders() const
+{
+ return this->folders;
+}
+
bool
modelCDMFolder::HasCMakeLists()
{
modelCDMFolder(const std::string& path, const int& level = 3);
~modelCDMFolder();
+ modelCDMCMakeListsFile* GetCMakeLists() const;
+ std::vector<modelCDMFolder*> GetFolders() const;
+
bool CreateFolder(
const std::string& name,
std::string*& result,
#include "modelCDMIProjectTreeNode.h"
#include <algorithm>
+#include "CDMUtilities.h"
+
#include "wx/dir.h"
bool modelCDMIProjectTreeNode::CompareNodeItem(const modelCDMIProjectTreeNode* x, const modelCDMIProjectTreeNode* y)
const bool modelCDMIProjectTreeNode::OpenInFileExplorer(std::string*& result) const
{
- //TODO: implement method
- return false;
+ if (!CDMUtilities::openFileExplorer(this->GetPath()))
+ return true;
+ else
+ {
+ result = new std::string("Couldn't open file.");
+ return false;
+ }
}
#include "modelCDMProject.h"
#include <iostream>
+#include <sstream>
#include <vector>
#include <algorithm>
#include <fstream>
+#include <ctime>
#include "CDMUtilities.h"
#include "creaWx.h"
bool modelCDMProject::SetVersion(const std::string& version, std::string*& result)
{
- //TODO: implement method
+
+ std::vector<std::string> vers;
+ CDMUtilities::splitter::split(vers, version, " .", CDMUtilities::splitter::no_empties);
+
+ time_t now = time(0);
+ tm* ltm = localtime(&now);
+
+ std::stringstream date;
+ date << ltm->tm_mday << "/" << ltm->tm_mon << "/" << 1900 + ltm->tm_year;
+
+ //set name of library in CMakeLists inside copied folder
+ std::string line;
+ std::ifstream in((this->path + "/CMakeLists.txt").c_str());
+ if( !in.is_open())
+ {
+ result = new std::string("CMakeLists.txt file failed to open.");
+ return false;
+ }
+ std::ofstream out((this->path + "/CMakeLists.txt.tmp").c_str());
+ if( !out.is_open())
+ {
+ result = new std::string("CMakeLists.txt.tmp file failed to open.");
+ return false;
+ }
+ while (getline(in, line))
+ {
+ if(line.find("SET(PROJECT_MAJOR_VERSION") != std::string::npos)
+ line = "SET(PROJECT_MAJOR_VERSION " + vers[0] + ")";
+ else if(line.find("SET(PROJECT_MINOR_VERSION") != std::string::npos)
+ line = "SET(PROJECT_MINOR_VERSION " + vers[1] + ")";
+ else if(line.find("SET(PROJECT_BUILD_VERSION") != std::string::npos)
+ line = "SET(PROJECT_BUILD_VERSION " + vers[2] + ")";
+ else if(line.find("SET(PROJECT_VERSION_DATE") != std::string::npos)
+ line = "SET(PROJECT_VERSION_DATE \"" + date.str() + "\")";
+ out << line << std::endl;
+ }
+ in.close();
+ out.close();
+ //delete old file and rename new file
+ std::string renameCommand = "mv " + this->path + "/CMakeLists.txt.tmp " + this->path + "/CMakeLists.txt";
+ if(system(renameCommand.c_str()))
+ {
+ result = new std::string("An error occurred while running '" + renameCommand + "'.");
+ return false;
+ }
+
+ this->version = vers[0] + "." + vers[1] + "." + vers[2];
+ this->versionDate = date.str();
return true;
}
bool modelCDMProject::SetBuildPath(const std::string& path, std::string*& result)
{
- //TODO: implement method
+ if(path == "")
+ {
+ result = new std::string("The path cannot be empty");
+ return false;
+ }
+ if(path == this->path)
+ {
+ result = new std::string("The path cannot be same as the project sources");
+ return false;
+ }
+ this->buildPath = path;
return true;
}
)
{
if(this->appli != NULL)
- {
- return this->appli->CreateApplication(name, result);
- }
- result = new std::string("there is no appli folder in this project.");
- return NULL;
+ {
+ return this->appli->CreateApplication(name, result);
+ }
+ result = new std::string("there is no appli folder in this project.");
+ return NULL;
}
modelCDMIProjectTreeNode* modelCDMProject::CreateBlackBox(
bool modelCDMProject::OpenCMakeListsFile(std::string*& result)
{
- //TODO: implement method
- return true;
+ if (!CDMUtilities::openTextEditor(this->CMakeLists->GetPath()))
+ return true;
+ else
+ {
+ result = new std::string("Couldn't open CMakeLists file.");
+ return false;
+ }
}
const bool modelCDMProject::Refresh(std::string*& result)
std::vector<modelCDMApplication*> applications = this->appli->GetApplications();
for (int i = 0; i < applications.size(); i++)
{
- wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(propertiesPanel,ID_LINK_SELECT_APPLICATION, crea::std2wx(applications[i]->GetName().c_str()), crea::std2wx(applications[i]->GetName().c_str()));
+ wxHyperlinkCtrl* pApplicationlk = new wxHyperlinkCtrl(propertiesPanel,ID_LINK_SELECT_APPLICATION, crea::std2wx(applications[i]->GetName().c_str()), crea::std2wx(applications[i]->GetName().c_str()));
std::string tt = "Name: " + applications[i]->GetName() + "\n";
tt += "Location: " + applications[i]->GetPath();
- pLibrarylk->SetToolTip(crea::std2wx(tt.c_str()));
- propertiesPanelSizer -> Add(pLibrarylk, 0, wxALIGN_LEFT | wxALL, 5);
+ pApplicationlk->SetToolTip(crea::std2wx(tt.c_str()));
+ pApplicationlk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMAppliDescriptionPanel::OnMouseEnter,NULL,this);
+ pApplicationlk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMAppliDescriptionPanel::OnMouseExit,NULL,this);
+ propertiesPanelSizer -> Add(pApplicationlk, 0, wxALIGN_LEFT | wxALL, 5);
}
propertiesPanel->SetSizer(propertiesPanelSizer);
break;
}
}
+ wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+ newEvent1->SetInt(applicationId);
+ newEvent1->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent1);
wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
newEvent->SetInt(applicationId);
wxPostEvent(this->GetParent(), *newEvent);
}
-void
-wxCDMAppliDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
+void wxCDMAppliDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
{
//TODO: implement method
std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;
event.Skip();
}
+
+void wxCDMAppliDescriptionPanel::OnMouseEnter(wxMouseEvent& event)
+{
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+ std::string AppName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+ int appId = 0;
+ std::vector<modelCDMApplication*> applications = this->appli->GetApplications();
+ for (int i = 0; i < applications.size(); i++)
+ {
+ if(applications[i]->GetName() == AppName)
+ {
+ appId = applications[i]->GetId();
+ break;
+ }
+ }
+ newEvent->SetInt(appId);
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ event.Skip();
+}
+
+void wxCDMAppliDescriptionPanel::OnMouseExit(wxMouseEvent& event)
+{
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+ std::string AppName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+ int appId = 0;
+ std::vector<modelCDMApplication*> applications = this->appli->GetApplications();
+ for (int i = 0; i < applications.size(); i++)
+ {
+ if(applications[i]->GetName() == AppName)
+ {
+ appId = applications[i]->GetId();
+ break;
+ }
+ }
+ newEvent->SetInt(appId);
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ event.Skip();
+}
+
void OnBtnReturn(wxCommandEvent& event);
void OnBtnOpenFolder(wxCommandEvent& event);
+ void OnMouseEnter(wxMouseEvent& event);
+ void OnMouseExit(wxMouseEvent& event);
+
};
#endif /* WXCDMAPPLIDESCRIPTIONPANEL_H_ */
newEvent->SetId(0);
wxPostEvent(this->GetParent(), *newEvent);
+ wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+ newEvent1->SetInt(libraryId);
+ newEvent1->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent1);
+
}
void wxCDMLibDescriptionPanel::OnBtnReturn(wxCommandEvent& event)
wxHyperlinkCtrl* pBBlk = new wxHyperlinkCtrl(BBPanel,ID_LINK_SELECT_BLACKBOX, crea::std2wx(blackBoxes[i]->GetName().c_str()), crea::std2wx(blackBoxes[i]->GetName().c_str()));
std::string tt = "Author: " + blackBoxes[i]->GetAuthors() + "\nDescription: " + blackBoxes[i]->GetDescription() + "\nCategories: " + blackBoxes[i]->GetCategories();
pBBlk->SetToolTip(crea::std2wx(tt));
+ pBBlk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnMouseEnter,NULL,this);
+ pBBlk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnMouseExit,NULL,this);
BBPanelSizer -> Add(pBBlk, 0, wxALIGN_LEFT | wxALL, 5);
}
actionsPanelSizer->Add(createBBbt, 0, wxALL, 5);
wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
editCMakebt->SetToolTip(wxT("Open the system default text editor to edit the package's CMakeLists.txt file."));
+ editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnCMakeMouseEnter,NULL,this);
+ editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnCMakeMouseExit,NULL,this);
actionsPanelSizer->Add(editCMakebt, 0, wxALL, 5);
wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Package Folder"));
openFolderbt->SetToolTip(wxT("Open the package folder in the file explorer."));
newEvent->SetId(0);
wxPostEvent(this->GetParent(), *newEvent);
+ wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+ newEvent1->SetInt(bbId);
+ newEvent1->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent1);
+
}
void wxCDMPackageDescriptionPanel::OnBtnCreateBlackBox(wxCommandEvent& event)
event.Skip();
}
+void wxCDMPackageDescriptionPanel::OnMouseEnter(wxMouseEvent& event)
+{
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+ std::string BBName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+ int bbId = 0;
+ std::vector<modelCDMBlackBox*> boxes = this->package->GetBlackBoxes();
+ for (int i = 0; i < boxes.size(); i++)
+ {
+ if(boxes[i]->GetName() == BBName)
+ {
+ bbId = boxes[i]->GetId();
+ break;
+ }
+ }
+ newEvent->SetInt(bbId);
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ event.Skip();
+}
+
+void wxCDMPackageDescriptionPanel::OnMouseExit(wxMouseEvent& event)
+{
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+ std::string BBName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+ int bbId = 0;
+ std::vector<modelCDMBlackBox*> boxes = this->package->GetBlackBoxes();
+ for (int i = 0; i < boxes.size(); i++)
+ {
+ if(boxes[i]->GetName() == BBName)
+ {
+ bbId = boxes[i]->GetId();
+ break;
+ }
+ }
+ newEvent->SetInt(bbId);
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ event.Skip();
+}
+
+void wxCDMPackageDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event)
+{
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+ if(this->package->GetCMakeLists() != NULL)
+ {
+ int CMId = this->package->GetCMakeLists()->GetId();
+ newEvent->SetInt(CMId);
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ }
+ event.Skip();
+}
+
+void wxCDMPackageDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event)
+{
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+ if(this->package->GetCMakeLists() != NULL)
+ {
+ int CMId = this->package->GetCMakeLists()->GetId();
+ newEvent->SetInt(CMId);
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ }
+ event.Skip();
+}
+
+
void OnBtnEditCMakeLists(wxCommandEvent& event);
void OnBtnOpenFolder(wxCommandEvent& event);
+ void OnMouseEnter(wxMouseEvent& event);
+ void OnMouseExit(wxMouseEvent& event);
+
+ void OnCMakeMouseEnter(wxMouseEvent& event);
+ void OnCMakeMouseExit(wxMouseEvent& event);
+
};
#endif /* WXCDMPACKAGEDESCRIPTIONPANEL_H_ */
newEvent->SetId(0);
wxPostEvent(this->GetParent(), *newEvent);
+ wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+ newEvent1->SetInt(packageId);
+ newEvent1->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent1);
+
}
void wxCDMPackageManagerPanel::OnBtnCreatePackage(wxCommandEvent& event)
std::string PkgName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
int pkgId = 0;
std::vector<modelCDMPackage*> packages = this->project->GetPackages();
- project->GetPackages();
+ project->GetPackages();
for (int i = 0; i < packages.size(); i++)
{
if(packages[i]->GetName() == PkgName)
#include "creaDevManagerIds.h"
#include "images/PrIcon64.xpm"
+#include "CDMUtilities.h"
BEGIN_EVENT_TABLE(wxCDMProjectDescriptionPanel, wxPanel)
EVT_BUTTON(ID_BUTTON_GOTO_PACKAGE_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManagePackages)
//values
// version
wxBoxSizer* pVersionsz = new wxBoxSizer(wxHORIZONTAL);
- wxStaticText* pVersiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->project->GetVersion()));
+ this->versiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->project->GetVersion()));
wxButton* pVersionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Set"));
pVersionbt->SetToolTip(wxT("Update the version of the project."));
- pVersionsz->Add(pVersiontc, 0, wxALIGN_CENTER_VERTICAL, 0);
+ pVersionsz->Add(this->versiontc, 0, wxALIGN_CENTER_VERTICAL, 0);
pVersionsz->Add(pVersionbt, 0, wxALIGN_CENTER | wxLEFT, 10);
// versionDate
- wxStaticText* pVersionDatetc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetVersionDate()));
+ this->versionDatetc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetVersionDate()));
// sourceLocation
wxBoxSizer* pSourceLocationsz = new wxBoxSizer(wxHORIZONTAL);
wxStaticText* pSourceLocationtc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetPath()));
pSourceLocationsz->Add(pSourceLocationbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
// buildLocation
wxBoxSizer* pBuildLocationsz = new wxBoxSizer(wxHORIZONTAL);
- wxStaticText* pBuildLocationtc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetBuildPath()));
- pBuildLocationtc->SetMaxSize(wxSize(350,-1));
+ this->buildPathtc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetBuildPath()));
+ this->buildPathtc->SetMaxSize(wxSize(350,-1));
wxButton* pBuildLocationbt = new wxButton(propertiesPanel, ID_BUTTON_SET_BUILD_PATH, wxT("Choose"));
pBuildLocationbt->SetToolTip(wxT("Select a new location for compiling the project."));
- pBuildLocationsz->Add(pBuildLocationtc, 0, wxALIGN_CENTER, 0);
+ pBuildLocationsz->Add(this->buildPathtc, 0, wxALIGN_CENTER, 0);
pBuildLocationsz->Add(pBuildLocationbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
propertiesGridSizer->Add(pVersion, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
propertiesGridSizer->Add(pVersionsz, 1, wxEXPAND);
propertiesGridSizer->Add(pVersionDate, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
- propertiesGridSizer->Add(pVersionDatetc, 1, wxEXPAND);
+ propertiesGridSizer->Add(this->versionDatetc, 1, wxEXPAND);
propertiesGridSizer->Add(pSourceLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
propertiesGridSizer->Add(pSourceLocationsz, 1, wxEXPAND);
propertiesGridSizer->Add(pBuildLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
sizer->SetSizeHints(this);
}
-void
-wxCDMProjectDescriptionPanel::OnBtnManagePackages(wxCommandEvent& event)
+void wxCDMProjectDescriptionPanel::OnBtnManagePackages(wxCommandEvent& event)
{
wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
newEvent->SetId(1);
event.Skip();
}
-void
-wxCDMProjectDescriptionPanel::OnBtnManageLibraries(wxCommandEvent& event)
+void wxCDMProjectDescriptionPanel::OnBtnManageLibraries(wxCommandEvent& event)
{
wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
newEvent->SetId(1);
event.Skip();
}
-void
-wxCDMProjectDescriptionPanel::OnBtnManageApplications(wxCommandEvent& event)
+void wxCDMProjectDescriptionPanel::OnBtnManageApplications(wxCommandEvent& event)
{
wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
newEvent->SetId(1);
void wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
{
- //TODO: implement method
- std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl;
- event.Skip();
+ std::string* result;
+ if(!this->project->OpenCMakeListsFile(result))
+ wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
}
void
wxCDMProjectDescriptionPanel::OnBtnSetBuildPath(wxCommandEvent& event)
{
- //TODO: implement method
- std::cerr << "Event OnBtnSetBuildPath not implemented" << std::endl;
- event.Skip();
+ wxDirDialog* dialog = new wxDirDialog(this, wxT("Choose the new build location for the project"));
+ if(dialog->ShowModal())
+ {
+ std::string* result;
+ if(!this->project->SetBuildPath(crea::wx2std(dialog->GetPath()), result))
+ wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+ }
+ this->buildPathtc->SetLabel(crea::std2wx(this->project->GetBuildPath()));
}
void
wxCDMProjectDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
{
- //TODO: implement method
- std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;
- event.Skip();
+ std::string* result;
+ if(!this->project->OpenInFileExplorer(result))
+ wxMessageBox(crea::std2wx(*result),_T("Open File - Error!"),wxOK | wxICON_ERROR);
}
void
//TODO: implement method
std::cerr << "Event OnBtnSetVersion not implemented" << std::endl;
event.Skip();
+
+ //get name
+ wxString libraryName = wxGetTextFromUser(
+ wxT("Enter the new version name"),
+ wxT("New Library - creaDevManager"),
+ crea::std2wx(this->project->GetVersion())
+ );
+ //check name
+ std::vector<std::string> parts;
+ CDMUtilities::splitter::split(parts, crea::wx2std(libraryName), " .", CDMUtilities::splitter::no_empties);
+ if(parts.size() == 3)
+ {
+ std::string* result;
+ if(!this->project->SetVersion(crea::wx2std(libraryName), result))
+ wxMessageBox(crea::std2wx(*result),_T("Open File - Error!"),wxOK | wxICON_ERROR);
+ }
+ else
+ {
+ wxMessageBox(crea::std2wx("The version format is incorrect, please follow the following format:\nX.Y.Z\nX: Major Version\nY: Minor Version\nZ: Build Version"),_T("Set Project Version - Error!"),wxOK | wxICON_ERROR);
+ }
+ this->versiontc->SetLabel(crea::std2wx(this->project->GetVersion()));
+ this->versionDatetc->SetLabel(crea::std2wx(this->project->GetVersionDate()));
+
}
private:
modelCDMProject* project;
+ wxStaticText* versiontc;
+ wxStaticText* versionDatetc;
+ wxStaticText* buildPathtc;
//handlers
protected: