this class has static method for retrieving the resources for the application More...

Static Public Member Functions

static QString findResource (QString resourceName)
 return the full path of the requested resource (in this case is a file name) It search in the following order:
 
static void initialize ()
 initialize data
 
static bool loadPlugin (QString filename)
 Load a plugin.
 
static void loadPlugins (QDir dir)
 Load all plugins found in the directory.
 
static void loadPlugins (const farsa::ConfigurationParameters &params)
 Load all plugins from all directories listed in the TOTAL99/pluginPath parameter of the given ConfigurationParameters object.
 

Static Public Attributes

static QString confBasePath
 path to the base (global) configuration directory
 
static QString confUserPath
 path to the user configuration directory
 
static QString pluginBasePath
 path to the base (global) plugin directory
 
static QString pluginUserPath
 path to the user plugin directory
 
static QString uiTemplate
 the graphical template in using for the user interface
 

Detailed Description

this class has static method for retrieving the resources for the application

How resources are stored and retrieved

Global Resources

The global resources are stored in the 'conf' directory at the same level where the 'bin' directory with the executable has been installed. The content of the 'conf' directory is the following:

  • total99.ini: contains the global preferences of the application. They are considered the default settings.
  • templates: is a directory containing the graphical templates for the UI. Each template is a directory containing icons, fonts and stylesheet for the user interface.

User Resources

Any of the global configuration and setting can been override by the user. The executable will look inside a user configuration directory with the same exactly structure of the 'conf' directory. All the parameters setted into the total99.ini inside the user configuration directory will take priority respect to the global configuration The user configuration directory is located on OS-ware basis:

  • on Windows: APPDATA%/FARSA/Total99
  • on Linux: ~/.FARSA/total99
  • on Mac OS: ~/Library/Application Support/FARSA/Total99

Total99 Plugins

This class has also methods for handling the plugins. In particular, the loadPlugin method load the data from a plugin and register all the new classes defined into the plugin. The policy for plugin loading is the following:

  • first all valid plugins in the system-wide plugin directory are loaded;
  • then all valid plugins in the user plugin directory are loaded;
  • finally all valid plugins in the directories listed in the TOTAL99/pluginPath configuration parameter are loaded. The system-wide plugin directory is a directory named 'plugins' located at the same level as the global resources directory 'conf' (see above), while the user plugin directory is a directory named 'plugins' inside the user configuration directory (see above). The parameter pluginPath inside the group TOTAL99 of the loaded configuration file is a list of directories separated by the ';' character. This parameter is valid ONLY inside experiments configuration files (it is ignored when found inside the local or global total99.ini file). Non-existent directories are ignored.

Definition at line 59 of file total99resources.h.

Member Function Documentation

QString findResource ( QString  resourceName)
static

return the full path of the requested resource (in this case is a file name) It search in the following order:

  • in the user configuration directory
  • in the template directory under user configuration directory
  • in the global configuration directory
  • in the template directory under global directory
    Parameters
    resourceNamethe file name of the resource to find; i.e.: anIcon.png

Definition at line 45 of file total99resources.cpp.

void initialize ( )
static

initialize data

Definition at line 106 of file total99resources.cpp.

References Logger::info().

bool loadPlugin ( QString  filename)
static

Load a plugin.

This method load the plugin, and once loaded it call Total99Plugin::registerTypesOnFactory in order to register all types on the Factory for ConfigurationParameters, and call Total99Plugin::insertWidgetsToMap in order to update the viewers map with the new widget defined into the plugin loaded

Parameters
filenameis the full path of the plugin
Returns
true if the plugin has been loaded, false if any error occurs during the loading

Definition at line 72 of file total99resources.cpp.

References Logger::error(), and FarsaPlugin::registerTypesOnFactory().

void loadPlugins ( QDir  dir)
static

Load all plugins found in the directory.

Definition at line 85 of file total99resources.cpp.

References Logger::info().

void loadPlugins ( const farsa::ConfigurationParameters params)
static

Load all plugins from all directories listed in the TOTAL99/pluginPath parameter of the given ConfigurationParameters object.

See class description for more information on the format of the parameter

Definition at line 94 of file total99resources.cpp.

References ConfigurationParameters::getParametersWithPrefixList(), ConfigurationParameters::getValue(), and Logger::warning().

Member Data Documentation

QString confBasePath
static

path to the base (global) configuration directory

Definition at line 71 of file total99resources.h.

QString confUserPath
static

path to the user configuration directory

Definition at line 73 of file total99resources.h.

QString pluginBasePath
static

path to the base (global) plugin directory

Definition at line 75 of file total99resources.h.

QString pluginUserPath
static

path to the user plugin directory

Definition at line 77 of file total99resources.h.

QString uiTemplate
static

the graphical template in using for the user interface

Definition at line 79 of file total99resources.h.


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