ApplicationSettings Class Reference


Detailed Description

ApplicationSettings is a utility class.

#include <ApplicationSettings.h>

List of all members.

Public Types

enum   SearchPathID {
  kBehaviors, kCursors, kDocument, kEnvironmentGeometry,
  kEnvironments, kGeometry, kHelp, kImages,
  kMaterials, kShaders, kShadowPresets, kTessellations,
  kTextures, kResources, kRapidPresets, kWelcome
}
enum   LogFileChoice {
  Base = 0, CppErr = 1, CppOut = 2, PyErr = 3,
  PyOut = 4
}

Public Member Functions

const awString::IString &  ApplicationSettings::documentationRegistryPath () const
  If there is a local documentation installed, this is a path to it.
bool  setLanguage (const awString::IString &)
  This expects and returns 2-2 (ISO 3166-1-alpha-2 + language) codes: en-US, fr-FR, ja-JP, de-DE, etc.
const awString::IString &  getLanguage () const
bool  setForcedLanguage (const awString::IString &)
  Sometimes we can force a language so that the preference is ignored.
const awString::IString &  getForcedLanguage () const
void  setLanguageWindowsProtein (const awString::IString &lang, const awString::IString &langWin, const awString::IString &langPro)
  Use this to explicitly add codes for Windows and Protein.
awString::IString  getLanguageWindows () const
  This version returns the three letter Windows language code: ENU for en-US, FRA for fr-FR, DEU for de-DE, JPN for ja-JP.
awString::IString  getLanguageProtein () const
  Protein got locked in with ISO 639 naming for English, and three letter windows names for the rest.
awString::IString  getLanguageRoot () const
awString::IString  getLanguageDirectory () const
bool  setSupportDirectory (const awString::IString &dir)
const awString::IString &  getSupportDirectory () const
bool  setSampleSceneDirectory (const awString::IString &dir)
const awString::IString &  getSampleSceneDirectory () const
bool  setWorkingDirectory (const awString::IString &dir)
const awString::IString &  getWorkingDirectory () const
void  setLastOpenPath (const awString::IString &path)
const awString::IString &  getLastOpenPath () const
void  setDocumentPath (const awString::IString &path)
  The document path is intended to be the name of the main application document currently in use.
const awString::IString &  getDocumentPath () const
void  setCompanionDirectory (const awString::IString &dir)
const awString::IString &  getCompanionDirectory () const
void  setTempDirectory (const awString::IString &dir)
const awString::IString &  getTempDirectory () const
void  setProductTemporaryDirectory (const awString::IString &dir)
const awString::IString &  getProductTemporaryDirectory () const
void  setUnzipTemporaryDirectory (const awString::IString &dir)
const awString::IString &  getUnzipTemporaryDirectory () const
bool  addDirectoryToSearchPath (SearchPathID id, const awString::IString &directory)
  Returns true if the directory exists and was successfully added to the search path with the given id; false otherwise.
bool  prependDirectoryToSearchPath (SearchPathID id, const awString::IString &directory)
bool  removeDirectoryFromSearchPath (SearchPathID id, const awString::IString &directory)
  Returns true if the directory exists and was successfully removed from the search path with the given id; false otherwise.
void  clearSearchPath (SearchPathID id)
  Clears any and all directories in the search path with the given id.
awString::IString  getDirectories (SearchPathID id) const
  Returns a token-separated string consisting of all the directories for the given search path.
awString::IString  findFileInSearchPath (SearchPathID id, const awString::IString &filename)
  Finds the given filename in the search path and returns it as fully-specified.
void  setUserPreferencesDirectory (const awString::IString &)
  If set* method is not called, we will just take the default location for the user preferences directory.
const awString::IString &  getUserPreferencesDirectory () const
awString::IString  getCommonPreferencesDirectory ()
awString::IString  getSceneDocumentsDirectory ()
awString::IString  getAppDataDirectory ()
const awString::IString &  getApplicationPath () const
awString::IString  qualifyTextureFilename (const awString::IString &filename)
awString::IString  getErrorReportingDirectory ()
  Creates and returns a directory for writing files for crash reporting.
awString::IString  getApplicationDirectory () const
const awString::IString &  getProteinAssetsLibraryFilename () const
  The master file for the Protein library.
void  setProteinAssetsLibraryFilename (const awString::IString &file)
const awString::IString &  getProteinAssetsLibraryDirectory () const
  The directory in which Protein assets library filename resides.
void  setProteinAssetsLibraryDirectory (const awString::IString &dir)
const awString::IString &  getProteinAssetsLibraryDefinition () const
  The directory, associated with the Protein master file, usually in the same place as that file, with the .fbm extension.
void  setProteinAssetsLibraryDefinition (const awString::IString &dir)
const awString::IString &  getProteinAssetsLibraryTexture () const
  The directory containing texture assets. Often not version specific.
