Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
notification_manager.h
1#pragma once
2
3#include <QList>
4#include <QObject>
5#include <QPointer>
6
7#include "logging.h"
8#include "widgets/notification_widget.h"
9
22class NotificationManager : public QObject
23{
24 Q_OBJECT
25public:
32 explicit NotificationManager(QWidget* parentWindow, QObject* parent = nullptr);
33
37 void toggleMinimize(bool minimize);
38
39public slots:
50 void showNotification(const QString& header, const QString& text, logging::LogLevel level);
51
64 QString showLongNotification(const QString& id, const QString& header, QWidget* contents, logging::LogLevel level);
65
66private slots:
75
76private:
82 void repositionToasts();
83
93 bool eventFilter(QObject* watched, QEvent* event);
94
102 QString updateExistingNotification(const QString& id, QWidget* contents, logging::LogLevel level);
103
104 QPointer<QWidget> mParentWindow;
105 QList<NotificationWidget*> mToasts;
106
108};
QList< NotificationWidget * > mToasts
List of active notification toasts.
Definition notification_manager.h:105
void repositionToasts()
Repositions all active notification toasts.
Definition notification_manager.cpp:111
void showNotification(const QString &header, const QString &text, logging::LogLevel level)
Displays a new notification toast.
Definition notification_manager.cpp:28
void toggleMinimize(bool minimize)
Minimizes or expands all notifications.
Definition notification_manager.cpp:19
void onToastDismissed(NotificationWidget *toast)
Handles dismissal of a notification toast.
Definition notification_manager.cpp:105
QString updateExistingNotification(const QString &id, QWidget *contents, logging::LogLevel level)
Updates an existing notification with new contents.
Definition notification_manager.cpp:80
QString showLongNotification(const QString &id, const QString &header, QWidget *contents, logging::LogLevel level)
Displays a new long notification toast.
Definition notification_manager.cpp:51
QPointer< QWidget > mParentWindow
Weak pointer to the parent window used for positioning.
Definition notification_manager.h:104
bool eventFilter(QObject *watched, QEvent *event)
Event filter to track parent window changes.
Definition notification_manager.cpp:150
NotificationManager(QWidget *parentWindow, QObject *parent=nullptr)
Constructs a notification manager.
Definition notification_manager.cpp:10
bool mMinimize
Whether toasts should be minimized.
Definition notification_manager.h:107
A transient UI widget for displaying notifications with animation and auto-dismiss support.
Definition notification_widget.h:29