NotificationDisplay: add an Error-State and implement signal to trigger on change
this is more or less gratitious functionality for now, yet I consider it a proof-of-concept
This commit is contained in:
parent
33af82cf73
commit
12344ae9d8
3 changed files with 62 additions and 8 deletions
|
|
@ -129,6 +129,9 @@ namespace widget {
|
|||
vector<Entry> errorMarks_;
|
||||
TextWidget textLog_;
|
||||
|
||||
sigc::signal<void, bool> errorChangedSignal_;
|
||||
|
||||
|
||||
public:
|
||||
~ErrorLogDisplay() { };
|
||||
|
||||
|
|
@ -158,12 +161,17 @@ namespace widget {
|
|||
void
|
||||
clearAll()
|
||||
{
|
||||
bool shallNotify = not errorMarks_.empty();
|
||||
|
||||
errorMarks_.clear();
|
||||
size_t lineCnt = textLog_.get_buffer()->get_line_count();
|
||||
string placeholder;
|
||||
if (lineCnt > 0)
|
||||
placeholder = _Fmt{_("───════ %d preceding lines removed ════───\n")} % lineCnt;
|
||||
textLog_.get_buffer()->set_text (placeholder); // discard existing content
|
||||
|
||||
if (shallNotify)
|
||||
errorChangedSignal_.emit (true);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -192,10 +200,15 @@ namespace widget {
|
|||
void
|
||||
addError (string text)
|
||||
{
|
||||
bool shallNotify = errorMarks_.empty();
|
||||
|
||||
errorMarks_.emplace_back(
|
||||
addEntry ("ERROR: "+text, TAG_ERROR));
|
||||
if (not expand.isExpanded())
|
||||
expand (true);
|
||||
|
||||
if (shallNotify)
|
||||
errorChangedSignal_.emit (true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -240,6 +253,8 @@ namespace widget {
|
|||
void
|
||||
turnError_into_InfoMsg()
|
||||
{
|
||||
bool shallNotify = not errorMarks_.empty();
|
||||
|
||||
auto buff = textLog_.get_buffer();
|
||||
for (Entry& entry : errorMarks_)
|
||||
{
|
||||
|
|
@ -250,6 +265,9 @@ namespace widget {
|
|||
buff->apply_tag_by_name (uString{TAG_WARN}, begin,end);
|
||||
}
|
||||
errorMarks_.clear();
|
||||
|
||||
if (shallNotify)
|
||||
errorChangedSignal_.emit (true);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -264,6 +282,22 @@ namespace widget {
|
|||
}
|
||||
|
||||
|
||||
/* ======= Error-State ======= */
|
||||
|
||||
bool
|
||||
isError() const
|
||||
{
|
||||
return not errorMarks_.empty();
|
||||
}
|
||||
|
||||
/** signal fired when error state changes */
|
||||
sigc::signal<void,bool>
|
||||
signalErrorChanged()
|
||||
{
|
||||
return errorChangedSignal_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private:/* ===== Internals ===== */
|
||||
|
||||
|
|
|
|||
|
|
@ -180,8 +180,8 @@ namespace test {
|
|||
invokeCommand();
|
||||
markState();
|
||||
revealer();
|
||||
// notify();
|
||||
// mutate();
|
||||
notify();
|
||||
mutate();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2484,6 +2484,22 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1538746635373" ID="ID_1501747643" MODIFIED="1538746770472" TEXT="Error-Flag (Zustand)">
|
||||
<linktarget COLOR="#87a5af" DESTINATION="ID_1501747643" ENDARROW="Default" ENDINCLINATION="54;212;" ID="Arrow_ID_512060720" SOURCE="ID_1074988560" STARTARROW="None" STARTINCLINATION="788;93;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1538746644284" ID="ID_1672227402" MODIFIED="1538746653979" TEXT="wenn ein Error-Eintrag im Index steht">
|
||||
<icon BUILTIN="info"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1538746666721" ID="ID_9727272" MODIFIED="1538747828042" TEXT="Prädikat zur Erkennung">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1538746673144" ID="ID_1324190008" MODIFIED="1538747829912" TEXT="Signal welcehs bei Status-Änderung triggert">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1538746726849" ID="ID_1790025982" MODIFIED="1538747833704" TEXT="Buttons im InfoboxPanel steuern (Proof-of-Concept)">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1522936265009" ID="ID_433355936" MODIFIED="1538263469670" TEXT="Bang! -Button">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
|
|
@ -2569,8 +2585,8 @@
|
|||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1533689098787" ID="ID_191346591" MODIFIED="1538263469671" TEXT="Empfangs-Logik im NotificationHub (Controller)">
|
||||
<icon BUILTIN="full-3"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534119968325" ID="ID_1630503080" MODIFIED="1538263469671" TEXT="Einrichtung">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1534119968325" ID="ID_1630503080" MODIFIED="1538746815645" TEXT="Einrichtung">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1534336479160" ID="ID_203145360" MODIFIED="1538263469671" TEXT="Link zum Widget herstellen">
|
||||
<arrowlink COLOR="#a66b86" DESTINATION="ID_1326202399" ENDARROW="Default" ENDINCLINATION="279;-1333;" ID="Arrow_ID_664593340" STARTARROW="None" STARTINCLINATION="-1296;0;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
|
|
@ -2865,13 +2881,14 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1533689138950" ID="ID_580572298" MODIFIED="1538263469671" TEXT="status-Flag">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1533689138950" ID="ID_580572298" MODIFIED="1538746809685" TEXT="status-Flag">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node CREATED="1534722574441" ID="ID_558411855" MODIFIED="1538263469671" TEXT="delegiert an Widget">
|
||||
<arrowlink COLOR="#7691b1" DESTINATION="ID_1390682663" ENDARROW="Default" ENDINCLINATION="-71;33;" ID="Arrow_ID_1469414604" STARTARROW="None" STARTINCLINATION="109;16;"/>
|
||||
<icon BUILTIN="stop-sign"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534722791268" ID="ID_1074988560" MODIFIED="1538263469672" TEXT="Error-State">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1534722791268" ID="ID_1074988560" MODIFIED="1538747845155" TEXT="Error-State">
|
||||
<arrowlink COLOR="#87a5af" DESTINATION="ID_1501747643" ENDARROW="Default" ENDINCLINATION="54;212;" ID="Arrow_ID_512060720" STARTARROW="None" STARTINCLINATION="788;93;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534722566362" HGAP="29" ID="ID_202753412" MODIFIED="1538263469672" TEXT="sichtbar" VSHIFT="-18">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
|
|
@ -3793,6 +3810,9 @@
|
|||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534721764680" ID="ID_237796687" MODIFIED="1538263469675" TEXT="Belegen der View">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1538747863296" ID="ID_1171544173" MODIFIED="1538747871991" TEXT="Reaktion auf Error-state">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534721772238" ID="ID_130695962" MODIFIED="1538263469675" TEXT="Verbinden mit bestehendem InfoboxPanel">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue