LibrePCB Developers Documentation
AddComponentDialog Class Referencefinal

The AddComponentDialog class. More...

#include <addcomponentdialog.h>

Inherits QDialog.

+ Collaboration diagram for AddComponentDialog:

Classes

struct  SearchResult
 
struct  SearchResultComponent
 
struct  SearchResultDevice
 

Public Member Functions

 AddComponentDialog (const WorkspaceLibraryDb &db, const WorkspaceSettings &settings, const QStringList &localeOrder, const QStringList &normOrder, QWidget *parent=nullptr)
 
 ~AddComponentDialog () noexcept
 
std::shared_ptr< const ComponentgetSelectedComponent () const noexcept
 
std::shared_ptr< const ComponentSymbolVariantgetSelectedSymbolVariant () const noexcept
 
std::shared_ptr< const DevicegetSelectedDevice () const noexcept
 
std::shared_ptr< const PartgetSelectedPart () const noexcept
 
tl::optional< Package::AssemblyTypegetSelectedPackageAssemblyType () const noexcept
 
bool getAutoOpenAgain () const noexcept
 Check if dialog shall be opened again after the current component. More...
 
void setLocaleOrder (const QStringList &order) noexcept
 
void setNormOrder (const QStringList &order) noexcept
 
void selectComponentByKeyword (const QString keyword, const tl::optional< Uuid > &selectedDevice=tl::nullopt) noexcept
 
virtual bool eventFilter (QObject *obj, QEvent *e) noexcept override
 

Protected Member Functions

virtual bool event (QEvent *event) noexcept override
 

Private Slots

void searchEditTextChanged (const QString &text) noexcept
 
void treeCategories_currentItemChanged (const QModelIndex &current, const QModelIndex &previous) noexcept
 
void treeComponents_currentItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *previous) noexcept
 
void treeComponents_itemDoubleClicked (QTreeWidgetItem *item, int column) noexcept
 
void treeComponents_itemExpanded (QTreeWidgetItem *item) noexcept
 
void cbxSymbVar_currentIndexChanged (int index) noexcept
 
void customComponentsContextMenuRequested (const QPoint &pos) noexcept
 

Private Member Functions

void searchComponents (const QString &input, const tl::optional< Uuid > &selectedDevice=tl::nullopt, bool selectFirstDevice=false)
 
SearchResult search (const QString &input)
 
void setSelectedCategory (const tl::optional< Uuid > &categoryUuid)
 
void setSelectedComponent (std::shared_ptr< const Component > cmp)
 
void setSelectedSymbVar (std::shared_ptr< const ComponentSymbolVariant > symbVar)
 
void setSelectedDevice (std::shared_ptr< const Device > dev)
 
void setSelectedPart (std::shared_ptr< const Part > part)
 
void addPartItem (std::shared_ptr< Part > part, QTreeWidgetItem *parent)
 
void schedulePartsInformationUpdate () noexcept
 
void updatePartsInformation (int downloadDelayMs=0) noexcept
 
virtual void accept () noexcept override
 

Private Attributes

const WorkspaceLibraryDbmDb
 
const WorkspaceSettingsmSettings
 
QStringList mLocaleOrder
 
QStringList mNormOrder
 
QScopedPointer< Ui::AddComponentDialog > mUi
 
QScopedPointer< GraphicsScenemComponentPreviewScene
 
QScopedPointer< GraphicsScenemDevicePreviewScene
 
QScopedPointer< DefaultGraphicsLayerProvidermGraphicsLayerProvider
 
QScopedPointer< CategoryTreeModelmCategoryTreeModel
 
QScopedPointer< PartInformationToolTipmPartToolTip
 
uint mPartInfoProgress
 
bool mUpdatePartInformationScheduled
 
qint64 mUpdatePartInformationDownloadStart
 
bool mUpdatePartInformationOnExpand
 
QString mCurrentSearchTerm
 
tl::optional< UuidmSelectedCategoryUuid
 
