Gui::PreferencePackManager Class Reference

and loadable collections of user preferences More...

#include <PreferencePackManager.h>

Classes

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

Public Member Functions

bool apply (const std::string &preferencePackName) const
 Apply the named preferencePack. More...
 
std::vector< boost::filesystem::path > configBackups () const
 Get a list of all available config file backups. More...
 
void deleteUserPack (const std::string &name)
 Deletes the user-saved pack specified by name. More...
 
bool isVisible (const std::string &addonName, const std::string &preferencePackName) const
 Check the visibility of the specified pack. More...
 
 PreferencePackManager ()
 
std::vector< std::string > preferencePackNames () const
 Get an alphabetical list of names of all visible PreferencePacks. More...
 
std::map< std::string, PreferencePackpreferencePacks () const
 Get a map of all visible PreferencePack names and their associated packs. More...
 
void rescan ()
 Rescan the preferencePack directory and update the available PreferencePacks. More...
 
void save (const std::string &name, const std::vector< TemplateFile > &templates)
 Save current settings as a (possibly new) preferencePack. More...
 
std::vector< TemplateFiletemplateFiles (bool rescan=false)
 
void toggleVisibility (const std::string &addonName, const std::string &preferencePackName)
 Toggle the visibility of the named preference pack in a named addon. More...
 
 ~PreferencePackManager ()=default
 

Detailed Description

and loadable collections of user preferences

This class provides some additional utility functions for allowing users to save their current preferences as a PreferencePack based on a set of template files provided either in the main FreeCAD distribution, or inside various installed mods.

Constructor & Destructor Documentation

◆ PreferencePackManager()

PreferencePackManager::PreferencePackManager ( )

◆ ~PreferencePackManager()

Gui::PreferencePackManager::~PreferencePackManager ( )
default

Member Function Documentation

◆ apply()

bool PreferencePackManager::apply ( const std::string &  preferencePackName) const

Apply the named preferencePack.

Returns
True if the preferencePack was applied, or false if it was not

References Gui::ToolBarManager::getInstance(), Gui::DockWindowManager::instance(), Gui::DockWindowManager::loadState(), and Gui::ToolBarManager::restoreState().

◆ configBackups()

std::vector< boost::filesystem::path > Gui::PreferencePackManager::configBackups ( ) const

Get a list of all available config file backups.

Backups are currently stored for one week.

References App::Application::getUserAppDataDir().

Referenced by Gui::Dialog::DlgGeneralImp::DlgGeneralImp(), and Gui::Dialog::DlgRevertToBackupConfigImp::showEvent().

◆ deleteUserPack()

void Gui::PreferencePackManager::deleteUserPack ( const std::string &  name)

Deletes the user-saved pack specified by name.

References App::Application::getUserAppDataDir().

Referenced by Gui::Dialog::DlgPreferencePackManagementImp::deleteUserPack().

◆ isVisible()

bool PreferencePackManager::isVisible ( const std::string &  addonName,
const std::string &  preferencePackName 
) const

Check the visibility of the specified pack.

Returns
True if the preferencePack is visible, or false if not. All packs are visible by default, but can be marked as "invisible" (i.e. not returned by the manager in lists of packs) by using the toggleVisibility function.

References App::GetApplication(), ParameterGrp::GetGroups(), and App::Application::GetParameterGroupByPath().

Referenced by ArchVRM.Renderer::removeHidden().

◆ preferencePackNames()

std::vector< std::string > PreferencePackManager::preferencePackNames ( ) const

Get an alphabetical list of names of all visible PreferencePacks.

◆ preferencePacks()

std::map< std::string, PreferencePack > Gui::PreferencePackManager::preferencePacks ( ) const

Get a map of all visible PreferencePack names and their associated packs.

Referenced by Gui::Dialog::DlgGeneralImp::recreatePreferencePackMenu().

◆ rescan()

void PreferencePackManager::rescan ( )

Rescan the preferencePack directory and update the available PreferencePacks.

Referenced by PreferencePackManager(), Gui::Dialog::DlgGeneralImp::recreatePreferencePackMenu(), templateFiles(), and toggleVisibility().

◆ save()

void PreferencePackManager::save ( const std::string &  name,
const std::vector< TemplateFile > &  templates 
)

◆ templateFiles()

◆ toggleVisibility()

void PreferencePackManager::toggleVisibility ( const std::string &  addonName,
const std::string &  preferencePackName 
)

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