LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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
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 std::optional<Uuid>& deviceUuid,
113 Package* package,
114 bool packageOwned) noexcept;
115 void setSelectedFootprintUuid(const std::optional<Uuid>& uuid) noexcept;
116 void addSelectedDeviceToBoard() noexcept;
117 void addSimilarDevicesToBoard() noexcept;
118 void addAllDevicesToBoard() noexcept;
120 const std::optional<Uuid>& libCmpUuidFilter) noexcept;
121
130 std::pair<QList<DeviceMetadata>, int> getAvailableDevices(
131 ComponentInstance& cmp) const noexcept;
132 std::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:78
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:56
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
Package * mSelectedPackage
Definition unplacedcomponentsdock.h:151
void setSelectedComponentInstance(ComponentInstance *cmp) noexcept
Definition unplacedcomponentsdock.cpp:315
Point mNextPosition
Definition unplacedcomponentsdock.h:143
void setSelectedDeviceAndPackage(const std::optional< Uuid > &deviceUuid, Package *package, bool packageOwned) noexcept
Definition unplacedcomponentsdock.cpp:348
std::optional< Uuid > mSelectedDeviceUuid
Definition unplacedcomponentsdock.h:150
QScopedPointer< DefaultGraphicsLayerProvider > mGraphicsLayerProvider
Definition unplacedcomponentsdock.h:156
std::optional< Uuid > getSuggestedFootprint(const Uuid &libPkgUuid) const noexcept
Definition unplacedcomponentsdock.cpp:633
void setBoard(Board *board)
Definition unplacedcomponentsdock.cpp:169
int getUnplacedComponentsCount() const noexcept
Definition unplacedcomponentsdock.cpp:161
Board * mBoard
Definition unplacedcomponentsdock.h:138
ProjectEditor & mProjectEditor
Definition unplacedcomponentsdock.h:136
void addAllDevicesToBoard() noexcept
Definition unplacedcomponentsdock.cpp:443
ComponentInstance * mSelectedComponent
Definition unplacedcomponentsdock.h:149
void setSelectedFootprintUuid(const std::optional< Uuid > &uuid) noexcept
Definition unplacedcomponentsdock.cpp:391
void autoAddDevicesToBoard(const std::optional< Uuid > &libCmpUuidFilter) noexcept
Definition unplacedcomponentsdock.cpp:451
bool mSelectedPackageOwned
Definition unplacedcomponentsdock.h:152
std::optional< Uuid > mSelectedFootprintUuid
Definition unplacedcomponentsdock.h:153
void addSelectedDeviceToBoard() noexcept
Definition unplacedcomponentsdock.cpp:417
QHash< Uuid, Uuid > mLastFootprintOfPackage
Definition unplacedcomponentsdock.h:145
void currentFootprintIndexChanged(int index) noexcept
Definition unplacedcomponentsdock.cpp:305
Project & mProject
Definition unplacedcomponentsdock.h:137
QScopedPointer< GraphicsScene > mPreviewGraphicsScene
Definition unplacedcomponentsdock.h:157
void currentComponentListItemChanged(QListWidgetItem *current, QListWidgetItem *previous) noexcept
Definition unplacedcomponentsdock.cpp:253
std::pair< QList< DeviceMetadata >, int > getAvailableDevices(ComponentInstance &cmp) const noexcept
Get all available devices for a specific component instance.
Definition unplacedcomponentsdock.cpp:497
void currentDeviceIndexChanged(int index) noexcept
Definition unplacedcomponentsdock.cpp:267
void updateComponentsList() noexcept
Definition unplacedcomponentsdock.cpp:195
void addSimilarDevicesToBoard() noexcept
Definition unplacedcomponentsdock.cpp:430
QHash< Uuid, Uuid > mLastDeviceOfComponent
Definition unplacedcomponentsdock.h:144
void addDeviceTriggered(ComponentInstance &cmp, const Uuid &deviceUuid, Uuid footprintUuid)
QScopedPointer< FootprintGraphicsItem > mPreviewGraphicsItem
Definition unplacedcomponentsdock.h:158
QScopedPointer< Ui::UnplacedComponentsDock > mUi
Definition unplacedcomponentsdock.h:139
Definition occmodel.cpp:76
Definition uuid.h:186
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