20#ifndef LIBREPCB_EDITOR_ADDCOMPONENTDIALOG_H
21#define LIBREPCB_EDITOR_ADDCOMPONENTDIALOG_H
26#include "../workspace/categorytreemodel.h"
33#include <optional/tl/optional.hpp>
46class ComponentSymbolVariant;
50class WorkspaceLibraryDb;
51class WorkspaceSettings;
55class DefaultGraphicsLayerProvider;
56class FootprintGraphicsItem;
58class PartInformationProvider;
59class PartInformationToolTip;
60class SymbolGraphicsItem;
63class AddComponentDialog;
90 QHash<FilePath, SearchResultDevice>
devices;
104 const QStringList& localeOrder,
105 const QStringList& normOrder,
106 QWidget* parent =
nullptr);
144 const QString keyword,
145 const tl::optional<Uuid>& selectedDevice = tl::nullopt)
noexcept;
146 virtual bool eventFilter(QObject* obj, QEvent* e)
noexcept override;
149 virtual bool event(QEvent*
event)
noexcept override;
154 const QModelIndex& previous)
noexcept;
156 QTreeWidgetItem* previous)
noexcept;
158 int column)
noexcept;
166 const tl::optional<Uuid>& selectedDevice = tl::nullopt,
167 bool selectFirstDevice =
false);
168 SearchResult
search(
const QString& input);
172 std::shared_ptr<const ComponentSymbolVariant> symbVar);
175 void addPartItem(std::shared_ptr<Part> part, QTreeWidgetItem* parent);
178 virtual
void accept() noexcept override;
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 Device class represents an instance of a component (a "real" component)
Definition: device.h:55
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
The Package class represents a package of a component (including footprint and 3D model)
Definition: package.h:59
The Part class.
Definition: part.h:46
The Symbol class represents the part of a component which is added to schematics.
Definition: symbol.h:55
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The WorkspaceLibraryDb class.
Definition: workspacelibrarydb.h:58
Container for all workspace related settings.
Definition: workspacesettings.h:60
The AddComponentDialog class.
Definition: addcomponentdialog.h:73
void treeComponents_itemExpanded(QTreeWidgetItem *item) noexcept
Definition: addcomponentdialog.cpp:429
void treeComponents_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous) noexcept
Definition: addcomponentdialog.cpp:362
QScopedPointer< FootprintGraphicsItem > mPreviewFootprintGraphicsItem
Definition: addcomponentdialog.h:206
std::shared_ptr< const Device > getSelectedDevice() const noexcept
Definition: addcomponentdialog.h:117
QList< std::shared_ptr< SymbolGraphicsItem > > mPreviewSymbolGraphicsItems
Definition: addcomponentdialog.h:205
void updatePartsInformation(int downloadDelayMs=0) noexcept
Definition: addcomponentdialog.cpp:912
QScopedPointer< PartInformationToolTip > mPartToolTip
Definition: addcomponentdialog.h:190
uint mPartInfoProgress
Definition: addcomponentdialog.h:191
void setSelectedSymbVar(std::shared_ptr< const ComponentSymbolVariant > symbVar)
Definition: addcomponentdialog.cpp:818
void customComponentsContextMenuRequested(const QPoint &pos) noexcept
Definition: addcomponentdialog.cpp:450
std::shared_ptr< const Component > mSelectedComponent
Definition: addcomponentdialog.h:199
tl::optional< Package::AssemblyType > getSelectedPackageAssemblyType() const noexcept
Definition: addcomponentdialog.cpp:279
const WorkspaceLibraryDb & mDb
Definition: addcomponentdialog.h:181
std::shared_ptr< const ComponentSymbolVariant > getSelectedSymbolVariant() const noexcept
Definition: addcomponentdialog.h:113
QScopedPointer< Ui::AddComponentDialog > mUi
Definition: addcomponentdialog.h:185
QScopedPointer< GraphicsScene > mDevicePreviewScene
Definition: addcomponentdialog.h:187
QScopedPointer< DefaultGraphicsLayerProvider > mGraphicsLayerProvider
Definition: addcomponentdialog.h:188
bool getAutoOpenAgain() const noexcept
Check if dialog shall be opened again after the current component.
Definition: addcomponentdialog.cpp:286
std::shared_ptr< const Device > mSelectedDevice
Definition: addcomponentdialog.h:201
tl::optional< Uuid > mSelectedCategoryUuid
Definition: addcomponentdialog.h:198
void addPartItem(std::shared_ptr< Part > part, QTreeWidgetItem *parent)
Definition: addcomponentdialog.cpp:888
void treeCategories_currentItemChanged(const QModelIndex ¤t, const QModelIndex &previous) noexcept
Definition: addcomponentdialog.cpp:348
void cbxSymbVar_currentIndexChanged(int index) noexcept
Definition: addcomponentdialog.cpp:436
QScopedPointer< CategoryTreeModel > mCategoryTreeModel
Definition: addcomponentdialog.h:189
void setSelectedCategory(const tl::optional< Uuid > &categoryUuid)
Definition: addcomponentdialog.cpp:710
virtual bool event(QEvent *event) noexcept override
Definition: addcomponentdialog.cpp:318
qint64 mUpdatePartInformationDownloadStart
Definition: addcomponentdialog.h:193
void setSelectedDevice(std::shared_ptr< const Device > dev)
Definition: addcomponentdialog.cpp:848
QScopedPointer< QAction > mActionCopyMpn
Definition: addcomponentdialog.h:209
SearchResult search(const QString &input)
Definition: addcomponentdialog.cpp:590
void setNormOrder(const QStringList &order) noexcept
Definition: addcomponentdialog.h:140
const WorkspaceSettings & mSettings
Definition: addcomponentdialog.h:182
void treeComponents_itemDoubleClicked(QTreeWidgetItem *item, int column) noexcept
Definition: addcomponentdialog.cpp:415
std::shared_ptr< const Part > mSelectedPart
Definition: addcomponentdialog.h:203
void setSelectedPart(std::shared_ptr< const Part > part)
Definition: addcomponentdialog.cpp:882
void searchEditTextChanged(const QString &text) noexcept
Definition: addcomponentdialog.cpp:329
~AddComponentDialog() noexcept
Definition: addcomponentdialog.cpp:256
void schedulePartsInformationUpdate() noexcept
Definition: addcomponentdialog.cpp:908
QStringList mNormOrder
Definition: addcomponentdialog.h:184
void setSelectedComponent(std::shared_ptr< const Component > cmp)
Definition: addcomponentdialog.cpp:784
std::shared_ptr< const ComponentSymbolVariant > mSelectedSymbVar
Definition: addcomponentdialog.h:200
bool mUpdatePartInformationOnExpand
Definition: addcomponentdialog.h:194
void selectComponentByKeyword(const QString keyword, const tl::optional< Uuid > &selectedDevice=tl::nullopt) noexcept
Definition: addcomponentdialog.cpp:294
QString mCurrentSearchTerm
Definition: addcomponentdialog.h:195
AddComponentDialog(const WorkspaceLibraryDb &db, const WorkspaceSettings &settings, const QStringList &localeOrder, const QStringList &normOrder, QWidget *parent=nullptr)
Definition: addcomponentdialog.cpp:64
bool mUpdatePartInformationScheduled
Definition: addcomponentdialog.h:192
std::shared_ptr< const Component > getSelectedComponent() const noexcept
Definition: addcomponentdialog.h:110
QScopedPointer< GraphicsScene > mComponentPreviewScene
Definition: addcomponentdialog.h:186
std::shared_ptr< const Part > getSelectedPart() const noexcept
Definition: addcomponentdialog.h:120
QStringList mLocaleOrder
Definition: addcomponentdialog.h:183
std::unique_ptr< Package > mSelectedPackage
Definition: addcomponentdialog.h:202
void setLocaleOrder(const QStringList &order) noexcept
Definition: addcomponentdialog.cpp:269
QList< std::shared_ptr< Symbol > > mPreviewSymbols
Definition: addcomponentdialog.h:204
virtual bool eventFilter(QObject *obj, QEvent *e) noexcept override
Definition: addcomponentdialog.cpp:304
void searchComponents(const QString &input, const tl::optional< Uuid > &selectedDevice=tl::nullopt, bool selectFirstDevice=false)
Definition: addcomponentdialog.cpp:496
virtual void accept() noexcept override
Definition: addcomponentdialog.cpp:998
The CategoryTreeModel class.
Definition: categorytreemodel.h:48
The DefaultGraphicsLayerProvider class.
Definition: defaultgraphicslayerprovider.h:46
The GraphicsScene class.
Definition: graphicsscene.h:45
The SymbolGraphicsItem class.
Definition: symbolgraphicsitem.h:56
Definition: occmodel.cpp:77
Definition: addcomponentdialog.h:87
bool deprecated
Definition: addcomponentdialog.h:89
bool match
Definition: addcomponentdialog.h:91
QString name
Definition: addcomponentdialog.h:88
QHash< FilePath, SearchResultDevice > devices
Definition: addcomponentdialog.h:90
Definition: addcomponentdialog.h:77
bool deprecated
Definition: addcomponentdialog.h:80
bool match
Definition: addcomponentdialog.h:84
tl::optional< Uuid > uuid
Definition: addcomponentdialog.h:78
QString name
Definition: addcomponentdialog.h:79
PartList parts
Definition: addcomponentdialog.h:83
FilePath pkgFp
Definition: addcomponentdialog.h:81
QString pkgName
Definition: addcomponentdialog.h:82
Definition: addcomponentdialog.h:94
int partsCount
Definition: addcomponentdialog.h:97
QHash< FilePath, SearchResultComponent > components
Definition: addcomponentdialog.h:95
int deviceCount
Definition: addcomponentdialog.h:96