Gui::PreferencePackManager::TemplateFile Struct Reference

containing a set of preferences that can be saved into a PreferencePack More...

#include <PreferencePackManager.h>

Public Attributes

std::string group
 
std::string name
 
boost::filesystem::path path
 

Detailed Description

containing a set of preferences that can be saved into a PreferencePack

PreferencePacks can contain any parameters at all, but inside FreeCAD there is no centralized list of all of these parameters, and at any given time the user.cfg file usually does not store a value for all possible parameters. Instead, it simply allows calling code to use whatever default values that code sets. This is all completely hidden from the users: FreeCAD behaves as though those values exist in the config file.

When a user saves their current configuration as a pack, they likely expect that saved configuration to include those default values, so that if they later apply their saved configuration those defaults are restored. To enable this a set of template files listing default values for various types of parameters can be used. Each file is presented to the user as a checkable box when saving a new preferences pack, and the intention is that these files will list out the various user-facing parameters that someone might want to save into a preferences pack.

These files are themselves valid user.cfg files, that if loaded and applied will result in the default values of their contained variables being set. For this to work, these files should be kept up-to-date with the default values set in the code. They are not required to contain an exhaustive listing of all possible parameters: in most cases it is enough that they list the variables that a user would expect for a given name. For example, "Sketcher Colors.cfg" should list out all of the default colors used in Sketcher that a user can set in Preferences, but it is not necessary that it contain any color that is only used internally, and it should not include things like fonts, or behavior information.

Template files are always located in a directory hierarchy that differentiates between templates that only affect appearance, and those that affect behavior.

The base FreeCAD installation includes default templates in: $INSTALL_DIR/data/Gui/PreferencePackTemplates/

External add-ons are also searched for any directory called PreferencePackTemplates or preference_pack_templates – either of which is expected to contain appearance and/or behavior subdirectories. In this way external add-ons can allow a user to easily save their preferences to a PreferencePack, or even to add additional templates representing sets of core FreeCAD preferences.

Member Data Documentation

◆ group

std::string Gui::PreferencePackManager::TemplateFile::group

◆ name

◆ path


The documentation for this struct was generated from the following file: