Workspace 6.21.5
Public Member Functions | List of all members
ForcedShutdownEvent Class Reference

This event is raised by something that wants to force the application to quit. More...

#include <Workspace/Application/globalnotifications.h>

Inheritance diagram for ForcedShutdownEvent:
[legend]

Public Member Functions

 ForcedShutdownEvent (const QString &reason)
 
const QString & getReason () const
 
- Public Member Functions inherited from ObservableEventType< ForcedShutdownEvent >
CSIRO_WORKSPACE_API const EventIDSingleton< CSIRO::DataExecution::AllObservableEvents > & eventID ()
 
CSIRO_WORKSPACE_API const EventIDSingleton< CSIRO::DataExecution::ProgressEvent > & eventID ()
 
const EventIDSingleton< ForcedShutdownEvent > & getEventID () const override
 
- Public Member Functions inherited from ObservableEvent
virtual ~ObservableEvent ()=default
 
virtual const EventIDgetEventID () const =0
 

Additional Inherited Members

- Static Public Member Functions inherited from ObservableEventType< ForcedShutdownEvent >
static const EventIDSingleton< ForcedShutdownEvent > & eventID ()
 
- Protected Member Functions inherited from ObservableEventType< ForcedShutdownEvent >
 ObservableEventType ()=default
 

Detailed Description

Client code sometimes needs to force the application to quit. This can be for a variety of reasons, but if the client code simply kills the application or forces the main event loop to stop, the application may not have an opportunity to properly perform some last minute processing, such as saving a project file.

A ShutdownEvent notification is only raised after the main event loop has finished, whereas a ForcedShutdownEvent notification would be raised at the point where the need to quit has been identified. This might be before the main event loop has even started, it could be within the main event loop, or it could be from a separate thread entirely. In addition, ForcedShutdownEvent notifications carry information about why the forced shutdown has been requested. This gives the application the opportunity to provide the user with some explanation as to why the application is shutting down.

This event is intended to be raised on the GlobalNotifications singleton. While it could also be raised on other Observable objects, such usage is discouraged.

Constructor & Destructor Documentation

◆ ForcedShutdownEvent()

ForcedShutdownEvent ( const QString &  reason)
inline
Parameters
reasonA description about why the application is about to be shut down. This text will typically end up being shown as the contents of a QMessageBox or sent directly to the standard output. It should only contain plain text (ie no rich text tags). Therefore, it should also only contain a single paragraph, since any newline characters may be stripped out and treated as spaces instead by things like QMessageBox.
See also
getReason()

Member Function Documentation

◆ getReason()

const QString & getReason ( ) const
inline
Returns
The reason for the forced shutdown. This would normally be suitable for use within the main message of a QMessageBox or to be sent directly to the standard output.