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: More...
 
static void initialize ()
 initialize data More...
 
static bool loadPlugin (QString filename)
 Load a plugin. More...
 
static void loadPlugins (QDir dir)
 Load all plugins found in the directory. More...
 
static void loadPlugins (const farsa::ConfigurationParameters &params)
 Load all plugins from all directories listed in the TOTAL99/pluginPath parameters and all plugins in the TOTAL99/plugin parameters of the given ConfigurationParameters object. More...
 

Static Public Attributes

static QString confBasePath
 path to the base (global) configuration directory More...
 
static QString confUserPath
 path to the user configuration directory More...
 
static QString pluginBasePath
 path to the base (global) plugin directory More...
 
static QString pluginConfigBasePath
 path to the base (global) directory with plugin configuration files More...
 
static QString pluginSuffix
 The suffix for plugins on the current operating system. More...
 
static QString uiTemplate
 path to the user plugin directory More...
 

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. Plugins are loaded from the directories listed in the TOTAL99/pluginPath parameters plus all plugins in the TOTAL99/plugin parameters. The TOTAL99 group can have different pluginPath:X parameters, with X being numbers. Each parameter is a directory from which plugins are loaded. Non-existing directories are ignored. The TOTAL99 group can also have different plugin:X paramers, with X being numbers. Each parameter is either the full path of a plugin to load or the name of a plugin (without the .farsaPlugin* suffix). In the latter case the plugin is loaded from the system-wide plugin directory, if it exists. These parameter is valid ONLY inside experiments configuration files (they are ignored when found inside the local or global total99.ini file).

Definition at line 62 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 53 of file total99resources.cpp.

References Total99Resources::confBasePath, Total99Resources::confUserPath, and Total99Resources::uiTemplate.

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

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 82 of file total99resources.cpp.

References DependencySorter< ElementType_t >::add(), Logger::error(), FarsaPlugin::getDependencies(), Logger::info(), Total99Resources::pluginBasePath, FarsaPlugin::registerTypesOnFactory(), and DependencySorter< ElementType_t >::sort().

Referenced by Total99Resources::loadPlugins().

void loadPlugins ( QDir  dir)
static

Load all plugins found in the directory.

Definition at line 157 of file total99resources.cpp.

References Logger::info(), and Total99Resources::loadPlugin().

Referenced by Total99Resources::loadPlugins().

void loadPlugins ( const farsa::ConfigurationParameters params)
static

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

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

Definition at line 175 of file total99resources.cpp.

References ConfigurationParameters::getParametersWithPrefixList(), ConfigurationParameters::getValue(), Total99Resources::loadPlugin(), Total99Resources::loadPlugins(), Total99Resources::pluginBasePath, Total99Resources::pluginSuffix, and Logger::warning().

Member Data Documentation

QString confBasePath
static

path to the base (global) configuration directory

Definition at line 74 of file total99resources.h.

Referenced by Total99Resources::findResource(), and Total99Resources::initialize().

QString confUserPath
static

path to the user configuration directory

Definition at line 76 of file total99resources.h.

Referenced by Total99Resources::findResource(), and Total99Resources::initialize().

QString pluginBasePath
static

path to the base (global) plugin directory

Definition at line 78 of file total99resources.h.

Referenced by Total99Resources::initialize(), Total99Resources::loadPlugin(), and Total99Resources::loadPlugins().

QString pluginConfigBasePath
static

path to the base (global) directory with plugin configuration files

Definition at line 80 of file total99resources.h.

Referenced by Total99Resources::initialize().

QString pluginSuffix
static

The suffix for plugins on the current operating system.

Definition at line 86 of file total99resources.h.

Referenced by Total99Resources::initialize(), and Total99Resources::loadPlugins().

QString uiTemplate
static

path to the user plugin directory

the graphical template in using for the user interface

Definition at line 84 of file total99resources.h.

Referenced by Total99Resources::findResource(), and Total99Resources::initialize().


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