X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FmodelCDMAppli.cpp;fp=lib%2FcreaDevManagerLib%2FmodelCDMAppli.cpp;h=417392792399e8024b7eed70ae5b7101c762f655;hb=5af1633cdea030f5189c57c51bd843685eecd8b6;hp=c92932a1c5583de3c0a9f6795d926fefe26cc13d;hpb=7a33a157d7372e4d507cd4a8ec0ae9a1f92d986e;p=crea.git diff --git a/lib/creaDevManagerLib/modelCDMAppli.cpp b/lib/creaDevManagerLib/modelCDMAppli.cpp index c92932a..4173927 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.cpp +++ b/lib/creaDevManagerLib/modelCDMAppli.cpp @@ -69,9 +69,17 @@ modelCDMAppli::modelCDMAppli(const std::string& path, const std::string& name, c { std::string stdfileName = crea::wx2std(fileName); - modelCDMApplication* application = new modelCDMApplication(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - this->applications.push_back(application); - this->children.push_back(application); + if(stdfileName != "template_appli" && stdfileName != "template_wx_appli") + { + modelCDMApplication* application = new modelCDMApplication(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->applications.push_back(application); + this->children.push_back(application); + } + else + { + modelCDMFolder* folder = new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(folder); + } cont = dir.GetNext(&fileName); } @@ -175,26 +183,51 @@ const bool modelCDMAppli::Refresh(std::string*& result) while (cont) { std::string stdfileName = crea::wx2std(fileName); - std::string applicationName = stdfileName; - //check if they already exist - bool found = false; - for (int i = 0; !found && i < this->applications.size(); i++) + + if(stdfileName != "template_appli" && stdfileName != "template_wx_appli") { - if (this->applications[i]->GetName() == applicationName) + std::string applicationName = stdfileName; + //check if application already exist + bool found = false; + for (int i = 0; !found && i < this->applications.size(); i++) { - found = true; - int pos = std::find(this->children.begin(), this->children.end(), this->applications[i]) - this->children.begin(); - checked[pos] = true; - checkedApplications[i] = true; - if(!this->applications[i]->Refresh(result)) - return false; + if (this->applications[i]->GetName() == applicationName) + { + found = true; + int pos = std::find(this->children.begin(), this->children.end(), this->applications[i]) - this->children.begin(); + checked[pos] = true; + checkedApplications[i] = true; + if(!this->applications[i]->Refresh(result)) + return false; + } + } + if(!found) + { + modelCDMApplication* application= new modelCDMApplication(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->applications.push_back(application); + this->children.push_back(application); } } - if(!found) + else { - modelCDMApplication* application= new modelCDMApplication(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); - this->applications.push_back(application); - this->children.push_back(application); + //check if folder already exist + bool found = false; + for (int i = 0; !found && i < this->children.size(); i++) + { + if (this->children[i]->GetName() == stdfileName) + { + found = true; + checked[i] = true; + + if(!this->children[i]->Refresh(result)) + return false; + } + } + if(!found) + { + modelCDMFolder* folder= new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(folder); + } } cont = dir.GetNext(&fileName); }