LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
63 class NewElementWizardContext final : public QObject {
64  Q_OBJECT
65 
66 public:
67  // Types
68 
69  enum PageId {
70  ID_None = -1,
80  };
81 
82  enum class ElementType {
83  None,
86  Symbol,
87  Package,
88  Component,
89  Device,
90  };
91 
92  // Constructors / Destructor
93  NewElementWizardContext() = delete;
94  NewElementWizardContext(const NewElementWizardContext& other) = delete;
96  const IF_GraphicsLayerProvider& lp,
97  QObject* parent = nullptr) noexcept;
98  ~NewElementWizardContext() noexcept;
99 
100  // Getters
101  const FilePath& getOutputDirectory() const noexcept {
102  return mOutputDirectory;
103  }
104  const workspace::Workspace& getWorkspace() const noexcept {
105  return mWorkspace;
106  }
107  const IF_GraphicsLayerProvider& getLayerProvider() const noexcept {
108  return mLayerProvider;
109  }
110  const QStringList& getLibLocaleOrder() const noexcept;
111 
112  // General Methods
113  void reset() noexcept;
114  void createLibraryElement();
115 
116  // Operator Overloadings
117  NewElementWizardContext& operator=(const NewElementWizardContext& rhs) =
118  delete;
119 
120 private: // Data
121  const workspace::Workspace& mWorkspace;
122  const library::Library& mLibrary;
125 
126 public: // Data
127  // common
129  tl::optional<ElementName> mElementName;
132  QString mElementAuthor;
133  tl::optional<Version> mElementVersion;
134  tl::optional<Uuid> mElementCategoryUuid;
135 
136  // symbol
141 
142  // package
145 
146  // component
153 
154  // device
155  tl::optional<Uuid> mDeviceComponentUuid;
156  tl::optional<Uuid> mDevicePackageUuid;
158 };
159 
160 /*******************************************************************************
161  * End of File
162  ******************************************************************************/
163 
164 } // namespace editor
165 } // namespace library
166 } // namespace librepcb
167 
168 #endif // LIBREPCB_LIBRARY_EDITOR_NEWELEMENTWIZARDCONTEXT_H
The Version class represents a version number in the format "1.42.7".
Definition: version.h:60
tl::optional< ElementName > mElementName
Definition: newelementwizardcontext.h:129
AttributeList mComponentAttributes
Definition: newelementwizardcontext.h:148
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:65
const IF_GraphicsLayerProvider & mLayerProvider
Definition: newelementwizardcontext.h:123
CircleList mSymbolCircles
Definition: newelementwizardcontext.h:139
The Library class represents a library directory.
Definition: library.h:49
tl::optional< Uuid > mDeviceComponentUuid
Definition: newelementwizardcontext.h:155
const workspace::Workspace & mWorkspace
Definition: newelementwizardcontext.h:121
void createLibraryElement()
Definition: newelementwizardcontext.cpp:100
The NewElementWizardContext class.
Definition: newelementwizardcontext.h:63
const IF_GraphicsLayerProvider & getLayerProvider() const noexcept
Definition: newelementwizardcontext.h:107
tl::optional< Uuid > mDevicePackageUuid
Definition: newelementwizardcontext.h:156
FootprintList mPackageFootprints
Definition: newelementwizardcontext.h:144
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:250
PolygonList mSymbolPolygons
Definition: newelementwizardcontext.h:138
FilePath mOutputDirectory
Definition: newelementwizardcontext.h:124
DevicePadSignalMap mDevicePadSignalMap
Definition: newelementwizardcontext.h:157
QString mElementKeywords
Definition: newelementwizardcontext.h:131
TextList mSymbolTexts
Definition: newelementwizardcontext.h:140
tl::optional< Uuid > mElementCategoryUuid
Definition: newelementwizardcontext.h:134
QString mElementDescription
Definition: newelementwizardcontext.h:130
ElementType mElementType
Definition: newelementwizardcontext.h:128
const library::Library & mLibrary
Definition: newelementwizardcontext.h:122
ElementType
Definition: newelementwizardcontext.h:82
ComponentSymbolVariantList mComponentSymbolVariants
Definition: newelementwizardcontext.h:152
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:130
const QStringList & getLibLocaleOrder() const noexcept
Definition: newelementwizardcontext.cpp:59
PageId
Definition: newelementwizardcontext.h:69
QString mComponentDefaultValue
Definition: newelementwizardcontext.h:149
NormDependentPrefixMap mComponentPrefixes
Definition: newelementwizardcontext.h:150
bool mComponentSchematicOnly
Definition: newelementwizardcontext.h:147
SymbolPinList mSymbolPins
Definition: newelementwizardcontext.h:137
const FilePath & getOutputDirectory() const noexcept
Definition: newelementwizardcontext.h:101
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
QString mElementAuthor
Definition: newelementwizardcontext.h:132
ComponentSignalList mComponentSignals
Definition: newelementwizardcontext.h:151
PackagePadList mPackagePads
Definition: newelementwizardcontext.h:143
tl::optional< Version > mElementVersion
Definition: newelementwizardcontext.h:133
const workspace::Workspace & getWorkspace() const noexcept
Definition: newelementwizardcontext.h:104
last page
Definition: newelementwizardcontext.h:70
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition: elementname.h:92
void reset() noexcept
Definition: newelementwizardcontext.cpp:67