StringArray EnabledModuleList::getAllModules() const { StringArray moduleIDs; for (int i = 0; i < getNumModules(); ++i) moduleIDs.add (getModuleID(i)); return moduleIDs; }
void EnabledModuleList::createRequiredModules (OwnedArray<LibraryModule>& modules) { for (int i = 0; i < getNumModules(); ++i) { ModuleDescription info (getModuleInfo (getModuleID (i))); if (info.isValid()) modules.add (new LibraryModule (info)); } }
bool EnabledModuleList::areMostModulesCopiedLocally() const { int numYes = 0, numNo = 0; for (int i = getNumModules(); --i >= 0;) { if (shouldCopyModuleFilesLocally (getModuleID (i)).getValue()) ++numYes; else ++numNo; } return numYes > numNo; }
bool EnabledModuleList::areMostModulesUsingGlobalPath() const { auto numYes = 0, numNo = 0; for (auto i = getNumModules(); --i >= 0;) { if (shouldUseGlobalPath (getModuleID (i))) ++numYes; else ++numNo; } return numYes > numNo; }
void DisplayWindow::writeCppFile(QString dir, string path) { ofstream ofile(path.c_str()); ofile << "#include <fstream>\n#include <string>\n#include <LightParameter.h>\n#include <NeoPixelCodeConverter.h>\n#include <vector>\n\n"; ofile << "using namespace std;\n\n"; ofile << "NeoPixelCodeConverter b;\nvector<LightParameter> a;\n\n"; ofile << "int main()\n{\n\n"; ofile<<"int* "; for(int t = 0; t < vecOfStructures->size(); t++) { uint32_t c1 = vecOfStructures->at(t).Color1; uint32_t c2 = vecOfStructures->at(t).Color1; ofile<<"arr = new int["<<vecOfStructures->at(t).grouplength<<"] {"; for( int j = 0; j < vecOfStructures->at(t).grouplength; j++) { ofile<<vecOfStructures->at(t).group[j]<<", "; } ofile<<"};\n"; ofile<< "a.push_back(LightParameter("; ofile<< getPattern(vecOfStructures->at(t).pattern).toStdString() << ", "; ofile<< getDirection(vecOfStructures->at(t).direction).toStdString() << ", "; ofile<< vecOfStructures->at(t).startTime << ", "; ofile<< vecOfStructures->at(t).cycles << ", "; ofile<< vecOfStructures->at(t).index << ", "; ofile<< vecOfStructures->at(t).onTime << ", "; ofile<< vecOfStructures->at(t).offTime << ", "; ofile<< vecOfStructures->at(t).brightness << ", "; ofile<< "b.Color(" <<int(parentForDWin->Red(c1))<<","; ofile<< int(parentForDWin->Green(c1))<<","; ofile<< int(parentForDWin->Blue(c1))<<"), "; ofile<< "b.Color(" <<int(parentForDWin->Red(c2))<<","; ofile<< int(parentForDWin->Green(c2))<<","; ofile<<int(parentForDWin->Blue(c2))<<"), "; ofile<< vecOfStructures->at(t).interval << ", "; ofile<< "arr, " << vecOfStructures->at(t).grouplength << "));\n"; ofile<<"delete [] arr;\n\n"; } ofile<< "b.create(a, " << getNumModules() << ", " << vecOfStructures->size() << ", \"" << QString(dir + "/out/out.ino").toStdString() << "\""; ofile<< ");\n\n}"; ofile.close(); }
void EnabledModuleList::setLocalCopyModeForAllModules (bool copyLocally) { for (int i = getNumModules(); --i >= 0;) shouldCopyModuleFilesLocally (project.getModules().getModuleID (i)) = copyLocally; }
void EnabledModuleList::createRequiredModules (OwnedArray<LibraryModule>& modules) { for (int i = 0; i < getNumModules(); ++i) modules.add (new LibraryModule (getModuleInfo (getModuleID (i)))); }