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

#include <VisualPreferences.h>

Collaboration diagram for VizKit::VisualPreferences:
Collaboration graph
[legend]

List of all members.

Classes

class  Preference

Public Types

enum  PreferenceKeyInt {
  kUnknownPrefInt = 0, kFadeInTimeOnPlayInMS, kFadeInTimeOnResumeInMS, kFadeOutTimeBeforeEndOfTrackInMS,
  kFadeOutTimeOnPauseInMS, kFadeInOutTimeOnShowInMS, kTrackInfoFontSize, kTrackLyricsFontSize,
  kPreferencePane
}
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, kTrackLyricsTextureColorTopLeftRed, kTrackLyricsTextureColorTopLeftGreen, kTrackLyricsTextureColorTopLeftBlue,
  kTrackLyricsTextureColorTopLeftAlpha, kTrackLyricsTextureColorBottomLeftRed, kTrackLyricsTextureColorBottomLeftGreen, kTrackLyricsTextureColorBottomLeftBlue,
  kTrackLyricsTextureColorBottomLeftAlpha, kTrackLyricsTextureColorBottomRightRed, kTrackLyricsTextureColorBottomRightGreen, kTrackLyricsTextureColorBottomRightBlue,
  kTrackLyricsTextureColorBottomRightAlpha, kTrackLyricsTextureColorTopRightRed, kTrackLyricsTextureColorTopRightGreen, kTrackLyricsTextureColorTopRightBlue,
  kTrackLyricsTextureColorTopRightAlpha, kCanvasBackgroundColorRed, kCanvasBackgroundColorGreen, kCanvasBackgroundColorBlue,
  kCanvasBackgroundColorAlpha, kSurfaceBackgroundColorRed, kSurfaceBackgroundColorGreen, kSurfaceBackgroundColorBlue,
  kSurfaceBackgroundColorAlpha
}
enum  PreferenceKeyChar {
  kUnknownPrefChar = 0, kTrackInfoDisplayItemsDelimiterCharacters, kTrackInfoFont, kTrackLyricsFont,
  kFallbackSystemFont, kTrackLyricsAlignment
}
enum  PreferenceKeyBool { kUnknownPrefBool = 0, kCheckForUpdate }

Static Public Member Functions

static void dispose (void)
static void setValue (const PreferenceKeyInt anIdentifier, const int aValue)
static void setValue (const PreferenceKeyFloat anIdentifier, const float aValue)
static void setValue (const PreferenceKeyChar anIdentifier, const char *const aValue)
static void setValue (const PreferenceKeyBool anIdentifier, const bool aValue)
static int getDefault (const PreferenceKeyInt anIdentifier, bool *isDefaultValue)
static float getDefault (const PreferenceKeyFloat anIdentifier, bool *isDefaultValue)
static bool getDefault (const PreferenceKeyChar anIdentifier, char *outPrefVal)
static bool getDefault (const PreferenceKeyBool anIdentifier, bool *isDefaultValue)
static int getValue (const PreferenceKeyInt anIdentifier, bool *isDefaultValue=NULL)
static float getValue (const PreferenceKeyFloat anIdentifier, bool *isDefaultValue=NULL)
static void getValue (const PreferenceKeyChar anIdentifier, char *outPrefVal, bool *isDefaultValue=NULL)
static bool getValue (const PreferenceKeyBool anIdentifier, bool *isDefaultValue=NULL)
static void storeValues (void)
static void setDefaultValues (void)
static void convertPreferenceKeyToString (const PreferenceKeyInt aKey, char *outString)
static void convertPreferenceKeyToString (const PreferenceKeyFloat aKey, char *outString)
static void convertPreferenceKeyToString (const PreferenceKeyChar aKey, char *outString)
static void convertPreferenceKeyToString (const PreferenceKeyBool aKey, char *outString)
static
VisualPreferences::PreferenceKeyInt 
convertPreferenceKeyIntStringToKey (const char *const aPreferenceKeyString)
static
VisualPreferences::PreferenceKeyFloat 
convertPreferenceKeyFloatStringToKey (const char *const aPreferenceKeyString)
static
VisualPreferences::PreferenceKeyChar 
convertPreferenceKeyCharStringToKey (const char *const aPreferenceKeyString)
static
VisualPreferences::PreferenceKeyBool 
convertPreferenceKeyBoolStringToKey (const char *const aPreferenceKeyString)

Private Types

enum  PrefDataType { kIntPrefType = 0, kCharPrefType, kFloatPrefType, kBoolPrefType }
enum  PrefStatus { kDefaultPref = 0, kPrefSetButNotStored, kPrefSetAndStored }
typedef std::vector< Preference * > PreferenceVector
typedef PreferenceVector::iterator PreferenceVectorIterator

Private Member Functions

 VisualPreferences ()
 ~VisualPreferences ()
 VisualPreferences (const VisualPreferences &other)
