Workspace 6.21.5
Public Slots | Public Member Functions | List of all members
LogToGui Class Reference

LogStream subclass for directing a log stream to GUI application components.

#include <Workspace/DataExecution/Logging/logtogui.h>

Inheritance diagram for LogToGui:
[legend]

Public Slots

void splashDestroyed ()
 

Public Member Functions

 LogToGui ()
 
 LogToGui (Widgets::SplashScreen &splash)
 
 ~LogToGui () override
 
void flush () override
 
QString & getBuffer ()
 
bool getBufferEnabled () const
 
bool getPrefixTimestamp () const
 
bool isStreamOkay () const override
 
void setBufferEnabled (bool b)
 
void setLogWidget (Presentation::TextViewer &viewer)
 
void setPrefixTimestamp (bool b)
 
- Public Member Functions inherited from LogStream
virtual ~LogStream ()
 
virtual void flush ()=0
 
virtual bool isStreamOkay () const =0
 
void logText (const QString &msg, const QDateTime &timestamp)
 

Constructor & Destructor Documentation

◆ LogToGui() [1/2]

LogToGui ( )

◆ LogToGui() [2/2]

◆ ~LogToGui()

~LogToGui ( )
override

Member Function Documentation

◆ flush()

void flush ( )
overridevirtual

Clients would not normally need to call this function, but if for some reason they want to be sure that all logged text has been sent to where it needs to go before performing some task, they can call flush(). When flush() returns, all underlying streams and buffers associated with the LogStream object will have been flushed to disk, etc.

Implements LogStream.

◆ getBuffer()

QString & getBuffer ( )
Returns
The internal buffer. Clients should not manipulate it except perhaps to clear it after calling setBufferEnabled(false).
See also
setBufferEnabled(), getBufferEnabled()

◆ getBufferEnabled()

bool getBufferEnabled ( ) const
Returns
True if log text is currently being captured to the internal buffer.
See also
setBufferEnabled(), getBuffer()

◆ getPrefixTimestamp()

bool getPrefixTimestamp ( ) const
Returns
True if log text is currently prefixing with timestamp.
See also
setPrefixTimeStamp()

◆ isStreamOkay()

bool isStreamOkay ( ) const
overridevirtual
Returns
True if the stream is able to accept text for writing.

Implements LogStream.

◆ setBufferEnabled()

void setBufferEnabled ( bool  b)
Parameters
bIf true, then all text logged to this stream will also be appended to the internal buffer until setBufferEnabled() is called again with b set to false (or setLogWidget() is called).

This function is meant to be used to temporarily re-enable the internal buffer after setLogWidget() has already been called. It can be used to capture log text for a task that should have its text appear after the log is cleared, but where the log should only be cleared if the task is successful. This requires that the text from the task be buffered until it can be determined if the task was successful or not.

See also
getBufferEnabled(), getBuffer()

◆ setLogWidget()

void setLogWidget ( Presentation::TextViewer viewer)
Parameters
viewerThe logging widget that should receive this stream's log text from here on. The contents of the internal buffer are copied to it and buffering is then switched off.
See also
setBufferEnabled(), getBuffer()

◆ setPrefixTimestamp()

void setPrefixTimestamp ( bool  b)
Parameters
bIf true, then all text logged to this stream will also be prefixed with timestamp.
See also
getPrefixTimestamp()

◆ splashDestroyed

void splashDestroyed ( )
slot