Lumiera  0.pre.03
»edit your freedom«
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.

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

Public Member Functions

void addError (string text)
 present an error notification prominently. More...
 
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 clearAll ()
 empty text buffer and discard all error bookmarks
 
void clearInfoMsg ()
 clear all mere information messages; retain just the previously tagged errors More...
 
bool isError () const
 
SignalErrorChanged signalErrorChanged ()
 signal fired when error state changes
 
void triggerFlash ()
 temporarily change display style to prompt for attention; set callback-timeout for return to normal state. More...
 
void turnError_into_InfoMsg ()
 visit all errors and downgrade the markup; discard all bookmarks
 

Public Attributes

model::Expander expand
 
model::Revealer reveal
 

Private Types

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

Private Member Functions

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

Private Attributes

SignalErrorChanged errorChangedSignal_
 
vector< Entry > errorMarks_
 
TextWidget textLog_
 

Member Function Documentation

◆ 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 205 of file error-log-display.hpp.

References ErrorLogDisplay::addEntry().

Referenced by NotificationHub::buildMutator().

+ 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 224 of file error-log-display.hpp.

References ErrorLogDisplay::addInfo(), and steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry().

+ 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 281 of file error-log-display.hpp.

◆ 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 320 of file error-log-display.hpp.

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

+ Here is the caller graph for this function:
+ Inheritance diagram for ErrorLogDisplay:
+ Collaboration diagram for ErrorLogDisplay:

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