![]() |
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 emited when the value of attributes has changed. 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... | |
![]() | |
virtual void | attributesChanged ()=0 |
This signal is emited 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) | |
The constructor to open an existing project with all its content. 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... | |
ProjectMetadata & | getMetadata () const noexcept |
Get the ProjectMetadata object which contains all project metadata. More... | |
ProjectSettings & | getSettings () const noexcept |
Get the ProjectSettings object which contains all project settings. More... | |
ProjectLibrary & | getLibrary () const noexcept |
Get the ProjectLibrary object which contains all library elements used in this project. More... | |
ErcMsgList & | getErcMsgList () const noexcept |
Get the ERC messages list. More... | |
Circuit & | getCircuit () const noexcept |
Get the Circuit object. More... | |
SchematicLayerProvider & | getLayers () noexcept |
const SchematicLayerProvider & | getLayers () const noexcept |
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... | |
Schematic * | createSchematic (const ElementName &name) |
Create a new schematic (page) 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... | |
void | exportSchematicsAsPdf (const FilePath &filepath) |
Export the schematic pages as a PDF. More... | |
void | printSchematicPages (QPrinter &printer, QList< int > &pages) |
Print some schematics to a QPrinter (printer or file) 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... | |
Board * | createBoard (const ElementName &name) |
Create a new board. More... | |
Board * | createBoard (const Board &other, const ElementName &name) |
Create a new board as a copy of an existing board. 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 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 | |
Project (std::unique_ptr< TransactionalDirectory > directory, const QString &filename, bool create) | |
The constructor to create or open a project with all its content. More... | |
Private Attributes | |
std::unique_ptr< TransactionalDirectory > | mDirectory |
QString | mFilename |
the name of the *.lpp project file More... | |
QScopedPointer< StrokeFontPool > | mStrokeFontPool |
all fonts from ./resources/fontobene/ More... | |
QScopedPointer< ProjectMetadata > | mProjectMetadata |
e.g. project name, author, ... More... | |
QScopedPointer< ProjectSettings > | mProjectSettings |
all project specific settings More... | |
QScopedPointer< ProjectLibrary > | mProjectLibrary |
QScopedPointer< ErcMsgList > | mErcMsgList |
QScopedPointer< Circuit > | mCircuit |
QList< Schematic * > | mSchematics |
All schematics of this project. More... | |
QList< Schematic * > | mRemovedSchematics |
All removed schematics of this project. More... | |
QScopedPointer< SchematicLayerProvider > | mSchematicLayerProvider |
All schematic layers of this project. More... | |
QList< Board * > | mBoards |
All boards of this project. More... | |
QList< Board * > | mRemovedBoards |
All removed boards of this project. More... | |
QScopedPointer< AttributeList > | mAttributes |
all attributes in a specific order More... | |
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::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 |
|
inline |
The constructor to open an existing project with all its content.
directory | The directory which contains the project. |
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!)
|
explicitprivate |
The constructor to create or open a project with all its content.
directory | The directory which contains the project. |
filename | The filename of the *.lpp project file. |
create | True if the specified project does not exist already and must be created. |
Exception | If the project could not be created/opened successfully |
|
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 ProjectMetadata object which contains all project metadata.
|
inlinenoexcept |
Get the ProjectSettings object which contains all project settings.
|
inlinenoexcept |
Get the ProjectLibrary object which contains all library elements used in this project.
|
inlinenoexcept |
Get the ERC messages list.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
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 |
Schematic * createSchematic | ( | const ElementName & | name | ) |
Create a new schematic (page)
name | The schematic page name |
Exception | This method throws an exception on error. |
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 |
void exportSchematicsAsPdf | ( | const FilePath & | filepath | ) |
Export the schematic pages as a PDF.
filepath | The filepath where the PDF should be saved. If the file exists already, it will be overwritten. |
Exception | On error |
void printSchematicPages | ( | QPrinter & | printer, |
QList< int > & | pages | ||
) |
Print some schematics to a QPrinter (printer or file)
printer | The QPrinter where to print the schematic pages |
pages | A list with all schematic page indexes which should be printed |
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 |
Board * createBoard | ( | const ElementName & | name | ) |
Create a new board.
name | The board name |
Exception | This method throws an exception on error. |
Board * createBoard | ( | const Board & | other, |
const ElementName & | name | ||
) |
Create a new board as a copy of an existing board.
other | The board to copy |
name | The board name |
Exception | This method throws an exception on error. |
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 |
|
inlinestatic |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
overridesignal |
This signal is emited 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 |
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 |
|
private |
|
private |
the name of the *.lpp project file
|
private |
all fonts from ./resources/fontobene/
|
private |
e.g. project name, author, ...
|
private |
all project specific settings
|
private |
the library which contains all elements needed in this project
|
private |
A list which contains all electrical rule check (ERC) messages
|
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 schematic layers of this project.
|
private |
All boards of this project.
|
private |
All removed boards of this project.
|
private |
all attributes in a specific order