LibrePCB Developers Documentation
Loading...
Searching...
No Matches
componentvarianteditor.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_COMPONENTVARIANTEDITOR_H
21#define LIBREPCB_EDITOR_COMPONENTVARIANTEDITOR_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "appwindow.h"
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34
35class Component;
36class ComponentSymbolVariant;
37class Workspace;
38
39namespace editor {
40
41class ComponentGateListModel;
42class ComponentSignalNameListModel;
43class GraphicsLayerList;
44class GraphicsScene;
45class LibraryElementCache;
46class UndoCommand;
47class UndoStack;
48
49/*******************************************************************************
50 * Class ComponentVariantEditor
51 ******************************************************************************/
52
56class ComponentVariantEditor final : public QObject {
57 Q_OBJECT
58
59public:
60 // Constructors / Destructor
64 const Workspace& ws, const GraphicsLayerList& layers,
65 const LibraryElementCache& cache, QPointer<Component> component,
66 const std::shared_ptr<ComponentSignalNameListModel>& sigs,
67 std::shared_ptr<ComponentSymbolVariant> variant, UndoStack* stack,
68 const bool* wizardMode, QObject* parent = nullptr) noexcept;
69 ~ComponentVariantEditor() noexcept;
70
71 // General Methods
72 ui::ComponentVariantData getUiData() const;
73 void setUiData(const ui::ComponentVariantData& data) noexcept;
74 slint::Image renderScene(int gate, float width, float height) noexcept;
75 void addGate();
76 void autoConnectPins();
77 void updateUnassignedSignals() noexcept;
78
79 // Operator Overloadings
80 ComponentVariantEditor& operator=(const ComponentVariantEditor& rhs) = delete;
81
82signals:
84
85private:
86 void execCmd(UndoCommand* cmd);
87 static QString appendNumberToSignalName(QString name, int number) noexcept;
88
89private:
93 const QPointer<Component> mComponent;
96 const bool* mWizardMode;
97
98 std::unique_ptr<GraphicsScene> mScene;
100
103};
104
105/*******************************************************************************
106 * End of File
107 ******************************************************************************/
108
109} // namespace editor
110} // namespace librepcb
111
112#endif
The Component class represents a "generic" device in the library.
Definition component.h:73
The ComponentSymbolVariant class represents a symbol variant of a component.
Definition componentsymbolvariant.h:53
The Image class.
Definition image.h:49
The Workspace class represents a workspace with all its data (library, projects, settings,...
Definition workspace.h:54
The ComponentGateListModel class.
Definition componentgatelistmodel.h:60
The ComponentVariantEditor class.
Definition componentvarianteditor.h:56
void updateUnassignedSignals() noexcept
Definition componentvarianteditor.cpp:210
int mFrameIndex
Definition componentvarianteditor.h:99
const QPointer< Component > mComponent
Definition componentvarianteditor.h:93
void execCmd(UndoCommand *cmd)
Definition componentvarianteditor.cpp:234
static QString appendNumberToSignalName(QString name, int number) noexcept
Definition componentvarianteditor.cpp:243
const GraphicsLayerList & mLayers
Definition componentvarianteditor.h:91
slint::Image renderScene(int gate, float width, float height) noexcept
Definition componentvarianteditor.cpp:157
void addGate()
Definition componentvarianteditor.cpp:169
ComponentVariantEditor(const ComponentVariantEditor &other)=delete
const Workspace & mWorkspace
Definition componentvarianteditor.h:90
const LibraryElementCache & mCache
Definition componentvarianteditor.h:92
void setUiData(const ui::ComponentVariantData &data) noexcept
Definition componentvarianteditor.cpp:122
ui::ComponentVariantData getUiData() const
Definition componentvarianteditor.cpp:109
std::shared_ptr< ComponentSymbolVariant > mVariant
Definition componentvarianteditor.h:94
std::unique_ptr< GraphicsScene > mScene
Definition componentvarianteditor.h:98
const bool * mWizardMode
Definition componentvarianteditor.h:96
QPointer< UndoStack > mUndoStack
Definition componentvarianteditor.h:95
void autoConnectPins()
Definition componentvarianteditor.cpp:173
std::shared_ptr< ComponentGateListModel > mGates
Definition componentvarianteditor.h:101
bool mHasUnassignedSignals
Definition componentvarianteditor.h:102
The GraphicsLayerList class.
Definition graphicslayerlist.h:48
The GraphicsScene class.
Definition graphicsscene.h:64
Cache for fast access to library elements.
Definition libraryelementcache.h:56
The UndoCommand class represents a command which you can undo/redo.
Definition undocommand.h:46
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition undostack.h:106
Definition occmodel.cpp:77
Definition uuid.h:186