LibrePCB Developers Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 InteractiveHtmlBomOutputJob;
49class LppzOutputJob;
50class NetlistOutputJob;
51class OutputDirectoryWriter;
52class OutputJob;
53class PickPlaceOutputJob;
54class Project;
55class ProjectJsonOutputJob;
56
57/*******************************************************************************
58 * Class OutputJobRunner
59 ******************************************************************************/
60
64class OutputJobRunner final : public QObject {
65 Q_OBJECT
66
67public:
68 // Constructors / Destructor
69 OutputJobRunner() = delete;
70 OutputJobRunner(const OutputJobRunner& other) = delete;
71 explicit OutputJobRunner(Project& project) noexcept;
72 ~OutputJobRunner() noexcept;
73
74 // Getters
75 const FilePath& getOutputDirectory() const noexcept;
76 const QMultiHash<Uuid, FilePath>& getWrittenFiles() const noexcept;
77
78 // Setters
79 void setOutputDirectory(const FilePath& fp) noexcept;
80
81 // General Methods
82 void run(const QVector<std::shared_ptr<OutputJob>>& jobs);
83 QList<FilePath> findUnknownFiles(const QSet<Uuid>& knownJobs) const;
84 void removeUnknownFiles(const QList<FilePath>& files);
86
87 // Operator Overloadings
88 OutputJobRunner& operator=(const OutputJobRunner& rhs) = delete;
89
90signals:
91 void jobStarted(std::shared_ptr<const OutputJob> job);
92 void aboutToWriteFile(const FilePath& fp);
93 void aboutToRemoveFile(const FilePath& fp);
94 void warning(const QString& msg);
95 void previewReady(int index, const QSize& pageSize, const QRectF margins,
96 std::shared_ptr<QPicture> picture);
97
98private: // Methods
99 void run(const OutputJob& job);
100 void runImpl(const GraphicsOutputJob& job);
101 void runImpl(const GerberExcellonOutputJob& job);
102 void runImpl(const PickPlaceOutputJob& job);
103 void runImpl(const GerberX3OutputJob& job);
104 void runImpl(const NetlistOutputJob& job);
105 void runImpl(const BomOutputJob& job);
106 void runImpl(const InteractiveHtmlBomOutputJob& job);
107 void runImpl(const Board3DOutputJob& job);
108 void runImpl(const ProjectJsonOutputJob& job);
109 void runImpl(const LppzOutputJob& job);
110 void runImpl(const CopyOutputJob& job);
111 void runImpl(const ArchiveOutputJob& job);
112 QList<Board*> getBoards(const OutputJob::ObjectSet<std::optional<Uuid>>& set,
113 bool includeNullInAll) const;
114 QList<Board*> getBoards(const OutputJob::ObjectSet<Uuid>& set) const;
115 QVector<std::shared_ptr<AssemblyVariant>> getAssemblyVariants(
116 const OutputJob::ObjectSet<std::optional<Uuid>>& set,
117 bool includeNullInAll) const;
118 QVector<std::shared_ptr<AssemblyVariant>> getAssemblyVariants(
119 const OutputJob::ObjectSet<Uuid>& set) const;
120
121private: // Data
124};
125
126/*******************************************************************************
127 * End of File
128 ******************************************************************************/
129
130} // namespace librepcb
131
132#endif
File archiving (e.g. to ZIP) output job.
Definition archiveoutputjob.h:45
The AssemblyVariant class.
Definition assemblyvariant.h:44
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:127
Gerber/Excellon output job.
Definition gerberexcellonoutputjob.h:46
Gerber X3 pick&place output job.
Definition gerberx3outputjob.h:45
Asynchronously exports graphics to a QPainter.
Definition graphicsexport.h:89
PDF/Image output job.
Definition graphicsoutputjob.h:49
Interactive HTML BOM output job.
Definition interactivehtmlbomoutputjob.h:46
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:64
~OutputJobRunner() noexcept
Definition outputjobrunner.cpp:81
QList< FilePath > findUnknownFiles(const QSet< Uuid > &knownJobs) const
Definition outputjobrunner.cpp:123
GraphicsExport::Pages buildPages(const GraphicsOutputJob &job)
Definition outputjobrunner.cpp:132
void run(const QVector< std::shared_ptr< OutputJob > > &jobs)
Definition outputjobrunner.cpp:113
void warning(const QString &msg)
void removeUnknownFiles(const QList< FilePath > &files)
Definition outputjobrunner.cpp:128
OutputJobRunner(const OutputJobRunner &other)=delete
QVector< std::shared_ptr< AssemblyVariant > > getAssemblyVariants(const OutputJob::ObjectSet< std::optional< Uuid > > &set, bool includeNullInAll) const
Definition outputjobrunner.cpp:804
QList< Board * > getBoards(const OutputJob::ObjectSet< std::optional< Uuid > > &set, bool includeNullInAll) const
Definition outputjobrunner.cpp:746
void jobStarted(std::shared_ptr< const OutputJob > job)
void aboutToWriteFile(const FilePath &fp)
void setOutputDirectory(const FilePath &fp) noexcept
Definition outputjobrunner.cpp:101
const QMultiHash< Uuid, FilePath > & getWrittenFiles() const noexcept
Definition outputjobrunner.cpp:92
void runImpl(const GraphicsOutputJob &job)
Definition outputjobrunner.cpp:264
Project & mProject
Definition outputjobrunner.h:122
const FilePath & getOutputDirectory() const noexcept
Definition outputjobrunner.cpp:88
void aboutToRemoveFile(const FilePath &fp)
QScopedPointer< OutputDirectoryWriter > mWriter
Definition outputjobrunner.h:123
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:56
Definition occmodel.cpp:77
Definition uuid.h:186