mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
Fix participant Device
This commit is contained in:
parent
d444375ea4
commit
de5322327e
5 changed files with 27 additions and 4 deletions
|
|
@ -42,6 +42,23 @@ int ParticipantDeviceListModel::rowCount (const QModelIndex &index) const{
|
|||
return mList.count();
|
||||
}
|
||||
|
||||
int ParticipantDeviceListModel::count(){
|
||||
return mList.count();
|
||||
}
|
||||
|
||||
void ParticipantDeviceListModel::updateDevices(std::shared_ptr<linphone::Participant> participant){
|
||||
std::list<std::shared_ptr<linphone::ParticipantDevice>> devices = participant->getDevices() ;
|
||||
beginResetModel();
|
||||
mList.clear();
|
||||
for(auto device : devices){
|
||||
auto deviceModel = std::make_shared<ParticipantDeviceModel>(device);
|
||||
connect(this, &ParticipantDeviceListModel::securityLevelChanged, deviceModel.get(), &ParticipantDeviceModel::onSecurityLevelChanged);
|
||||
mList << deviceModel;
|
||||
}
|
||||
endResetModel();
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> ParticipantDeviceListModel::roleNames () const {
|
||||
QHash<int, QByteArray> roles;
|
||||
roles[Qt::DisplayRole] = "$participantDevice";
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ public:
|
|||
ParticipantDeviceListModel (std::shared_ptr<linphone::Participant> participant, QObject *parent = nullptr);
|
||||
|
||||
int rowCount (const QModelIndex &index = QModelIndex()) const override;
|
||||
int count();
|
||||
|
||||
void updateDevices(std::shared_ptr<linphone::Participant> participant);
|
||||
|
||||
virtual QHash<int, QByteArray> roleNames () const override;
|
||||
virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@ bool ParticipantListModel::removeRows (int row, int count, const QModelIndex &pa
|
|||
void ParticipantListModel::updateParticipants () {
|
||||
if( mChatRoomModel) {
|
||||
bool changed = false;
|
||||
CoreManager *coreManager = CoreManager::getInstance();
|
||||
auto dbParticipants = mChatRoomModel->getChatRoom()->getParticipants();
|
||||
auto me = mChatRoomModel->getChatRoom()->getMe();
|
||||
dbParticipants.push_front(me);
|
||||
|
|
|
|||
|
|
@ -52,8 +52,12 @@ int ParticipantModel::getSecurityLevel() const{
|
|||
return (mParticipant ? (int)mParticipant->getSecurityLevel() : 0);
|
||||
}
|
||||
|
||||
int ParticipantModel::getDeviceCount() const{
|
||||
return (mParticipant ? mParticipant->getDevices().size() : 0);
|
||||
int ParticipantModel::getDeviceCount(){
|
||||
int count = (mParticipant ? mParticipant->getDevices().size() : 0);
|
||||
if(mParticipant && count != mParticipantDevices->count()){
|
||||
mParticipantDevices->updateDevices(mParticipant);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
bool ParticipantModel::getInviting() const{
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public:
|
|||
bool getAdminStatus() const;
|
||||
bool isFocus() const;
|
||||
int getSecurityLevel() const;
|
||||
int getDeviceCount() const;
|
||||
int getDeviceCount();
|
||||
bool getInviting() const;
|
||||
|
||||
void setSipAddress(const QString& address);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue