本文整理汇总了C++中PropertiesFile::getFile方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertiesFile::getFile方法的具体用法?C++ PropertiesFile::getFile怎么用?C++ PropertiesFile::getFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertiesFile
的用法示例。
在下文中一共展示了PropertiesFile::getFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: filename
PropertiesFile& StoredSettings::getProjectProperties (const String& projectUID)
{
const String filename ("Introjucer_Project_" + projectUID);
for (int i = propertyFiles.size(); --i >= 0;)
{
PropertiesFile* const props = propertyFiles.getUnchecked(i);
if (props->getFile().getFileNameWithoutExtension() == filename)
return *props;
}
PropertiesFile* p = createPropsFile (filename);
if (!p->getFile().existsAsFile())
{
p->getFile().create();
}
DBG("PROPERTIES FILE FOR PROJECT: " + p->getFile().getFullPathName());
propertyFiles.add (p);
return *p;
}
示例2: saveSettingsToFile
void ApplicationSettingsComponent::saveSettingsToFile(){
PropertiesFile* properties = ApplicationConfiguration::getApplicationProperties();
properties->setValue("serialport", serialPortComboBox->getText());
properties->setValue("serialspeed", serialSpeedComboBox->getText());
properties->setValue("presetdirectory", presetDirectoryEditor->getText());
properties->setValue("midiinput", midiInputComboBox->getText());
properties->setValue("midioutput", midiOutputComboBox->getText());
properties->setValue("oschost", oscHostEditor->getText());
properties->setValue("oscport", oscPortEditor->getText());
properties->saveIfNeeded();
std::cout << "saved settings to file " << properties->getFile().getFullPathName() << std::endl;
}
示例3: loadSettingsFromFile
void ApplicationSettingsComponent::loadSettingsFromFile(){
PropertiesFile* properties = ApplicationConfiguration::getApplicationProperties();
#if JUCE_MAC || JUCE_IOS
DirectoryIterator it(File("/dev"), false, "tty.usbserial-*");
#elif JUCE_WINDOWS
DirectoryIterator it(File("\\\\.\\"), false, "COM*");
#elif JUCE_LINUX
DirectoryIterator it(File("/dev"), false, "ttyUSB*");
#endif
int index = 1;
serialPortComboBox->addItem("none", index);
while(it.next())
serialPortComboBox->addItem(it.getFile().getFullPathName(), ++index);
serialPortComboBox->setText(properties->getValue("serialport"));
serialSpeedComboBox->setText(properties->getValue("serialspeed"));
presetDirectoryEditor->setText(properties->getValue("presetdirectory"));
const StringArray& inputs = MidiInput::getDevices();
midiInputComboBox->addItem("none", ++index);
for(int i=0; i<inputs.size(); ++i)
midiInputComboBox->addItem(inputs[i], ++index);
#if ! JUCE_WINDOWS
midiInputComboBox->addItem("BlipZones", ++index);
#endif
midiInputComboBox->setText(properties->getValue("midiinput"));
const StringArray& outputs = MidiOutput::getDevices();
midiOutputComboBox->addItem("none", ++index);
for(int i=0; i<outputs.size(); ++i)
midiOutputComboBox->addItem(outputs[i], ++index);
#if ! JUCE_WINDOWS
midiOutputComboBox->addItem("BlipZones", ++index);
#endif
midiOutputComboBox->setText(properties->getValue("midioutput"));
oscHostEditor->setText(properties->getValue("oschost"));
oscPortEditor->setText(properties->getValue("oscport"));
std::cout << "loaded settings from file " << properties->getFile().getFullPathName() << std::endl;
}
示例4: flush
void StoredSettings::flush()
{
if (props != nullptr)
{
props->setValue ("recentFiles", recentFiles.toString());
props->removeValue ("keyMappings");
if (commandManager != nullptr)
{
ScopedPointer <XmlElement> keys (commandManager->getKeyMappings()->createXml (true));
if (keys != nullptr)
props->setValue ("keyMappings", (XmlElement*) keys);
}
}
props = nullptr;
{
// These settings are used in defining the properties file's location.
PropertiesFile::Options options;
options.applicationName = "Introjucer";
options.folderName = "Introjucer";
options.filenameSuffix = "settings";
options.osxLibrarySubFolder = "Application Support";
props = new PropertiesFile (options);
// Because older versions of the introjucer saved their settings under a different
// name, this code is an example of how to migrate your old settings files...
if (! props->getFile().exists())
{
PropertiesFile::Options oldOptions;
oldOptions.applicationName = "Jucer2";
oldOptions.filenameSuffix = "settings";
oldOptions.osxLibrarySubFolder = "Preferences";
PropertiesFile oldProps (oldOptions);
if (oldProps.getFile().exists())
props->addAllPropertiesFrom (oldProps);
}
}
// recent files...
recentFiles.restoreFromString (props->getValue ("recentFiles"));
recentFiles.removeNonExistentFiles();
// swatch colours...
swatchColours.clear();
#define COL(col) Colours::col,
const Colour colours[] =
{
#include "jucer_Colours.h"
Colours::transparentBlack
};
#undef COL
const int numSwatchColours = 24;
for (int i = 0; i < numSwatchColours; ++i)
swatchColours.add (Colour::fromString (props->getValue ("swatchColour" + String (i),
colours [2 + i].toString())));
}