void  setProteinAssetsLibraryTexture (const awString::IString &dir)
const awString::IString &  getProteinAssetsLibraryId () const
  The unique library ID.
void  setProteinAssetsLibraryId (const awString::IString &id)
void  setPythonHome (const awString::IString &)
const awString::IString &  getPythonHome () const
awString::IString  ffmpeg () const
awString::IString  getScaleformUIFile ()
void  setScaleformUIFile (const awString::IString &)
void  setLogFileBase (const awString::IString &)
bool  getIsLogFileSet () const
awString::IString  getLogFile (int) const
bool  getInitializationComplete () const
  Get and set the "initializationComplete" state.
void  setInitializationComplete (unsigned long windowHandle)
void  setOkayToCloseSplashWindow ()
bool  getInitializationStarted () const
void  setInitializationStarted ()
bool  getReleaseAllMemory () const
  The release all memory flag is a hint to the application that it should attempt to free all memory prior to exiting.
void  setReleaseAllMemory (bool)
void  exit ()
bool  addExitCallback (ApplicationExitCallback *)
  ApplicationSettings takes ownership of the callback pointer when it is added and maintains ownership until it is removed at which point ownership is transfered back to the calling code.
bool  removeExitCallback (ApplicationExitCallback *)
bool  runExitCallbacks ()
void  setBug268359workAround (bool state)
bool  getBug268359workAround () const
void  setDisableCER (bool disable)
bool  isCERDisabled () const
void  setDisableCIP (bool disable)
bool  isCIPDisabled () const
void  setUseObjectBasedModels (bool mode)
bool  useObjectBasedModels () const
int  getResolutionWidth () const
int  getResolutionHeight () const
void  setDisableDrawCache (bool disable)
bool  isDrawCacheDisabled () const

Static Public Member Functions

static ApplicationSettings instance ()
  Singleton access with lazy creation and explicit destruction.
static void  destruct ()
static bool  exists ()

Member Enumeration Documentation


Member Function Documentation

static ApplicationSettings& instance ( ) [static]

Singleton access with lazy creation and explicit destruction.

exists() just tells us if the instance() is already created.

static void destruct ( ) [static]
static bool exists ( ) [static]
const awString::IString& ApplicationSettings::documentationRegistryPath ( ) const

If there is a local documentation installed, this is a path to it.

bool setLanguage ( const awString::IString &  )

This expects and returns 2-2 (ISO 3166-1-alpha-2 + language) codes: en-US, fr-FR, ja-JP, de-DE, etc.

It will return true if it finds the code in the look up table to set the Windows and Protein language as well, otherwise, it will return false, but it will still set the language. In that scenario, you should probably use the setLanguageWindowsProtein version instead, to define the mapping for the Windows and Protein language codes. Otherwise, you just get English.

const awString::IString& getLanguage ( ) const
bool setForcedLanguage ( const awString::IString &  )

Sometimes we can force a language so that the preference is ignored.

getForcedLanguage() will return empty if the language was not forced, or the same as getLanguage() if it was. setForcedLanguage(), unlike setLanguage(), will take either 2-2 or Windows or Protein language code.

const awString::IString& getForcedLanguage ( ) const
void setLanguageWindowsProtein ( const awString::IString &  lang,
const awString::IString &  langWin,
const awString::IString &  langPro 
)

Use this to explicitly add codes for Windows and Protein.

If the one already exists (e.g., setLanguage() would return true), we will still set the new values.

awString::IString getLanguageWindows ( ) const

This version returns the three letter Windows language code: ENU for en-US, FRA for fr-FR, DEU for de-DE, JPN for ja-JP.

awString::IString getLanguageProtein ( ) const

Protein got locked in with ISO 639 naming for English, and three letter windows names for the rest.

So, all but English will match by default, but for English, the code will be "eng", instead of ENU (US-English).

awString::IString getLanguageRoot ( ) const
awString::IString getLanguageDirectory ( ) const
bool setSupportDirectory ( const awString::IString &  dir )
const awString::IString & getSupportDirectory ( ) const [inline]
{
    return mySupportDirectory;
}
bool setSampleSceneDirectory ( const awString::IString &  dir )
const awString::IString & getSampleSceneDirectory ( ) const [inline]
{
    return mySampleSceneDirectory;
}
bool setWorkingDirectory ( const awString::IString &  dir )
const awString::IString & getWorkingDirectory ( ) const [inline]
{
    return myWorkingDirectory;
}
void setLastOpenPath ( const awString::IString &  path )
const awString::IString & getLastOpenPath ( ) const [inline]
{
    return myLastOpenPath;
}
void setDocumentPath ( const awString::IString &  path )

The document path is intended to be the name of the main application document currently in use.