std::shared_ptr< const ComponentmSelectedComponent
 
std::shared_ptr< const ComponentSymbolVariantmSelectedSymbVar
 
std::shared_ptr< const DevicemSelectedDevice
 
std::unique_ptr< PackagemSelectedPackage
 
std::shared_ptr< const PartmSelectedPart
 
QList< std::shared_ptr< Symbol > > mPreviewSymbols
 
QList< std::shared_ptr< SymbolGraphicsItem > > mPreviewSymbolGraphicsItems
 
QScopedPointer< FootprintGraphicsItemmPreviewFootprintGraphicsItem
 
QScopedPointer< QAction > mActionCopyMpn
 

Detailed Description

The AddComponentDialog class.

Constructor & Destructor Documentation

◆ AddComponentDialog()

AddComponentDialog ( const WorkspaceLibraryDb db,
const WorkspaceSettings settings,
const QStringList &  localeOrder,
const QStringList &  normOrder,
QWidget *  parent = nullptr 
)
explicit
+ Here is the call graph for this function:

◆ ~AddComponentDialog()

~AddComponentDialog ( )
noexcept

Member Function Documentation

◆ getSelectedComponent()

std::shared_ptr< const Component > getSelectedComponent ( ) const
inlinenoexcept

◆ getSelectedSymbolVariant()

std::shared_ptr< const ComponentSymbolVariant > getSelectedSymbolVariant ( ) const
inlinenoexcept

◆ getSelectedDevice()

std::shared_ptr< const Device > getSelectedDevice ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getSelectedPart()

std::shared_ptr< const Part > getSelectedPart ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getSelectedPackageAssemblyType()

tl::optional< Package::AssemblyType > getSelectedPackageAssemblyType ( ) const
noexcept
+ Here is the caller graph for this function:

◆ getAutoOpenAgain()

bool getAutoOpenAgain ( ) const
noexcept

Check if dialog shall be opened again after the current component.

Returns the checked state of the "Add More" checkbox, i.e. whether the caller should open this dialog again after finishing placement of the component.

Return values
trueMust open this dialog again after placing the component.
falseShall not open this dialog again, exit placement tool.

◆ setLocaleOrder()

void setLocaleOrder ( const QStringList &  order)
noexcept

◆ setNormOrder()

void setNormOrder ( const QStringList &  order)
inlinenoexcept

◆ selectComponentByKeyword()

void selectComponentByKeyword ( const QString  keyword,
const tl::optional< Uuid > &  selectedDevice = tl::nullopt 
)
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eventFilter()

bool eventFilter ( QObject *  obj,
QEvent *  e 
)
overridevirtualnoexcept

◆ event()

bool event ( QEvent *  event)
overrideprotectedvirtualnoexcept

◆ searchEditTextChanged

void searchEditTextChanged ( const QString &  text)
privateslotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ treeCategories_currentItemChanged

void treeCategories_currentItemChanged ( const QModelIndex &  current,
const QModelIndex &  previous 
)
privateslotnoexcept
+ Here is the call graph for this function:

◆ treeComponents_currentItemChanged

void treeComponents_currentItemChanged ( QTreeWidgetItem *  current,
QTreeWidgetItem *  previous 
)
privateslotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ treeComponents_itemDoubleClicked

void treeComponents_itemDoubleClicked ( QTreeWidgetItem *  item,
int  column 
)
privateslotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ treeComponents_itemExpanded

void treeComponents_itemExpanded ( QTreeWidgetItem *  item)
privateslotnoexcept
+ Here is the caller graph for this function:

◆ cbxSymbVar_currentIndexChanged

void cbxSymbVar_currentIndexChanged ( int  index)
privateslotnoexcept
+ Here is the caller graph for this function:

◆ customComponentsContextMenuRequested

void customComponentsContextMenuRequested ( const QPoint &  pos)
privateslotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ searchComponents()

