LibrePCB Developers Documentation
unplacedcomponentsdock.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_UNPLACEDCOMPONENTSDOCK_H
21#define LIBREPCB_EDITOR_UNPLACEDCOMPONENTSDOCK_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
28
29#include <QtCore>
30#include <QtWidgets>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class Board;
38class ComponentInstance;
39class Device;
40class Footprint;
41class Package;
42class Project;
43
44namespace editor {
45
46class DefaultGraphicsLayerProvider;
47class FootprintGraphicsItem;
48class GraphicsScene;
49class ProjectEditor;
50
51namespace Ui {
52class UnplacedComponentsDock;
53}
54
55/*******************************************************************************
56 * Class SchematicPagesDock
57 ******************************************************************************/
58
62class UnplacedComponentsDock final : public QDockWidget {
63 Q_OBJECT
64
68
70 QString deviceName;
71
74
76 QString packageName;
77
81 };
82
83public:
84 // Constructors / Destructor
87 QWidget* parent = nullptr) noexcept;
89 ~UnplacedComponentsDock() noexcept;
90
91 // Getters
92 int getUnplacedComponentsCount() const noexcept;
93
94 // Setters
95 void setBoard(Board* board);
96
97 // Operator Overloadings
98 UnplacedComponentsDock& operator=(const UnplacedComponentsDock& rhs) = delete;
99
100signals:
102 void addDeviceTriggered(ComponentInstance& cmp, const Uuid& deviceUuid,
103 Uuid footprintUuid);
104
105private: // Methods
106 void updateComponentsList() noexcept;
107 void currentComponentListItemChanged(QListWidgetItem* current,
108 QListWidgetItem* previous) noexcept;
109 void currentDeviceIndexChanged(int index) noexcept;
110 void currentFootprintIndexChanged(int index) noexcept;
112 void setSelectedDeviceAndPackage(const tl::optional<Uuid>& deviceUuid,
113 Package* package,
114 bool packageOwned) noexcept;
115 void setSelectedFootprintUuid(const tl::optional<Uuid>& uuid) noexcept;
116 void addSelectedDeviceToBoard() noexcept;
117 void addSimilarDevicesToBoard() noexcept;
118 void addAllDevicesToBoard() noexcept;
120 const tl::optional<Uuid>& libCmpUuidFilter) noexcept;
121
130 std::pair<QList<DeviceMetadata>, int> getAvailableDevices(
131 ComponentInstance& cmp) const noexcept;
132 tl::optional<Uuid> getSuggestedFootprint(
133 const Uuid& libPkgUuid) const noexcept;
134
135private: // Data
139 QScopedPointer<Ui::UnplacedComponentsDock> mUi;
140
141 // State
147
148 // Current selection
154
155 // Preview graphics scene
159};
160
161/*******************************************************************************
162 * End of File
163 ******************************************************************************/
164
165} // namespace editor
166} // namespace librepcb
167
168#endif
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
The ComponentInstance class.
Definition: componentinstance.h:54
The Package class represents a package of a component (including footprint and 3D model)
Definition: package.h:59
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The Project class represents a whole (opened) project with all its content.
Definition: project.h:71
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The DefaultGraphicsLayerProvider class.
Definition: defaultgraphicslayerprovider.h:46
The FootprintGraphicsItem class.
Definition: footprintgraphicsitem.h:66
The GraphicsScene class.
Definition: graphicsscene.h:45
The ProjectEditor class.
Definition: projecteditor.h:66
The UnplacedComponentsDock class.
Definition: unplacedcomponentsdock.h:62
QList< DeviceMetadata > mCurrentDevices
Definition: unplacedcomponentsdock.h:146
bool mDisableListUpdate
Definition: unplacedcomponentsdock.h:142
tl::optional< Uuid > getSuggestedFootprint(const Uuid &libPkgUuid) const noexcept
Definition: unplacedcomponentsdock.cpp:634
tl::optional< Uuid > mSelectedFootprintUuid
Definition: unplacedcomponentsdock.h:153
Package * mSelectedPackage
Definition: unplacedcomponentsdock.h:151
void setSelectedComponentInstance(ComponentInstance *cmp) noexcept
Definition: unplacedcomponentsdock.cpp:316
Point mNextPosition
Definition: unplacedcomponentsdock.h:143
void setSelectedFootprintUuid(const tl::optional< Uuid > &uuid) noexcept
Definition: unplacedcomponentsdock.cpp:392
QScopedPointer< DefaultGraphicsLayerProvider > mGraphicsLayerProvider
Definition: unplacedcomponentsdock.h:156
void setBoard(Board *board)
Definition: unplacedcomponentsdock.cpp:170
int getUnplacedComponentsCount() const noexcept
Definition: unplacedcomponentsdock.cpp:162
Board * mBoard
Definition: unplacedcomponentsdock.h:138
ProjectEditor & mProjectEditor
Definition: unplacedcomponentsdock.h:136
void addAllDevicesToBoard() noexcept
Definition: unplacedcomponentsdock.cpp:444
ComponentInstance * mSelectedComponent
Definition: unplacedcomponentsdock.h:149
bool mSelectedPackageOwned
Definition: unplacedcomponentsdock.h:152
void addSelectedDeviceToBoard() noexcept
Definition: unplacedcomponentsdock.cpp:418
QHash< Uuid, Uuid > mLastFootprintOfPackage
Definition: unplacedcomponentsdock.h:145
void currentFootprintIndexChanged(int index) noexcept
Definition: unplacedcomponentsdock.cpp:306
Project & mProject
Definition: unplacedcomponentsdock.h:137
QScopedPointer< GraphicsScene > mPreviewGraphicsScene
Definition: unplacedcomponentsdock.h:157
void currentComponentListItemChanged(QListWidgetItem *current, QListWidgetItem *previous) noexcept
Definition: unplacedcomponentsdock.cpp:254
std::pair< QList< DeviceMetadata >, int > getAvailableDevices(ComponentInstance &cmp) const noexcept
Get all available devices for a specific component instance.
Definition: unplacedcomponentsdock.cpp:498
void autoAddDevicesToBoard(const tl::optional< Uuid > &libCmpUuidFilter) noexcept
Definition: unplacedcomponentsdock.cpp:452
void setSelectedDeviceAndPackage(const tl::optional< Uuid > &deviceUuid, Package *package, bool packageOwned) noexcept
Definition: unplacedcomponentsdock.cpp:349
void currentDeviceIndexChanged(int index) noexcept
Definition: unplacedcomponentsdock.cpp:268
void updateComponentsList() noexcept
Definition: unplacedcomponentsdock.cpp:196
void addSimilarDevicesToBoard() noexcept
Definition: unplacedcomponentsdock.cpp:431
QHash< Uuid, Uuid > mLastDeviceOfComponent
Definition: unplacedcomponentsdock.h:144
void addDeviceTriggered(ComponentInstance &cmp, const Uuid &deviceUuid, Uuid footprintUuid)
tl::optional< Uuid > mSelectedDeviceUuid
Definition: unplacedcomponentsdock.h:150
QScopedPointer< FootprintGraphicsItem > mPreviewGraphicsItem
Definition: unplacedcomponentsdock.h:158
QScopedPointer< Ui::UnplacedComponentsDock > mUi
Definition: unplacedcomponentsdock.h:139
Definition: occmodel.cpp:77
Definition: uuid.h:183
Definition: unplacedcomponentsdock.h:65
QString packageName
Package library element name.
Definition: unplacedcomponentsdock.h:76
Uuid packageUuid
Package library element UUID.
Definition: unplacedcomponentsdock.h:73
Uuid deviceUuid
Device library element UUID.
Definition: unplacedcomponentsdock.h:67
QString deviceName
Device library element name.
Definition: unplacedcomponentsdock.h:70
bool isListedInComponentInstance
Definition: unplacedcomponentsdock.h:80