Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
iv::logs::DownloadLogger Class Reference

#include <DownloadLogger.hpp>

Inheritance diagram for iv::logs::DownloadLogger:
[legend]
Collaboration diagram for iv::logs::DownloadLogger:
[legend]

Classes

struct  DialogComponents
 
struct  SubLoggerComponent
 

Public Member Functions

void addLog (std::string_view logTitle, std::string_view logMessage, eDownloadLogState logState) override
 Add a child log to the download logger.
 
std::shared_ptr< IDownloadLoggeraddSubLog (std::string_view logTitle, std::string_view logMessage, eDownloadLogState logState) override
 Add a child log to the download logger.
 
std::shared_ptr< AbstractProgressaddSubLogProgress (const std::string &title)
 
void start () override
 Start the download logger dialog. It opens a dialog with a tree to show the download progress.
 
void end () override
 End the download logger dialog.
 
void close ()
 Close the download logger dialog.
 
bool isCancelled () const override
 Check if the user cancelled the download.
 
void exportLogs () const
 Export the logs to a json file.
 

Static Public Member Functions

static std::shared_ptr< DownloadLoggercreateLogger (std::string_view operationTitle, CDialog *dlgFatherRef)
 

Private Member Functions

 DownloadLogger (std::string_view dialogTitle, CDialog *dlgFatherRef)
 
bool prvHasFailedDownload () const
 
void prvCheckFailedDownload () const
 
void prvShowLogsTree ()
 Show the logs tree.
 
void prvShowEndedPanel ()
 Show the ended panel.
 
void prvUpdateProgress ()
 

Private Attributes

std::string m_operationTitle
 
CDialogm_dlgFatherRef {nullptr}
 
std::shared_ptr< std::atomic_bool > m_isCancelled
 
std::shared_ptr< std::atomic_bool > m_isEnded
 
std::shared_ptr< std::vector< std::shared_ptr< DownloadLoggerInfo > > > m_subLoggersInfos
 
std::shared_ptr< std::atomic_bool > m_requiresUpdate
 
std::shared_ptr< std::vector< SubLoggerComponent > > m_subLoggersProgress
 
std::shared_ptr< std::atomic_bool > m_requiresProgressReconstruction
 
std::shared_ptr< DialogComponentsm_dialogComponents
 
std::shared_ptr< CDialogm_dlgModeless {nullptr}
 
std::shared_ptr< std::mutex > m_mutex
 

Static Private Attributes

static std::shared_ptr< DownloadLoggerm_instance = nullptr
 

Constructor & Destructor Documentation

◆ DownloadLogger()

iv::logs::DownloadLogger::DownloadLogger ( std::string_view dialogTitle,
CDialog * dlgFatherRef )
private

Member Function Documentation

◆ addLog()

void iv::logs::DownloadLogger::addLog ( std::string_view logTitle,
std::string_view logMessage,
eDownloadLogState logState )
overridevirtual

Add a child log to the download logger.

Parameters
logTitleTitle of the log
logMessageMessage of the log
logStateState of the log
Note
The log will be added as a child of context log.

Implements iv::logs::IDownloadLogger.

◆ addSubLog()

std::shared_ptr< IDownloadLogger > iv::logs::DownloadLogger::addSubLog ( std::string_view logTitle,
std::string_view logMessage,
eDownloadLogState logState )
overridevirtual

Add a child log to the download logger.

Parameters
logTitleTitle of the log
logMessageMessage of the log
logStateState of the log
Returns
A shared pointer of the IDownloadLogger with the new log context.
Note
The log will be added as a child of context log.
The returned IDownloadLogger must be used to add sub logs to this child log.

Implements iv::logs::IDownloadLogger.

◆ addSubLogProgress()

std::shared_ptr< AbstractProgress > iv::logs::DownloadLogger::addSubLogProgress ( const std::string & title)

◆ close()

void iv::logs::DownloadLogger::close ( )

Close the download logger dialog.

◆ createLogger()

std::shared_ptr< DownloadLogger > iv::logs::DownloadLogger::createLogger ( std::string_view operationTitle,
CDialog * dlgFatherRef )
static

◆ end()

void iv::logs::DownloadLogger::end ( )
overridevirtual

End the download logger dialog.

Implements iv::logs::IDownloadLogger.

◆ exportLogs()

void iv::logs::DownloadLogger::exportLogs ( ) const

Export the logs to a json file.

◆ isCancelled()

bool iv::logs::DownloadLogger::isCancelled ( ) const
nodiscardoverridevirtual

Check if the user cancelled the download.

Returns
True if the download has been cancelled, false otherwise.

Implements iv::logs::IDownloadLogger.

◆ prvCheckFailedDownload()

void iv::logs::DownloadLogger::prvCheckFailedDownload ( ) const
private

◆ prvHasFailedDownload()

bool iv::logs::DownloadLogger::prvHasFailedDownload ( ) const
nodiscardprivate

◆ prvShowEndedPanel()

void iv::logs::DownloadLogger::prvShowEndedPanel ( )
private

Show the ended panel.

Warning
This function must be called in the main thread or a listener.

◆ prvShowLogsTree()

void iv::logs::DownloadLogger::prvShowLogsTree ( )
private

Show the logs tree.

Warning
This function must be called in the main thread or a listener.

◆ prvUpdateProgress()

void iv::logs::DownloadLogger::prvUpdateProgress ( )
private

◆ start()

void iv::logs::DownloadLogger::start ( )
overridevirtual

Start the download logger dialog. It opens a dialog with a tree to show the download progress.

Note
The dialog has a cancel button to cancel the download, which must be checked with isCancelled() function.
The download logger must be finished with end() function and closed with close() function.
Warning
This function must be called in the main thread.

Implements iv::logs::IDownloadLogger.

Member Data Documentation

◆ m_dialogComponents

std::shared_ptr<DialogComponents> iv::logs::DownloadLogger::m_dialogComponents
private

◆ m_dlgFatherRef

CDialog* iv::logs::DownloadLogger::m_dlgFatherRef {nullptr}
private

◆ m_dlgModeless

std::shared_ptr<CDialog> iv::logs::DownloadLogger::m_dlgModeless {nullptr}
private

◆ m_instance

std::shared_ptr< DownloadLogger > iv::logs::DownloadLogger::m_instance = nullptr
staticprivate

◆ m_isCancelled

std::shared_ptr<std::atomic_bool> iv::logs::DownloadLogger::m_isCancelled
private

◆ m_isEnded

std::shared_ptr<std::atomic_bool> iv::logs::DownloadLogger::m_isEnded
private

◆ m_mutex

std::shared_ptr<std::mutex> iv::logs::DownloadLogger::m_mutex
private

◆ m_operationTitle

std::string iv::logs::DownloadLogger::m_operationTitle
private

◆ m_requiresProgressReconstruction

std::shared_ptr<std::atomic_bool> iv::logs::DownloadLogger::m_requiresProgressReconstruction
private

◆ m_requiresUpdate

std::shared_ptr<std::atomic_bool> iv::logs::DownloadLogger::m_requiresUpdate
private

◆ m_subLoggersInfos

std::shared_ptr<std::vector<std::shared_ptr<DownloadLoggerInfo> > > iv::logs::DownloadLogger::m_subLoggersInfos
private

◆ m_subLoggersProgress

std::shared_ptr<std::vector<SubLoggerComponent> > iv::logs::DownloadLogger::m_subLoggersProgress
private

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