/*
* Copyright (c) 2021 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef PARTICIPANT_DEVICE_LIST_H_
#define PARTICIPANT_DEVICE_LIST_H_
#include "../proxy/ListProxy.hpp"
#include "core/call/CallCore.hpp"
#include "core/participant/ParticipantDeviceCore.hpp"
#include
#include
#include
class ParticipantDeviceList : public ListProxy, public AbstractObject {
Q_OBJECT
public:
static QSharedPointer create(const std::shared_ptr &participant);
static QSharedPointer create();
ParticipantDeviceList(const std::shared_ptr &participant, QObject *parent = nullptr);
// ParticipantDeviceList(CallCore *callCore, QObject *parent = nullptr);
ParticipantDeviceList(QObject *parent = Q_NULLPTR);
~ParticipantDeviceList();
void setSelf(QSharedPointer me);
void initConferenceModel();
void updateDevices(std::shared_ptr participant);
void updateDevices(const std::list> &devices, const bool &isMe);
bool add(const QSharedPointer &deviceToAdd);
bool remove(std::shared_ptr deviceToAdd);
QSharedPointer get(std::shared_ptr deviceToGet,
int *index = nullptr);
QSharedPointer getMe(int *index = nullptr) const;
ParticipantDeviceCore *getActiveSpeakerModel() const;
bool isMe(std::shared_ptr device) const;
bool isMeAlone() const;
public slots:
void onActiveSpeakerParticipantDevice(const std::shared_ptr &participantDevice);
void onConferenceModelChanged();
void onSecurityLevelChanged(std::shared_ptr device);
void onParticipantAdded(const std::shared_ptr &participant);
void onParticipantRemoved(const std::shared_ptr &participant);
void onParticipantDeviceAdded(const std::shared_ptr &participantDevice);
void onParticipantDeviceRemoved(const std::shared_ptr &participantDevice);
void onConferenceStateChanged(linphone::Conference::State newState);
void onParticipantDeviceMediaCapabilityChanged(
const std::shared_ptr &participantDevice);
void onParticipantDeviceMediaAvailabilityChanged(
const std::shared_ptr &participantDevice);
void onParticipantDeviceIsSpeakingChanged(const std::shared_ptr &device,
bool isSpeaking);
void onParticipantDeviceSpeaking();
signals:
void activeSpeakerChanged();
void securityLevelChanged(std::shared_ptr device);
void participantSpeaking(ParticipantDeviceCore *speakingDevice);
void conferenceCreated();
void meChanged();
private:
CallCore *mCallCore = nullptr;
QSharedPointer mActiveSpeaker;
// QList mActiveSpeakers;// First item is last speaker
bool mInitialized = false;
QSharedPointer> mModelConnection;
DECLARE_ABSTRACT_OBJECT
};
Q_DECLARE_METATYPE(QSharedPointer);
#endif // PARTICIPANT_DEVICE_LIST_H_