bool ScopeSync::saveConfigurationAs() { File configurationFileDirectory = getConfigurationDirectory(); FileChooser fileChooser("Save Configuration File As...", configurationFileDirectory, "*.configuration"); if (fileChooser.browseForFileToSave(true)) { String fileName = fileChooser.getResult().getFullPathName(); if (File::isAbsolutePath(fileName)) { configuration->setLastFailedFile(configuration->getFile()); configuration->setFile(File(fileName)); getConfigurationRoot().setProperty(Ids::ID, createAlphaNumericUID(), nullptr); saveConfiguration(); } applyConfiguration(); UserSettings::getInstance()->addActionListener(this); UserSettings::getInstance()->rebuildFileLibrary(true, false, false); return true; } else return false; }
void Project::Item::initialiseMissingProperties() { if (! state.hasProperty (Ids::ID)) setID (createAlphaNumericUID()); if (isFile()) { state.setProperty (Ids::name, getFile().getFileName(), nullptr); } else if (isGroup()) { for (int i = getNumChildren(); --i >= 0;) getChild(i).initialiseMissingProperties(); } }
void Project::Item::initialiseNodeValues() { if (! node.hasProperty (Ids::id_)) node.setProperty (Ids::id_, createAlphaNumericUID(), 0); if (isFile()) { node.setProperty (Ids::name, getFile().getFileName(), 0); } else if (isGroup()) { for (int i = getNumChildren(); --i >= 0;) getChild(i).initialiseNodeValues(); } }
void Project::setMissingDefaultValues() { if (! projectRoot.hasProperty (ComponentBuilder::idProperty)) projectRoot.setProperty (ComponentBuilder::idProperty, createAlphaNumericUID(), nullptr); // Create main file group if missing if (! projectRoot.getChildWithName (Tags::projectMainGroup).isValid()) { Item mainGroup (*this, ValueTree (Tags::projectMainGroup)); projectRoot.addChild (mainGroup.state, 0, 0); } getMainGroup().initialiseMissingProperties(); if (getDocumentTitle().isEmpty()) setTitle ("Juce Project"); if (! projectRoot.hasProperty (Ids::projectType)) getProjectTypeValue() = ProjectType::getGUIAppTypeName(); if (! projectRoot.hasProperty (Ids::version)) getVersionValue() = "1.0.0"; updateOldStyleConfigList(); moveOldPropertyFromProjectToAllExporters (Ids::bigIcon); moveOldPropertyFromProjectToAllExporters (Ids::smallIcon); for (Project::ExporterIterator exporter (*this); exporter.next();) if (exporter->getNumConfigurations() == 0) exporter->createDefaultConfigs(); if (! projectRoot.getChildWithName (Tags::exporters).isValid()) createDefaultExporters(); getProjectType().setMissingProjectProperties (*this); if (! projectRoot.hasProperty (Ids::bundleIdentifier)) setBundleIdentifierToDefault(); if (! projectRoot.getChildWithName (Tags::modulesGroup).isValid()) addDefaultModules (false); }
void Project::setMissingDefaultValues() { if (! projectRoot.hasProperty (Ids::ID)) projectRoot.setProperty (Ids::ID, createAlphaNumericUID(), nullptr); // Create main file group if missing if (! projectRoot.getChildWithName (Ids::MAINGROUP).isValid()) { Item mainGroup (*this, ValueTree (Ids::MAINGROUP), false); projectRoot.addChild (mainGroup.state, 0, 0); } getMainGroup().initialiseMissingProperties(); if (getDocumentTitle().isEmpty()) setTitle ("JUCE Project"); if (! projectRoot.hasProperty (Ids::projectType)) getProjectTypeValue() = ProjectType_GUIApp::getTypeName(); if (! projectRoot.hasProperty (Ids::version)) getVersionValue() = "1.0.0"; updateOldStyleConfigList(); moveOldPropertyFromProjectToAllExporters (Ids::bigIcon); moveOldPropertyFromProjectToAllExporters (Ids::smallIcon); if (getProjectType().isAudioPlugin()) setMissingAudioPluginDefaultValues(); getModules().sortAlphabetically(); if (getBundleIdentifier().toString().isEmpty()) getBundleIdentifier() = getDefaultBundleIdentifier(); if (shouldIncludeBinaryInAppConfig() == var::null) shouldIncludeBinaryInAppConfig() = true; ProjucerApplication::getApp().updateNewlyOpenedProject (*this); }
void Project::setMissingDefaultValues() { if (! projectRoot.hasProperty (Ids::ID)) projectRoot.setProperty (Ids::ID, createAlphaNumericUID(), nullptr); // Create main file group if missing if (! projectRoot.getChildWithName (Tags::projectMainGroup).isValid()) { Item mainGroup (*this, ValueTree (Tags::projectMainGroup)); projectRoot.addChild (mainGroup.state, 0, 0); } getMainGroup().initialiseMissingProperties(); if (getDocumentTitle().isEmpty()) setTitle ("JUCE Project"); if (! projectRoot.hasProperty (Ids::projectType)) getProjectTypeValue() = ProjectType::getGUIAppTypeName(); if (! projectRoot.hasProperty (Ids::version)) getVersionValue() = "1.0.0"; updateOldStyleConfigList(); moveOldPropertyFromProjectToAllExporters (Ids::bigIcon); moveOldPropertyFromProjectToAllExporters (Ids::smallIcon); getProjectType().setMissingProjectProperties (*this); if (! projectRoot.getChildWithName (Tags::modulesGroup).isValid()) addDefaultModules (false); if (getBundleIdentifier().toString().isEmpty()) getBundleIdentifier() = getDefaultBundleIdentifier(); IntrojucerApp::getApp().updateNewlyOpenedProject (*this); }
void Project::setMissingDefaultValues() { if (! projectRoot.hasProperty (Ids::id_)) projectRoot.setProperty (Ids::id_, createAlphaNumericUID(), 0); // Create main file group if missing if (! projectRoot.getChildWithName (Tags::projectMainGroup).isValid()) { Item mainGroup (*this, ValueTree (Tags::projectMainGroup)); projectRoot.addChild (mainGroup.getNode(), 0, 0); } getMainGroup().initialiseNodeValues(); if (getDocumentTitle().isEmpty()) setTitle ("Juce Project"); if (! projectRoot.hasProperty (Ids::projectType)) getProjectType() = application; if (! projectRoot.hasProperty (Ids::version)) getVersion() = "1.0.0"; if (! projectRoot.hasProperty (Ids::juceLinkage)) getJuceLinkageModeValue() = useAmalgamatedJuceViaMultipleTemplates; const String juceFolderPath (getRelativePathForFile (StoredSettings::getInstance()->getLastKnownJuceFolder())); // Create configs group if (! projectRoot.getChildWithName (Tags::configurations).isValid()) { projectRoot.addChild (ValueTree (Tags::configurations), 0, 0); createDefaultConfigs(); } if (! projectRoot.getChildWithName (Tags::exporters).isValid()) createDefaultExporters(); const String sanitisedProjectName (CodeHelpers::makeValidIdentifier (getProjectName().toString(), false, true, false)); if (! projectRoot.hasProperty (Ids::buildVST)) { shouldBuildVST() = true; shouldBuildRTAS() = false; shouldBuildAU() = true; getPluginName() = getProjectName().toString(); getPluginDesc() = getProjectName().toString(); getPluginManufacturer() = "yourcompany"; getPluginManufacturerCode() = "Manu"; getPluginCode() = "Plug"; getPluginChannelConfigs() = "{1, 1}, {2, 2}"; getPluginIsSynth() = false; getPluginWantsMidiInput() = false; getPluginProducesMidiOut() = false; getPluginSilenceInProducesSilenceOut() = false; getPluginTailLengthSeconds() = 0; getPluginEditorNeedsKeyFocus() = false; getPluginAUExportPrefix() = sanitisedProjectName + "AU"; getPluginAUCocoaViewClassName() = sanitisedProjectName + "AU_V1"; getPluginRTASCategory() = String::empty; } if (! projectRoot.hasProperty (Ids::bundleIdentifier)) setBundleIdentifierToDefault(); }
bool UnityProjectBuilder::run() { logOutput ("Starting parse of \"" + projectFile.getFullPathName() + "\"..."); project = readValueTreeFromFile (projectFile); if (! project.hasType (Ids::jucerProject)) { logOutput ("ERROR: Invalid project, exiting"); return false; } logOutput ("Valid project found..."); ValueTree mainGroupTree (project.getChildWithName (Ids::mainGroup)); if (! mainGroupTree.isValid()) { logOutput ("ERROR: Empty project, exiting"); return false; } updateBuildDirectories(); File sourceDir (projectFile.getSiblingFile ("Source")); logOutput (newLine); recurseGroup (mainGroupTree, sourceDir); const Array<File> cppFiles (buildUnityCpp (sourceDir)); // add unity files ValueTree unityGroup (Ids::group); unityGroup.setProperty (Ids::idProp, createAlphaNumericUID(), nullptr); unityGroup.setProperty (Ids::nameProp, "Unity", nullptr); mainGroupTree.addChild (unityGroup, -1, nullptr); for (int i = 0; i < cppFiles.size(); ++i) { File cppFile (cppFiles[i]); if (cppFile.exists()) { ValueTree cppTree (Ids::file); cppTree.setProperty (Ids::idProp, createAlphaNumericUID(), nullptr); cppTree.setProperty (Ids::nameProp, cppFile.getFileName(), nullptr); cppTree.setProperty (Ids::compileProp, true, nullptr); cppTree.setProperty (Ids::resourceProp, false, nullptr); cppTree.setProperty (Ids::fileProp, cppFile.getRelativePathFrom (projectFile), nullptr); unityGroup.addChild (cppTree, -1, nullptr); } } // write unity Introjucer project unityProjectFile = projectFile.getSiblingFile (projectFile.getFileNameWithoutExtension() + unityName + projectFile.getFileExtension()); if (unityProjectFile.existsAsFile()) unityProjectFile.deleteFile(); writeValueTreeToFile (project, unityProjectFile); logOutput ("Completed successfully!"); return true; }