The class object that stores configuration data. More...
Public Member Functions | |
Configuration () | |
QDir & | operator[] (const string &option) |
void | setDefaultScene (const QString &newDfltScene) |
const QString & | getDefaultScene () const |
bool | read () |
bool | write () |
Static Public Attributes | |
static const string | filename |
Private Member Functions | |
string | getQualifiedFilename () |
Private Attributes | |
Stored configuration data | |
map< string, QDir > | config |
QString | dfltScene |
The class object that stores configuration data.
The data stored by this struct includes the working directory, the scenes directory, the plugins directory, the icon directory, the documentation directory, and the default scene residing in the scenes directory. The default scene file setting can be changed to be a different file, but the default scene chosen still must reside in the scenes directory. This class also determines where the configuration file is stored on various operating systems.
const QString& rtVTK::Configuration::getDefaultScene | ( | ) | const [inline] |
References dfltScene.
Referenced by rtVTK::MainWindow::loadDefaultScene().
string rtVTK::Configuration::getQualifiedFilename | ( | ) | [private] |
This function is responsible for fetching the location of the .rtVTK configuration file. In Windows, the file is stored in the local (i.e. non-roaming) appdata of the current user account (CSIDL_LOCAL_APPDATA a.k.a. LOCALAPPDATA%). In the event that path length is not under 1024 chars long, bad things might happen.
CSIDL values are legacy for supporting Pre-Windows Vista OS. Microsoft has replaced CSIDL with FOLDERID_LocalAppData, but that only is supported by Widows Vista and later.
In *NIX land, .rtVTK is just placed in the home directory. The . will make the file "hidden".
References filename.
QDir& rtVTK::Configuration::operator[] | ( | const string & | option | ) | [inline] |
References config.
bool rtVTK::Configuration::read | ( | ) |
Loads default scene from configuration file. If no configuration file is found, initializes to default value and then creates a configuration file containing the default data.
References dfltScene, and getQualifiedFilename().
Referenced by Configuration().
void rtVTK::Configuration::setDefaultScene | ( | const QString & | newDfltScene | ) | [inline] |
References dfltScene, and write().
Referenced by rtVTK::MainWindow::slotSetDefaultScene().
bool rtVTK::Configuration::write | ( | ) |
Saves the current default scene filename to the configuration file. The path is not written because the default scene is assumed to reside in the scenes directory.
References dfltScene, and getQualifiedFilename().
Referenced by Configuration(), and setDefaultScene().
map<string, QDir> rtVTK::Configuration::config [private] |
Referenced by Configuration(), and operator[]().
QString rtVTK::Configuration::dfltScene [private] |
Referenced by getDefaultScene(), read(), setDefaultScene(), and write().
const string rtVTK::Configuration::filename [static] |
Referenced by getQualifiedFilename().