linphone-desktop/Linphone/core/notifier/AbstractNotificationBackend.hpp
2026-04-03 13:14:26 +02:00

58 lines
1.2 KiB
C++

#ifndef ABSTRACTNOTIFICATIONBACKEND_HPP
#define ABSTRACTNOTIFICATIONBACKEND_HPP
#include "tool/AbstractObject.hpp"
#include <QHash>
#include <QObject>
#include <QSize>
#include <QString>
struct ToastButton {
QString label;
QString argument;
QString icon;
ToastButton(QString label, QString arg, QString icon = QString()) {
this->label = label;
this->argument = arg;
this->icon = icon;
}
};
class AbstractNotificationBackend : public QObject, public AbstractObject {
Q_OBJECT
public:
AbstractNotificationBackend(QObject *parent = Q_NULLPTR);
~AbstractNotificationBackend() = default;
enum NotificationType {
ReceivedMessage,
ReceivedCall
// ReceivedFileMessage,
// SnapshotWasTaken,
// RecordingCompleted
};
struct Notification {
Notification(int type, int timeout = 0) {
this->type = NotificationType(type);
this->timeout = timeout;
}
int getTimeout() const {
return timeout;
}
private:
int type;
int timeout;
};
protected:
virtual void sendNotification(NotificationType type, QVariantMap data) = 0;
static const QHash<int, Notification> Notifications;
signals:
void toastActivated(const QString &args);
private:
DECLARE_ABSTRACT_OBJECT
};
#endif // ABSTRACTNOTIFICATIONBACKEND_HPP