LibrePCB Developers Documentation
|
The Project class represents a whole (opened) project with all its content. More...
#include <project.h>
Inherits QObject.
Signals | |
void | attributesChanged () |
void | normOrderChanged () |
The norm order has been changed. | |
void | ercMessageApprovalsChanged (const QSet< SExpression > &approvals) |
Called by setErcMessageApprovals() | |
void | schematicAdded (int newIndex) |
This signal is emitted after a schematic was added to the project. | |
void | schematicRemoved (int oldIndex) |
This signal is emitted after a schematic was removed from the project. | |
void | boardAdded (int newIndex) |
This signal is emitted after a board was added to the project. | |
void | boardRemoved (int oldIndex) |
This signal is emitted after a board was removed from the project. | |
void | primaryBoardChanged (const QPointer< Board > &board) |
A different board has become the primary board. | |
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. | |
~Project () noexcept | |
The destructor will close the whole project (without saving!) | |
const QString & | getFileName () const noexcept |
Get the filename of the project file (*.lpp) | |
FilePath | getFilepath () const noexcept |
Get the filepath of the project file (*.lpp) | |
FilePath | getPath () const noexcept |
Get the path to the project directory. | |
const TransactionalDirectory & | getDirectory () const noexcept |
TransactionalDirectory & | getDirectory () noexcept |
FilePath | getCurrentOutputDir () const noexcept |
Get the output jobs base directory for the current version number. | |
StrokeFontPool & | getStrokeFonts () const noexcept |
Get the StrokeFontPool which contains all stroke fonts of the project. | |
const Uuid & | getUuid () const noexcept |
Get the UUID of the project. | |
const ElementName & | getName () const noexcept |
Get the name of the project. | |
const QString & | getAuthor () const noexcept |
Get the author of the project. | |
const FileProofName & | getVersion () const noexcept |
Get the version of the project. | |
const QDateTime & | getCreated () const noexcept |
Get the date and time when the project was created. | |
const QDateTime & | getDateTime () const noexcept |
Get the date and time when the project was opened or saved. | |
const AttributeList & | getAttributes () const noexcept |
Get the list of attributes. | |
const QStringList & | getLocaleOrder () const noexcept |
Get the configured locale order. | |
const QStringList & | getNormOrder () const noexcept |
Get the configured norm order. | |
const QStringList & | getCustomBomAttributes () const noexcept |
Get the configured custom BOM attributes. | |
bool | getDefaultLockComponentAssembly () const noexcept |
Whether assembly options of new components are locked for the board editor or not. | |
const OutputJobList & | getOutputJobs () const noexcept |
Get all output jobs. | |
OutputJobList & | getOutputJobs () noexcept |
ProjectLibrary & | getLibrary () const noexcept |
Get the ProjectLibrary object which contains all library elements used in this project. | |
Circuit & | getCircuit () const noexcept |
Get the Circuit object. | |
const QSet< SExpression > & | getErcMessageApprovals () const noexcept |
Get all ERC message approvals. | |
const QPointer< Board > & | getPrimaryBoard () noexcept |
Get the primary board (the first one) | |
void | setUuid (const Uuid &newUuid) noexcept |
Set the project's UUID. | |
void | setName (const ElementName &newName) noexcept |
Set the name of the project. | |
void | setAuthor (const QString &newAuthor) noexcept |
Set the author of the project. | |
void | setVersion (const FileProofName &newVersion) noexcept |
Set the version of the project. | |
void | setCreated (const QDateTime &newCreated) noexcept |
Set the creation date/time. | |
void | updateDateTime () noexcept |
Update the last modified date/time. | |
void | setAttributes (const AttributeList &newAttributes) noexcept |
Set all project attributes. | |
void | setLocaleOrder (const QStringList &newLocales) noexcept |
Set the locale order. | |
void | setNormOrder (const QStringList &newNorms) noexcept |
Set the norm order. | |
void | setCustomBomAttributes (const QStringList &newKeys) noexcept |
Set the custom BOM attributes. | |
void | setDefaultLockComponentAssembly (bool newLock) noexcept |
Set the default value for librepcb::ComponentInstance::mLockAssembly. | |
bool | setErcMessageApprovals (const QSet< SExpression > &approvals) noexcept |
Set all ERC message approvals. | |
int | getSchematicIndex (const Schematic &schematic) const noexcept |
Get the page index of a specific schematic. | |
const QList< Schematic * > & | getSchematics () const noexcept |
Get all schematics. | |
Schematic * | getSchematicByIndex (int index) const noexcept |
Get the schematic page at a specific index. | |
Schematic * | getSchematicByUuid (const Uuid &uuid) const noexcept |
Get the schematic page with a specific UUID. | |
Schematic * | getSchematicByName (const QString &name) const noexcept |
Get the schematic page with a specific name. | |
void | addSchematic (Schematic &schematic, int newIndex=-1) |
Add an existing schematic to this project. | |
void | removeSchematic (Schematic &schematic, bool deleteSchematic=false) |
Remove a schematic from this project. | |
int | getBoardIndex (const Board &board) const noexcept |
Get the index of a specific board. | |
const QList< Board * > & | getBoards () const noexcept |
Get all boards. | |
Board * | getBoardByIndex (int index) const noexcept |
Get the board at a specific index. | |
Board * | getBoardByUuid (const Uuid &uuid) const noexcept |
Get the board with a specific UUID. | |
Board * | getBoardByName (const QString &name) const noexcept |
Get the board with a specific name. | |
void | addBoard (Board &board, int newIndex=-1) |
Add an existing board to this project. | |
void | removeBoard (Board &board, bool deleteBoard=false) |
Remove a board from this project. | |
void | save () |
Save the project to the transactional file system. | |
bool | operator== (const Project &rhs) noexcept |
bool | operator!= (const Project &rhs) noexcept |
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. | |
QString | mFilename |
Name of the *.lpp project file. | |
QScopedPointer< StrokeFontPool > | mStrokeFontPool |
All fonts from ./resources/fontobene/. | |
Uuid | mUuid |
The project's UUID. | |
ElementName | mName |
The project name. | |
QString | mAuthor |
Author (optional). | |
FileProofName | mVersion |
Version number. | |
QDateTime | mCreated |
Date/time of project creation. | |
QDateTime | mDateTime |
Date/time of opening or saving the project. | |
AttributeList | mAttributes |
User-defined attributes in the specified order. | |
QStringList | mLocaleOrder |
Configured locales (e.g. "de_CH") in a particular order. | |
QStringList | mNormOrder |
Configured norms in a particular order. | |
QStringList | mCustomBomAttributes |
Custom attributes to be included in BOM export. | |
bool | mDefaultLockComponentAssembly |
Default value for librepcb::ComponentInstance::mLockAssembly. | |
OutputJobList | mOutputJobs |
Output jobs. | |
QScopedPointer< ProjectLibrary > | mProjectLibrary |
Ehe library which contains all elements needed in this project. | |
QScopedPointer< Circuit > | mCircuit |
QList< Schematic * > | mSchematics |
All schematics of this project. | |
QList< Schematic * > | mRemovedSchematics |
All removed schematics of this project. | |
QList< Board * > | mBoards |
All boards of this project. | |
QList< Board * > | mRemovedBoards |
All removed boards of this project. | |
QSet< SExpression > | mErcMessageApprovals |
All approved ERC messages. | |
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 filename of the project file (*.lpp)
|
inlinenoexcept |
Get the filepath of the project file (*.lpp)
|
inlinenoexcept |
Get the path to the project directory.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Get the output jobs base directory for the current version number.
./output/{{VERSION}}/
)
|
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 |
Whether assembly options of new components are locked for the board editor or not.
|
inlinenoexcept |
Get all output jobs.
|
inlinenoexcept |
|
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 |
|
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 the default value for librepcb::ComponentInstance::mLockAssembly.
newLock | The new lock default value. |
|
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. |
|
inlinenoexcept |
|
inlinenoexcept |
|
static |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
signal |
|
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 number.
|
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 |
Default value for librepcb::ComponentInstance::mLockAssembly.
|
private |
Output jobs.
|
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 |