LibrePCB Developers Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LibrariesModel Class Reference

The LibrariesModel class. More...

#include <librariesmodel.h>

Inherits QObject, and Model< ui::LibraryData >.

+ Collaboration diagram for LibrariesModel:

Public Types

enum class  Mode
 

Signals

void uiDataChanged (ui::LibraryListData data)
 
void onlineVersionsAvailable (const QHash< Uuid, Version > &versions)
 

Public Member Functions

 LibrariesModel ()=delete
 
 LibrariesModel (const LibrariesModel &other)=delete
 
 LibrariesModel (Workspace &ws, Mode mode, QObject *parent=nullptr) noexcept
 
virtual ~LibrariesModel () noexcept
 
ui::LibraryListData getUiData () const noexcept
 
void setOnlineVersions (const QHash< Uuid, Version > &versions) noexcept
 
void ensurePopulated (bool withIcons) noexcept
 
void highlightLibraryOnNextRescan (const FilePath &fp) noexcept
 
void applyChanges () noexcept
 
void cancel () noexcept
 
std::size_t row_count () const override
 
std::optional< ui::LibraryData > row_data (std::size_t i) const override
 
void set_row_data (std::size_t i, const ui::LibraryData &data) noexcept override
 
LibrariesModeloperator= (const LibrariesModel &rhs)=delete
 

Private Member Functions

void updateLibraries (bool resetHighlight=true) noexcept
 
void requestOnlineLibraries () noexcept
 
void onlineLibraryListReceived (QList< ApiEndpoint::Library > libs) noexcept
 
void requestMissingOnlineIcons () noexcept
 
void onlineIconReceived (const Uuid &uuid, const QByteArray &data) noexcept
 
void errorWhileFetchingLibraryList (QString errorMsg) noexcept
 
void apiEndpointOperationFinished () noexcept
 
void updateMergedLibraries () noexcept
 
void updateCheckStates (bool notify) noexcept
 
void checkMissingDependenciesOfLibs () noexcept
 
void uncheckLibsWithUnmetDependencies () noexcept
 
bool isLibraryChecked (const ui::LibraryData &lib) const noexcept
 
std::optional< std::size_t > indexOf (const Uuid &uuid) noexcept
 

Static Private Member Functions

static bool isMarkedForInstall (const ui::LibraryData &lib) noexcept
 
static bool isMarkedForUpdate (const ui::LibraryData &lib) noexcept
 
static bool isMarkedForUninstall (const ui::LibraryData &lib) noexcept
 

Private Attributes

WorkspacemWorkspace
 
const Mode mMode
 
std::vector< ui::LibraryData > mInstalledLibs
 
QStringList mInstalledLibsErrors
 Either local or remote libs.
 
QHash< Uuid, ApiEndpoint::LibrarymOnlineLibs
 
QStringList mOnlineLibsErrors
 
std::vector< ui::LibraryData > mMergedLibs
 
QHash< Uuid, bool > mCheckStates
 
bool mRequestIcons
 
QHash< Uuid, QPixmap > mIcons
 
QHash< slint::SharedString, slint::SharedString > mOnlineVersions
 
std::optional< FilePathmHighlightedLib
 
QList< std::shared_ptr< ApiEndpoint > > mApiEndpointsInProgress
 
QList< std::shared_ptr< LibraryDownload > > mDownloadsInProgress
 

Detailed Description

The LibrariesModel class.

Member Enumeration Documentation

◆ Mode

enum class Mode
strong
Enumerator
LocalLibs 
RemoteLibs 

Constructor & Destructor Documentation

◆ LibrariesModel() [1/3]

LibrariesModel ( )
delete

◆ LibrariesModel() [2/3]

LibrariesModel ( const LibrariesModel other)
delete

◆ LibrariesModel() [3/3]

LibrariesModel ( Workspace ws,
Mode  mode,
QObject *  parent = nullptr 
)
explicitnoexcept
+ Here is the call graph for this function:

◆ ~LibrariesModel()

~LibrariesModel ( )
virtualnoexcept

Member Function Documentation

◆ getUiData()

ui::LibraryListData getUiData ( ) const
noexcept
+ Here is the call graph for this function:

◆ setOnlineVersions()

