LibrePCB Developers Documentation
Loading...
Searching...
No Matches
LibraryTab Class Referencefinal

The LibraryTab class. More...

#include <librarytab.h>

+ Inheritance diagram for LibraryTab:
+ Collaboration diagram for LibraryTab:

Classes

struct  TreeItem
 

Signals

void componentCategoryEditorRequested (LibraryEditor &editor, const FilePath &fp, bool copyFrom)
 
void packageCategoryEditorRequested (LibraryEditor &editor, const FilePath &fp, bool copyFrom)
 
void symbolEditorRequested (LibraryEditor &editor, const FilePath &fp, bool copyFrom)
 
void packageEditorRequested (LibraryEditor &editor, const FilePath &fp, bool copyFrom)
 
void componentEditorRequested (LibraryEditor &editor, const FilePath &fp, bool copyFrom)
 
void deviceEditorRequested (LibraryEditor &editor, const FilePath &fp, bool copyFrom)
 
void organizationEditorRequested (LibraryEditor &editor, const FilePath &fp, bool copyFrom)
 
- Signals inherited from WindowTab
void panelPageRequested (ui::PanelPage p)
 
void closeRequested ()
 
void closeEnforced ()
 
void statusBarMessageChanged (const QString &message, int timeoutMs)
 
void cursorCoordinatesChanged (const Point &pos, const LengthUnit &unit)
 

Public Member Functions

 LibraryTab ()=delete
 
 LibraryTab (const LibraryTab &other)=delete
 
 LibraryTab (LibraryEditor &editor, bool wizardMode, QObject *parent=nullptr) noexcept
 
 ~LibraryTab () noexcept
 
FilePath getDirectoryPath () const noexcept override
 
ui::TabData getUiData () const noexcept override
 
void setUiData (const ui::TabData &data) noexcept override
 
ui::LibraryTabData getDerivedUiData () const noexcept
 
void setDerivedUiData (const ui::LibraryTabData &data) noexcept
 
void trigger (ui::TabAction a) noexcept override
 
LibraryTaboperator= (const LibraryTab &rhs)=delete
 
template<>
bool autoFix (const MsgNameNotTitleCase &msg)
 
template<>
bool autoFix (const MsgMissingAuthor &msg)
 
- Public Member Functions inherited from LibraryEditorTab
 LibraryEditorTab ()=delete
 
 LibraryEditorTab (const LibraryEditorTab &other)=delete
 
 LibraryEditorTab (LibraryEditor &editor, QObject *parent=nullptr) noexcept
 
virtual ~LibraryEditorTab () noexcept
 
LibraryEditorTaboperator= (const LibraryEditorTab &rhs)=delete
 
- Public Member Functions inherited from WindowTab
 WindowTab ()=delete
 
 WindowTab (const WindowTab &other)=delete
 
 WindowTab (GuiApplication &app, QObject *parent=nullptr) noexcept
 
virtual ~WindowTab () noexcept
 
virtual void setWindow (MainWindow *w) noexcept
 
virtual void activate () noexcept
 
virtual void deactivate () noexcept
 
virtual slint::Image renderScene (float width, float height, int scene) noexcept
 
virtual bool processScenePointerEvent (const QPointF &pos, slint::private_api::PointerEvent e) noexcept
 
virtual bool processSceneScrolled (const QPointF &pos, slint::private_api::PointerScrollEvent e) noexcept
 
virtual bool processSceneKeyEvent (const slint::private_api::KeyEvent &e) noexcept
 
virtual bool requestClose () noexcept
 Request to close the tab.
 
WindowTaboperator= (const WindowTab &rhs)=delete
 

Public Attributes

Signal< LibraryTabonDerivedUiDataChanged
 
- Public Attributes inherited from WindowTab
Signal< WindowTabonUiDataChanged
 

Protected Member Functions

std::optional< std::pair< RuleCheckMessageList, QSet< SExpression > > > runChecksImpl () override
 
bool autoFixImpl (const std::shared_ptr< const RuleCheckMessage > &msg, bool checkOnly) override
 