const awString::IString & getDocumentPath ( ) const [inline]
{
    return myDocumentPath;
}
void setCompanionDirectory ( const awString::IString &  dir )
const awString::IString & getCompanionDirectory ( ) const [inline]
{
    return myCompanionDirectory;
}
void setTempDirectory ( const awString::IString &  dir )
const awString::IString& getTempDirectory ( ) const
void setProductTemporaryDirectory ( const awString::IString &  dir )
const awString::IString& getProductTemporaryDirectory ( ) const
void setUnzipTemporaryDirectory ( const awString::IString &  dir )
const awString::IString& getUnzipTemporaryDirectory ( ) const
bool addDirectoryToSearchPath ( SearchPathID  id,
const awString::IString &  directory 
)

Returns true if the directory exists and was successfully added to the search path with the given id; false otherwise.

The second version puts the path at the start of the search list.

bool prependDirectoryToSearchPath ( SearchPathID  id,
const awString::IString &  directory 
)
bool removeDirectoryFromSearchPath ( SearchPathID  id,
const awString::IString &  directory 
)

Returns true if the directory exists and was successfully removed from the search path with the given id; false otherwise.

void clearSearchPath ( SearchPathID  id )

Clears any and all directories in the search path with the given id.

awString::IString getDirectories ( SearchPathID  id ) const

Returns a token-separated string consisting of all the directories for the given search path.

awString::IString findFileInSearchPath ( SearchPathID  id,
const awString::IString &  filename 
)

Finds the given filename in the search path and returns it as fully-specified.

Returns an empty string if it is not found in the search path.

void setUserPreferencesDirectory ( const awString::IString &  )

If set* method is not called, we will just take the default location for the user preferences directory.

const awString::IString& getUserPreferencesDirectory ( ) const
awString::IString getCommonPreferencesDirectory ( )
awString::IString getSceneDocumentsDirectory ( )
awString::IString getAppDataDirectory ( )
const awString::IString& getApplicationPath ( ) const
awString::IString qualifyTextureFilename ( const awString::IString &  filename )
awString::IString getErrorReportingDirectory ( )

Creates and returns a directory for writing files for crash reporting.

If the directory could not be created, then an empty string is returned.

awString::IString getApplicationDirectory ( ) const
const awString::IString& getProteinAssetsLibraryFilename ( ) const

The master file for the Protein library.

void setProteinAssetsLibraryFilename ( const awString::IString &  file )
const awString::IString& getProteinAssetsLibraryDirectory ( ) const

The directory in which Protein assets library filename resides.

void setProteinAssetsLibraryDirectory ( const awString::IString &  dir )
const awString::IString& getProteinAssetsLibraryDefinition ( ) const

The directory, associated with the Protein master file, usually in the same place as that file, with the .fbm extension.

void setProteinAssetsLibraryDefinition ( const awString::IString &  dir )
const awString::IString& getProteinAssetsLibraryTexture ( ) const

The directory containing texture assets. Often not version specific.

void setProteinAssetsLibraryTexture ( const awString::IString &  dir )
const awString::IString& getProteinAssetsLibraryId ( ) const

The unique library ID.

void setProteinAssetsLibraryId ( const awString::IString &  id )
void setPythonHome ( const awString::IString &  )
const awString::IString& getPythonHome ( ) const
awString::IString ffmpeg ( ) const
awString::IString getScaleformUIFile ( )
void setScaleformUIFile ( const awString::IString &  )
void setLogFileBase ( const awString::IString &  )
bool getIsLogFileSet ( ) const
awString::IString getLogFile ( int  ) const
bool getInitializationComplete ( ) const

Get and set the "initializationComplete" state.

void setInitializationComplete ( unsigned long  windowHandle )
void setOkayToCloseSplashWindow ( )
bool getInitializationStarted ( ) const
void setInitializationStarted ( )
bool getReleaseAllMemory ( ) const

The release all memory flag is a hint to the application that it should attempt to free all memory prior to exiting.

This can be useful for memory leak detection. The app may or may not pay attention to this hint.

void setReleaseAllMemory ( bool  )
bool addExitCallback ( ApplicationExitCallback )

ApplicationSettings takes ownership of the callback pointer when it is added and maintains ownership until it is removed at which point ownership is transfered back to the calling code.

Callback(s) will be deleted:

bool removeExitCallback ( ApplicationExitCallback )
bool runExitCallbacks ( )
void setBug268359workAround ( bool  state )
bool getBug268359workAround ( ) const
void setDisableCER ( bool  disable )
bool isCERDisabled ( ) const
void setDisableCIP ( bool  disable )
bool isCIPDisabled ( ) const
void setUseObjectBasedModels ( bool  mode )
bool useObjectBasedModels ( ) const
int getResolutionWidth ( ) const
int getResolutionHeight ( ) const
void setDisableDrawCache ( bool  disable )
bool isDrawCacheDisabled ( ) const

ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings
ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings ApplicationSettings