differentiate the severity levels for user notification (#1102)
basically we want a non-modal notification box in the UI, which normally stays out of the way. A good example of how such can be accomplished can be found in the Ardour UI. This leads to the conclusion that we want to differentiate between varoius degees of severity; some error conditions just can not be ignored, and must be indicated in an obvious way, e.g. a prominent nonmodal pop-up to appear for some seconds, while others just warant an unobstrusive warning sign
This commit is contained in:
parent
805e6047ba
commit
5299185c2b
4 changed files with 18 additions and 11 deletions
|
|
@ -65,14 +65,15 @@ namespace facade {
|
|||
class Proxy<IHandle_GuiNotification>
|
||||
: public Holder<IHandle_GuiNotification>
|
||||
{
|
||||
using Level = gui::NotifyLevel;
|
||||
|
||||
//----Proxy-Implementation-of-GuiNotification--------
|
||||
|
||||
void displayInfo (string const& text) override { _i_.displayInfo (cStr(text)); }
|
||||
void markError (ID uiElement, string const& text) override { _i_.markError(uiElement.getHash().get(), cStr(text)); }
|
||||
void markNote (ID uiElement, string const& text) override { _i_.markNote (uiElement.getHash().get(), cStr(text)); }
|
||||
void mutate (ID uiElement, DiffMessage& diff) override { _i_.mutate (uiElement.getHash().get(), &diff); }
|
||||
void triggerGuiShutdown (string const& cause) override { _i_.triggerGuiShutdown (cStr(cause)); }
|
||||
void displayInfo (Level level, string const& text) override { _i_.displayInfo (level, cStr(text)); }
|
||||
void markError (ID uiElement, string const& text) override { _i_.markError(uiElement.getHash().get(), cStr(text)); }
|
||||
void markNote (ID uiElement, string const& text) override { _i_.markNote (uiElement.getHash().get(), cStr(text)); }
|
||||
void mutate (ID uiElement, DiffMessage& diff) override { _i_.mutate (uiElement.getHash().get(), &diff); }
|
||||
void triggerGuiShutdown (string const& cause) override { _i_.triggerGuiShutdown (cStr(cause)); }
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace gui {
|
|||
|
||||
|
||||
void
|
||||
NotificationService::displayInfo (string const& text)
|
||||
NotificationService::displayInfo (NotifyLevel severity, string const& text)
|
||||
{
|
||||
INFO (gui, "@GUI: display '%s' as notification message.", cStr(text)); ///////////////////////////////////TICKET #1102 : build a message display box in the UI
|
||||
////////////////////////TODO actually push the information to the GUI ///////////////////////////////////TICKET #1098 : use a suitable Dispatcher
|
||||
|
|
@ -215,11 +215,11 @@ namespace gui {
|
|||
, NULL /* on open */
|
||||
, NULL /* on close */
|
||||
, LUMIERA_INTERFACE_INLINE (displayInfo,
|
||||
void, (const char* text),
|
||||
void, (uint severity, const char* text),
|
||||
{
|
||||
if (!_instance) lumiera_error_set(LUMIERA_ERROR_FACADE_LIFECYCLE, text);
|
||||
else
|
||||
_instance->displayInfo (text);
|
||||
_instance->displayInfo (NotifyLevel(severity), text);
|
||||
}
|
||||
)
|
||||
, LUMIERA_INTERFACE_INLINE (markError,
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ namespace gui {
|
|||
|
||||
/* === Implementation of the Facade Interface === */
|
||||
|
||||
void displayInfo (string const& text) override;
|
||||
void displayInfo (NotifyLevel,string const& text) override;
|
||||
void markError (ID uiElement, string const& text) override;
|
||||
void markNote (ID uiElement, string const& text) override;
|
||||
void mutate (ID uiElement, DiffMessage&) override; ////////////////////////////////////////TICKET #1066 : how to pass a diff message
|
||||
|
|
|
|||
|
|
@ -57,6 +57,12 @@ namespace gui {
|
|||
|
||||
using ID = lib::idi::BareEntryID const&;
|
||||
|
||||
enum NotifyLevel {
|
||||
NOTE_INFO, ///< possibly interesting info that can be safely ignored
|
||||
NOTE_WARN, ///< something to be aware of, to be indicated unobtrusively
|
||||
NOTE_ERROR ///< severe condition to be indicated prominently
|
||||
};
|
||||
|
||||
|
||||
/*****************************************************************//**
|
||||
* Global access point to push state update and notification of events
|
||||
|
|
@ -75,7 +81,7 @@ namespace gui {
|
|||
|
||||
|
||||
/** push a user visible notification text */
|
||||
virtual void displayInfo (string const& text) =0;
|
||||
virtual void displayInfo (NotifyLevel, string const& text) =0;
|
||||
|
||||
/** highlight an element in the UI as problem location */
|
||||
virtual void markError (ID uiElement, string const& text) =0;
|
||||
|
|
@ -121,7 +127,7 @@ extern "C" {
|
|||
|
||||
|
||||
LUMIERA_INTERFACE_DECLARE (lumieraorg_GuiNotification, 0,
|
||||
LUMIERA_INTERFACE_SLOT (void, displayInfo, (const char*)),
|
||||
LUMIERA_INTERFACE_SLOT (void, displayInfo, (uint, const char*)),
|
||||
LUMIERA_INTERFACE_SLOT (void, markError, (LumieraUid, const char*)),
|
||||
LUMIERA_INTERFACE_SLOT (void, markNote, (LumieraUid, const char*)),
|
||||
LUMIERA_INTERFACE_SLOT (void, mutate, (LumieraUid, void*)),
|
||||
|
|
|
|||
Loading…
Reference in a new issue