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