VisualPreferencesoperator= (const VisualPreferences &other)

Static Private Member Functions

static VisualPreferencesgetInstance (void)
static void setDefault (const PreferenceKeyInt anIdentifier, const int aValue)
static void setDefault (const PreferenceKeyFloat anIdentifier, const float aValue)
static void setDefault (const PreferenceKeyChar anIdentifier, const char *const aValue)
static void setDefault (const PreferenceKeyBool anIdentifier, const bool aValue)

Private Attributes

PreferenceVector preferenceVector

Static Private Attributes

static VisualPreferencestheVisualPreferences = NULL

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 
kCheckForUpdate 

Char preferences.

Enumerator:
kUnknownPrefChar 
kTrackInfoDisplayItemsDelimiterCharacters 
kTrackInfoFont 
kTrackLyricsFont 
kFallbackSystemFont 
kTrackLyricsAlignment 

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 
kTrackLyricsTextureColorTopLeftRed 
kTrackLyricsTextureColorTopLeftGreen 
kTrackLyricsTextureColorTopLeftBlue 
kTrackLyricsTextureColorTopLeftAlpha 
kTrackLyricsTextureColorBottomLeftRed 
kTrackLyricsTextureColorBottomLeftGreen 
kTrackLyricsTextureColorBottomLeftBlue 
kTrackLyricsTextureColorBottomLeftAlpha 
kTrackLyricsTextureColorBottomRightRed 
kTrackLyricsTextureColorBottomRightGreen 
kTrackLyricsTextureColorBottomRightBlue 
kTrackLyricsTextureColorBottomRightAlpha 
kTrackLyricsTextureColorTopRightRed 
kTrackLyricsTextureColorTopRightGreen 
kTrackLyricsTextureColorTopRightBlue 
kTrackLyricsTextureColorTopRightAlpha 
kCanvasBackgroundColorRed 
kCanvasBackgroundColorGreen 
kCanvasBackgroundColorBlue 
kCanvasBackgroundColorAlpha 
kSurfaceBackgroundColorRed 
kSurfaceBackgroundColorGreen 
kSurfaceBackgroundColorBlue 
kSurfaceBackgroundColorAlpha 

Integer preferences.

Enumerator:
kUnknownPrefInt 
kFadeInTimeOnPlayInMS 
kFadeInTimeOnResumeInMS 
kFadeOutTimeBeforeEndOfTrackInMS 
kFadeOutTimeOnPauseInMS 
kFadeInOutTimeOnShowInMS 
kTrackInfoFontSize 
kTrackLyricsFontSize 
kPreferencePane 

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

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.

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

Member Function Documentation

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.

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

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

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

Parameters:
aPreferenceKeyString A string with a PreferenceKey
Returns:
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:
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.

Parameters:
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.

Parameters:
aKey The key of a preference.
outString The character string value of 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:
aKey The key of a preference.
outString The character string value of the PreferenceKey enum value.
void VisualPreferences::dispose ( void   )  [static]

Disposes the VisualPreferences.

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:
anIdentifier The identifier (key) of the preference value.
[out] outPrefVal The 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:
anIdentifier The identifier (key) of the preference value.
isDefaultValue True if default preference value was found.
Returns:
The default integer preference value.
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:
anIdentifier The identifier (key) of the preference value.
isDefaultValue True 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:
anIdentifier The identifier (key) of the preference value.
isDefaultValue True if default preference value was found.
Returns:
The default float 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:
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).

Parameters:
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).

Parameters:
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).

Parameters:
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.

Remarks:
Explicitely declared in private section and not implemented to enforce uniqueness of singleton pattern.
void VisualPreferences::setDefault ( const PreferenceKeyBool  anIdentifier,
const bool  aValue 
) [static, private]

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:
anIdentifier The identifier (key) of the preference value.
aValue The value (boolean) of the preference value.
void VisualPreferences::setDefault ( const PreferenceKeyInt  anIdentifier,
const int  aValue 
) [static, private]

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:
anIdentifier The identifier (key) of the preference value.
aValue The value (integer) of the preference value.
void VisualPreferences::setDefault ( const PreferenceKeyChar  anIdentifier,
const char *const   aValue 
) [static, private]

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:
anIdentifier The identifier (key) of the preference value.
aValue The value (character) of the preference value.
void VisualPreferences::setDefault ( const PreferenceKeyFloat  anIdentifier,
const float  aValue 
) [static, private]

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:
anIdentifier The identifier (key) of the preference value.
aValue The value (float) 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:
anIdentifier The identifier (key) of the preference value.
aValue The value (integer) 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:
anIdentifier The identifier (key) of the preference value.
aValue The value (character) 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:
anIdentifier The identifier (key) of the preference value.
aValue The value (float) 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:
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.


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 Sep 26 2010 13:29:36 for VizKit by doxygen 1.7.1