ApplicationProperties, singleton


#1

Hi,

Because of some JUCE updates, I cannot set my storage parameters the way I used to in some old projects. Whereas I was using:

[i]PropertiesFile::Options myOption;
myOption.applicationName = JucePlugin_Desc;
myOption.filenameSuffix = “settings”;
myOption.folderName = “Library/Preferences/grmPref”;
myOption.osxLibrarySubFolder = “Library/Preferences”;
myOption.commonToAllUsers = true;
myOption.ignoreCaseOfKeyNames = true;
myOption.millisecondsBeforeSaving = 10;
myOption.storageFormat = PropertiesFile::storeAsXML;

    ApplicationProperties::getInstance()->setStorageParameters (myOption);[/i]

Now I get “No member named ‘getInstance’ in ‘juce::ApplicationProperties’”.

Could someone please explain what I should do?

Thank you


#2

It has changed and is no longer a singleton:

viewtopic.php?f=2&t=8835&hilit=applicationproperties+singleton


#3

Yeah I’ve seen this but I don’t get what JULES mean by “use your own singleton to hold an ApplicationProperties object”


#4

You can just inherit ApplicationProperties and then add juce_DeclareSingleton.


#5

Thank you!

Do you know why I get “No matching constructor for initialization of ‘StandaloneFilterWindow’” when I use juce_DeclareSingleton(StandaloneFilterWindow, false) in my class (class StandaloneFilterWindow : public ApplicationProperties) ?


#6

Maybe you didn’t added “public:” where you should have or maybe you declared none-empty constructor without explicitly adding also an empty constructor.


#7

Remember guys, singletons should only be used as a last resort. If you can find any other possible way of handling ownership of that object, then you should do so.