LibrePCB Developers Documentation
WorkspaceSettings Class Referencefinal

Container for all workspace related settings. More...

#include <workspacesettings.h>

+ Inheritance diagram for WorkspaceSettings:
+ Collaboration diagram for WorkspaceSettings:

Public Member Functions

 WorkspaceSettings ()=delete
 
 WorkspaceSettings (const WorkspaceSettings &other)=delete
 
 WorkspaceSettings (const FilePath &fp, QObject *parent=nullptr)
 
 ~WorkspaceSettings () noexcept
 
void restoreDefaults () noexcept
 Reset all settings to their default value. More...
 
void saveToFile () const
 Save all settings to the file. More...
 
WorkspaceSettingsoperator= (const WorkspaceSettings &rhs)=delete
 
- Public Member Functions inherited from SerializableObject
 SerializableObject () noexcept
 
virtual ~SerializableObject () noexcept
 
SExpression serializeToDomElement (const QString &name) const
 Serialize the object to a new S-Expression node. More...
 

Public Attributes

WorkspaceSettingsItem_GenericValue< QString > userName
 User name. More...
 
WorkspaceSettingsItem_GenericValue< QString > applicationLocale
 The application's locale (e.g. "en_US") More...
 
WorkspaceSettingsItem_GenericValue< LengthUnitdefaultLengthUnit
 The application's default length unit. More...
 
WorkspaceSettingsItem_GenericValue< uint > projectAutosaveIntervalSeconds
 Project autosave interval [seconds] (0 = autosave disabled) More...
 
WorkspaceSettingsItem_GenericValue< bool > useOpenGl
 Use OpenGL hardware acceleration. More...
 
WorkspaceSettingsItem_GenericValueList< QStringList > libraryLocaleOrder
 Preferred library locales (like "de_CH") in the right order. More...
 
WorkspaceSettingsItem_GenericValueList< QStringList > libraryNormOrder
 Preferred library norms (like "DIN EN 81346") in the right order. More...
 
WorkspaceSettingsItem_GenericValueList< QList< QUrl > > repositoryUrls
 The list of API repository URLs in the right order. More...
 

Private Member Functions

QList< WorkspaceSettingsItem * > getAllItems () const noexcept
 Get all librepcb::workspace::WorkspaceSettingsItem objects. More...
 
void serialize (SExpression &root) const override
 Serialize the object into an existing S-Expression node. More...
 

Private Attributes

FilePath mFilePath
 path to the "settings.lp" file More...
 

Additional Inherited Members

- Static Public Member Functions inherited from SerializableObject
template<typename T >
static void serializeObjectContainer (SExpression &root, const T &container, const QString &itemName)
 
template<typename T >
static void serializePointerContainer (SExpression &root, const T &container, const QString &itemName)
 
template<typename T >
static void serializePointerContainerUuidSorted (SExpression &root, const T &container, const QString &itemName)
 

Detailed Description

Container for all workspace related settings.

The "settings.lp" file in a workspace is used to store workspace related settings. This class is an interface to those settings. A librepcb::workspace::WorkspaceSettings object is created in the constructor of the librepcb::workspace::Workspace object.

Each settings item is represented by an instance of a librepcb::workspace::WorkspaceSettingsItem subclass.

See also
librepcb::workspace::WorkspaceSettingsItem

Constructor & Destructor Documentation

◆ WorkspaceSettings() [1/3]

WorkspaceSettings ( )
delete

◆ WorkspaceSettings() [2/3]

WorkspaceSettings ( const WorkspaceSettings other)
delete

◆ WorkspaceSettings() [3/3]

WorkspaceSettings ( const FilePath fp,
QObject *  parent = nullptr 
)
explicit
+ Here is the call graph for this function:

◆ ~WorkspaceSettings()

~WorkspaceSettings ( )
noexcept

Member Function Documentation

◆ restoreDefaults()

void restoreDefaults ( )
noexcept

Reset all settings to their default value.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveToFile()

void saveToFile ( ) const

Save all settings to the file.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

WorkspaceSettings& operator= ( const WorkspaceSettings rhs)
delete

◆ getAllItems()

QList< WorkspaceSettingsItem * > getAllItems ( ) const
privatenoexcept

Get all librepcb::workspace::WorkspaceSettingsItem objects.

Returns
List of librepcb::workspace::WorkspaceSettingsItem objects
+ Here is the caller graph for this function:

◆ serialize()

void serialize ( SExpression root) const
overrideprivatevirtual

Serialize the object into an existing S-Expression node.

This method inserts/appends all attributes and childs of the object to an existing S-Expression node. The content which already exists in the given S-Expression node will not be removed.

Note
The generated S-Expression node has always the format of the application's major version (it's not possible to generate DOMs of older versions).
Parameters
rootThe target DOM root node
Exceptions
ExceptionThis method throws an exception if an error occurs.

Implements SerializableObject.

+ Here is the call graph for this function:

Member Data Documentation

◆ mFilePath

FilePath mFilePath
private

path to the "settings.lp" file

◆ userName

User name.

Used when creating new library elements or projects.

Default: "" (but gets initialized when creating a new workspace)

◆ applicationLocale

WorkspaceSettingsItem_GenericValue<QString> applicationLocale

The application's locale (e.g. "en_US")

An empty string means that the system locale will be used.

Default: ""

◆ defaultLengthUnit

The application's default length unit.

Default: millimeters

◆ projectAutosaveIntervalSeconds

WorkspaceSettingsItem_GenericValue<uint> projectAutosaveIntervalSeconds

Project autosave interval [seconds] (0 = autosave disabled)

Default: 600

◆ useOpenGl

Use OpenGL hardware acceleration.

Default: False

◆ libraryLocaleOrder

WorkspaceSettingsItem_GenericValueList<QStringList> libraryLocaleOrder

Preferred library locales (like "de_CH") in the right order.

The locale which should be used first is at index 0 of the list. If no translation strings are found for all locales in this list, the fallback locale "en_US" will be used automatically, so the list do not have to contain "en_US". An empty list is also valid, then the fallback locale "en_US" will be used.

Default: []

◆ libraryNormOrder

WorkspaceSettingsItem_GenericValueList<QStringList> libraryNormOrder

Preferred library norms (like "DIN EN 81346") in the right order.

The norm which should be used first is at index 0 of the list.

Default: []

◆ repositoryUrls

WorkspaceSettingsItem_GenericValueList<QList<QUrl> > repositoryUrls

The list of API repository URLs in the right order.

The repository with the highest priority is at index 0 of the list. In case of version conflicts, the repository with the higher priority will be used.

Default: ["https://api.librepcb.org"]


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