template<typename MessageType >
bool autoFixHelper (const std::shared_ptr< const RuleCheckMessage > &msg, bool checkOnly)
 
template<typename MessageType >
bool autoFix (const MessageType &msg)
 
void messageApprovalChanged (const SExpression &approval, bool approved) noexcept override
 
void notifyDerivedUiDataChanged () noexcept override
 
- Protected Member Functions inherited from LibraryEditorTab
bool isPathOutsideLibDir () const noexcept
 
bool hasUnsavedChanges () const noexcept
 
void setWatchedFiles (const TransactionalDirectory &dir, const QSet< QString > &filenames) noexcept
 
virtual void watchedFilesModifiedChanged () noexcept
 
virtual void reloadFromDisk ()
 
void scheduleChecks () noexcept
 
void runChecks () noexcept
 
QString getWorkspaceSettingsUserName () const noexcept
 
- Protected Member Functions inherited from WindowTab
QWidget * getWindow () const noexcept
 

Private Member Functions

void refreshUiData () noexcept
 
void commitUiData () noexcept
 
void refreshLibElements () noexcept
 
std::shared_ptr< TreeItemcreateRootItem (ui::LibraryTreeViewItemType type) noexcept
 
template<typename CategoryType >
void loadCategories (ui::LibraryTreeViewItemType type, TreeItem &root)
 
template<typename CategoryType >
std::shared_ptr< TreeItemgetOrCreateCategory (ui::LibraryTreeViewItemType type, const Uuid &uuid, TreeItem &root)
 
template<typename ElementType , typename CategoryType >
void loadElements (ui::LibraryTreeViewItemType type, ui::LibraryTreeViewItemType catType, TreeItem &root, int &count)
 
void loadOrganizations ()
 
void sortItemsRecursive (QVector< std::shared_ptr< TreeItem > > &items) noexcept
 
void addCategoriesToModel (ui::LibraryTreeViewItemType type, TreeItem &root, int count) noexcept
 
void addCategoriesToModel (TreeItem &item, ui::LibraryTreeViewItemType type, slint::VectorModel< ui::LibraryTreeViewItemData > &model, int level) noexcept
 
void setSelectedCategory (const std::optional< ui::LibraryTreeViewItemData > &data) noexcept
 
void getChildsRecursive (TreeItem &item, QSet< std::shared_ptr< TreeItem > > &childs) noexcept
 
QList< std::shared_ptr< TreeItem > > getSelectedCategories () const noexcept
 
QList< std::shared_ptr< TreeItem > > getSelectedElements () const noexcept
 
void duplicateElements (const QList< std::shared_ptr< TreeItem > > &items) noexcept
 
void moveOrCopyElementsTo (const QList< std::shared_ptr< TreeItem > > &items, const FilePath &dstLib, bool move) noexcept
 
void deleteElements (const QList< std::shared_ptr< TreeItem > > &items) noexcept
 

Private Attributes

LibrarymLibrary
 
const WorkspaceLibraryDbmDb
 
const QStringList & mLocaleOrder
 
bool mWizardMode
 
int mCurrentPageIndex
 
int mCurrentCategoryIndex
 
int mCurrentElementIndex
 
std::shared_ptr< slint::VectorModel< float > > mViewsScrollPositions
 
QString mFilterTerm
 
QByteArray mIcon
 
slint::SharedString mName
 
slint::SharedString mNameError
 
ElementName mNameParsed
 
slint::SharedString mDescription
 
slint::SharedString mKeywords
 
slint::SharedString mAuthor
 
slint::SharedString mVersion
 
slint::SharedString mVersionError
 
Version mVersionParsed
 
bool mDeprecated
 
slint::SharedString mUrl
 
slint::SharedString mUrlError
 
std::shared_ptr< LibraryDependenciesModelmDependencies
 
slint::SharedString mManufacturer
 
QHash< FilePath, UuidmLibCategories
 
std::shared_ptr< TreeItemmUncategorizedRoot
 
std::shared_ptr< TreeItemmCmpCatRoot
 
