20#ifndef LIBREPCB_CORE_PROJECT_H
21#define LIBREPCB_CORE_PROJECT_H
26#include "../attribute/attribute.h"
27#include "../fileio/directorylock.h"
28#include "../fileio/transactionaldirectory.h"
29#include "../job/outputjob.h"
30#include "../types/elementname.h"
31#include "../types/fileproofname.h"
32#include "../types/uuid.h"
33#include "../types/version.h"
87 Project(std::unique_ptr<TransactionalDirectory> directory,
88 const QString& filename);
288 void setAuthor(
const QString& newAuthor)
noexcept;
302 void setCreated(
const QDateTime& newCreated)
noexcept;
328 void setNormOrder(const QStringList& newNorms) noexcept;
449 return mBoards.value(index,
nullptr);
507 static std::unique_ptr<Project>
create(
508 std::unique_ptr<TransactionalDirectory> directory,
509 const QString& filename);
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
The Circuit class represents all electrical connections in a project (drawn in the schematics)
Definition: circuit.h:70
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
The Project class represents a whole (opened) project with all its content.
Definition: project.h:71
TransactionalDirectory & getDirectory() noexcept
Definition: project.h:124
QDateTime mCreated
Date/time of project creation.
Definition: project.h:592
const TransactionalDirectory & getDirectory() const noexcept
Definition: project.h:120
void addSchematic(Schematic &schematic, int newIndex=-1)
Add an existing schematic to this project.
Definition: project.cpp:218
int getSchematicIndex(const Schematic &schematic) const noexcept
Get the page index of a specific schematic.
Definition: project.cpp:200
void updateDateTime() noexcept
Update the last modified date/time.
Definition: project.cpp:148
const QDateTime & getDateTime() const noexcept
Get the date and time when the project was opened or saved.
Definition: project.h:183
bool setErcMessageApprovals(const QSet< SExpression > &approvals) noexcept
Set all ERC message approvals.
Definition: project.cpp:185
const QString & getAuthor() const noexcept
Get the author of the project.
Definition: project.h:162
QDateTime mDateTime
Date/time of opening or saving the project.
Definition: project.h:595
void setUuid(const Uuid &newUuid) noexcept
Set the project's UUID.
Definition: project.cpp:113
void boardAdded(int newIndex)
This signal is emitted after a board was added to the project.
const FileProofName & getVersion() const noexcept
Get the version of the project.
Definition: project.h:169
bool getDefaultLockComponentAssembly() const noexcept
Whether assembly options of new components are locked for the board editor or not.
Definition: project.h:221
const QStringList & getCustomBomAttributes() const noexcept
Get the configured custom BOM attributes.
Definition: project.h:211
const QList< Board * > & getBoards() const noexcept
Get all boards.
Definition: project.h:439
ProjectLibrary & getLibrary() const noexcept
Get the ProjectLibrary object which contains all library elements used in this project.
Definition: project.h:239
QPointer< Board > mPrimaryBoard
Definition: project.h:638
OutputJobList mOutputJobs
Output jobs.
Definition: project.h:613
const ElementName & getName() const noexcept
Get the name of the project.
Definition: project.h:155
Uuid mUuid
The project's UUID.
Definition: project.h:580
~Project() noexcept
The destructor will close the whole project (without saving!)
Definition: project.cpp:85
QStringList mCustomBomAttributes
Custom attributes to be included in BOM export.
Definition: project.h:607
int getBoardIndex(const Board &board) const noexcept
Get the index of a specific board.
Definition: project.cpp:288
void schematicAdded(int newIndex)
This signal is emitted after a schematic was added to the project.
static bool isFilePathInsideProjectDirectory(const FilePath &fp) noexcept
Definition: project.cpp:550
ElementName mName
The project name.
Definition: project.h:583
void addBoard(Board &board, int newIndex=-1)
Add an existing board to this project.
Definition: project.cpp:306
QSet< SExpression > mErcMessageApprovals
All approved ERC messages.
Definition: project.h:635
FileProofName mVersion
Version number.
Definition: project.h:589
FilePath getCurrentOutputDir() const noexcept
Get the output jobs base directory for the current version number.
Definition: project.h:131
FilePath getFilepath() const noexcept
Get the filepath of the project file (*.lpp)
Definition: project.h:109
static bool isProjectFile(const FilePath &file) noexcept
Definition: project.cpp:561
static Version getProjectFileFormatVersion(const FilePath &dir)
Definition: project.cpp:570
const QPointer< Board > & getPrimaryBoard() noexcept
Get the primary board (the first one)
Definition: project.h:262
void removeSchematic(Schematic &schematic, bool deleteSchematic=false)
Remove a schematic from this project.
Definition: project.cpp:257
FilePath getPath() const noexcept
Get the path to the project directory.
Definition: project.h:118
void setDefaultLockComponentAssembly(bool newLock) noexcept
Set the default value for librepcb::ComponentInstance::mLockAssembly.
Definition: project.cpp:181
const AttributeList & getAttributes() const noexcept
Get the list of attributes.
Definition: project.h:190
QScopedPointer< Circuit > mCircuit
Definition: project.h:620
void primaryBoardChanged(const QPointer< Board > &board)
A different board has become the primary board.
QScopedPointer< ProjectLibrary > mProjectLibrary
Ehe library which contains all elements needed in this project.
Definition: project.h:616
OutputJobList & getOutputJobs() noexcept
Definition: project.h:231
QList< Schematic * > mRemovedSchematics
All removed schematics of this project.
Definition: project.h:626
Project(const Project &other)=delete
QList< Schematic * > mSchematics
All schematics of this project.
Definition: project.h:623
const QDateTime & getCreated() const noexcept
Get the date and time when the project was created.
Definition: project.h:176
Board * getBoardByName(const QString &name) const noexcept
Get the board with a specific name.
Definition: project.cpp:299
void setAttributes(const AttributeList &newAttributes) noexcept
Set all project attributes.
Definition: project.cpp:153
void setLocaleOrder(const QStringList &newLocales) noexcept
Set the locale order.
Definition: project.cpp:160
void setNormOrder(const QStringList &newNorms) noexcept
Set the norm order.
Definition: project.cpp:167
StrokeFontPool & getStrokeFonts() const noexcept
Get the StrokeFontPool which contains all stroke fonts of the project.
Definition: project.h:141
bool mDefaultLockComponentAssembly
Default value for librepcb::ComponentInstance::mLockAssembly.
Definition: project.h:610
QList< Board * > mBoards
All boards of this project.
Definition: project.h:629
static bool isProjectDirectory(const FilePath &dir) noexcept
Definition: project.cpp:566
QScopedPointer< StrokeFontPool > mStrokeFontPool
All fonts from ./resources/fontobene/.
Definition: project.h:577
AttributeList mAttributes
User-defined attributes in the specified order.
Definition: project.h:598
const OutputJobList & getOutputJobs() const noexcept
Get all output jobs.
Definition: project.h:230
void save()
Save the project to the transactional file system.
Definition: project.cpp:371
QList< Board * > mRemovedBoards
All removed boards of this project.
Definition: project.h:632
QStringList mNormOrder
Configured norms in a particular order.
Definition: project.h:604
const Uuid & getUuid() const noexcept
Get the UUID of the project.
Definition: project.h:148
Board * getBoardByIndex(int index) const noexcept
Get the board at a specific index.
Definition: project.h:448
void setVersion(const FileProofName &newVersion) noexcept
Set the version of the project.
Definition: project.cpp:134
Schematic * getSchematicByIndex(int index) const noexcept
Get the schematic page at a specific index.
Definition: project.h:381
std::unique_ptr< TransactionalDirectory > mDirectory
Project root directory.
Definition: project.h:571
void setName(const ElementName &newName) noexcept
Set the name of the project.
Definition: project.cpp:120
void updatePrimaryBoard()
Definition: project.cpp:580
Circuit & getCircuit() const noexcept
Get the Circuit object.
Definition: project.h:246
bool operator==(const Project &rhs) noexcept
Definition: project.h:502
const QList< Schematic * > & getSchematics() const noexcept
Get all schematics.
Definition: project.h:369
void boardRemoved(int oldIndex)
This signal is emitted after a board was removed from the project.
Board * getBoardByUuid(const Uuid &uuid) const noexcept
Get the board with a specific UUID.
Definition: project.cpp:292
void normOrderChanged()
The norm order has been changed.
void schematicRemoved(int oldIndex)
This signal is emitted after a schematic was removed from the project.
void setCreated(const QDateTime &newCreated) noexcept
Set the creation date/time.
Definition: project.cpp:141
Schematic * getSchematicByUuid(const Uuid &uuid) const noexcept
Get the schematic page with a specific UUID.
Definition: project.cpp:204
const QStringList & getLocaleOrder() const noexcept
Get the configured locale order.
Definition: project.h:197
const QStringList & getNormOrder() const noexcept
Get the configured norm order.
Definition: project.h:204
QStringList mLocaleOrder
Configured locales (e.g. "de_CH") in a particular order.
Definition: project.h:601
void removeBoard(Board &board, bool deleteBoard=false)
Remove a board from this project.
Definition: project.cpp:345
Schematic * getSchematicByName(const QString &name) const noexcept
Get the schematic page with a specific name.
Definition: project.cpp:211
void ercMessageApprovalsChanged(const QSet< SExpression > &approvals)
Called by setErcMessageApprovals()
bool operator!=(const Project &rhs) noexcept
Definition: project.h:503
const QSet< SExpression > & getErcMessageApprovals() const noexcept
Get all ERC message approvals.
Definition: project.h:253
void setCustomBomAttributes(const QStringList &newKeys) noexcept
Set the custom BOM attributes.
Definition: project.cpp:175
const QString & getFileName() const noexcept
Get the filename of the project file (*.lpp)
Definition: project.h:102
static std::unique_ptr< Project > create(std::unique_ptr< TransactionalDirectory > directory, const QString &filename)
Definition: project.cpp:506
QString mAuthor
Author (optional).
Definition: project.h:586
QString mFilename
Name of the *.lpp project file.
Definition: project.h:574
void setAuthor(const QString &newAuthor) noexcept
Set the author of the project.
Definition: project.cpp:127
The ProjectLibrary class.
Definition: projectlibrary.h:52
The SExpression class.
Definition: sexpression.h:69
The Schematic class represents one schematic page of a project and is always part of a circuit.
Definition: schematic.h:74
The StrokeFontPool class.
Definition: strokefontpool.h:46
Helper class to access a subdirectory of TransactionalFileSystem.
Definition: transactionaldirectory.h:51
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The Version class represents a version number in the format "1.42.7".
Definition: version.h:58
Definition: occmodel.cpp:77
type_safe::constrained_type< QString, FileProofNameConstraint, FileProofNameVerifier > FileProofName
Definition: fileproofname.h:89
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition: elementname.h:84