Implement voice & video calls
This commit is contained in:
@@ -22,6 +22,9 @@
|
||||
#include <csapi/pushrules.h>
|
||||
#include <jobs/basejob.h>
|
||||
#include <user.h>
|
||||
#ifdef GSTREAMER_AVAILABLE
|
||||
#include "call/callmanager.h"
|
||||
#endif
|
||||
|
||||
#include "controller.h"
|
||||
#include "neochatconfig.h"
|
||||
@@ -606,3 +609,35 @@ QVector<QVariant> NotificationsManager::toActions(PushNotificationAction::Action
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
#ifdef GSTREAMER_AVAILABLE
|
||||
void NotificationsManager::postCallInviteNotification(NeoChatRoom *room, const QString &roomName, const QString &sender, const QImage &icon, bool video)
|
||||
{
|
||||
QPixmap img;
|
||||
img.convertFromImage(icon);
|
||||
KNotification *notification = new KNotification("message");
|
||||
|
||||
if (sender == roomName) {
|
||||
notification->setTitle(sender);
|
||||
} else {
|
||||
notification->setTitle(i18n("%1 (%2)", sender, roomName));
|
||||
}
|
||||
|
||||
notification->setText(video ? i18n("%1 is inviting you to a video call", sender) : i18n("%1 is inviting you to a voice call", sender));
|
||||
notification->setPixmap(img);
|
||||
notification->setDefaultAction(i18n("Open NeoChat in this room"));
|
||||
connect(notification, &KNotification::defaultActivated, this, [=]() {
|
||||
RoomManager::instance().enterRoom(room);
|
||||
WindowController::instance().showAndRaiseWindow(notification->xdgActivationToken());
|
||||
});
|
||||
notification->setActions({i18n("Accept"), i18n("Decline")});
|
||||
connect(notification, &KNotification::action1Activated, this, [=]() {
|
||||
CallManager::instance().acceptCall();
|
||||
});
|
||||
connect(notification, &KNotification::action2Activated, this, [=]() {
|
||||
CallManager::instance().hangupCall();
|
||||
});
|
||||
notification->sendEvent();
|
||||
m_notifications.insert(room->id(), notification);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user