LibrePCB Developers Documentation
LibraryDownload Class Referencefinal

The LibraryDownload class. More...

#include <librarydownload.h>

Inherits QObject.

+ Collaboration diagram for LibraryDownload:

Public Slots

void start () noexcept
 Start downloading the library. More...
 
void abort () noexcept
 Abort downloading the library. More...
 

Signals

void progressState (const QString &status)
 
void progressPercent (int percent)
 
void finished (bool success, const QString &errMsg)
 
void abortRequested ()
 

Public Member Functions

 LibraryDownload ()=delete
 
 LibraryDownload (const LibraryDownload &other)=delete
 
 LibraryDownload (const QUrl &urlToZip, const FilePath &destDir) noexcept
 
 ~LibraryDownload () noexcept
 
const FilePathgetDestinationDir () const noexcept
 
void setExpectedZipFileSize (qint64 bytes) noexcept
 Set the expected size of the requested content. More...
 
void setExpectedChecksum (QCryptographicHash::Algorithm algorithm, const QByteArray &checksum) noexcept
 Set the expected checksum of the file to download. More...
 
LibraryDownloadoperator= (const LibraryDownload &rhs)=delete
 

Private Member Functions

void downloadErrored (const QString &errMsg) noexcept
 
void downloadAborted () noexcept
 
void downloadSucceeded () noexcept
 
FilePath getPathToLibDir () noexcept
 

Private Attributes

QScopedPointer< FileDownloadmFileDownload
 
FilePath mDestDir
 
FilePath mTempDestDir
 
FilePath mTempZipFile
 

Detailed Description

The LibraryDownload class.

Constructor & Destructor Documentation

◆ LibraryDownload() [1/3]

LibraryDownload ( )
delete

◆ LibraryDownload() [2/3]

LibraryDownload ( const LibraryDownload other)
delete

◆ LibraryDownload() [3/3]

LibraryDownload ( const QUrl &  urlToZip,
const FilePath destDir 
)
noexcept
+ Here is the call graph for this function:

◆ ~LibraryDownload()

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

Member Function Documentation

◆ getDestinationDir()

const FilePath& getDestinationDir ( ) const
inlinenoexcept
+ Here is the call graph for this function:

◆ setExpectedZipFileSize()

void setExpectedZipFileSize ( qint64  bytes)
noexcept

Set the expected size of the requested content.

If set, this size will be used to calculate the download progress in percent in case that there is no "Content-Length" attribute in the received HTTP header.

Parameters
bytesExpected content size of the reply in bytes
+ Here is the caller graph for this function:

◆ setExpectedChecksum()

void setExpectedChecksum ( QCryptographicHash::Algorithm  algorithm,
const QByteArray &  checksum 
)
noexcept

Set the expected checksum of the file to download.

If set, the checksum of the downloaded file will be compared with this checksum. If they differ, the file gets removed and an error will be reported.

Parameters
algorithmThe checksum algorithm to be used
checksumThe expected checksum of the file to download
+ Here is the caller graph for this function:

◆ operator=()

LibraryDownload& operator= ( const LibraryDownload rhs)
delete
+ Here is the caller graph for this function:

◆ start

void start ( )
slotnoexcept

Start downloading the library.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ abort

void abort ( )
slotnoexcept

Abort downloading the library.

+ Here is the caller graph for this function:

◆ progressState

void progressState ( const QString &  status)
signal
+ Here is the caller graph for this function:

◆ progressPercent

void progressPercent ( int  percent)
signal
+ Here is the caller graph for this function:

◆ finished

void finished ( bool  success,
const QString &  errMsg 
)
signal
+ Here is the caller graph for this function:

◆ abortRequested

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

◆ downloadErrored()

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

◆ downloadAborted()

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

◆ downloadSucceeded()

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

◆ getPathToLibDir()

FilePath getPathToLibDir ( )
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ mFileDownload

QScopedPointer<FileDownload> mFileDownload
private

◆ mDestDir

FilePath mDestDir
private

◆ mTempDestDir

FilePath mTempDestDir
private

◆ mTempZipFile

FilePath mTempZipFile
private

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