LibrePCB Developers Documentation
PartInformationProvider Class Referencefinal

Parts information provider & cache. More...

#include <partinformationprovider.h>

Inherits QObject.

+ Collaboration diagram for PartInformationProvider:

Classes

struct  Part
 
struct  PartInformation
 
struct  PartResource
 

Signals

void serviceOperational ()
 
void providerInfoChanged ()
 
void newPartsInformationAvailable ()
 

Public Member Functions

 PartInformationProvider (const PartInformationProvider &other) noexcept=delete
 
 PartInformationProvider (QObject *parent=nullptr) noexcept
 
 ~PartInformationProvider () noexcept
 
bool isOperational () const noexcept
 
const QString & getProviderName () const noexcept
 
const QUrl & getProviderUrl () const noexcept
 
const QUrl & getProviderLogoUrl () const noexcept
 
const QPixmap getProviderLogo () const noexcept
 
const QUrl & getInfoUrl () const noexcept
 
void setCacheDir (const FilePath &dir) noexcept
 
void setApiEndpoint (const QUrl &url) noexcept
 
void startOperation () noexcept
 
std::shared_ptr< PartInformationgetPartInfo (const Part &part) noexcept
 
bool isOngoing (const Part &part) const noexcept
 
void scheduleRequest (const Part &part) noexcept
 
void requestScheduledParts () noexcept
 
PartInformationProvideroperator= (const PartInformationProvider &rhs) noexcept=delete
 

Static Public Member Functions

static PartInformationProviderinstance () noexcept
 

Private Member Functions

void reset () noexcept
 
void requestStatus () noexcept
 
void statusReceived (const QJsonObject &json) noexcept
 
void errorWhileFetchingStatus (const QString &errorMsg) noexcept
 
void partsInformationReceived (const QJsonObject &json) noexcept
 
void errorWhileFetchingPartsInformation (const QString &errorMsg) noexcept
 
void removeOutdatedInformation () noexcept
 
void loadCacheFromDisk () noexcept
 
void saveCacheToDisk () noexcept
 

Private Attributes

FilePath mCacheFp
 
QScopedPointer< ApiEndpointmEndpoint
 
int mErrorCounter
 
bool mDisabledDueToErrors
 
qint64 mStatusRequestedTimestamp
 
bool mStatusReceived
 
QString mProviderName
 Valid only if mStatusReceived is true More...
 
QUrl mProviderUrl
 Valid only if mStatusReceived is true More...
 
QUrl mProviderLogoUrl
 Valid only if mStatusReceived is true More...
 
QPixmap mProviderLogo
 Requested asynchronously. More...
 
QUrl mInfoUrl
 Valid only if mStatusReceived is true More...
 
QUrl mQueryUrl
 Valid only if mStatusReceived is true More...
 
int mQueryMaxPartCount
 Valid only if mStatusReceived is true More...
 
QVector< PartmScheduledParts
 
QSet< PartmRequestedParts
 
QMap< Part, std::shared_ptr< PartInformation > > mCache
 
bool mCacheModified
 

Detailed Description

Parts information provider & cache.

To avoid duplicate API requests, received information is cached in the global instance instance().

Constructor & Destructor Documentation

◆ PartInformationProvider() [1/2]

PartInformationProvider ( const PartInformationProvider other)
deletenoexcept

◆ PartInformationProvider() [2/2]

PartInformationProvider ( QObject *  parent = nullptr)
explicitnoexcept
+ Here is the call graph for this function:

◆ ~PartInformationProvider()

~PartInformationProvider ( )
noexcept

Member Function Documentation

◆ isOperational()

bool isOperational ( ) const
noexcept
+ Here is the caller graph for this function:

◆ getProviderName()

const QString & getProviderName ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getProviderUrl()

const QUrl & getProviderUrl ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getProviderLogoUrl()

const QUrl & getProviderLogoUrl ( ) const
inlinenoexcept

◆ getProviderLogo()

const QPixmap getProviderLogo ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getInfoUrl()

const QUrl & getInfoUrl ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ setCacheDir()

void setCacheDir ( const FilePath dir)
noexcept
+ Here is the call graph for this function:

◆ setApiEndpoint()

void setApiEndpoint ( const QUrl &  url)
noexcept
+ Here is the call graph for this function:

◆ startOperation()

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

◆ getPartInfo()

std::shared_ptr< PartInformationProvider::PartInformation > getPartInfo ( const Part part)
noexcept

◆ isOngoing()

bool isOngoing ( const Part part) const
noexcept

◆ scheduleRequest()

void scheduleRequest ( const Part part)
noexcept
+ Here is the call graph for this function:

◆ requestScheduledParts()

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

◆ instance()

static PartInformationProvider & instance ( )
inlinestaticnoexcept
+ Here is the caller graph for this function:

◆ operator=()

PartInformationProvider & operator= ( const PartInformationProvider rhs)
deletenoexcept

◆ serviceOperational

void serviceOperational ( )
signal
+ Here is the caller graph for this function:

◆ providerInfoChanged

void providerInfoChanged ( )
signal
+ Here is the caller graph for this function:

◆ newPartsInformationAvailable

void newPartsInformationAvailable ( )
signal
+ Here is the caller graph for this function:

◆ reset()

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

◆ requestStatus()

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

◆ statusReceived()

void statusReceived ( const QJsonObject &  json)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ errorWhileFetchingStatus()

void errorWhileFetchingStatus ( const QString &  errorMsg)
privatenoexcept
+ Here is the caller graph for this function:

◆ partsInformationReceived()

void partsInformationReceived ( const QJsonObject &  json)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ errorWhileFetchingPartsInformation()

void errorWhileFetchingPartsInformation ( const QString &  errorMsg)
privatenoexcept
+ Here is the caller graph for this function:

◆ removeOutdatedInformation()

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

◆ loadCacheFromDisk()

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

◆ saveCacheToDisk()

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

Member Data Documentation

◆ mCacheFp

FilePath mCacheFp
private

◆ mEndpoint

QScopedPointer<ApiEndpoint> mEndpoint
private

◆ mErrorCounter

int mErrorCounter
private

◆ mDisabledDueToErrors

bool mDisabledDueToErrors
private

◆ mStatusRequestedTimestamp

qint64 mStatusRequestedTimestamp
private

◆ mStatusReceived

bool mStatusReceived
private

◆ mProviderName

QString mProviderName
private

Valid only if mStatusReceived is true

◆ mProviderUrl

QUrl mProviderUrl
private

Valid only if mStatusReceived is true

◆ mProviderLogoUrl

QUrl mProviderLogoUrl
private

Valid only if mStatusReceived is true

◆ mProviderLogo

QPixmap mProviderLogo
private

Requested asynchronously.

◆ mInfoUrl

QUrl mInfoUrl
private

Valid only if mStatusReceived is true

◆ mQueryUrl

QUrl mQueryUrl
private

Valid only if mStatusReceived is true

◆ mQueryMaxPartCount

int mQueryMaxPartCount
private

Valid only if mStatusReceived is true

◆ mScheduledParts

QVector<Part> mScheduledParts
private

◆ mRequestedParts

QSet<Part> mRequestedParts
private

◆ mCache

QMap<Part, std::shared_ptr<PartInformation> > mCache
private

◆ mCacheModified

bool mCacheModified
private

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