Receives toast notification data, often from external sources, and emits it for processing.
More...
#include <ToastReceiver.h>
Receives toast notification data, often from external sources, and emits it for processing.
This class acts as a listener for toast notification data. It is typically connected to a FileMonitor
to detect new toast-related files (e.g., JSON files) and then parses these files into ToastMetaProtocol
objects. Once successfully parsed, it emits a signal to notify other components (like a ToastProxy
or ToastPostServer
) that a new toast is ready to be displayed.
◆ ToastReceiver()
ToastReceiver::ToastReceiver |
( |
FileMonitor * |
parent = nullptr | ) |
|
|
explicit |
Constructs a ToastReceiver instance.
- Parameters
-
parent | A pointer to the parent QObject , often a FileMonitor that this receiver will be associated with for detecting incoming toast data. Defaults to nullptr . |
◆ fromExternalJsonString()
std::optional< ToastMetaProtocol > ToastReceiver::fromExternalJsonString |
( |
const QString & |
json_file | ) |
const |
Parses a JSON string from an external source into a ToastMetaProtocol
object.
- This method attempts to read and parse the content of a JSON file (specified by
json_file
) into a ToastMetaProtocol
struct. It returns std::nullopt
if the file cannot be read, is not valid JSON, or does not contain the expected toast metadata. - Parameters
-
json_file | The path to the JSON file containing the toast metadata. |
- Returns
- An
std::optional<ToastMetaProtocol>
containing the parsed toast data if successful, otherwise std::nullopt
.
◆ postToast
Signal emitted when a new toast notification is ready to be posted.
- This signal carries the parsed
ToastMetaProtocol
data and should be connected to a slot responsible for displaying the toast. - Parameters
-
protocolMeta | A constant reference to the ToastMetaProtocol object containing the toast data. |
The documentation for this class was generated from the following files:
- core/server/toast_file_gen_and_receiver/ToastReceiver.h
- core/server/toast_file_gen_and_receiver/ToastReceiver.cpp