void setOnlineVersions ( const QHash< Uuid, Version > &  versions)
noexcept
+ Here is the call graph for this function:

◆ ensurePopulated()

void ensurePopulated ( bool  withIcons)
noexcept

◆ highlightLibraryOnNextRescan()

void highlightLibraryOnNextRescan ( const FilePath fp)
noexcept

◆ applyChanges()

void applyChanges ( )
noexcept
+ Here is the call graph for this function:

◆ cancel()

void cancel ( )
noexcept

◆ row_count()

std::size_t row_count ( ) const
override

◆ row_data()

std::optional< ui::LibraryData > row_data ( std::size_t  i) const
override

◆ set_row_data()

void set_row_data ( std::size_t  i,
const ui::LibraryData &  data 
)
overridenoexcept
+ Here is the call graph for this function:

◆ operator=()

LibrariesModel & operator= ( const LibrariesModel rhs)
delete

◆ uiDataChanged

void uiDataChanged ( ui::LibraryListData  data)
signal

◆ onlineVersionsAvailable

void onlineVersionsAvailable ( const QHash< Uuid, Version > &  versions)
signal

◆ updateLibraries()

void updateLibraries ( bool  resetHighlight = true)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ requestOnlineLibraries()

void requestOnlineLibraries ( )
privatenoexcept

◆ onlineLibraryListReceived()

void onlineLibraryListReceived ( QList< ApiEndpoint::Library libs)
privatenoexcept

◆ requestMissingOnlineIcons()

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

◆ onlineIconReceived()

void onlineIconReceived ( const Uuid uuid,
const QByteArray &  data 
)
privatenoexcept
+ Here is the call graph for this function:

◆ errorWhileFetchingLibraryList()

void errorWhileFetchingLibraryList ( QString  errorMsg)
privatenoexcept
+ Here is the call graph for this function:

◆ apiEndpointOperationFinished()

void apiEndpointOperationFinished ( )
privatenoexcept

◆ updateMergedLibraries()

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

◆ updateCheckStates()

void updateCheckStates ( bool  notify)
privatenoexcept

◆ checkMissingDependenciesOfLibs()

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

◆ uncheckLibsWithUnmetDependencies()

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

◆ isLibraryChecked()

bool isLibraryChecked ( const ui::LibraryData &  lib) const
privatenoexcept
+ Here is the call graph for this function:

◆ isMarkedForInstall()

bool isMarkedForInstall ( const ui::LibraryData &  lib)
staticprivatenoexcept
+ Here is the caller graph for this function:

◆ isMarkedForUpdate()

bool isMarkedForUpdate ( const ui::LibraryData &  lib)
staticprivatenoexcept
+ Here is the caller graph for this function:

◆ isMarkedForUninstall()

bool isMarkedForUninstall ( const ui::LibraryData &  lib)
staticprivatenoexcept
+ Here is the caller graph for this function:

◆ indexOf()

std::optional< std::size_t > indexOf ( const Uuid uuid)
privatenoexcept

Member Data Documentation

◆ mWorkspace

Workspace& mWorkspace
private

◆ mMode

const Mode mMode
private

◆ mInstalledLibs

std::vector<ui::LibraryData> mInstalledLibs
private

◆ mInstalledLibsErrors

QStringList mInstalledLibsErrors
private

Either local or remote libs.

◆ mOnlineLibs

QHash<Uuid, ApiEndpoint::Library> mOnlineLibs
private

◆ mOnlineLibsErrors

QStringList mOnlineLibsErrors
private

◆ mMergedLibs

std::vector<ui::LibraryData> mMergedLibs
private

◆ mCheckStates

QHash<Uuid, bool> mCheckStates
private

◆ mRequestIcons

bool mRequestIcons
private

◆ mIcons

QHash<Uuid, QPixmap> mIcons
private

◆ mOnlineVersions

QHash<slint::SharedString, slint::SharedString> mOnlineVersions
private

◆ mHighlightedLib

std::optional<FilePath> mHighlightedLib
private

◆ mApiEndpointsInProgress

QList<std::shared_ptr<ApiEndpoint> > mApiEndpointsInProgress
private

◆ mDownloadsInProgress

QList<std::shared_ptr<LibraryDownload> > mDownloadsInProgress
private

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