From 8fa3eb2517a69c7a357f5a44e17e422f7efa5a2b Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 21 Sep 2018 05:17:54 +0200 Subject: [PATCH] NotificationDisplay: integrate with the new Revealer-Functor (closes #1162) after an extended digression to fix our matcher for tests on the EventLog, the new helper abstractions gui::model::Expander and gui::model::Revealer are now covered and ready for use. In this special case here, the controller uses both the Expander and Revealer inherited from model::Tangible; yet both are wired to access the actual display widget via the getter, and delegate to the Expander rsp. Revealer located within the widget. Which in turn are wired when creating the widget within the InfoboxPanel. Bottom line -- we have a generic scheme now, and the actual implementation is filled in as lambda, at the point where the component or widget is created --- src/gui/ctrl/notification-hub.hpp | 4 +-- src/gui/model/expander-revealer.hpp | 5 ++-- src/gui/panel/infobox-panel.cpp | 3 +++ src/gui/widget/error-log-display.hpp | 7 +---- wiki/thinkPad.ichthyo.mm | 38 ++++++++++++++++++++++------ 5 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/gui/ctrl/notification-hub.hpp b/src/gui/ctrl/notification-hub.hpp index 638e6bc90..96f64aa49 100644 --- a/src/gui/ctrl/notification-hub.hpp +++ b/src/gui/ctrl/notification-hub.hpp @@ -152,7 +152,7 @@ namespace ctrl { doFlash() override { if (not widget_) return; - widget_->revealYourself(); + widget_->reveal(); widget_->triggerFlash(); } @@ -173,7 +173,7 @@ namespace ctrl { getWidget().expand (yes); } ); - installRevealer([&](){ getWidget().revealYourself(); }); // implementation implies also expand + installRevealer([&](){ getWidget().reveal(); }); // implementation implies also expand } ~NotificationHub() { }; diff --git a/src/gui/model/expander-revealer.hpp b/src/gui/model/expander-revealer.hpp index 8811ea96b..bdf91bba0 100644 --- a/src/gui/model/expander-revealer.hpp +++ b/src/gui/model/expander-revealer.hpp @@ -36,10 +36,10 @@ ** ** The base class of all [tangible UI elements](\ref Tangible) provides a default implementation ** for these generic interaction mechanism: It offers slots to connect UI signals against, and - ** it understands the _`mark`_ messages "`expand`" and "`revealYourself`". These are implemented + ** it understands the \em `mark` messages `"expand"` and `"revealYourself"`. These are implemented ** by delegating to the \ref Expander and \ref Revealer functors respectively. Moreover, this ** default implementation automatically detects a resulting state change and emits an appropriate - ** _`note`_ message on the UI-Bus, so to make those state changes persistent. However, in order + ** \em `note` message on the UI-Bus, so to make those state changes persistent. However, in order ** to supply an concrete implementation, depending on the circumstances, either the widget itself ** or a parent container holding the element needs to install lambdas into those functor holders, ** to detail what actually needs to be done. E.g. it is quite common to implement the "expand" @@ -53,6 +53,7 @@ ** install an appropriate Expander functor within their constructor. ** ** @see [UI-Element protocol](\ref tangible.hpp) + ** @see [simple test case](\ref AbstractTangible_test::revealer()) ** @see [usage example](\ref error-log-display.hpp) ** */ diff --git a/src/gui/panel/infobox-panel.cpp b/src/gui/panel/infobox-panel.cpp index 2c8d86996..c17910b73 100644 --- a/src/gui/panel/infobox-panel.cpp +++ b/src/gui/panel/infobox-panel.cpp @@ -98,6 +98,9 @@ namespace panel{ theLog_->expand = model::Expander{[&]() { return logExpander_.get_expanded(); } ,[&](bool yes) { logExpander_.set_expanded (yes); } }; + theLog_->reveal = model::Revealer{[&]() { Panel::show(true); + theLog_->expand(true); + } }; frame_.set_border_width (5); frame_.add (logExpander_); frame_.show_all(); diff --git a/src/gui/widget/error-log-display.hpp b/src/gui/widget/error-log-display.hpp index 376ceea2f..7e4d59a7e 100644 --- a/src/gui/widget/error-log-display.hpp +++ b/src/gui/widget/error-log-display.hpp @@ -98,6 +98,7 @@ namespace widget { } model::Expander expand; + model::Revealer reveal; void @@ -153,12 +154,6 @@ namespace widget { UNIMPLEMENTED ("paint and set callback-timeout to return to normal state"); } - void - revealYourself() - { - UNIMPLEMENTED ("store a link to parent. Ask parent to reveal us. Switch to expanded display"); - } - private:/* ===== Internals ===== */ diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 0e5afa175..b77d5ef85 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -2045,8 +2045,23 @@ - + + + + + + + + + + + + + + + + @@ -2152,7 +2167,7 @@ - + @@ -2387,8 +2402,8 @@ - - + + @@ -2414,14 +2429,17 @@ - + + + + - + @@ -2457,7 +2475,7 @@ - + @@ -2471,6 +2489,7 @@

+
@@ -18835,6 +18854,9 @@
+ + +
@@ -37962,7 +37984,7 @@ - +