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, PreferencePack > | preferencePacks () 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< TemplateFile > | templateFiles (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 | |
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.
PreferencePackManager::PreferencePackManager | ( | ) |
References App::Application::getResourceDir(), App::Application::getUserAppDataDir(), and rescan().
|
default |
bool PreferencePackManager::apply | ( | const std::string & | preferencePackName | ) | const |
Apply the named preferencePack.
References Gui::ToolBarManager::getInstance(), Gui::DockWindowManager::instance(), Gui::DockWindowManager::loadState(), and Gui::ToolBarManager::restoreState().
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().
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().
bool PreferencePackManager::isVisible | ( | const std::string & | addonName, |
const std::string & | preferencePackName | ||
) | const |
Check the visibility of the specified pack.
References App::GetApplication(), ParameterGrp::GetGroups(), and App::Application::GetParameterGroupByPath().
Referenced by ArchVRM.Renderer::removeHidden().
std::vector< std::string > PreferencePackManager::preferencePackNames | ( | ) | const |
Get an alphabetical list of names of all visible 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().
void PreferencePackManager::rescan | ( | ) |
Rescan the preferencePack directory and update the available PreferencePacks.
Referenced by PreferencePackManager(), Gui::Dialog::DlgGeneralImp::recreatePreferencePackMenu(), templateFiles(), and toggleVisibility().
void PreferencePackManager::save | ( | const std::string & | name, |
const std::vector< TemplateFile > & | templates | ||
) |
Save current settings as a (possibly new) preferencePack.
If the named preferencePack does not exist, this creates it on disk. If it does exist, this overwrites the original.
References ParameterManager::CreateDocument(), App::Application::getUserAppDataDir(), ParameterManager::LoadDocument(), App::Meta::repository, ParameterManager::SaveDocument(), App::Metadata::setName(), and App::Metadata::setVersion().
Referenced by Mod.Show.mTempoVis.TempoVis::modify(), Mod.Show.mTempoVis.TempoVis::modifyVPProperty(), Gui::Dialog::DlgGeneralImp::newPreferencePackDialogAccepted(), draftguitools.gui_setstyle.Draft_SetStyle_TaskPanel::onSaveStyle(), and Mod.Show.mTempoVis.TempoVis::saveCamera().
std::vector< PreferencePackManager::TemplateFile > PreferencePackManager::templateFiles | ( | bool | rescan = false | ) |
References App::Application::getResourceDir(), App::Application::getUserAppDataDir(), and rescan().
Referenced by Gui::Dialog::DlgGeneralImp::newPreferencePackDialogAccepted().
void PreferencePackManager::toggleVisibility | ( | const std::string & | addonName, |
const std::string & | preferencePackName | ||
) |
Toggle the visibility of the named preference pack in a named addon.
References App::GetApplication(), ParameterGrp::GetGroups(), App::Application::GetParameterGroupByPath(), and rescan().
Referenced by Gui::Dialog::DlgPreferencePackManagementImp::hideBuiltInPack(), and Gui::Dialog::DlgPreferencePackManagementImp::hideInstalledPack().