VizKit  3.3.7
Classes | Public Types | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
VizKit::VisualPreferences Class Reference

Stores preference values of different data type (integer, float, char, boolean). More...

#include <VisualPreferences.h>

List of all members.

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.
VisualPreferencesoperator= (const VisualPreferences &other)
 Assignment operator.

Static Private Member Functions

static VisualPreferencesgetInstance (void)
 Constructs a VisualPreferences.

Private Attributes

PreferenceVector preferenceVector
 Vector of preferences.

Static Private Attributes

static VisualPreferencestheVisualPreferences = NULL
 VisualPreferences is a singleton class.

Detailed Description

Stores preference values of different data type (integer, float, char, boolean).

All public methods are declared static.


Member Typedef Documentation

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.


Member Enumeration Documentation

The format of the data that is stored with the preference.

Enumerator:
kIntPrefType 

Integer type.

kCharPrefType 

8-bit character type.

kFloatPrefType 

Float type.

kBoolPrefType 

Bool type.

Boolean preferences.

Enumerator:
kUnknownPrefBool 
AdditionalPreferenceKeyBoolKeys 

Char preferences.

Enumerator:
kUnknownPrefChar 
kTrackInfoDisplayItemsDelimiterCharacters 
kTrackInfoFont 
kTrackLyricsFont 
kFallbackSystemFont 
AdditionalPreferenceKeyCharKeys 

Float preferences.

Enumerator:
kUnknownPrefFloat 
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 

Integer preferences.

Enumerator:
kUnknownPrefInt 
kFadeInTimeOnPlayInMS 
kFadeInTimeOnResumeInMS 
kFadeOutTimeBeforeEndOfTrackInMS 
kFadeOutTimeOnPauseInMS 
kFadeInOutTimeOnShowInMS 
kTrackInfoFontSize 
kTrackLyricsFontSize 
AdditionalPreferenceKeyIntKeys 

The status of the preference.

Enumerator:
kDefaultPref 

Default (factory) preference value.

kPrefSetButNotStored 

The preference has been set but not stored.

kPrefSetAndStored 

The preference value is stored persistently.


Constructor & Destructor Documentation

The constructor.

VisualPreferences is a singleton class. The constructor is private. New instance of class can only be created internally.

The destructor.

VisualPreferences is a singleton class. The destructor is private. Instance of class can only be destructed internally.

Copy constructor.

Parameters:
otherAnother VisualPreferences.
Remarks:
Explicitely declared in private section and not implemented to enforce uniqueness of singleton pattern.

Member Function Documentation

Static helper function that converts a string with a boolean PreferenceKey to the according PreferenceKey.

Possibly useful for debugging or tracing purposes.

Parameters:
aPreferenceKeyStringA string with a PreferenceKey
Returns:
The PreferenceKey enum value.

Static helper function that converts a string with a char PreferenceKey to the according PreferenceKey.

Possibly useful for debugging or tracing purposes.

Parameters:
aPreferenceKeyStringA string with a PreferenceKey
Returns:
The PreferenceKey enum value.

Static helper function that converts a string with a float PreferenceKey to the according PreferenceKey.

Possibly useful for debugging or tracing purposes.

Parameters:
aPreferenceKeyStringA string with a PreferenceKey
Returns:
The PreferenceKey enum value.

Static helper function that converts a string with an integer PreferenceKey to the according PreferenceKey.

Possibly useful for debugging or tracing purposes.

Parameters:
aPreferenceKeyStringA string with a PreferenceKey
Returns:
The PreferenceKey enum value.
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.

Parameters:
aKeyThe key of a preference.
outStringThe 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.

Parameters:
aKeyThe key of a preference.
outStringThe 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.

Parameters:
aKeyThe key of a preference.
outStringThe 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.

Parameters:
aKeyThe key of a preference.
outStringThe 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.

Parameters:
anIdentifierThe identifier (key) of the preference value.
isDefaultValueTrue if default preference value was found.
Returns:
The default integer preference value.
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.

Parameters:
anIdentifierThe identifier (key) of the preference value.
isDefaultValueTrue if default preference value was found.
Returns:
The default float preference value.
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.

Parameters:
anIdentifierThe identifier (key) of the preference value.
[out]outPrefValThe value of the character preference.
Returns:
True if default preference value was found.
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.

Parameters:
anIdentifierThe identifier (key) of the preference value.
isDefaultValueTrue if default preference value was found.
Returns:
The default integer preference value.
VisualPreferences * VisualPreferences::getInstance ( void  ) [static, private]

Constructs a VisualPreferences.

The VisualPreferences internally is a singleton. Returns a pointer to the initialized VisualPreferences.

Returns:
A pointer to the singleton instance.
int VisualPreferences::getValue ( const PreferenceKeyInt  anIdentifier,
bool *  isDefaultValue = NULL 
) [static]

Retrieves a persistent preference value (integer).

Parameters:
anIdentifierThe identifier (key) of the preference value.
isDefaultValueTrue if returned value is default value.
float VisualPreferences::getValue ( const PreferenceKeyFloat  anIdentifier,
bool *  isDefaultValue = NULL 
) [static]

Retrieves a persistent preference value (float).

Parameters:
anIdentifierThe identifier (key) of the preference value.
isDefaultValueTrue if returned value is default value.
void VisualPreferences::getValue ( const PreferenceKeyChar  anIdentifier,
char *  outPrefVal,
bool *  isDefaultValue = NULL 
) [static]

Retrieves a persistent preference value (char).

Parameters:
anIdentifierThe identifier (key) of the preference value.
[out]outPrefValThe value of the character preference.
isDefaultValueTrue if returned value is default value.
bool VisualPreferences::getValue ( const PreferenceKeyBool  anIdentifier,
bool *  isDefaultValue = NULL 
) [static]

Retrieves a persistent preference value (boolean).

Parameters:
anIdentifierThe identifier (key) of the preference value.
isDefaultValueTrue if returned value is default value.
VisualPreferences& VizKit::VisualPreferences::operator= ( const VisualPreferences other) [private]

Assignment operator.

Remarks:
Explicitely declared in private section and not implemented to enforce uniqueness of singleton pattern.
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.

Parameters:
anIdentifierThe identifier (key) of the preference value.
aValueThe 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.

Parameters:
anIdentifierThe identifier (key) of the preference value.
aValueThe 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.

Parameters:
anIdentifierThe identifier (key) of the preference value.
aValueThe 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.

Parameters:
anIdentifierThe identifier (key) of the preference value.
aValueThe 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.

Parameters:
anIdentifierThe identifier (key) of the preference value.
aValueThe 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.

Parameters:
anIdentifierThe identifier (key) of the preference value.
aValueThe 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.

Parameters:
anIdentifierThe identifier (key) of the preference value.
aValueThe 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.

Parameters:
anIdentifierThe identifier (key) of the preference value.
aValueThe value (boolean) of the preference value.
void VisualPreferences::storeValues ( void  ) [static]

Stores the preferences in persistent storage.


Member Data Documentation

Vector of preferences.

VisualPreferences is a singleton class.

Pointer to private instance is handled internally.


The documentation for this class was generated from the following files:

Generated on Sun May 3 2015 20:26:32 for VizKit by doxygen 1.8.0