LibrePCB Developers Documentation
outputjobrunner.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_CORE_OUTPUTJOBRUNNER_H
21#define LIBREPCB_CORE_OUTPUTJOBRUNNER_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../export/graphicsexport.h"
27#include "../fileio/filepath.h"
28#include "../job/outputjob.h"
29
30#include <QtCore>
31
32#include <memory>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class ArchiveOutputJob;
40class AssemblyVariant;
41class Board3DOutputJob;
42class Board;
43class BomOutputJob;
44class CopyOutputJob;
45class GerberExcellonOutputJob;
46class GerberX3OutputJob;
47class GraphicsOutputJob;
48class LppzOutputJob;
49class NetlistOutputJob;
50class OutputDirectoryWriter;
51class OutputJob;
52class PickPlaceOutputJob;
53class Project;
54class ProjectJsonOutputJob;
55
56/*******************************************************************************
57 * Class OutputJobRunner
58 ******************************************************************************/
59
63class OutputJobRunner final : public QObject {
64 Q_OBJECT
65
66public:
67 // Constructors / Destructor
68 OutputJobRunner() = delete;
69 OutputJobRunner(const OutputJobRunner& other) = delete;
70 explicit OutputJobRunner(Project& project) noexcept;
71 ~OutputJobRunner() noexcept;
72
73 // Getters
74 const FilePath& getOutputDirectory() const noexcept;
75 const QMultiHash<Uuid, FilePath>& getWrittenFiles() const noexcept;
76
77 // Setters
78 void setOutputDirectory(const FilePath& fp) noexcept;
79
80 // General Methods
81 void run(const QVector<std::shared_ptr<OutputJob>>& jobs);
82 QList<FilePath> findUnknownFiles(const QSet<Uuid>& knownJobs) const;
83 void removeUnknownFiles(const QList<FilePath>& files);
85
86 // Operator Overloadings
87 OutputJobRunner& operator=(const OutputJobRunner& rhs) = delete;
88
89signals:
90 void jobStarted(std::shared_ptr<const OutputJob> job);
91 void aboutToWriteFile(const FilePath& fp);
92 void aboutToRemoveFile(const FilePath& fp);
93 void warning(const QString& msg);
94 void previewReady(int index, const QSize& pageSize, const QRectF margins,
95 std::shared_ptr<QPicture> picture);
96
97private: // Methods
98 void run(const OutputJob& job);
99 void runImpl(const GraphicsOutputJob& job);
100 void runImpl(const GerberExcellonOutputJob& job);
101 void runImpl(const PickPlaceOutputJob& job);
102 void runImpl(const GerberX3OutputJob& job);
103 void runImpl(const NetlistOutputJob& job);
104 void runImpl(const BomOutputJob& job);
105 void runImpl(const Board3DOutputJob& job);
106 void runImpl(const ProjectJsonOutputJob& job);
107 void runImpl(const LppzOutputJob& job);
108 void runImpl(const CopyOutputJob& job);
109 void runImpl(const ArchiveOutputJob& job);
110 QList<Board*> getBoards(const OutputJob::ObjectSet<tl::optional<Uuid>>& set,
111 bool includeNullInAll) const;
112 QList<Board*> getBoards(const OutputJob::ObjectSet<Uuid>& set) const;
113 QVector<std::shared_ptr<AssemblyVariant>> getAssemblyVariants(
114 const OutputJob::ObjectSet<tl::optional<Uuid>>& set,
115 bool includeNullInAll) const;
116 QVector<std::shared_ptr<AssemblyVariant>> getAssemblyVariants(
117 const OutputJob::ObjectSet<Uuid>& set) const;
118
119private: // Data
122};
123
124/*******************************************************************************
125 * End of File
126 ******************************************************************************/
127
128} // namespace librepcb
129
130#endif
File archiving (e.g. to ZIP) output job.
Definition: archiveoutputjob.h:45
The AssemblyVariant class.
Definition: assemblyvariant.h:45
3D board model output job
Definition: board3doutputjob.h:43
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
BOM output job.
Definition: bomoutputjob.h:45
File copy output job.
Definition: copyoutputjob.h:45
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
Gerber/Excellon output job.
Definition: gerberexcellonoutputjob.h:47
Gerber X3 pick&place output job.
Definition: gerberx3outputjob.h:45
Asynchronously exports graphics to a QPainter.
Definition: graphicsexport.h:90
PDF/Image output job.
Definition: graphicsoutputjob.h:50
Zipped project (*.lppz) output job.
Definition: lppzoutputjob.h:45
Netlist output job.
Definition: netlistoutputjob.h:43
The OutputDirectoryWriter class.
Definition: outputdirectorywriter.h:44
Base class for all output job types.
Definition: outputjob.h:50
The OutputJobRunner class.
Definition: outputjobrunner.h:63
~OutputJobRunner() noexcept
Definition: outputjobrunner.cpp:78
QList< FilePath > findUnknownFiles(const QSet< Uuid > &knownJobs) const
Definition: outputjobrunner.cpp:120
GraphicsExport::Pages buildPages(const GraphicsOutputJob &job)
Definition: outputjobrunner.cpp:129
void run(const QVector< std::shared_ptr< OutputJob > > &jobs)
Definition: outputjobrunner.cpp:110
void warning(const QString &msg)
void removeUnknownFiles(const QList< FilePath > &files)
Definition: outputjobrunner.cpp:125
OutputJobRunner(const OutputJobRunner &other)=delete
void jobStarted(std::shared_ptr< const OutputJob > job)
void aboutToWriteFile(const FilePath &fp)
void setOutputDirectory(const FilePath &fp) noexcept
Definition: outputjobrunner.cpp:98
const QMultiHash< Uuid, FilePath > & getWrittenFiles() const noexcept
Definition: outputjobrunner.cpp:89
void runImpl(const GraphicsOutputJob &job)
Definition: outputjobrunner.cpp:258
Project & mProject
Definition: outputjobrunner.h:120
const FilePath & getOutputDirectory() const noexcept
Definition: outputjobrunner.cpp:85
QList< Board * > getBoards(const OutputJob::ObjectSet< tl::optional< Uuid > > &set, bool includeNullInAll) const
Definition: outputjobrunner.cpp:695
void aboutToRemoveFile(const FilePath &fp)
QVector< std::shared_ptr< AssemblyVariant > > getAssemblyVariants(const OutputJob::ObjectSet< tl::optional< Uuid > > &set, bool includeNullInAll) const
Definition: outputjobrunner.cpp:753
QScopedPointer< OutputDirectoryWriter > mWriter
Definition: outputjobrunner.h:121
void previewReady(int index, const QSize &pageSize, const QRectF margins, std::shared_ptr< QPicture > picture)
Pick&Place output job.
Definition: pickplaceoutputjob.h:45
The Project class represents a whole (opened) project with all its content.
Definition: project.h:71
JSON project data output job.
Definition: projectjsonoutputjob.h:43
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Definition: occmodel.cpp:77
Definition: uuid.h:183