int mCmpCatElementCount
 
std::shared_ptr< TreeItemmPkgCatRoot
 
int mPkgCatElementCount
 
std::shared_ptr< TreeItemmOrganizationsRoot
 
int mOrganizationsElementCount
 
QHash< QString, std::shared_ptr< TreeItem > > mLibElementsMap
 
std::shared_ptr< slint::VectorModel< ui::LibraryTreeViewItemData > > mCategories
 
std::shared_ptr< slint::VectorModel< ui::LibraryTreeViewItemData > > mElements
 
std::shared_ptr< slint::FilterModel< ui::LibraryTreeViewItemData > > mFilteredElements
 
slint::SharedString mMoveOrCopyToLibraryPath
 

Additional Inherited Members

- Protected Attributes inherited from LibraryEditorTab
LibraryEditormEditor
 
std::unique_ptr< UndoStackmUndoStack
 
bool mManualModificationsMade
 
QSet< SExpressionmSupportedApprovals
 
QSet< SExpressionmDisappearedApprovals
 
std::shared_ptr< RuleCheckMessagesModelmCheckMessages
 
slint::SharedString mCheckError
 
QTimer mRuleCheckDelayTimer
 
QFileSystemWatcher mFileSystemWatcher
 
QHash< FilePath, QByteArray > mWatchedFileHashes
 To detect modifications.
 
QSet< FilePathmModifiedWatchedFiles
 Modified, but not reloaded yet.
 
bool mAutoReloadOnFileModifications
 Set by derived classes.
 
QTimer mWatchedFilesTimer
 To delay/aggregate the notification & reload.
 
- Protected Attributes inherited from WindowTab
GuiApplicationmApp
 
MainWindowmWindow
 

Detailed Description

The LibraryTab class.

Constructor & Destructor Documentation

◆ LibraryTab() [1/3]

LibraryTab ( )
delete

◆ LibraryTab() [2/3]

LibraryTab ( const LibraryTab other)
delete

◆ LibraryTab() [3/3]

LibraryTab ( LibraryEditor editor,
bool  wizardMode,
QObject *  parent = nullptr 
)
explicitnoexcept

◆ ~LibraryTab()

~LibraryTab ( )
noexcept
+ Here is the call graph for this function:

Member Function Documentation

◆ getDirectoryPath()

FilePath getDirectoryPath ( ) const
overridevirtualnoexcept

Implements LibraryEditorTab.

+ Here is the call graph for this function:

◆ getUiData()

ui::TabData getUiData ( ) const
overridevirtualnoexcept

Implements WindowTab.

+ Here is the call graph for this function:

◆ setUiData()

void setUiData ( const ui::TabData &  data)
overridevirtualnoexcept

Reimplemented from WindowTab.

+ Here is the call graph for this function:

◆ getDerivedUiData()

ui::LibraryTabData getDerivedUiData ( ) const
noexcept
+ Here is the call graph for this function:

◆ setDerivedUiData()

void setDerivedUiData ( const ui::LibraryTabData &  data)
noexcept
+ Here is the call graph for this function:

◆ trigger()

void trigger ( ui::TabAction  a)
overridevirtualnoexcept

Reimplemented from WindowTab.

+ Here is the call graph for this function:

◆ operator=()

LibraryTab & operator= ( const LibraryTab rhs)
delete

◆ componentCategoryEditorRequested

void componentCategoryEditorRequested ( LibraryEditor editor,
const FilePath fp,
bool  copyFrom 
)
signal
+ Here is the caller graph for this function:

◆ packageCategoryEditorRequested

void packageCategoryEditorRequested ( LibraryEditor editor,
const FilePath fp,
bool  copyFrom 
)
signal
+ Here is the caller graph for this function:

◆ symbolEditorRequested

void symbolEditorRequested ( LibraryEditor editor,
const FilePath fp,
bool  copyFrom 
)
signal
+ Here is the caller graph for this function:

◆ packageEditorRequested

void packageEditorRequested ( LibraryEditor editor,
const FilePath fp,
bool  copyFrom 
)
signal
+ Here is the caller graph for this function:

