mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-27 16:59:21 +00:00
feat(ui/views/App/Calls/ConferenceManager): in progress
This commit is contained in:
parent
6dc58b7b32
commit
06ff2410d7
11 changed files with 148 additions and 10 deletions
|
|
@ -109,6 +109,7 @@ set(SOURCES
|
|||
src/components/codecs/VideoCodecsModel.cpp
|
||||
src/components/conference/ConferenceAddModel.cpp
|
||||
src/components/conference/ConferenceHelperModel.cpp
|
||||
src/components/conference/ConferenceModel.cpp
|
||||
src/components/contact/ContactModel.cpp
|
||||
src/components/contact/VcardModel.cpp
|
||||
src/components/contacts/ContactsListModel.cpp
|
||||
|
|
@ -153,6 +154,7 @@ set(HEADERS
|
|||
src/components/Components.hpp
|
||||
src/components/conference/ConferenceAddModel.hpp
|
||||
src/components/conference/ConferenceHelperModel.hpp
|
||||
src/components/conference/ConferenceModel.hpp
|
||||
src/components/contact/ContactModel.hpp
|
||||
src/components/contact/VcardModel.hpp
|
||||
src/components/contacts/ContactsListModel.hpp
|
||||
|
|
|
|||
|
|
@ -349,6 +349,7 @@ void App::registerTypes () {
|
|||
registerType<ChatModel>("ChatModel");
|
||||
registerType<ChatProxyModel>("ChatProxyModel");
|
||||
registerType<ConferenceHelperModel>("ConferenceHelperModel");
|
||||
registerType<ConferenceModel>("ConferenceModel");
|
||||
registerType<ContactsListProxyModel>("ContactsListProxyModel");
|
||||
registerType<SipAddressesProxyModel>("SipAddressesProxyModel");
|
||||
registerType<SoundPlayer>("SoundPlayer");
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ CallModel::CallModel (shared_ptr<linphone::Call> call) {
|
|||
mCall = call;
|
||||
mCall->setData("call-model", *this);
|
||||
|
||||
updateIsInConference();
|
||||
|
||||
// Deal with auto-answer.
|
||||
{
|
||||
SettingsModel *settings = CoreManager::getInstance()->getSettingsModel();
|
||||
|
|
@ -254,7 +256,7 @@ void CallModel::handleCallStateChanged (const shared_ptr<linphone::Call> &call,
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
void CallModel::updateIsInConference () {
|
||||
if (mIsInConference != !!mCall->getConference()) {
|
||||
if (mIsInConference != mCall->getParams()->getLocalConferenceMode()) {
|
||||
mIsInConference = !mIsInConference;
|
||||
emit isInConferenceChanged(mIsInConference);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <linphone++/linphone.hh>
|
||||
#include <QObject>
|
||||
|
||||
#include <QDebug>
|
||||
// =============================================================================
|
||||
|
||||
class CallModel : public QObject {
|
||||
|
|
@ -115,6 +115,7 @@ private:
|
|||
}
|
||||
|
||||
bool isInConference () const {
|
||||
qDebug() << "toto" << mIsInConference;
|
||||
return mIsInConference;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,10 @@ ConferenceHelperModel::ConferenceAddModel::ConferenceAddModel (QObject *parent)
|
|||
this, &ConferenceAddModel::handleDataChanged
|
||||
);
|
||||
|
||||
for (auto &participant : coreManager->getCore()->getConference()->getParticipants())
|
||||
addToConference(participant);
|
||||
for (const auto &call : coreManager->getCore()->getCalls()) {
|
||||
if (call->getParams()->getLocalConferenceMode())
|
||||
addToConference(call->getRemoteAddress());
|
||||
}
|
||||
}
|
||||
|
||||
int ConferenceHelperModel::ConferenceAddModel::rowCount (const QModelIndex &) const {
|
||||
|
|
@ -68,6 +70,22 @@ QVariant ConferenceHelperModel::ConferenceAddModel::data (const QModelIndex &ind
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool ConferenceHelperModel::ConferenceAddModel::addToConference (const shared_ptr<const linphone::Address> &linphoneAddress) {
|
||||
const QString &sipAddress = ::Utils::linphoneStringToQString(linphoneAddress->asStringUriOnly());
|
||||
if (mSipAddresses.contains(sipAddress))
|
||||
return false;
|
||||
|
||||
int row = rowCount();
|
||||
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
addToConferencePrivate(linphoneAddress->clone());
|
||||
endInsertRows();
|
||||
|
||||
mConferenceHelperModel->invalidate();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConferenceHelperModel::ConferenceAddModel::addToConference (const QString &sipAddress) {
|
||||
if (mSipAddresses.contains(sipAddress))
|
||||
return false;
|
||||
|
|
@ -80,7 +98,7 @@ bool ConferenceHelperModel::ConferenceAddModel::addToConference (const QString &
|
|||
shared_ptr<linphone::Address> linphoneAddress = CoreManager::getInstance()->getCore()->interpretUrl(
|
||||
::Utils::qStringToLinphoneString(sipAddress)
|
||||
);
|
||||
addToConference(linphoneAddress);
|
||||
addToConferencePrivate(linphoneAddress);
|
||||
|
||||
endInsertRows();
|
||||
|
||||
|
|
@ -120,7 +138,19 @@ void ConferenceHelperModel::ConferenceAddModel::update () {
|
|||
linphoneAddresses.push_back(linphoneAddress);
|
||||
}
|
||||
|
||||
mConferenceHelperModel->mConference->inviteParticipants(
|
||||
shared_ptr<linphone::Conference> conference = mConferenceHelperModel->mConference;
|
||||
|
||||
// Remove sip addresses if necessary.
|
||||
for (const auto &call : CoreManager::getInstance()->getCore()->getCalls()) {
|
||||
if (!call->getParams()->getLocalConferenceMode())
|
||||
continue;
|
||||
|
||||
const QString &sipAddress = ::Utils::linphoneStringToQString(call->getRemoteAddress()->asStringUriOnly());
|
||||
if (!mSipAddresses.contains(sipAddress))
|
||||
call->terminate();
|
||||
}
|
||||
|
||||
conference->inviteParticipants(
|
||||
linphoneAddresses,
|
||||
CoreManager::getInstance()->getCore()->createCallParams(nullptr)
|
||||
);
|
||||
|
|
@ -128,7 +158,7 @@ void ConferenceHelperModel::ConferenceAddModel::update () {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ConferenceHelperModel::ConferenceAddModel::addToConference (const shared_ptr<linphone::Address> &linphoneAddress) {
|
||||
void ConferenceHelperModel::ConferenceAddModel::addToConferencePrivate (const shared_ptr<linphone::Address> &linphoneAddress) {
|
||||
QString sipAddress = ::Utils::linphoneStringToQString(linphoneAddress->asStringUriOnly());
|
||||
QVariantMap map = CoreManager::getInstance()->getSipAddressesModel()->find(sipAddress);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@
|
|||
#include <memory>
|
||||
|
||||
#include "ConferenceHelperModel.hpp"
|
||||
#include "ConferenceModel.hpp"
|
||||
|
||||
// =============================================================================
|
||||
// Sip addresses list to add to conference.
|
||||
// =============================================================================
|
||||
|
||||
namespace linphone {
|
||||
|
|
@ -45,6 +48,8 @@ public:
|
|||
QHash<int, QByteArray> roleNames () const override;
|
||||
QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
bool addToConference (const std::shared_ptr<const linphone::Address> &linphoneAddress);
|
||||
|
||||
Q_INVOKABLE bool addToConference (const QString &sipAddress);
|
||||
Q_INVOKABLE bool removeFromConference (const QString &sipAddress);
|
||||
|
||||
|
|
@ -55,7 +60,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void addToConference (const std::shared_ptr<linphone::Address> &linphoneAddress);
|
||||
void addToConferencePrivate (const std::shared_ptr<linphone::Address> &linphoneAddress);
|
||||
|
||||
void handleDataChanged (
|
||||
const QModelIndex &topLeft,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
// =============================================================================
|
||||
// Sip addresses not in conference.
|
||||
// Can filter the sip addresses with a pattern.
|
||||
// =============================================================================
|
||||
|
||||
class CallModel;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* ConferenceModel.cpp
|
||||
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
||||
*
|
||||
* 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 2
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Created on: May 23, 2017
|
||||
* Author: Ronan Abhamon
|
||||
*/
|
||||
|
||||
#include "ConferenceModel.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
ConferenceModel::ConferenceModel (QObject *parent) : QAbstractListModel(parent) {}
|
||||
|
||||
int ConferenceModel::rowCount (const QModelIndex &index) const {
|
||||
return mSipAddresses.count();
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> ConferenceModel::roleNames () const {
|
||||
QHash<int, QByteArray> roles;
|
||||
roles[Qt::DisplayRole] = "$sipAddress";
|
||||
return roles;
|
||||
}
|
||||
|
||||
QVariant ConferenceModel::data (const QModelIndex &index, int role) const {
|
||||
int row = index.row();
|
||||
|
||||
if (!index.isValid() || row < 0 || row >= mSipAddresses.count())
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::DisplayRole)
|
||||
return mSipAddresses[row];
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* ConferenceModel.hpp
|
||||
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
||||
*
|
||||
* 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 2
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Created on: May 23, 2017
|
||||
* Author: Ronan Abhamon
|
||||
*/
|
||||
|
||||
#ifndef CONFERENCE_MODEL_H_
|
||||
#define CONFERENCE_MODEL_H_
|
||||
|
||||
#include <QAbstractListModel>
|
||||
|
||||
// =============================================================================
|
||||
|
||||
class ConferenceModel : public QAbstractListModel {
|
||||
public:
|
||||
ConferenceModel (QObject *parent = Q_NULLPTR);
|
||||
~ConferenceModel () = default;
|
||||
|
||||
int rowCount (const QModelIndex &index = QModelIndex()) const override;
|
||||
|
||||
QHash<int, QByteArray> roleNames () const override;
|
||||
QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
private:
|
||||
QStringList mSipAddresses;
|
||||
};
|
||||
|
||||
#endif // CONFERENCE_MODEL_H_
|
||||
|
|
@ -136,7 +136,7 @@ ListView {
|
|||
readonly property var params: Logic.getParams($call)
|
||||
|
||||
anchors.centerIn: parent
|
||||
sourceComponent: params.component
|
||||
sourceComponent: params ? params.component : null
|
||||
}
|
||||
|
||||
SequentialAnimation on color {
|
||||
|
|
|
|||
|
|
@ -19,9 +19,10 @@ Window {
|
|||
|
||||
// `{}` is a workaround to avoid `TypeError: Cannot read property...`.
|
||||
property var call: calls.selectedCall || ({
|
||||
callError: '',
|
||||
isOutgoing: true,
|
||||
sipAddress: '',
|
||||
recording: false,
|
||||
sipAddress: '',
|
||||
updating: true,
|
||||
videoEnabled: false
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue