![]() |
LibrePCB Developers Documentation
|
The Project class represents a whole (opened) project with all its content. More...
#include <project.h>
Signals | |
void | attributesChanged () override |
This signal is emitted when the value of attributes has changed. More... | |
void | normOrderChanged () |
The norm order has been changed. More... | |
void | ercMessageApprovalsChanged (const QSet< SExpression > &approvals) |
Called by setErcMessageApprovals() More... | |
void | schematicAdded (int newIndex) |
This signal is emitted after a schematic was added to the project. More... | |
void | schematicRemoved (int oldIndex) |
This signal is emitted after a schematic was removed from the project. More... | |
void | boardAdded (int newIndex) |
This signal is emitted after a board was added to the project. More... | |
void | boardRemoved (int oldIndex) |
This signal is emitted after a board was removed from the project. More... | |
void | primaryBoardChanged (const QPointer< Board > &board) |
A different board has become the primary board. More... | |
![]() | |
virtual void | attributesChanged ()=0 |
This signal is emitted when the value of attributes has changed. More... | |
Public Member Functions | |
Project ()=delete | |
Project (const Project &other)=delete | |
Project (std::unique_ptr< TransactionalDirectory > directory, const QString &filename) | |
Create a new, default initialized project. More... | |
~Project () noexcept | |
The destructor will close the whole project (without saving!) More... | |
FilePath | getFilepath () const noexcept |
Get the filepath of the project file (*.lpp) More... | |
FilePath | getPath () const noexcept |
Get the path to the project directory. More... | |
const TransactionalDirectory & | getDirectory () const noexcept |
TransactionalDirectory & | getDirectory () noexcept |
StrokeFontPool & | getStrokeFonts () const noexcept |
Get the StrokeFontPool which contains all stroke fonts of the project. More... | |
const Uuid & | getUuid () const noexcept |
Get the UUID of the project. More... | |
const ElementName & | getName () const noexcept |
Get the name of the project. More... | |
const QString & | getAuthor () const noexcept |
Get the author of the project. More... | |
const QString & | getVersion () const noexcept |
Get the version of the project. More... | |
const QDateTime & | getCreated () const noexcept |
Get the date and time when the project was created. More... | |
const QDateTime & | getDateTime () const noexcept |
Get the date and time when the project was opened or saved. More... | |
const AttributeList & | getAttributes () const noexcept |
Get the list of attributes. More... | |
const QStringList & | getLocaleOrder () const noexcept |
Get the configured locale order. More... | |
const QStringList & | getNormOrder () const noexcept |
Get the configured norm order. More... | |
const QStringList & | getCustomBomAttributes () const noexcept |
Get the configured custom BOM attributes. More... | |
ProjectLibrary & | getLibrary () const noexcept |
Get the ProjectLibrary object which contains all library elements used in this project. More... | |
Circuit & | getCircuit () const noexcept |
Get the Circuit object. More... | |
const QSet< SExpression > & | getErcMessageApprovals () const noexcept |
Get all ERC message approvals. More... | |
const QPointer< Board > & | getPrimaryBoard () noexcept |
Get the primary board (the first one) More... | |
void | setUuid (const Uuid &newUuid) noexcept |
Set the project's UUID. More... | |
void | setName (const ElementName &newName) noexcept |
Set the name of the project. More... | |
void | setAuthor (const QString &newAuthor) noexcept |
Set the author of the project. More... | |
void | setVersion (const QString &newVersion) noexcept |
Set the version of the project. More... | |
void | setCreated (const QDateTime &newCreated) noexcept |
Set the creation date/time. More... | |
void | updateDateTime () noexcept |
Update the last modified date/time. More... | |
void | setAttributes (const AttributeList &newAttributes) noexcept |
Set all project attributes. More... | |
void | setLocaleOrder (const QStringList &newLocales) noexcept |
Set the locale order. More... | |
void | setNormOrder (const QStringList &newNorms) noexcept |
Set the norm order. More... | |
void | setCustomBomAttributes (const QStringList &newKeys) noexcept |
Set the custom BOM attributes. More... | |
bool | setErcMessageApprovals (const QSet< SExpression > &approvals) noexcept |
Set all ERC message approvals. More... | |
int | getSchematicIndex (const Schematic &schematic) const noexcept |
Get the page index of a specific schematic. More... | |
const QList< Schematic * > & | getSchematics () const noexcept |
Get all schematics. More... | |
Schematic * | getSchematicByIndex (int index) const noexcept |
Get the schematic page at a specific index. More... | |
Schematic * | getSchematicByUuid (const Uuid &uuid) const noexcept |
Get the schematic page with a specific UUID. More... | |
Schematic * | getSchematicByName (const QString &name) const noexcept |
Get the schematic page with a specific name. More... | |
void | addSchematic (Schematic &schematic, int newIndex=-1) |
Add an existing schematic to this project. More... | |
void | removeSchematic (Schematic &schematic, bool deleteSchematic=false) |
Remove a schematic from this project. More... | |
int | getBoardIndex (const Board &board) const noexcept |
Get the index of a specific board. More... | |
const QList< Board * > & | getBoards () const noexcept |
Get all boards. More... | |
Board * | getBoardByIndex (int index) const noexcept |
Get the board at a specific index. More... | |
Board * | getBoardByUuid (const Uuid &uuid) const noexcept |
Get the board with a specific UUID. More... | |
Board * | getBoardByName (const QString &name) const noexcept |
Get the board with a specific name. More... | |
void | addBoard (Board &board, int newIndex=-1) |
Add an existing board to this project. More... | |
void | removeBoard (Board &board, bool deleteBoard=false) |
Remove a board from this project. More... | |
void | save () |
Save the project to the transactional file system. More... | |
QString | getUserDefinedAttributeValue (const QString &key) const noexcept override |
Get the value of a user defined attribute (if available) More... | |
QString | getBuiltInAttributeValue (const QString &key) const noexcept override |
Get the value of a built-in attribute (if available) More... | |
bool | operator== (const Project &rhs) noexcept |
bool | operator!= (const Project &rhs) noexcept |
![]() | |
AttributeProvider () noexcept | |
AttributeProvider (const AttributeProvider &other)=delete | |
AttributeProvider & | operator= (const AttributeProvider &rhs)=delete |
virtual | ~AttributeProvider () noexcept |
QString | getAttributeValue (const QString &key) const noexcept |
Get the value of an attribute which can be used in texts (like "{{NAME}}") More... | |
virtual QVector< const AttributeProvider * > | getAttributeProviderParents () const noexcept |
Get all parent attribute providers (fallback if attribute not found) More... | |
Static Public Member Functions | |
static std::unique_ptr< Project > | create (std::unique_ptr< TransactionalDirectory > directory, const QString &filename) |
static bool | isFilePathInsideProjectDirectory (const FilePath &fp) noexcept |
static bool | isProjectFile (const FilePath &file) noexcept |
static bool | isProjectDirectory (const FilePath &dir) noexcept |
static Version | getProjectFileFormatVersion (const FilePath &dir) |
Private Member Functions | |
void | updatePrimaryBoard () |
Private Attributes | |
std::unique_ptr< TransactionalDirectory > | mDirectory |
Project root directory. More... | |
QString | mFilename |
Name of the *.lpp project file. More... | |
QScopedPointer< StrokeFontPool > | mStrokeFontPool |
All fonts from ./resources/fontobene/. More... | |
Uuid | mUuid |
The project's UUID. More... | |
ElementName | mName |
The project name. More... | |
QString | mAuthor |
Author (optional). More... | |
QString | mVersion |
Version (arbitrary string, optional). More... | |
QDateTime | mCreated |
Date/time of project creation. More... | |
QDateTime | mDateTime |
Date/time of opening or saving the project. More... | |
AttributeList | mAttributes |
User-defined attributes in the specified order. More... | |
QStringList | mLocaleOrder |
Configured locales (e.g. "de_CH") in a particular order. More... | |
QStringList | mNormOrder |
Configured norms in a particular order. More... | |
QStringList | mCustomBomAttributes |
Custom attributes to be included in BOM export. More... | |
QScopedPointer< ProjectLibrary > | mProjectLibrary |
Ehe library which contains all elements needed in this project. More... | |
QScopedPointer< Circuit > | mCircuit |
QList< Schematic * > | mSchematics |
All schematics of this project. More... | |
QList< Schematic * > | mRemovedSchematics |
All removed schematics of this project. More... | |
QList< Board * > | mBoards |
All boards of this project. More... | |
QList< Board * > | mRemovedBoards |
All removed boards of this project. More... | |
QSet< SExpression > | mErcMessageApprovals |
All approved ERC messages. More... | |
QPointer< Board > | mPrimaryBoard |
The Project class represents a whole (opened) project with all its content.
This class represents a whole project with all the content of its directory:
The constructor of the librepcb::Project class needs the filepath to a project file. Then the project will be opened. A new project can be created with the static method create(). The destructor will close the project (without saving). Use the method save() to write the whole project to the harddisc.
|
delete |
Project | ( | std::unique_ptr< TransactionalDirectory > | directory, |
const QString & | filename | ||
) |
Create a new, default initialized project.
directory | The project directory to use. |
filename | The filename of the *.lpp project file. |
Exception | If the project could not be opened successfully |
|
noexcept |
The destructor will close the whole project (without saving!)
|
inlinenoexcept |
Get the filepath of the project file (*.lpp)
|
inlinenoexcept |
Get the path to the project directory.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Get the StrokeFontPool which contains all stroke fonts of the project.
|
inlinenoexcept |
Get the UUID of the project.
|
inlinenoexcept |
Get the name of the project.
|
inlinenoexcept |
Get the author of the project.
|
inlinenoexcept |
Get the version of the project.
|
inlinenoexcept |
Get the date and time when the project was created.
|
inlinenoexcept |
Get the date and time when the project was opened or saved.
|
inlinenoexcept |
Get the list of attributes.
|
inlinenoexcept |
Get the configured locale order.
|
inlinenoexcept |
Get the configured norm order.
|
inlinenoexcept |
Get the configured custom BOM attributes.
|
inlinenoexcept |
Get the ProjectLibrary object which contains all library elements used in this project.
|
inlinenoexcept |
|
inlinenoexcept |
Get all ERC message approvals.
|
inlinenoexcept |
Get the primary board (the first one)
|
noexcept |
Set the project's UUID.
newUuid | The new UUID. |
|
noexcept |
Set the name of the project.
newName | The new name |
|
noexcept |
Set the author of the project.
newAuthor | The new author |
|
noexcept |
Set the version of the project.
newVersion | The new version (can be an arbitrary string) |
|
noexcept |
Set the creation date/time.
newCreated | The new date/time of creation. |
|
noexcept |
Update the last modified date/time.
|
noexcept |
Set all project attributes.
newAttributes | The new list of attributes. |
|
noexcept |
Set the locale order.
newLocales | The new locale order. |
|
noexcept |
Set the norm order.
newNorms | The new norm order. |
|
noexcept |
Set the custom BOM attributes.
newKeys | The new attribute keys. |
|
noexcept |
Set all ERC message approvals.
approvals | Approval nodes |
false | If approvals have not been modified (no change) |
true | If approvals have been moified |
|
noexcept |
Get the page index of a specific schematic.
|
inlinenoexcept |
Get all schematics.
|
inlinenoexcept |
Get the schematic page at a specific index.
index | The page index (zero is the first) |
Get the schematic page with a specific UUID.
uuid | The schematic UUID |
|
noexcept |
Get the schematic page with a specific name.
name | The schematic name |
void addSchematic | ( | Schematic & | schematic, |
int | newIndex = -1 |
||
) |
Add an existing schematic to this project.
schematic | The schematic to add |
newIndex | The desired index in the list (after inserting it) |
Exception | On error |
void removeSchematic | ( | Schematic & | schematic, |
bool | deleteSchematic = false |
||
) |
Remove a schematic from this project.
schematic | The schematic to remove |
deleteSchematic | If true, the schematic object will be deleted (Set this to true only when called from ctor or dtor!!) |
Exception | On error |
|
noexcept |
Get the index of a specific board.
|
inlinenoexcept |
Get all boards.
|
inlinenoexcept |
Get the board at a specific index.
index | The board index (zero is the first) |
Get the board with a specific UUID.
uuid | The board UUID |
|
noexcept |
Get the board with a specific name.
name | The board name |
void addBoard | ( | Board & | board, |
int | newIndex = -1 |
||
) |
Add an existing board to this project.
board | The board to add |
newIndex | The desired index in the list (after inserting it) |
Exception | On error |
void removeBoard | ( | Board & | board, |
bool | deleteBoard = false |
||
) |
Remove a board from this project.
board | The board to remove |
deleteBoard | If true, the board object will be deleted (Set this to true only when called from ctor or dtor!!) |
Exception | On error |
void save | ( | ) |
Save the project to the transactional file system.
Exception | If an error occurred. |
|
overridevirtualnoexcept |
Get the value of a user defined attribute (if available)
key | The attribute name (e.g. "NAME" for "{{NAME}}") |
Reimplemented from AttributeProvider.
|
overridevirtualnoexcept |
Get the value of a built-in attribute (if available)
key | The attribute name (e.g. "NAME" for "{{NAME}}") |
Reimplemented from AttributeProvider.
|
inlinenoexcept |
|
inlinenoexcept |
|
static |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
overridesignal |
This signal is emitted when the value of attributes has changed.
All derived classes must emit this signal when some attributes have changed their values (only attributes which can be fetched with getAttributeValue(), inclusive all attributes from all "parent" classes).
|
signal |
The norm order has been changed.
|
signal |
Called by setErcMessageApprovals()
approvals | The new approvals |
|
signal |
This signal is emitted after a schematic was added to the project.
newIndex | The index of the added schematic |
|
signal |
This signal is emitted after a schematic was removed from the project.
oldIndex | The index of the removed schematic |
|
signal |
This signal is emitted after a board was added to the project.
newIndex | The index of the added board |
|
signal |
This signal is emitted after a board was removed from the project.
oldIndex | The index of the removed board |
|
signal |
A different board has become the primary board.
board | New primary board (may be nullptr) |
|
private |
|
private |
Project root directory.
|
private |
Name of the *.lpp project file.
|
private |
All fonts from ./resources/fontobene/.
|
private |
The project's UUID.
|
private |
The project name.
|
private |
Author (optional).
|
private |
Version (arbitrary string, optional).
|
private |
Date/time of project creation.
|
private |
Date/time of opening or saving the project.
|
private |
User-defined attributes in the specified order.
|
private |
Configured locales (e.g. "de_CH") in a particular order.
|
private |
Configured norms in a particular order.
|
private |
Custom attributes to be included in BOM export.
|
private |
Ehe library which contains all elements needed in this project.
|
private |
The whole circuit of this project (contains all netclasses, netsignals, component instances, ...)
|
private |
All schematics of this project.
|
private |
All removed schematics of this project.
|
private |
All boards of this project.
|
private |
All removed boards of this project.
|
private |
All approved ERC messages.
|
private |