◆ componentEditorRequested

void componentEditorRequested ( LibraryEditor editor,
const FilePath fp,
bool  copyFrom 
)
signal
+ Here is the caller graph for this function:

◆ deviceEditorRequested

void deviceEditorRequested ( LibraryEditor editor,
const FilePath fp,
bool  copyFrom 
)
signal
+ Here is the caller graph for this function:

◆ organizationEditorRequested

void organizationEditorRequested ( LibraryEditor editor,
const FilePath fp,
bool  copyFrom 
)
signal
+ Here is the caller graph for this function:

◆ runChecksImpl()

std::optional< std::pair< RuleCheckMessageList, QSet< SExpression > > > runChecksImpl ( )
overrideprotectedvirtual

Implements LibraryEditorTab.

+ Here is the call graph for this function:

◆ autoFixImpl()

bool autoFixImpl ( const std::shared_ptr< const RuleCheckMessage > &  msg,
bool  checkOnly 
)
overrideprotectedvirtual

Implements LibraryEditorTab.

◆ autoFixHelper()

template<typename MessageType >
bool autoFixHelper ( const std::shared_ptr< const RuleCheckMessage > &  msg,
bool  checkOnly 
)
protected
+ Here is the call graph for this function:

◆ autoFix() [1/3]

template<typename MessageType >
bool autoFix ( const MessageType &  msg)
protected
+ Here is the caller graph for this function:

◆ messageApprovalChanged()

void messageApprovalChanged ( const SExpression approval,
bool  approved 
)
overrideprotectedvirtualnoexcept

Implements LibraryEditorTab.

◆ notifyDerivedUiDataChanged()

void notifyDerivedUiDataChanged ( )
overrideprotectedvirtualnoexcept

Implements LibraryEditorTab.

◆ refreshUiData()

void refreshUiData ( )
privatenoexcept
+ Here is the call graph for this function:

◆ commitUiData()

void commitUiData ( )
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ refreshLibElements()

void refreshLibElements ( )
privatenoexcept
+ Here is the call graph for this function:

◆ createRootItem()

std::shared_ptr< LibraryTab::TreeItem > createRootItem ( ui::LibraryTreeViewItemType  type)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadCategories()

template<typename CategoryType >
void loadCategories ( ui::LibraryTreeViewItemType  type,
TreeItem root 
)
private
+ Here is the call graph for this function:

◆ getOrCreateCategory()

template<typename CategoryType >
std::shared_ptr< LibraryTab::TreeItem > getOrCreateCategory ( ui::LibraryTreeViewItemType  type,
const Uuid uuid,
TreeItem root 
)
private
+ Here is the call graph for this function:

◆ loadElements()

template<typename ElementType , typename CategoryType >
void loadElements ( ui::LibraryTreeViewItemType  type,
ui::LibraryTreeViewItemType  catType,
TreeItem root,
int &  count 
)
private
+ Here is the call graph for this function:

◆ loadOrganizations()

void loadOrganizations ( )
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sortItemsRecursive()

void sortItemsRecursive ( QVector< std::shared_ptr< TreeItem > > &  items)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCategoriesToModel() [1/2]

void addCategoriesToModel ( ui::LibraryTreeViewItemType  type,
TreeItem root,
int  count 
)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCategoriesToModel() [2/2]

void addCategoriesToModel ( TreeItem item,
ui::LibraryTreeViewItemType  type,
slint::VectorModel< ui::LibraryTreeViewItemData > &  model,
int  level 
)
privatenoexcept
+ Here is the call graph for this function:

◆ setSelectedCategory()

void setSelectedCategory ( const std::optional< ui::LibraryTreeViewItemData > &  data)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getChildsRecursive()

void getChildsRecursive ( TreeItem item,
QSet< std::shared_ptr< TreeItem > > &  childs 
)
privatenoexcept
+ Here is the call graph for this function:

◆ getSelectedCategories()

QList< std::shared_ptr< LibraryTab::TreeItem > > getSelectedCategories ( ) const
privatenoexcept
+ Here is the call graph for this function:

