(gui): add notification popups in sight applications
What does this MR do?
Add new kind of dialog popups: notifications
-
Notification can be displayed at 7 fixed positions (from top-left to bottom right including top & bottom centers).
-
3 Types of notifications: INFO, SUCCESS, FAILURE (background color changes).
-
Notifications appears / disappears with a fade-in/out effect on opacity.
-
Two ways of displaying notifications:
- Centralized by the new
SNotifier
service:- Using new IService signals
infoNotified
,successNotified
andfailureNotified
connected to SNotifier slotspopInfo
,popSuccess
,popfailure
. -
SNotifier
can queue multiple notifications, if queue is full the oldest one is removed. -
SNotifier
handles also position of the notification per application/config (ex: always at TOP_RIGHT).
- Using new IService signals
- Or notification can be displayed by calling directly
::fwGui::NotificationDialog::show()
, loosing the advantages of the centralized system (position, queue, ...).
- Centralized by the new
-
Add
ExNotifications
sample &SDisplayTestNotification
service to test and to show how it can work.
REMOVE THIS PART FROM MERGE COMMIT MESSAGE
This MR can be a good place to discuss about the strategy to display notifications in sight application.
Here I've implemented two ways to do it:
- Centralized using SNotifier service and new signals in IService, available in all the child classes.
-
PRO:
- SNotifier handles position of notification for the whole application/activity.
- SNotifier handles the queue if multiple notifications are displayed at same time.
-
CONS:
- Needs new signals in IService, to be used in all sight services.
- Needs "manual" (aka in xml) connection between all the services and SNotifier.
- "Uncentralized" by calling in each needed service the dialog
::fwGui::NotificationDialog::show()
-
PRO:
- "Do whatever you want" design!
-
CONS:
- "Do whatever you want" design!
- Each service can display the notification where he wants
- Notification cannot be queued, since services hasn't the knowledge of displayed notifications.
I highly recommend to use the first method, the second can also be used in some very specifics cases.
How to test it?
-
Compile ExNotifications
-
Run it !
-
Configure the wanted notification (type & position)
-
Press the 'NOTIFY !' button
-
If the "Use SNotifier to centralize" is checked it will use the SNotifier service to centralize and queue popups. If not
::fwGui::NotificationDialog::show()
is directly called and notifications cannot be queued. -
When using the SNotifier Mode you can now attach a parent container (in which container the notifications will appears). In this example parent container is set to the
SDefaultView
, so if you move the toolbar location (up/down/left/right) notification should always be displayed in theSDefaultView
(the inner rectangle of this example).
Data
No Data required.
Some results
- "uncentralized"
- centralized
- With a parent container
Additional tests to run
-
Build on Windows -
Build on Linux
Associated Issues/Merge Requests
Closes #445 (closed)