Maki
Formally verfied low-code orchestration
Toggle main menu visibility
Loading...
Searching...
No Matches
notifications.h
1
#pragma once
2
3
#include <stdint.h>
4
5
#include <QWidget>
6
#include <chrono>
7
#include <functional>
8
#include <string>
9
10
#include "logging.h"
11
12
namespace
notification {
13
17
using
NotificationBody = std::variant<std::string, QWidget*>;
18
26
extern
std::function<void(logging::LogLevel level,
27
const
std::string& header,
28
const
std::string& message)>
29
gNotificationStream;
30
40
extern
std::function<QString(
const
QString&
id
,
41
logging::LogLevel level,
42
const
std::string& header,
43
QWidget* body)>
44
gLongNotificationStream;
45
53
void
Notify(logging::LogLevel level,
const
std::string& header,
const
NotificationBody& message);
54
64
QString NotifyLongRunning(
const
QString&
id
, logging::LogLevel level,
const
std::string& header,
const
NotificationBody& body);
65
73
template
<
typename
... Args>
74
std::string format(std::string_view fmt, Args&&... args)
75
{
76
return
std::vformat(fmt, std::make_format_args(args...));
77
}
78
79
}
// namespace notification
80
81
#define NOTIFY_ERROR(header, s, ...) \
82
notification::Notify(logging::LogLevel::Error, header, notification::format(s, ##__VA_ARGS__))
83
#define NOTIFY_WARNING(header, s, ...) \
84
notification::Notify(logging::LogLevel::Warning, header, notification::format(s, ##__VA_ARGS__))
85
#define NOTIFY_INFO(header, s, ...) \
86
notification::Notify(logging::LogLevel::Info, header, notification::format(s, ##__VA_ARGS__))
87
88
#define NOTIFY_LONG_ERROR(id, header, content) \
89
notification::NotifyLongRunning(id, logging::LogLevel::Error, header, content)
90
#define NOTIFY_LONG_WARNING(id, header, content) \
91
notification::NotifyLongRunning(id, logging::LogLevel::Warning, header, content)
92
#define NOTIFY_LONG_INFO(id, header, content) \
93
notification::NotifyLongRunning(id, logging::LogLevel::Info, header, content)
Generated for
MAKI
· © 2026 with
Doxygen
1.9.8
GitHub
Research