LibrePCB Developers Documentation
Loading...
Searching...
No Matches
componentgateeditor.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_COMPONENTGATEEDITOR_H
21#define LIBREPCB_EDITOR_COMPONENTGATEEDITOR_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 ComponentSymbolVariantItem;
37class Symbol;
38class Workspace;
39
40namespace editor {
41
42class ComponentPinoutListModel;
43class ComponentSignalNameListModel;
44class GraphicsLayerList;
45class GraphicsScene;
46class LibraryElementCache;
47class SymbolGraphicsItem;
48class UndoCommand;
49class UndoStack;
50
51/*******************************************************************************
52 * Class ComponentGateEditor
53 ******************************************************************************/
54
58class ComponentGateEditor final : public QObject {
59 Q_OBJECT
60
61public:
62 // Constructors / Destructor
65 explicit ComponentGateEditor(
66 const Workspace& ws, const GraphicsLayerList& layers,
67 const LibraryElementCache& cache, QPointer<const Component> component,
68 QPointer<GraphicsScene> componentScene,
69 const std::shared_ptr<ComponentSignalNameListModel>& sigs,
70 std::shared_ptr<ComponentSymbolVariantItem> gate, UndoStack* stack,
71 QObject* parent = nullptr) noexcept;
72 ~ComponentGateEditor() noexcept;
73
74 // General Methods
75 ui::ComponentGateData getUiData() const;
76 void setUiData(const ui::ComponentGateData& data) noexcept;
77 slint::Image renderScene(float width, float height) noexcept;
78 void chooseSymbol();
79 void refreshPreview() noexcept;
80
81 // Operator Overloadings
82 ComponentGateEditor& operator=(const ComponentGateEditor& rhs) = delete;
83
84signals:
86
87private:
88 void reloadSymbol() noexcept;
89 void execCmd(UndoCommand* cmd);
90
91private:
95 const QPointer<const Component> mComponent;
100 QCollator mCollator;
102
103 std::shared_ptr<const Symbol> mSymbol;
107 QMetaObject::Connection mCacheConnection;
108
110 std::shared_ptr<slint::SortModel<ui::ComponentPinoutData>> mPinoutSorted;
111};
112
113/*******************************************************************************
114 * End of File
115 ******************************************************************************/
116
117} // namespace editor
118} // namespace librepcb
119
120#endif
The Component class represents a "generic" device in the library.
Definition component.h:73
The ComponentSymbolVariantItem class represents one symbol of a component symbol variant.
Definition componentsymbolvariantitem.h:54
The Image class.
Definition image.h:49
The Symbol class represents the part of a component which is added to schematics.
Definition symbol.h:56
The Workspace class represents a workspace with all its data (library, projects, settings,...
Definition workspace.h:54
The ComponentGateEditor class.
Definition componentgateeditor.h:58
ComponentGateEditor(const ComponentGateEditor &other)=delete
void chooseSymbol()
Definition componentgateeditor.cpp:153
std::shared_ptr< slint::SortModel< ui::ComponentPinoutData > > mPinoutSorted
Definition componentgateeditor.h:110
slint::Image renderScene(float width, float height) noexcept
Definition componentgateeditor.cpp:141
int mFrameIndex
Definition componentgateeditor.h:101
void setUiData(const ui::ComponentGateData &data) noexcept
Definition componentgateeditor.cpp:120
void execCmd(UndoCommand *cmd)
Definition componentgateeditor.cpp:257
std::shared_ptr< ComponentSymbolVariantItem > mGate
Definition componentgateeditor.h:98
void refreshPreview() noexcept
Definition componentgateeditor.cpp:186
const GraphicsLayerList & mLayers
Definition componentgateeditor.h:93
std::unique_ptr< SymbolGraphicsItem > mComponentGraphicsItem
Definition componentgateeditor.h:106
std::unique_ptr< SymbolGraphicsItem > mGraphicsItem
Definition componentgateeditor.h:105
QMetaObject::Connection mCacheConnection
Definition componentgateeditor.h:107
const Workspace & mWorkspace
Definition componentgateeditor.h:92
const QPointer< const Component > mComponent
Definition componentgateeditor.h:95
const LibraryElementCache & mCache
Definition componentgateeditor.h:94
QPointer< GraphicsScene > mComponentScene
Definition componentgateeditor.h:96
std::unique_ptr< GraphicsScene > mScene
Definition componentgateeditor.h:104
QCollator mCollator
Definition componentgateeditor.h:100
ui::ComponentGateData getUiData() const
Definition componentgateeditor.cpp:102
std::shared_ptr< const Symbol > mSymbol
Definition componentgateeditor.h:103
UndoStack * mUndoStack
Definition componentgateeditor.h:99
std::shared_ptr< ComponentSignalNameListModel > mSignals
Definition componentgateeditor.h:97
std::shared_ptr< ComponentPinoutListModel > mPinout
Definition componentgateeditor.h:109
void reloadSymbol() noexcept
Definition componentgateeditor.cpp:205
The ComponentPinoutListModel class.
Definition componentpinoutlistmodel.h:52
The ComponentSignalNameListModel class.
Definition componentsignalnamelistmodel.h:50
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 SymbolGraphicsItem class.
Definition symbolgraphicsitem.h:55
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