LibrePCB Developers Documentation
newelementwizardcontext.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_EDITOR_NEWELEMENTWIZARDCONTEXT_H
21 #define LIBREPCB_EDITOR_NEWELEMENTWIZARDCONTEXT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
35 
36 #include <QtCore>
37 #include <QtWidgets>
38 
39 /*******************************************************************************
40  * Namespace / Forward Declarations
41  ******************************************************************************/
42 namespace librepcb {
43 
44 class Library;
45 class Workspace;
46 
47 namespace editor {
48 
49 class IF_GraphicsLayerProvider;
50 
51 /*******************************************************************************
52  * Class NewElementWizardContext
53  ******************************************************************************/
54 
58 class NewElementWizardContext final : public QObject {
59  Q_OBJECT
60 
61 public:
62  // Types
63 
64  enum PageId {
65  ID_None = -1,
75  };
76 
77  enum class ElementType {
78  None,
81  Symbol,
82  Package,
83  Component,
84  Device,
85  };
86 
87  // Constructors / Destructor
88  NewElementWizardContext() = delete;
89  NewElementWizardContext(const NewElementWizardContext& other) = delete;
91  const IF_GraphicsLayerProvider& lp,
92  QObject* parent = nullptr) noexcept;
93  ~NewElementWizardContext() noexcept;
94 
95  // Getters
96  const FilePath& getOutputDirectory() const noexcept {
97  return mOutputDirectory;
98  }
99  const Workspace& getWorkspace() const noexcept { return mWorkspace; }
100  const IF_GraphicsLayerProvider& getLayerProvider() const noexcept {
101  return mLayerProvider;
102  }
103  const QStringList& getLibLocaleOrder() const noexcept;
104 
105  // General Methods
106  void reset(ElementType newType = ElementType::None) noexcept;
107  void copyElement(ElementType type, const FilePath& fp);
108  void createLibraryElement();
109 
110  // Operator Overloadings
112  delete;
113 
114 private: // Data
119 
120 public: // Data
121  // common
122  QHash<QString, QByteArray> mFiles;
124  tl::optional<ElementName> mElementName;
127  QString mElementAuthor;
128  tl::optional<Version> mElementVersion;
130 
131  // symbol
136 
137  // package
142 
143  // component
150 
151  // device
152  tl::optional<Uuid> mDeviceComponentUuid;
153  tl::optional<Uuid> mDevicePackageUuid;
157 };
158 
159 /*******************************************************************************
160  * End of File
161  ******************************************************************************/
162 
163 } // namespace editor
164 } // namespace librepcb
165 
166 #endif
ComponentSymbolVariantList mComponentSymbolVariants
Definition: newelementwizardcontext.h:149
const FilePath & getOutputDirectory() const noexcept
Definition: newelementwizardcontext.h:96
tl::optional< Uuid > mDeviceComponentUuid
Definition: newelementwizardcontext.h:152
tl::optional< ElementName > mElementName
Definition: newelementwizardcontext.h:124
QHash< QString, QByteArray > mFiles
Definition: newelementwizardcontext.h:122
The NewElementWizardContext class.
Definition: newelementwizardcontext.h:58
SymbolPinList mSymbolPins
Definition: newelementwizardcontext.h:132
Definition: newelementwizardcontext.h:69
CircleList mSymbolCircles
Definition: newelementwizardcontext.h:134
Package::AssemblyType mPackageAssemblyType
Definition: newelementwizardcontext.h:138
const Workspace & mWorkspace
Definition: newelementwizardcontext.h:115
Definition: occmodel.cpp:77
ComponentSignalList mComponentSignals
Definition: newelementwizardcontext.h:148
Definition: newelementwizardcontext.h:66
QString mElementKeywords
Definition: newelementwizardcontext.h:126
Library & mLibrary
Definition: newelementwizardcontext.h:116
PackageModelList mPackageModels
Definition: newelementwizardcontext.h:140
bool mComponentSchematicOnly
Definition: newelementwizardcontext.h:144
const QStringList & getLibLocaleOrder() const noexcept
Definition: newelementwizardcontext.cpp:67
AttributeList mComponentAttributes
Definition: newelementwizardcontext.h:145
~NewElementWizardContext() noexcept
Definition: newelementwizardcontext.cpp:60
tl::optional< Version > mElementVersion
Definition: newelementwizardcontext.h:128
FilePath mOutputDirectory
Definition: newelementwizardcontext.h:118
TextList mSymbolTexts
Definition: newelementwizardcontext.h:135
FootprintList mPackageFootprints
Definition: newelementwizardcontext.h:141
const IF_GraphicsLayerProvider & mLayerProvider
Definition: newelementwizardcontext.h:117
ElementType
Definition: newelementwizardcontext.h:77
QString mElementAuthor
Definition: newelementwizardcontext.h:127
AssemblyType
Definition: package.h:78
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:111
QString mElementDescription
Definition: newelementwizardcontext.h:125
NormDependentPrefixMap mComponentPrefixes
Definition: newelementwizardcontext.h:147
last page
Definition: newelementwizardcontext.h:65
void reset(ElementType newType=ElementType::None) noexcept
Definition: newelementwizardcontext.cpp:75
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
DevicePadSignalMap mDevicePadSignalMap
Definition: newelementwizardcontext.h:154
void createLibraryElement()
Definition: newelementwizardcontext.cpp:372
AttributeList mDeviceAttributes
Definition: newelementwizardcontext.h:155
QString mComponentDefaultValue
Definition: newelementwizardcontext.h:146
const Workspace & getWorkspace() const noexcept
Definition: newelementwizardcontext.h:99
PartList mDeviceParts
Definition: newelementwizardcontext.h:156
tl::optional< Uuid > mDevicePackageUuid
Definition: newelementwizardcontext.h:153
QSet< Uuid > mElementCategoryUuids
Definition: newelementwizardcontext.h:129
The Library class represents a library directory.
Definition: library.h:46
ElementType mElementType
Definition: newelementwizardcontext.h:123
void copyElement(ElementType type, const FilePath &fp)
Definition: newelementwizardcontext.cpp:114
const IF_GraphicsLayerProvider & getLayerProvider() const noexcept
Definition: newelementwizardcontext.h:100
PackagePadList mPackagePads
Definition: newelementwizardcontext.h:139
Definition: newelementwizardcontext.h:68
PolygonList mSymbolPolygons
Definition: newelementwizardcontext.h:133
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:54
Definition: newelementwizardcontext.h:67
PageId
Definition: newelementwizardcontext.h:64
NewElementWizardContext & operator=(const NewElementWizardContext &rhs)=delete