Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
ErrorLogDisplay Class Reference

#include "stage/widget/error-log-display.hpp"

Description

Widget to display log and error messages.

Based on a multiline text display box with scrollbars. Warning and error messages are highlighted by special formatting. And error entries are treated specially, insofar they are tracked by an index, allowing to build additional convenience features later on...

Remarks
this is just a widget intended for direct use. By default, it is managed by the NotificationHub, which is a controller, attached to the UI-Bus and responding to the [UI-Element protocol] (tangible.hpp).

Definition at line 114 of file error-log-display.hpp.

Public Attributes

model::Expander expand
 
model::Revealer reveal
 

Public Member Functions

 ~ErrorLogDisplay ()
 
 ErrorLogDisplay ()
 
void clearAll ()
 empty text buffer and discard all error bookmarks
 
void addInfo (string text)
 just add normal information message to buffer, without special markup and without expanding the widget
 
void addWarn (string text)
 add an information message, formatted more prominent as warning
 
void addError (string text)
 present an error notification prominently.
 
void clearInfoMsg ()
 clear all mere information messages; retain just the previously tagged errors
 
void turnError_into_InfoMsg ()
 visit all errors and downgrade the markup; discard all bookmarks
 
void triggerFlash ()
 temporarily change display style to prompt for attention; set callback-timeout for return to normal state.
 
bool isError () const
 
SignalErrorChanged signalErrorChanged ()
 signal fired when error state changes
 

Private Types

using Mark = Glib::RefPtr< Gtk::TextBuffer::Mark >
 
using Entry = std::pair< Mark, Mark >
 
using TextWidget = model::FlashDeco< Gtk::TextView >
 
using SignalErrorChanged = sigc::signal< void, bool >
 

Private Member Functions

Entry addEntry (string const &text, Literal markupTagName=nullptr)
 add message entry to the (ever growing) text buffer.
 

Private Attributes

vector< EntryerrorMarks_
 
TextWidget textLog_
 
SignalErrorChanged errorChangedSignal_
 

Constructor & Destructor Documentation

◆ ~ErrorLogDisplay()

~ErrorLogDisplay ( )
inline

Definition at line 131 of file error-log-display.hpp.

◆ ErrorLogDisplay()

ErrorLogDisplay ( )
inline

Definition at line 133 of file error-log-display.hpp.

References ErrorLogDisplay::textLog_.

Member Typedef Documentation

◆ Mark

using Mark = Glib::RefPtr<Gtk::TextBuffer::Mark>
private

Definition at line 118 of file error-log-display.hpp.

◆ Entry

using Entry = std::pair<Mark,Mark>
private

Definition at line 119 of file error-log-display.hpp.

◆ TextWidget

using TextWidget = model::FlashDeco<Gtk::TextView>
private

Definition at line 120 of file error-log-display.hpp.

◆ SignalErrorChanged

using SignalErrorChanged = sigc::signal<void, bool>
private

Definition at line 122 of file error-log-display.hpp.

Member Function Documentation

◆ clearAll()

void clearAll ( )
inline

empty text buffer and discard all error bookmarks

Definition at line 157 of file error-log-display.hpp.

References _, ErrorLogDisplay::errorChangedSignal_, ErrorLogDisplay::isError(), and ErrorLogDisplay::textLog_.

+ Here is the call graph for this function:

◆ addInfo()

void addInfo ( string  text)
inline

just add normal information message to buffer, without special markup and without expanding the widget

Definition at line 176 of file error-log-display.hpp.

References ErrorLogDisplay::addEntry().

Referenced by ErrorLogDisplay::clearInfoMsg(), and NotificationHub::doMsg().

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

◆ addWarn()

void addWarn ( string  text)
inline

add an information message, formatted more prominent as warning

Definition at line 183 of file error-log-display.hpp.

References ErrorLogDisplay::addEntry(), and stage::TAG_WARN.

Referenced by NotificationHub::doMark().

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

◆ addError()

void addError ( string  text)
inline

present an error notification prominently.

Adds the error text, formatted accordingly to stand out, but also stores a Mark to bookmark the presence of this error entry. And finally expand the display if collapsed.

Definition at line 196 of file error-log-display.hpp.

References ErrorLogDisplay::addEntry(), ErrorLogDisplay::errorChangedSignal_, ErrorLogDisplay::expand, ErrorLogDisplay::isError(), Expander::isExpanded(), and stage::TAG_ERROR.

Referenced by NotificationHub::doErr().

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

◆ clearInfoMsg()

void clearInfoMsg ( )
inline

clear all mere information messages; retain just the previously tagged errors

Remarks
in fact populates a new buffer

Definition at line 215 of file error-log-display.hpp.

References _, ErrorLogDisplay::addInfo(), ErrorLogDisplay::errorMarks_, and ErrorLogDisplay::textLog_.

+ Here is the call graph for this function:

◆ turnError_into_InfoMsg()

void turnError_into_InfoMsg ( )
inline

visit all errors and downgrade the markup; discard all bookmarks

Definition at line 249 of file error-log-display.hpp.

References ErrorLogDisplay::errorChangedSignal_, ErrorLogDisplay::errorMarks_, ErrorLogDisplay::isError(), stage::TAG_ERROR, stage::TAG_WARN, and ErrorLogDisplay::textLog_.

+ Here is the call graph for this function:

◆ triggerFlash()

void triggerFlash ( )
inline

temporarily change display style to prompt for attention; set callback-timeout for return to normal state.

See also
stage::CSS_CLASS_FLASH

Definition at line 272 of file error-log-display.hpp.

References FlashDeco< WIT >::flash(), and ErrorLogDisplay::textLog_.

+ Here is the call graph for this function:

◆ isError()

bool isError ( ) const
inline

Definition at line 281 of file error-log-display.hpp.

References ErrorLogDisplay::errorMarks_.

Referenced by ErrorLogDisplay::addError(), ErrorLogDisplay::clearAll(), and ErrorLogDisplay::turnError_into_InfoMsg().

+ Here is the caller graph for this function:

◆ signalErrorChanged()

SignalErrorChanged signalErrorChanged ( )
inline

signal fired when error state changes

Definition at line 288 of file error-log-display.hpp.

References ErrorLogDisplay::errorChangedSignal_.

◆ addEntry()

Entry addEntry ( string const &  text,
Literal  markupTagName = nullptr 
)
inlineprivate

add message entry to the (ever growing) text buffer.

Returns
pair of anonymous marks bracketing the content added
Remarks
an entry is content sans the following line break, which is appended automatically. We inject the content between two marks, which will adjust when content is altered.
According to the API doc, TextView::scroll_to(iter) is not reliable; preferably we should use a text mark, which could e.g. be the insert position. The handling of marks and tags is described in the GTKmm tutorial.
Warning
Each entry creates a new pair of marks. Not sure about the impact on performance...

Definition at line 311 of file error-log-display.hpp.

References ErrorLogDisplay::textLog_.

Referenced by ErrorLogDisplay::addError(), ErrorLogDisplay::addInfo(), and ErrorLogDisplay::addWarn().

+ Here is the caller graph for this function:

Member Data Documentation

◆ errorMarks_

◆ textLog_

◆ errorChangedSignal_

◆ expand

◆ reveal

Definition at line 152 of file error-log-display.hpp.

Referenced by NotificationHub::NotificationHub().

+ Inheritance diagram for ErrorLogDisplay:
+ Collaboration diagram for ErrorLogDisplay:

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