void searchComponents ( const QString &  input,
const tl::optional< Uuid > &  selectedDevice = tl::nullopt,
bool  selectFirstDevice = false 
)
private
+ Here is the call graph for this function:

◆ search()

AddComponentDialog::SearchResult search ( const QString &  input)
private
+ Here is the call graph for this function:

◆ setSelectedCategory()

void setSelectedCategory ( const tl::optional< Uuid > &  categoryUuid)
private
+ Here is the call graph for this function:

◆ setSelectedComponent()

void setSelectedComponent ( std::shared_ptr< const Component cmp)
private

◆ setSelectedSymbVar()

void setSelectedSymbVar ( std::shared_ptr< const ComponentSymbolVariant symbVar)
private
+ Here is the call graph for this function:

◆ setSelectedDevice()

void setSelectedDevice ( std::shared_ptr< const Device dev)
private
+ Here is the call graph for this function:

◆ setSelectedPart()

void setSelectedPart ( std::shared_ptr< const Part part)
private

◆ addPartItem()

void addPartItem ( std::shared_ptr< Part part,
QTreeWidgetItem *  parent 
)
private

◆ schedulePartsInformationUpdate()

void schedulePartsInformationUpdate ( )
privatenoexcept

◆ updatePartsInformation()

void updatePartsInformation ( int  downloadDelayMs = 0)
privatenoexcept

◆ accept()

void accept ( )
overrideprivatevirtualnoexcept

Member Data Documentation

◆ mDb

const WorkspaceLibraryDb& mDb
private

◆ mSettings

const WorkspaceSettings& mSettings
private

◆ mLocaleOrder

QStringList mLocaleOrder
private

◆ mNormOrder

QStringList mNormOrder
private

◆ mUi

QScopedPointer<Ui::AddComponentDialog> mUi
private

◆ mComponentPreviewScene

QScopedPointer<GraphicsScene> mComponentPreviewScene
private

◆ mDevicePreviewScene

QScopedPointer<GraphicsScene> mDevicePreviewScene
private

◆ mGraphicsLayerProvider

QScopedPointer<DefaultGraphicsLayerProvider> mGraphicsLayerProvider
private

◆ mCategoryTreeModel

QScopedPointer<CategoryTreeModel> mCategoryTreeModel
private

◆ mPartToolTip

QScopedPointer<PartInformationToolTip> mPartToolTip
private

◆ mPartInfoProgress

uint mPartInfoProgress
private

◆ mUpdatePartInformationScheduled

bool mUpdatePartInformationScheduled
private

◆ mUpdatePartInformationDownloadStart

qint64 mUpdatePartInformationDownloadStart
private

◆ mUpdatePartInformationOnExpand

bool mUpdatePartInformationOnExpand
private

◆ mCurrentSearchTerm

QString mCurrentSearchTerm
private

◆ mSelectedCategoryUuid

tl::optional<Uuid> mSelectedCategoryUuid
private

◆ mSelectedComponent

std::shared_ptr<const Component> mSelectedComponent
private

◆ mSelectedSymbVar

std::shared_ptr<const ComponentSymbolVariant> mSelectedSymbVar
private

◆ mSelectedDevice

std::shared_ptr<const Device> mSelectedDevice
private

◆ mSelectedPackage

std::unique_ptr<Package> mSelectedPackage
private

◆ mSelectedPart

std::shared_ptr<const Part> mSelectedPart
private

◆ mPreviewSymbols

QList<std::shared_ptr<Symbol> > mPreviewSymbols
private

◆ mPreviewSymbolGraphicsItems

QList<std::shared_ptr<SymbolGraphicsItem> > mPreviewSymbolGraphicsItems
private

◆ mPreviewFootprintGraphicsItem

QScopedPointer<FootprintGraphicsItem> mPreviewFootprintGraphicsItem
private

◆ mActionCopyMpn

QScopedPointer<QAction> mActionCopyMpn
private

The documentation for this class was generated from the following files: