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

The WorkspaceLibraryScanner class. More...

#include <workspacelibraryscanner.h>

Inherits QThread.

+ Collaboration diagram for WorkspaceLibraryScanner:

Signals

void scanStarted ()
 
void scanLibraryListUpdated (int libraryCount)
 
void scanProgressUpdate (int percent)
 
void scanSucceeded (int elementCount)
 
void scanFailed (QString errorMsg)
 
void scanFinished ()
 

Public Member Functions

 WorkspaceLibraryScanner (Workspace &ws, const FilePath &dbFilePath) noexcept
 
 WorkspaceLibraryScanner (const WorkspaceLibraryScanner &other)=delete
 
 ~WorkspaceLibraryScanner () noexcept
 
void startScan () noexcept
 
WorkspaceLibraryScanneroperator= (const WorkspaceLibraryScanner &rhs)=delete
 
template<>
QVariant optionalToVariant (const tl::optional< QString > &opt) noexcept
 
template<>
QVariant optionalToVariant (const tl::optional< ElementName > &opt) noexcept
 

Private Member Functions

void run () noexceptoverride
 
void scan () noexcept
 
QHash< FilePath, int > updateLibraries (SQLiteDatabase &db, const QHash< FilePath, std::shared_ptr< library::Library >> &libs)
 
void clearAllTables (SQLiteDatabase &db)
 
void getLibrariesOfDirectory (const FilePath &dir, QHash< FilePath, std::shared_ptr< library::Library >> &libs) noexcept
 
template<typename ElementType >
int addCategoriesToDb (SQLiteDatabase &db, const QList< FilePath > &dirs, const QString &table, const QString &idColumn, int libId)
 
template<typename ElementType >
int addElementsToDb (SQLiteDatabase &db, const QList< FilePath > &dirs, const QString &table, const QString &idColumn, int libId)
 
int addDevicesToDb (SQLiteDatabase &db, const QList< FilePath > &dirs, const QString &table, const QString &idColumn, int libId)
 

Static Private Member Functions

template<typename T >
static QVariant optionalToVariant (const T &opt) noexcept
 

Private Attributes

WorkspacemWorkspace
 
FilePath mDbFilePath
 
QSemaphore mSemaphore
 
volatile bool mAbort
 

Detailed Description

The WorkspaceLibraryScanner class.

Warning
Be very careful with dependencies to other objects as the run() method is executed in a separate thread! Keep the number of dependencies as small as possible and consider thread synchronization and object lifetimes.

Constructor & Destructor Documentation

WorkspaceLibraryScanner ( Workspace ws,
const FilePath dbFilePath 
)
noexcept
~WorkspaceLibraryScanner ( )
noexcept

Member Function Documentation

void startScan ( )
noexcept
WorkspaceLibraryScanner& operator= ( const WorkspaceLibraryScanner rhs)
delete
void scanStarted ( )
signal

+ Here is the caller graph for this function:

void scanLibraryListUpdated ( int  libraryCount)
signal

+ Here is the caller graph for this function:

void scanProgressUpdate ( int  percent)
signal

+ Here is the caller graph for this function:

void scanSucceeded ( int  elementCount)
signal

+ Here is the caller graph for this function:

void scanFailed ( QString  errorMsg)
signal

+ Here is the caller graph for this function:

void scanFinished ( )
signal

+ Here is the caller graph for this function:

void run ( )
overrideprivatenoexcept
void scan ( )
privatenoexcept

+ Here is the call graph for this function:

QHash< FilePath, int > updateLibraries ( SQLiteDatabase db,
const QHash< FilePath, std::shared_ptr< library::Library >> &  libs 
)
private

+ Here is the call graph for this function:

void clearAllTables ( SQLiteDatabase db)
private

+ Here is the call graph for this function:

void getLibrariesOfDirectory ( const FilePath dir,
QHash< FilePath, std::shared_ptr< library::Library >> &  libs 
)
privatenoexcept

+ Here is the call graph for this function:

int addCategoriesToDb ( SQLiteDatabase db,
const QList< FilePath > &  dirs,
const QString &  table,
const QString &  idColumn,
int  libId 
)
private

+ Here is the call graph for this function:

int addElementsToDb ( SQLiteDatabase db,
const QList< FilePath > &  dirs,
const QString &  table,
const QString &  idColumn,
int  libId 
)
private

+ Here is the call graph for this function:

int addDevicesToDb ( SQLiteDatabase db,
const QList< FilePath > &  dirs,
const QString &  table,
const QString &  idColumn,
int  libId 
)
private

+ Here is the call graph for this function:

static QVariant optionalToVariant ( const T &  opt)
staticprivatenoexcept
QVariant optionalToVariant ( const tl::optional< QString > &  opt)
noexcept
QVariant optionalToVariant ( const tl::optional< ElementName > &  opt)
noexcept

Member Data Documentation

Workspace& mWorkspace
private
FilePath mDbFilePath
private
QSemaphore mSemaphore
private
volatile bool mAbort
private

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