Maki
Formally verified 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
39signals:
40 void showingNotification(NotificationWidget* toast);
41
42public slots:
53 void showNotification(const QString& header, const QString& text, logging::LogLevel level);
54
67 QString showLongNotification(const QString& id, const QString& header, QWidget* contents, logging::LogLevel level);
68
69private slots:
78
79private:
85 void repositionToasts();
86
96 bool eventFilter(QObject* watched, QEvent* event);
97
105 QString updateExistingNotification(const QString& id, QWidget* contents, logging::LogLevel level);
106
107 QPointer<QWidget> mParentWindow;
108 QList<NotificationWidget*> mToasts;
109
111};
QList< NotificationWidget * > mToasts
List of active notification toasts.
Definition notification_manager.h:108
void repositionToasts()
Repositions all active notification toasts.
Definition notification_manager.cpp:121
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:115
QString updateExistingNotification(const QString &id, QWidget *contents, logging::LogLevel level)
Updates an existing notification with new contents.
Definition notification_manager.cpp:90
QString showLongNotification(const QString &id, const QString &header, QWidget *contents, logging::LogLevel level)
Displays a new long notification toast.
Definition notification_manager.cpp:56
QPointer< QWidget > mParentWindow
Weak pointer to the parent window used for positioning.
Definition notification_manager.h:107
bool eventFilter(QObject *watched, QEvent *event)
Event filter to track parent window changes.
Definition notification_manager.cpp:160
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:110
A transient UI widget for displaying notifications with animation and auto-dismiss support.
Definition notification_widget.h:29