VizKit
3.3.7
|
Stores preference values of different data type (integer, float, char, boolean). More...
#include <VisualPreferences.h>
Classes | |
class | Preference |
Stores a key-value-pair of preferences. More... | |
Public Types | |
enum | PreferenceKeyInt { kUnknownPrefInt = 0, kFadeInTimeOnPlayInMS, kFadeInTimeOnResumeInMS, kFadeOutTimeBeforeEndOfTrackInMS, kFadeOutTimeOnPauseInMS, kFadeInOutTimeOnShowInMS, kTrackInfoFontSize, kTrackLyricsFontSize, AdditionalPreferenceKeyIntKeys } |
Integer preferences. More... | |
enum | PreferenceKeyFloat { kUnknownPrefFloat = 0, kTrackInfoFontColorRedFloat, kTrackInfoFontColorGreenFloat, kTrackInfoFontColorBlueFloat, kTrackInfoFontColorAlphaFloat, kTrackInfoTextureColorTopLeftRed, kTrackInfoTextureColorTopLeftGreen, kTrackInfoTextureColorTopLeftBlue, kTrackInfoTextureColorTopLeftAlpha, kTrackInfoTextureColorBottomLeftRed, kTrackInfoTextureColorBottomLeftGreen, kTrackInfoTextureColorBottomLeftBlue, kTrackInfoTextureColorBottomLeftAlpha, kTrackInfoTextureColorBottomRightRed, kTrackInfoTextureColorBottomRightGreen, kTrackInfoTextureColorBottomRightBlue, kTrackInfoTextureColorBottomRightAlpha, kTrackInfoTextureColorTopRightRed, kTrackInfoTextureColorTopRightGreen, kTrackInfoTextureColorTopRightBlue, kTrackInfoTextureColorTopRightAlpha, kTrackLyricsFontColorRedFloat, kTrackLyricsFontColorGreenFloat, kTrackLyricsFontColorBlueFloat, kTrackLyricsFontColorAlphaFloat, kCanvasBackgroundColorRed, kCanvasBackgroundColorGreen, kCanvasBackgroundColorBlue, AdditionalPreferenceKeyFloatKeys } |
Float preferences. More... | |
enum | PreferenceKeyChar { kUnknownPrefChar = 0, kTrackInfoDisplayItemsDelimiterCharacters, kTrackInfoFont, kTrackLyricsFont, kFallbackSystemFont, AdditionalPreferenceKeyCharKeys } |
Char preferences. More... | |
enum | PreferenceKeyBool { kUnknownPrefBool = 0, AdditionalPreferenceKeyBoolKeys } |
Boolean preferences. More... | |
Static Public Member Functions | |
static void | dispose (void) |
Disposes the VisualPreferences. | |
static void | setValue (const PreferenceKeyInt anIdentifier, const int aValue) |
Sets a preference value (integer). | |
static void | setValue (const PreferenceKeyFloat anIdentifier, const float aValue) |
Sets a preference value (float). | |
static void | setValue (const PreferenceKeyChar anIdentifier, const char *const aValue) |
Sets a preference value (char). | |
static void | setValue (const PreferenceKeyBool anIdentifier, const bool aValue) |
Sets a preference value (boolean). | |
static int | getDefault (const PreferenceKeyInt anIdentifier, bool *isDefaultValue) |
Retrieves a default preference value (integer). | |
static float | getDefault (const PreferenceKeyFloat anIdentifier, bool *isDefaultValue) |
Retrieves a default preference value (float). | |
static bool | getDefault (const PreferenceKeyChar anIdentifier, char *outPrefVal) |
Retrieves a default preference value (char). | |
static bool | getDefault (const PreferenceKeyBool anIdentifier, bool *isDefaultValue) |
Retrieves a default preference value (boolean). | |
static int | getValue (const PreferenceKeyInt anIdentifier, bool *isDefaultValue=NULL) |
Retrieves a persistent preference value (integer). | |
static float | getValue (const PreferenceKeyFloat anIdentifier, bool *isDefaultValue=NULL) |
Retrieves a persistent preference value (float). | |
static void | getValue (const PreferenceKeyChar anIdentifier, char *outPrefVal, bool *isDefaultValue=NULL) |
Retrieves a persistent preference value (char). | |
static bool | getValue (const PreferenceKeyBool anIdentifier, bool *isDefaultValue=NULL) |
Retrieves a persistent preference value (boolean). | |
static void | storeValues (void) |
Stores the preferences in persistent storage. | |
static void | setDefaultValues (void) |
Called on init of the plug-in in VisualMainAction::handleInitMessage(). | |
static void | convertPreferenceKeyToString (const PreferenceKeyInt aKey, char *outString) |
Static helper function that converts an integer PreferenceKey to the string. | |
static void | convertPreferenceKeyToString (const PreferenceKeyFloat aKey, char *outString) |
Static helper function that converts a float PreferenceKey to the string. | |
static void | convertPreferenceKeyToString (const PreferenceKeyChar aKey, char *outString) |
Static helper function that converts a char PreferenceKey to the string. | |
static void | convertPreferenceKeyToString (const PreferenceKeyBool aKey, char *outString) |
Static helper function that converts a boolean PreferenceKey to the string. | |
static VisualPreferences::PreferenceKeyInt | convertPreferenceKeyIntStringToKey (const char *const aPreferenceKeyString) |
Static helper function that converts a string with an integer PreferenceKey to the according PreferenceKey. | |
static VisualPreferences::PreferenceKeyFloat | convertPreferenceKeyFloatStringToKey (const char *const aPreferenceKeyString) |
Static helper function that converts a string with a float PreferenceKey to the according PreferenceKey. | |
static VisualPreferences::PreferenceKeyChar | convertPreferenceKeyCharStringToKey (const char *const aPreferenceKeyString) |
Static helper function that converts a string with a char PreferenceKey to the according PreferenceKey. | |
static VisualPreferences::PreferenceKeyBool | convertPreferenceKeyBoolStringToKey (const char *const aPreferenceKeyString) |
Static helper function that converts a string with a boolean PreferenceKey to the according PreferenceKey. | |
static void | setDefault (const PreferenceKeyInt anIdentifier, const int aValue) |
Sets a default preference value (integer). | |
static void | setDefault (const PreferenceKeyFloat anIdentifier, const float aValue) |
Sets a default preference value (float). | |
static void | setDefault (const PreferenceKeyChar anIdentifier, const char *const aValue) |
Sets a default preference value (char). | |
static void | setDefault (const PreferenceKeyBool anIdentifier, const bool aValue) |
Sets a default preference value (boolean). | |
Private Types | |
enum | PrefDataType { kIntPrefType = 0, kCharPrefType, kFloatPrefType, kBoolPrefType } |
The format of the data that is stored with the preference. More... | |
enum | PrefStatus { kDefaultPref = 0, kPrefSetButNotStored, kPrefSetAndStored } |
The status of the preference. More... | |
typedef std::vector< Preference * > | PreferenceVector |
Preferences are collected as a vector of pointers to Preferences. | |
typedef PreferenceVector::iterator | PreferenceVectorIterator |
The PreferenceVectorIterator is an iterator of the PreferenceVector. | |
Private Member Functions | |
VisualPreferences () | |
The constructor. | |
~VisualPreferences () | |
The destructor. | |
VisualPreferences (const VisualPreferences &other) | |
Copy constructor. | |
VisualPreferences & | operator= (const VisualPreferences &other) |
Assignment operator. | |
Static Private Member Functions | |
static VisualPreferences * | getInstance (void) |
Constructs a VisualPreferences. | |
Private Attributes | |
PreferenceVector | preferenceVector |
Vector of preferences. | |
Static Private Attributes | |
static VisualPreferences * | theVisualPreferences = NULL |
VisualPreferences is a singleton class. |
Stores preference values of different data type (integer, float, char, boolean).
All public methods are declared static.
typedef std::vector<Preference*> VizKit::VisualPreferences::PreferenceVector [private] |
Preferences are collected as a vector of pointers to Preferences.
typedef PreferenceVector::iterator VizKit::VisualPreferences::PreferenceVectorIterator [private] |
The PreferenceVectorIterator is an iterator of the PreferenceVector.
enum VizKit::VisualPreferences::PrefDataType [private] |
Float preferences.
enum VizKit::VisualPreferences::PrefStatus [private] |
VisualPreferences::VisualPreferences | ( | ) | [private] |
The constructor.
VisualPreferences is a singleton class. The constructor is private. New instance of class can only be created internally.
VisualPreferences::~VisualPreferences | ( | ) | [private] |
The destructor.
VisualPreferences is a singleton class. The destructor is private. Instance of class can only be destructed internally.
VizKit::VisualPreferences::VisualPreferences | ( | const VisualPreferences & | other | ) | [private] |
Copy constructor.
other | Another VisualPreferences. |
VisualPreferences::PreferenceKeyBool VisualPreferences::convertPreferenceKeyBoolStringToKey | ( | const char *const | aPreferenceKeyString | ) | [static] |
Static helper function that converts a string with a boolean PreferenceKey to the according PreferenceKey.
Possibly useful for debugging or tracing purposes.
aPreferenceKeyString | A string with a PreferenceKey |
VisualPreferences::PreferenceKeyChar VisualPreferences::convertPreferenceKeyCharStringToKey | ( | const char *const | aPreferenceKeyString | ) | [static] |
Static helper function that converts a string with a char PreferenceKey to the according PreferenceKey.
Possibly useful for debugging or tracing purposes.
aPreferenceKeyString | A string with a PreferenceKey |
VisualPreferences::PreferenceKeyFloat VisualPreferences::convertPreferenceKeyFloatStringToKey | ( | const char *const | aPreferenceKeyString | ) | [static] |
Static helper function that converts a string with a float PreferenceKey to the according PreferenceKey.
Possibly useful for debugging or tracing purposes.
aPreferenceKeyString | A string with a PreferenceKey |
VisualPreferences::PreferenceKeyInt VisualPreferences::convertPreferenceKeyIntStringToKey | ( | const char *const | aPreferenceKeyString | ) | [static] |
Static helper function that converts a string with an integer PreferenceKey to the according PreferenceKey.
Possibly useful for debugging or tracing purposes.
aPreferenceKeyString | A string with a PreferenceKey |
void VisualPreferences::convertPreferenceKeyToString | ( | const PreferenceKeyInt | aKey, |
char * | outString | ||
) | [static] |
Static helper function that converts an integer PreferenceKey to the string.
Possibly useful for debugging or tracing purposes.
aKey | The key of a preference. |
outString | The character string value of the PreferenceKey enum value. |
void VisualPreferences::convertPreferenceKeyToString | ( | const PreferenceKeyFloat | aKey, |
char * | outString | ||
) | [static] |
Static helper function that converts a float PreferenceKey to the string.
Possibly useful for debugging or tracing purposes.
aKey | The key of a preference. |
outString | The character string value of the PreferenceKey enum value. |
void VisualPreferences::convertPreferenceKeyToString | ( | const PreferenceKeyChar | aKey, |
char * | outString | ||
) | [static] |
Static helper function that converts a char PreferenceKey to the string.
Possibly useful for debugging or tracing purposes.
aKey | The key of a preference. |
outString | The character string value of the PreferenceKey enum value. |
void VisualPreferences::convertPreferenceKeyToString | ( | const PreferenceKeyBool | aKey, |
char * | outString | ||
) | [static] |
Static helper function that converts a boolean PreferenceKey to the string.
Possibly useful for debugging or tracing purposes.
aKey | The key of a preference. |
outString | The character string value of the PreferenceKey enum value. |
void VisualPreferences::dispose | ( | void | ) | [static] |
Disposes the VisualPreferences.
int VisualPreferences::getDefault | ( | const PreferenceKeyInt | anIdentifier, |
bool * | isDefaultValue | ||
) | [static] |
Retrieves a default preference value (integer).
The default preference is handled as a fallback if a preference value is requested. It is handled as an error if a preference value is requested and no default value has been specified before nor any value with the requested key has been saved before.
anIdentifier | The identifier (key) of the preference value. |
isDefaultValue | True if default preference value was found. |
float VisualPreferences::getDefault | ( | const PreferenceKeyFloat | anIdentifier, |
bool * | isDefaultValue | ||
) | [static] |
Retrieves a default preference value (float).
The default preference is handled as a fallback if a preference value is requested. It is handled as an error if a preference value is requested and no default value has been specified before nor any value with the requested key has been saved before.
anIdentifier | The identifier (key) of the preference value. |
isDefaultValue | True if default preference value was found. |
bool VisualPreferences::getDefault | ( | const PreferenceKeyChar | anIdentifier, |
char * | outPrefVal | ||
) | [static] |
Retrieves a default preference value (char).
The default preference is handled as a fallback if a preference value is requested. It is handled as an error if a preference value is requested and no default value has been specified before nor any value with the requested key has been saved before.
anIdentifier | The identifier (key) of the preference value. | |
[out] | outPrefVal | The value of the character preference. |
bool VisualPreferences::getDefault | ( | const PreferenceKeyBool | anIdentifier, |
bool * | isDefaultValue | ||
) | [static] |
Retrieves a default preference value (boolean).
The default preference is handled as a fallback if a preference value is requested. It is handled as an error if a preference value is requested and no default value has been specified before nor any value with the requested key has been saved before.
anIdentifier | The identifier (key) of the preference value. |
isDefaultValue | True if default preference value was found. |
VisualPreferences * VisualPreferences::getInstance | ( | void | ) | [static, private] |
Constructs a VisualPreferences.
The VisualPreferences internally is a singleton. Returns a pointer to the initialized VisualPreferences.
int VisualPreferences::getValue | ( | const PreferenceKeyInt | anIdentifier, |
bool * | isDefaultValue = NULL |
||
) | [static] |
Retrieves a persistent preference value (integer).
anIdentifier | The identifier (key) of the preference value. |
isDefaultValue | True if returned value is default value. |
float VisualPreferences::getValue | ( | const PreferenceKeyFloat | anIdentifier, |
bool * | isDefaultValue = NULL |
||
) | [static] |
Retrieves a persistent preference value (float).
anIdentifier | The identifier (key) of the preference value. |
isDefaultValue | True if returned value is default value. |
void VisualPreferences::getValue | ( | const PreferenceKeyChar | anIdentifier, |
char * | outPrefVal, | ||
bool * | isDefaultValue = NULL |
||
) | [static] |
Retrieves a persistent preference value (char).
anIdentifier | The identifier (key) of the preference value. | |
[out] | outPrefVal | The value of the character preference. |
isDefaultValue | True if returned value is default value. |
bool VisualPreferences::getValue | ( | const PreferenceKeyBool | anIdentifier, |
bool * | isDefaultValue = NULL |
||
) | [static] |
Retrieves a persistent preference value (boolean).
anIdentifier | The identifier (key) of the preference value. |
isDefaultValue | True if returned value is default value. |
VisualPreferences& VizKit::VisualPreferences::operator= | ( | const VisualPreferences & | other | ) | [private] |
Assignment operator.
void VisualPreferences::setDefault | ( | const PreferenceKeyInt | anIdentifier, |
const int | aValue | ||
) | [static] |
Sets a default preference value (integer).
The default preference value is set by VisualPreferences' setDefaultValues(). That way there will always be a preference value present even if the user hasn't set any yet. If it is not possible to set a default value, at least a value has to be set and stored before the value will be returned on request.
anIdentifier | The identifier (key) of the preference value. |
aValue | The value (integer) of the preference value. |
void VisualPreferences::setDefault | ( | const PreferenceKeyFloat | anIdentifier, |
const float | aValue | ||
) | [static] |
Sets a default preference value (float).
The default preference value is set by VisualPreferences' setDefaultValues(). That way there will always be a preference value present even if the user hasn't set any yet. If it is not possible to set a default value, at least a value has to be set and stored before the value will be returned on request.
anIdentifier | The identifier (key) of the preference value. |
aValue | The value (float) of the preference value. |
void VisualPreferences::setDefault | ( | const PreferenceKeyChar | anIdentifier, |
const char *const | aValue | ||
) | [static] |
Sets a default preference value (char).
The default preference value is set by VisualPreferences' setDefaultValues(). That way there will always be a preference value present even if the user hasn't set any yet. If it is not possible to set a default value, at least a value has to be set and stored before the value will be returned on request.
anIdentifier | The identifier (key) of the preference value. |
aValue | The value (character) of the preference value. |
void VisualPreferences::setDefault | ( | const PreferenceKeyBool | anIdentifier, |
const bool | aValue | ||
) | [static] |
Sets a default preference value (boolean).
The default preference value is set by VisualPreferences' setDefaultValues(). That way there will always be a preference value present even if the user hasn't set any yet. If it is not possible to set a default value, at least a value has to be set and stored before the value will be returned on request.
anIdentifier | The identifier (key) of the preference value. |
aValue | The value (boolean) of the preference value. |
void VisualPreferences::setDefaultValues | ( | void | ) | [static] |
Called on init of the plug-in in VisualMainAction::handleInitMessage().
The default (factory) preference values are set.
void VisualPreferences::setValue | ( | const PreferenceKeyInt | anIdentifier, |
const int | aValue | ||
) | [static] |
Sets a preference value (integer).
To store a preference persistently, the method storeValues has to be called afterwards.
anIdentifier | The identifier (key) of the preference value. |
aValue | The value (integer) of the preference value. |
void VisualPreferences::setValue | ( | const PreferenceKeyFloat | anIdentifier, |
const float | aValue | ||
) | [static] |
Sets a preference value (float).
To store a preference persistently, the method storeValues has to be called afterwards.
anIdentifier | The identifier (key) of the preference value. |
aValue | The value (float) of the preference value. |
void VisualPreferences::setValue | ( | const PreferenceKeyChar | anIdentifier, |
const char *const | aValue | ||
) | [static] |
Sets a preference value (char).
To store a preference persistently, the method storeValues has to be called afterwards.
anIdentifier | The identifier (key) of the preference value. |
aValue | The value (character) of the preference value. |
void VisualPreferences::setValue | ( | const PreferenceKeyBool | anIdentifier, |
const bool | aValue | ||
) | [static] |
Sets a preference value (boolean).
To store a preference persistently, the method storeValues has to be called afterwards.
anIdentifier | The identifier (key) of the preference value. |
aValue | The value (boolean) of the preference value. |
void VisualPreferences::storeValues | ( | void | ) | [static] |
Stores the preferences in persistent storage.
Vector of preferences.
VisualPreferences * VisualPreferences::theVisualPreferences = NULL [static, private] |
VisualPreferences is a singleton class.
Pointer to private instance is handled internally.