◆ getSelectedElements()

QList< std::shared_ptr< LibraryTab::TreeItem > > getSelectedElements ( ) const
privatenoexcept
+ Here is the call graph for this function:

◆ duplicateElements()

void duplicateElements ( const QList< std::shared_ptr< TreeItem > > &  items)
privatenoexcept

◆ moveOrCopyElementsTo()

void moveOrCopyElementsTo ( const QList< std::shared_ptr< TreeItem > > &  items,
const FilePath dstLib,
bool  move 
)
privatenoexcept
+ Here is the call graph for this function:

◆ deleteElements()

void deleteElements ( const QList< std::shared_ptr< TreeItem > > &  items)
privatenoexcept
+ Here is the call graph for this function:

◆ autoFix() [2/3]

template<>
bool autoFix ( const MsgNameNotTitleCase msg)
+ Here is the call graph for this function:

◆ autoFix() [3/3]

template<>
bool autoFix ( const MsgMissingAuthor msg)
+ Here is the call graph for this function:

Member Data Documentation

◆ onDerivedUiDataChanged

Signal<LibraryTab> onDerivedUiDataChanged

◆ mLibrary

Library& mLibrary
private

◆ mDb

const WorkspaceLibraryDb& mDb
private

◆ mLocaleOrder

const QStringList& mLocaleOrder
private

◆ mWizardMode

bool mWizardMode
private

◆ mCurrentPageIndex

int mCurrentPageIndex
private

◆ mCurrentCategoryIndex

int mCurrentCategoryIndex
private

◆ mCurrentElementIndex

int mCurrentElementIndex
private

◆ mViewsScrollPositions

std::shared_ptr<slint::VectorModel<float> > mViewsScrollPositions
private

◆ mFilterTerm

QString mFilterTerm
private

◆ mIcon

QByteArray mIcon
private

◆ mName

slint::SharedString mName
private

◆ mNameError

slint::SharedString mNameError
private

◆ mNameParsed

ElementName mNameParsed
private

◆ mDescription

slint::SharedString mDescription
private

◆ mKeywords

slint::SharedString mKeywords
private

◆ mAuthor

slint::SharedString mAuthor
private

◆ mVersion

slint::SharedString mVersion
private

◆ mVersionError

slint::SharedString mVersionError
private

◆ mVersionParsed

Version mVersionParsed
private

◆ mDeprecated

bool mDeprecated
private

◆ mUrl

slint::SharedString mUrl
private

◆ mUrlError

slint::SharedString mUrlError
private

◆ mDependencies

std::shared_ptr<LibraryDependenciesModel> mDependencies
private

◆ mManufacturer

slint::SharedString mManufacturer
private

◆ mLibCategories

QHash<FilePath, Uuid> mLibCategories
private

◆ mUncategorizedRoot

std::shared_ptr<TreeItem> mUncategorizedRoot
private

◆ mCmpCatRoot

std::shared_ptr<TreeItem> mCmpCatRoot
private

◆ mCmpCatElementCount

int mCmpCatElementCount
private

◆ mPkgCatRoot

std::shared_ptr<TreeItem> mPkgCatRoot
private

◆ mPkgCatElementCount

int mPkgCatElementCount
private

◆ mOrganizationsRoot

std::shared_ptr<TreeItem> mOrganizationsRoot
private

◆ mOrganizationsElementCount

int mOrganizationsElementCount
private

◆ mLibElementsMap

QHash<QString, std::shared_ptr<TreeItem> > mLibElementsMap
private

◆ mCategories

std::shared_ptr<slint::VectorModel<ui::LibraryTreeViewItemData> > mCategories
private

◆ mElements

std::shared_ptr<slint::VectorModel<ui::LibraryTreeViewItemData> > mElements
private

◆ mFilteredElements

std::shared_ptr<slint::FilterModel<ui::LibraryTreeViewItemData> > mFilteredElements
private

◆ mMoveOrCopyToLibraryPath

slint::SharedString mMoveOrCopyToLibraryPath
private

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