LibrePCB Developers Documentation
OrderPcbApiRequest Class Referencefinal

Order a PCB via a LibrePCB API server. More...

#include <orderpcbapirequest.h>

Inherits QObject.

+ Collaboration diagram for OrderPcbApiRequest:

Signals

void infoRequestSucceeded (QUrl infoUrl, int maxFileSize) const
 Information request succeeded. More...
 
void infoRequestFailed (QString errorMsg) const
 Information request failed. More...
 
void uploadProgressState (QString state) const
 Upload progress state changed. More...
 
void uploadProgressPercent (int percent) const
 Upload progress in percent changed. More...
 
void uploadSucceeded (QUrl redirectUrl) const
 Upload succeeded. More...
 
void uploadFailed (QString errorMsg) const
 Information request failed. More...
 

Public Member Functions

 OrderPcbApiRequest ()=delete
 
 OrderPcbApiRequest (const OrderPcbApiRequest &other)=delete
 
 OrderPcbApiRequest (const QUrl &apiServerUrl, QObject *parent=nullptr) noexcept
 Constructor. More...
 
 ~OrderPcbApiRequest () noexcept
 Destructor. More...
 
bool isReadyForUpload () const noexcept
 Check if the information for upload was successfully received. More...
 
const QUrl & getReceivedInfoUrl () const noexcept
 Get received URL to service information. More...
 
const QUrl & getReceivedUploadUrl () const noexcept
 Get received URL where to upload the project. More...
 
int getReceivedMaxFileSize () const noexcept
 Get maximum allowed project file size to upload. More...
 
void startInfoRequest () noexcept
 Request the upload information from the API server. More...
 
void startUpload (const QByteArray &lppz, const QString &boardPath) const noexcept
 Upload the project. More...
 
OrderPcbApiRequestoperator= (const OrderPcbApiRequest &rhs)=delete
 

Private Member Functions

void infoRequestResponseReceived (const QByteArray &data) noexcept
 
void uploadResponseReceived (const QByteArray &data) const noexcept
 

Private Attributes

QUrl mApiServerUrl
 
QUrl mInfoUrl
 
QUrl mUploadUrl
 
int mMaxFileSize
 

Detailed Description

Order a PCB via a LibrePCB API server.

See details at Order PCB.

Constructor & Destructor Documentation

◆ OrderPcbApiRequest() [1/3]

OrderPcbApiRequest ( )
delete

◆ OrderPcbApiRequest() [2/3]

OrderPcbApiRequest ( const OrderPcbApiRequest other)
delete

◆ OrderPcbApiRequest() [3/3]

OrderPcbApiRequest ( const QUrl &  apiServerUrl,
QObject *  parent = nullptr 
)
explicitnoexcept

Constructor.

Parameters
apiServerUrlURL of the API server (as set in workspace settings).
parentParent widget.

◆ ~OrderPcbApiRequest()

~OrderPcbApiRequest ( )
noexcept

Destructor.

Member Function Documentation

◆ isReadyForUpload()

bool isReadyForUpload ( ) const
inlinenoexcept

Check if the information for upload was successfully received.

Return values
trueReady to call startUpload().
falseNot ready, startUpload() should not be called.

◆ getReceivedInfoUrl()

const QUrl & getReceivedInfoUrl ( ) const
inlinenoexcept

Get received URL to service information.

Returns
URL (might be invalid if N/A or failed to receive information).

◆ getReceivedUploadUrl()

const QUrl & getReceivedUploadUrl ( ) const
inlinenoexcept

Get received URL where to upload the project.

Returns
Upload URL (might be invalid if failed to receive information).

◆ getReceivedMaxFileSize()

int getReceivedMaxFileSize ( ) const
inlinenoexcept

Get maximum allowed project file size to upload.

Returns
Max. size in bytes (-1 if unknown).

◆ startInfoRequest()

void startInfoRequest ( )
noexcept

Request the upload information from the API server.

Will request information from the API server, and then emits either infoRequestSucceeded() or infoRequestFailed().

+ Here is the call graph for this function:

◆ startUpload()

void startUpload ( const QByteArray &  lppz,
const QString &  boardPath 
) const
noexcept

Upload the project.

Will emit uploadProgressState() and uploadProgressPercent() during the upload, and either uploadSucceeded() or uploadFailed() when the upload is finished.

Parameters
lppzProject as a ZIP export.
boardPathPath to the pre-selected board (e.g. "boards/default/board.lp"). Leave empty if unknown.
+ Here is the call graph for this function:

◆ operator=()

OrderPcbApiRequest & operator= ( const OrderPcbApiRequest rhs)
delete

◆ infoRequestSucceeded

void infoRequestSucceeded ( QUrl  infoUrl,
int  maxFileSize 
) const
signal

Information request succeeded.

Parameters
infoUrlThe received service information URL.
maxFileSizeThe received maximum file size in bytes (-1 if N/A).
+ Here is the caller graph for this function:

◆ infoRequestFailed

void infoRequestFailed ( QString  errorMsg) const
signal

Information request failed.

Parameters
errorMsgError message.
+ Here is the caller graph for this function:

◆ uploadProgressState

void uploadProgressState ( QString  state) const
signal

Upload progress state changed.

Parameters
stateSHort description of current state.
+ Here is the caller graph for this function:

◆ uploadProgressPercent

void uploadProgressPercent ( int  percent) const
signal

Upload progress in percent changed.

Parameters
percentCurrent upload progress in percent.
+ Here is the caller graph for this function:

◆ uploadSucceeded

void uploadSucceeded ( QUrl  redirectUrl) const
signal

Upload succeeded.

Parameters
redirectUrlThe received URL to be opened in the web browser.
+ Here is the caller graph for this function:

◆ uploadFailed

void uploadFailed ( QString  errorMsg) const
signal

Information request failed.

Parameters
errorMsgError message.
+ Here is the caller graph for this function:

◆ infoRequestResponseReceived()

void infoRequestResponseReceived ( const QByteArray &  data)
privatenoexcept
+ Here is the caller graph for this function:

◆ uploadResponseReceived()

void uploadResponseReceived ( const QByteArray &  data) const
privatenoexcept
+ Here is the caller graph for this function:

Member Data Documentation

◆ mApiServerUrl

QUrl mApiServerUrl
private

◆ mInfoUrl

QUrl mInfoUrl
private

◆ mUploadUrl

QUrl mUploadUrl
private

◆ mMaxFileSize

int mMaxFileSize
private

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