From e7e09a642bd5cc2a4c1957730b80005c278d676e Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 17 Aug 2018 14:19:37 +0200 Subject: [PATCH] NotificateDisplay: delegate view allocation through a functor --- src/gui/ctrl/notification-hub.hpp | 11 ++++++++++- src/gui/interact/wizard.cpp | 20 +++++++++++++++++++- src/gui/interact/wizard.hpp | 6 +++++- wiki/thinkPad.ichthyo.mm | 8 ++++---- 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/gui/ctrl/notification-hub.hpp b/src/gui/ctrl/notification-hub.hpp index 67a87f63e..16d25de80 100644 --- a/src/gui/ctrl/notification-hub.hpp +++ b/src/gui/ctrl/notification-hub.hpp @@ -69,6 +69,7 @@ #include "gui/model/controller.hpp" #include "gui/model/w-link.hpp" +#include //#include //#include @@ -159,14 +160,22 @@ namespace ctrl { public: - NotificationHub (ID identity, ctrl::BusTerm& nexus) + using WidgetAllocator = std::function; + + + NotificationHub (ID identity, ctrl::BusTerm& nexus, WidgetAllocator wa) : model::Controller{identity, nexus} + , allocateWidget_{wa} + , widget_{} { } ~NotificationHub() { }; private: + /** external operation to find or allocate an log display widget */ + WidgetAllocator allocateWidget_; + /** collaboration with a log display allocated elsewhere */ WLink widget_; diff --git a/src/gui/interact/wizard.cpp b/src/gui/interact/wizard.cpp index 49921c692..fec5d3eab 100644 --- a/src/gui/interact/wizard.cpp +++ b/src/gui/interact/wizard.cpp @@ -68,7 +68,12 @@ namespace interact { Wizard::Wizard (GlobalCtx& globals) : globalCtx_{globals} - , notificationHub_{new NotificationHub{getErrorLogID(), globals.uiBus_.getAccessPoint()}} + , notificationHub_{new NotificationHub{getErrorLogID() + ,globals.uiBus_.getAccessPoint() + ,[&]() -> widget::ErrorLogDisplay& + { + return allocateErrorLogView(); + }} } { } @@ -107,4 +112,17 @@ namespace interact { } + + /** @internal reach out to attach or allocate a display widget for the error log. + * @todo as of 8/2018 we use "inside knowledge" to create this view in a hard wired location. + * But in the end, this allocation task should be delegated to the ViewLocator + */ + widget::ErrorLogDisplay& + Wizard::allocateErrorLogView() + { + UNIMPLEMENTED("reach out to attach or allocate a display widget for the error log"); + } + + + }}// namespace gui::interact diff --git a/src/gui/interact/wizard.hpp b/src/gui/interact/wizard.hpp index 213115302..8fb24532f 100644 --- a/src/gui/interact/wizard.hpp +++ b/src/gui/interact/wizard.hpp @@ -64,6 +64,9 @@ namespace ctrl { class GlobalCtx; class NotificationHub; } +namespace widget { + class ErrorLogDisplay; +} namespace interact { using std::unique_ptr; @@ -92,8 +95,9 @@ namespace interact { void show_HelpAbout(); static ID getErrorLogID() { return proc::asset::meta::theErrorLog_ID; } - private: + private: + widget::ErrorLogDisplay& allocateErrorLogView(); }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index b617519ed..b4da59e58 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -1767,11 +1767,11 @@ - + - - - + + +