diff --git a/linphone-app/CMakeLists.txt b/linphone-app/CMakeLists.txt
index 736093fdc..7ad44bf11 100644
--- a/linphone-app/CMakeLists.txt
+++ b/linphone-app/CMakeLists.txt
@@ -142,6 +142,7 @@ set(SOURCES
src/app/providers/ExternalImageProvider.cpp
src/app/providers/ThumbnailProvider.cpp
src/app/proxyModel/ProxyListModel.cpp
+ src/app/proxyModel/SortFilterProxyModel.cpp
#src/app/proxyModel/ProxyMapModel.cpp
#src/app/proxyModel/ProxyModel.cpp
src/app/translator/DefaultTranslator.cpp
@@ -167,13 +168,16 @@ set(SOURCES
src/components/codecs/VideoCodecsModel.cpp
src/components/conference/ConferenceAddModel.cpp
src/components/conference/ConferenceHelperModel.cpp
+ src/components/conference/ConferenceListener.cpp
src/components/conference/ConferenceModel.cpp
src/components/conference/ConferenceProxyModel.cpp
src/components/conferenceInfo/ConferenceInfoModel.cpp
src/components/conferenceInfo/ConferenceInfoListModel.cpp
src/components/conferenceInfo/ConferenceInfoMapModel.cpp
+ src/components/conferenceInfo/ConferenceInfoProxyListModel.cpp
src/components/conferenceInfo/ConferenceInfoProxyModel.cpp
- src/components/conferenceScheduler/ConferenceSchedulerHandler.cpp
+ src/components/conferenceScheduler/ConferenceScheduler.cpp
+ src/components/conferenceScheduler/ConferenceSchedulerListener.cpp
src/components/contact/ContactModel.cpp
src/components/contact/VcardModel.cpp
src/components/contacts/ContactsImporterModel.cpp
@@ -220,7 +224,7 @@ set(SOURCES
src/components/presence/Presence.cpp
src/components/recorder/RecorderManager.cpp
src/components/recorder/RecorderModel.cpp
- src/components/search/SearchHandler.cpp
+ src/components/search/SearchListener.cpp
src/components/search/SearchResultModel.cpp
src/components/search/SearchSipAddressesModel.cpp
src/components/search/SearchSipAddressesProxyModel.cpp
@@ -263,7 +267,12 @@ set(HEADERS
src/app/providers/ImageProvider.hpp
src/app/providers/ExternalImageProvider.hpp
src/app/providers/ThumbnailProvider.hpp
+ src/app/proxyModel/ProxyAbstractListModel.hpp
+ src/app/proxyModel/ProxyAbstractMapModel.hpp
+ src/app/proxyModel/ProxyAbstractObject.hpp
src/app/proxyModel/ProxyListModel.hpp
+ src/app/proxyModel/SortFilterAbstractProxyModel.hpp
+ src/app/proxyModel/SortFilterProxyModel.hpp
#src/app/proxyModel/ProxyMapModel.hpp
#src/app/proxyModel/ProxyModel.hpp
src/app/single-application/SingleApplication.hpp
@@ -291,13 +300,16 @@ set(HEADERS
src/components/Components.hpp
src/components/conference/ConferenceAddModel.hpp
src/components/conference/ConferenceHelperModel.hpp
+ src/components/conference/ConferenceListener.hpp
src/components/conference/ConferenceModel.hpp
src/components/conference/ConferenceProxyModel.hpp
src/components/conferenceInfo/ConferenceInfoModel.hpp
src/components/conferenceInfo/ConferenceInfoListModel.hpp
src/components/conferenceInfo/ConferenceInfoMapModel.hpp
+ src/components/conferenceInfo/ConferenceInfoProxyListModel.hpp
src/components/conferenceInfo/ConferenceInfoProxyModel.hpp
- src/components/conferenceScheduler/ConferenceSchedulerHandler.hpp
+ src/components/conferenceScheduler/ConferenceScheduler.hpp
+ src/components/conferenceScheduler/ConferenceSchedulerListener.hpp
src/components/contact/ContactModel.hpp
src/components/contact/VcardModel.hpp
src/components/contacts/ContactsImporterModel.hpp
@@ -345,7 +357,7 @@ set(HEADERS
src/components/presence/Presence.hpp
src/components/recorder/RecorderManager.hpp
src/components/recorder/RecorderModel.hpp
- src/components/search/SearchHandler.hpp
+ src/components/search/SearchListener.hpp
src/components/search/SearchResultModel.hpp
src/components/search/SearchSipAddressesModel.hpp
src/components/search/SearchSipAddressesProxyModel.hpp
diff --git a/linphone-app/assets/images/camera_preview_custom.svg b/linphone-app/assets/images/camera_preview_custom.svg
new file mode 100644
index 000000000..2e4d5e068
--- /dev/null
+++ b/linphone-app/assets/images/camera_preview_custom.svg
@@ -0,0 +1,44 @@
+
+
diff --git a/linphone-app/resources.qrc b/linphone-app/resources.qrc
index 5e987a2ab..6fab7e243 100644
--- a/linphone-app/resources.qrc
+++ b/linphone-app/resources.qrc
@@ -29,6 +29,7 @@
assets/images/call_sign_paused.svg
assets/images/camera_off_custom.svg
assets/images/camera_on_custom.svg
+ assets/images/camera_preview_custom.svg
assets/images/cancel_custom.svg
assets/images/chat_custom.svg
assets/images/chat_amount.svg
diff --git a/linphone-app/src/app/App.cpp b/linphone-app/src/app/App.cpp
index d4203b3cb..c6c718200 100644
--- a/linphone-app/src/app/App.cpp
+++ b/linphone-app/src/app/App.cpp
@@ -237,6 +237,7 @@ App::~App () {
qInfo() << QStringLiteral("Destroying app...");
if( mEngine )
delete mEngine;
+ CoreManager::uninit();
processEvents(QEventLoop::AllEvents); // Process all needed events on engine deletion.
if( mParser)
delete mParser;
diff --git a/linphone-app/src/app/main.cpp b/linphone-app/src/app/main.cpp
index 7481ec706..a6e5b5b40 100644
--- a/linphone-app/src/app/main.cpp
+++ b/linphone-app/src/app/main.cpp
@@ -75,9 +75,11 @@ int main (int argc, char *argv[]) {
ret = app->exec();
} while (ret == App::RestartCode);
controller.stopApp(); // Stopping app before core to let time to GUI to process needed items from linphone.
- auto core = CoreManager::getInstance()->getCore();
- if(core && core->getGlobalState() == linphone::GlobalState::On)
- core->stop();
+ if( CoreManager::getInstance()){
+ auto core = CoreManager::getInstance()->getCore();
+ if(core && core->getGlobalState() == linphone::GlobalState::On)
+ core->stop();
+ }
cleanStream();
return ret;
}
diff --git a/linphone-app/src/app/proxyModel/ProxyAbstractListModel.hpp b/linphone-app/src/app/proxyModel/ProxyAbstractListModel.hpp
new file mode 100644
index 000000000..92ccfa493
--- /dev/null
+++ b/linphone-app/src/app/proxyModel/ProxyAbstractListModel.hpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2022 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 PROXY_ABSTRACT_LIST_MODEL_H_
+#define PROXY_ABSTRACT_LIST_MODEL_H_
+
+#include
+#include
+
+#include "ProxyAbstractObject.hpp"
+
+template
+class ProxyAbstractListModel : public ProxyAbstractObject {
+public:
+
+ ProxyAbstractListModel (QObject *parent = Q_NULLPTR) : ProxyAbstractObject(parent) {}
+
+ virtual ~ProxyAbstractListModel(){
+ resetData();
+ }
+
+ virtual int rowCount (const QModelIndex &index = QModelIndex()) const override{
+ return mList.count();
+ }
+
+
+ virtual QHash roleNames () const override {
+ QHash roles;
+ roles[Qt::DisplayRole] = "$modelData";
+ return roles;
+ }
+ virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override{
+ int row = index.row();
+ if (!index.isValid() || row < 0 || row >= mList.count())
+ return QVariant();
+ if (role == Qt::DisplayRole)
+ return QVariant::fromValue(mList[row]);
+ return QVariant();
+ }
+
+ virtual T getAt(const int& index) const{
+ return mList[index];
+ }
+
+// Add functions
+ virtual void add(T item){
+ int row = mList.count();
+ beginInsertRows(QModelIndex(), row, row);
+ mList << item;
+ endInsertRows();
+ }
+
+ virtual void prepend(T item){
+ beginInsertRows(QModelIndex(), 0, 0);
+ mList.prepend(item);
+ endInsertRows();
+ }
+
+ virtual void prepend(QList items){
+ beginInsertRows(QModelIndex(), 0, items.size()-1);
+ items << mList;
+ mList = items;
+ endInsertRows();
+ }
+
+// Remove functions
+ virtual bool removeRow (int row, const QModelIndex &parent = QModelIndex()){
+ return removeRows(row, 1, parent);
+ }
+ virtual bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()) override{
+ int limit = row + count - 1;
+ if (row < 0 || count < 0 || limit >= mList.count())
+ return false;
+ beginRemoveRows(parent, row, limit);
+ for (int i = 0; i < count; ++i)
+ mList.takeAt(row);
+ endRemoveRows();
+ return true;
+ }
+
+ virtual void resetData(){
+ beginResetModel();
+ mList.clear();
+ endResetModel();
+ }
+
+protected:
+ QList mList;
+};
+
+#endif
diff --git a/linphone-app/src/app/proxyModel/ProxyAbstractMapModel.hpp b/linphone-app/src/app/proxyModel/ProxyAbstractMapModel.hpp
new file mode 100644
index 000000000..e14686cc9
--- /dev/null
+++ b/linphone-app/src/app/proxyModel/ProxyAbstractMapModel.hpp
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2022 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 PROXY_ABSTRACT_MAP_MODEL_H_
+#define PROXY_ABSTRACT_MAP_MODEL_H_
+
+#include
+
+#include "ProxyAbstractObject.hpp"
+
+template
+class ProxyAbstractMapModel : public ProxyAbstractObject {
+public:
+
+ ProxyAbstractMapModel (QObject *parent = Q_NULLPTR) : ProxyAbstractObject(parent) {}
+
+ virtual ~ProxyAbstractMapModel(){
+ resetData();
+ }
+
+ virtual int rowCount (const QModelIndex &index = QModelIndex()) const override{
+ return mMappedList.count();
+ }
+
+
+ virtual QHash roleNames () const override {
+ QHash roles;
+ roles[Qt::DisplayRole] = "$modelData";
+ roles[Qt::DisplayRole+1] = "$modelKey";
+ return roles;
+ }
+ virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override{
+ int row = index.row();
+ auto it = mMappedList.begin() + row;
+ if (role == Qt::DisplayRole)
+ return QVariant::fromValue(*it);
+ else if( role == Qt::DisplayRole+1)
+ return QVariant::fromValue(it.key());
+
+ return QVariant();
+ }
+
+ /*
+ virtual Y getAt(const int& index) const{
+
+ mList.
+ return mList[index];
+ }*/
+
+// Add functions
+/*
+ virtual void add(T item){
+ int row = mList.count();
+ beginInsertRows(QModelIndex(), row, row);
+ mList << item;
+ endInsertRows();
+ }
+
+ virtual void prepend(T item){
+ beginInsertRows(QModelIndex(), 0, 0);
+ mList.prepend(item);
+ endInsertRows();
+ }
+
+ virtual void prepend(QList items){
+ beginInsertRows(QModelIndex(), 0, items.size()-1);
+ items << mList;
+ mList = items;
+ endInsertRows();
+ }
+
+// Remove functions
+ virtual bool removeRow (int row, const QModelIndex &parent = QModelIndex()){
+ return removeRows(row, 1, parent);
+ }
+ virtual bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()) override{
+ int limit = row + count - 1;
+ if (row < 0 || count < 0 || limit >= mList.count())
+ return false;
+ beginRemoveRows(parent, row, limit);
+ for (int i = 0; i < count; ++i)
+ mList.takeAt(row);
+ endRemoveRows();
+ return true;
+ }
+ */
+ virtual void resetData(){
+ beginResetModel();
+ mMappedList.clear();
+ endResetModel();
+ }
+
+protected:
+ QMap mMappedList;
+};
+
+#endif
diff --git a/linphone-app/src/app/proxyModel/ProxyAbstractObject.hpp b/linphone-app/src/app/proxyModel/ProxyAbstractObject.hpp
new file mode 100644
index 000000000..fc7f0dd46
--- /dev/null
+++ b/linphone-app/src/app/proxyModel/ProxyAbstractObject.hpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2022 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 PROXY_ABSTRACT_OBJECT_H_
+#define PROXY_ABSTRACT_OBJECT_H_
+
+#include
+#include
+
+// Use a regular declaration for Qt signal/slots handling
+class ProxyAbstractObject : public QAbstractListModel{
+ Q_OBJECT
+public:
+ Q_PROPERTY(int count READ getCount NOTIFY countChanged)
+
+ ProxyAbstractObject(QObject * parent = nullptr) : QAbstractListModel(parent){
+ connect(this, &ProxyAbstractObject::rowsInserted, this, &ProxyAbstractObject::countChanged);
+ connect(this, &ProxyAbstractObject::rowsRemoved, this, &ProxyAbstractObject::countChanged);
+ }
+ Q_INVOKABLE virtual int getCount() const{
+ return rowCount();
+ }
+ Q_INVOKABLE virtual bool remove(QObject *itemToRemove){return false;}
+ Q_INVOKABLE virtual void resetData(){}
+
+signals:
+ void countChanged();
+};
+
+#endif
diff --git a/linphone-app/src/app/proxyModel/ProxyListModel.cpp b/linphone-app/src/app/proxyModel/ProxyListModel.cpp
index e3963fa06..4161922e2 100644
--- a/linphone-app/src/app/proxyModel/ProxyListModel.cpp
+++ b/linphone-app/src/app/proxyModel/ProxyListModel.cpp
@@ -24,45 +24,10 @@
// =============================================================================
-ProxyListModel::ProxyListModel (QObject *parent) : QAbstractListModel(parent) {
- connect(this, &ProxyListModel::rowsInserted, this, &ProxyListModel::countChanged);
- connect(this, &ProxyListModel::rowsRemoved, this, &ProxyListModel::countChanged);
+ProxyListModel::ProxyListModel (QObject *parent) : ProxyAbstractListModel(parent) {
}
ProxyListModel::~ProxyListModel(){
- beginResetModel();
- mList.clear();
- endResetModel();
-}
-
-int ProxyListModel::rowCount (const QModelIndex &) const {
- return mList.count();
-}
-
-int ProxyListModel::getCount() const{
- return rowCount();
-}
-
-QHash ProxyListModel::roleNames () const {
- QHash roles;
- roles[Qt::DisplayRole] = "$modelData";
- return roles;
-}
-
-QVariant ProxyListModel::data (const QModelIndex &index, int role) const {
- int row = index.row();
-
- if (!index.isValid() || row < 0 || row >= mList.count())
- return QVariant();
-
- if (role == Qt::DisplayRole)
- return QVariant::fromValue(mList[row].get());
-
- return QVariant();
-}
-
-QSharedPointer ProxyListModel::getAt(const int& index) const{
- return mList[index];
}
QSharedPointer ProxyListModel::get(QObject * itemToGet, int * index) const{
@@ -78,25 +43,7 @@ QSharedPointer ProxyListModel::get(QObject * itemToGet, int * index) co
}
// -----------------------------------------------------------------------------
-
-void ProxyListModel::add(QSharedPointer item){
- int row = mList.count();
- beginInsertRows(QModelIndex(), row, row);
- mList << item;
- endInsertRows();
-}
-
-void ProxyListModel::prepend(QSharedPointer item){
- mList.prepend(item);
-}
-
-void ProxyListModel::prepend(QList> items){
- beginInsertRows(QModelIndex(), 0, items.size()-1);
- items << mList;
- mList = items;
- endInsertRows();
-}
-
+/*
bool ProxyListModel::remove(QObject *itemToRemove) {
bool removed = false;
qInfo() << QStringLiteral("Removing ") << itemToRemove->metaObject()->className() << QStringLiteral(" : ") << itemToRemove;
@@ -110,35 +57,6 @@ bool ProxyListModel::remove(QObject *itemToRemove) {
if( !removed)
qWarning() << QStringLiteral("Unable to remove ") << itemToRemove->metaObject()->className() << QStringLiteral(" : ") << itemToRemove;
return removed;
-}
+}*/
-bool ProxyListModel::remove(QSharedPointer itemToRemove){
- return remove(itemToRemove.get());
-}
-
-bool ProxyListModel::removeRow (int row, const QModelIndex &parent) {
- return removeRows(row, 1, parent);
-}
-
-bool ProxyListModel::removeRows (int row, int count, const QModelIndex &parent) {
- int limit = row + count - 1;
-
- if (row < 0 || count < 0 || limit >= mList.count())
- return false;
-
- beginRemoveRows(parent, row, limit);
-
- for (int i = 0; i < count; ++i)
- mList.takeAt(row);
-
- endRemoveRows();
-
- return true;
-}
-
-void ProxyListModel::resetData(){
- beginResetModel();
- mList.clear();
- endResetModel();
-}
// -----------------------------------------------------------------------------
diff --git a/linphone-app/src/app/proxyModel/ProxyListModel.hpp b/linphone-app/src/app/proxyModel/ProxyListModel.hpp
index 3e0d379b4..fb4c83380 100644
--- a/linphone-app/src/app/proxyModel/ProxyListModel.hpp
+++ b/linphone-app/src/app/proxyModel/ProxyListModel.hpp
@@ -22,12 +22,12 @@
#define _PROXY_LIST_MODEL_H_
-#include
+#include "ProxyAbstractListModel.hpp"
#include
// =============================================================================
-class ProxyListModel : public QAbstractListModel {
+class ProxyListModel : public ProxyAbstractListModel> {
Q_OBJECT
public:
@@ -35,16 +35,9 @@ public:
ProxyListModel (QObject *parent = Q_NULLPTR);
virtual ~ProxyListModel();
- virtual int rowCount (const QModelIndex &index = QModelIndex()) const override;
- Q_INVOKABLE int getCount() const;
-
- virtual QHash roleNames () const override;
- virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
-
- QSharedPointer getAt(const int& index) const;
template
QSharedPointer getAt(const int& index) const{
- return getAt(index).objectCast();
+ return ProxyAbstractListModel>::getAt(index).objectCast();
}
QSharedPointer get(QObject * itemToGet, int * index = nullptr) const;
@@ -57,20 +50,24 @@ public:
return newList;
}
// Add functions
- virtual void add(QSharedPointer item);
+ virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override{
+ int row = index.row();
+ if (!index.isValid() || row < 0 || row >= mList.count())
+ return QVariant();
+ if (role == Qt::DisplayRole)
+ return QVariant::fromValue(mList[row].get());
+ return QVariant();
+ }
template
void add(QSharedPointer item){
- add(item.template objectCast());
+ ProxyAbstractListModel>::add(item.template objectCast());
}
- //virtual void add(QList> item);
- virtual void prepend(QSharedPointer item);
template
void prepend(QSharedPointer item){
- prepend(item.template objectCast());
+ ProxyAbstractListModel>::prepend(item.template objectCast());
}
- virtual void prepend(QList> items);
template
void prepend(QList> items){
beginInsertRows(QModelIndex(), 0, items.size()-1);
@@ -78,23 +75,24 @@ public:
mList = items;
endInsertRows();
}
-
-// Remove functions
- Q_INVOKABLE virtual bool remove(QObject *itemToRemove) ;
- virtual bool remove(QSharedPointer itemToRemove) ;
-
- virtual bool removeRow (int row, const QModelIndex &parent = QModelIndex());
- virtual bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()) override;
-
-
- Q_INVOKABLE virtual void resetData();
-
-signals:
- void countChanged();
-
-protected:
- QList> mList;
+ virtual bool remove(QObject *itemToRemove) override{
+ bool removed = false;
+ qInfo() << QStringLiteral("Removing ") << itemToRemove->metaObject()->className() << QStringLiteral(" : ") << itemToRemove;
+ int index = 0;
+ for(auto item : mList)
+ if( item == itemToRemove) {
+ removed = removeRow(index);
+ break;
+ }else
+ ++index;
+ if( !removed)
+ qWarning() << QStringLiteral("Unable to remove ") << itemToRemove->metaObject()->className() << QStringLiteral(" : ") << itemToRemove;
+ return removed;
+ }
+ virtual bool remove(QSharedPointer itemToRemove){
+ return remove(itemToRemove.get());
+ }
};
#endif
diff --git a/linphone-app/src/app/proxyModel/ProxyMapModel.cpp b/linphone-app/src/app/proxyModel/ProxyMapModel.cpp
deleted file mode 100644
index cdc3c0519..000000000
--- a/linphone-app/src/app/proxyModel/ProxyMapModel.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 .
- */
-
-#include "ConferenceInfoMapModel.hpp"
-
-#include
-#include
-#include
-
-#include "app/App.hpp"
-#include "components/conference/ConferenceAddModel.hpp"
-#include "components/conference/ConferenceHelperModel.hpp"
-#include "components/core/CoreHandlers.hpp"
-#include "components/core/CoreManager.hpp"
-#include "components/settings/SettingsModel.hpp"
-#include "utils/Utils.hpp"
-
-#include "ConferenceInfoProxyModel.hpp"
-#include "ConferenceInfoListModel.hpp"
-#include "ConferenceInfoModel.hpp"
-
-// =============================================================================
-
-ConferenceInfoMapModel::ConferenceInfoMapModel (QObject *parent) : QAbstractListModel(parent) {
- auto conferenceInfos = CoreManager::getInstance()->getCore()->getConferenceInformationList();
- auto me = CoreManager::getInstance()->getCore()->getDefaultAccount()->getParams()->getIdentityAddress();
- for(auto conferenceInfo : conferenceInfos){
- std::list> participants = conferenceInfo->getParticipants();
- bool haveMe = conferenceInfo->getOrganizer()->weakEqual(me);
- if(!haveMe)
- haveMe = (std::find_if(participants.begin(), participants.end(), [me](const std::shared_ptr& address){
- return me->weakEqual(address);
- }) != participants.end());
- if(haveMe){
- auto conferenceInfoModel = ConferenceInfoModel::create( conferenceInfo );
- QDate t = conferenceInfoModel->getDateTime().date();
- if( !mMappedList.contains(t))
- mMappedList[t] = new ConferenceInfoProxyModel(new ConferenceInfoListModel(), this);
- mMappedList[t]->add(conferenceInfoModel);
- }
- }
-}
-
-int ConferenceInfoMapModel::rowCount (const QModelIndex &) const {
- return mMappedList.size();
-}
-
-QHash ConferenceInfoMapModel::roleNames () const {
- QHash roles;
- roles[Qt::DisplayRole] = "$modelData";
- roles[Qt::DisplayRole + 1] = "date";
- return roles;
-}
-
-QVariant ConferenceInfoMapModel::data (const QModelIndex &index, int role) const {
- int row = index.row();
-
- if (!index.isValid() || row < 0 || row >= mMappedList.size())
- return QVariant();
- auto it = mMappedList.begin() + row;
-
- if (role == Qt::DisplayRole)
- return QVariant::fromValue(*it);
- else if( role == Qt::DisplayRole+1)
- return QVariant::fromValue(it.key());
-
- return QVariant();
-}
-
-// -----------------------------------------------------------------------------
-
-void ConferenceInfoMapModel::setConferenceInfoFilter (int filterMode){
- for(auto list : mMappedList){
- list->setConferenceInfoFilter(filterMode);
- }
-}
\ No newline at end of file
diff --git a/linphone-app/src/app/proxyModel/SortFilterAbstractProxyModel.hpp b/linphone-app/src/app/proxyModel/SortFilterAbstractProxyModel.hpp
new file mode 100644
index 000000000..0ac2e3af3
--- /dev/null
+++ b/linphone-app/src/app/proxyModel/SortFilterAbstractProxyModel.hpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2022 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 SORT_FILTER_ABSTRACT_PROXY_MODEL_H_
+#define SORT_FILTER_ABSTRACT_PROXY_MODEL_H_
+
+#include "SortFilterProxyModel.hpp"
+
+template
+class SortFilterAbstractProxyModel : public SortFilterProxyModel {
+public:
+ SortFilterAbstractProxyModel(T * model, QObject * parent = nullptr) : SortFilterProxyModel(parent){
+ setSourceModel(model);
+ sort(0, Qt::DescendingOrder);
+ }
+
+ template
+ void add(QSharedPointer x){
+ qobject_cast(sourceModel())->add(x);
+ }
+};
+
+
+#endif
diff --git a/linphone-app/src/app/proxyModel/SortFilterProxyModel.cpp b/linphone-app/src/app/proxyModel/SortFilterProxyModel.cpp
new file mode 100644
index 000000000..99e5cda25
--- /dev/null
+++ b/linphone-app/src/app/proxyModel/SortFilterProxyModel.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2022 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 .
+ */
+
+#include "SortFilterProxyModel.hpp"
+
+SortFilterProxyModel::SortFilterProxyModel(QObject * parent) : QSortFilterProxyModel(parent){
+ mFilterType = 0;
+ connect(this, &SortFilterProxyModel::rowsInserted, this, &SortFilterProxyModel::countChanged);
+ connect(this, &SortFilterProxyModel::rowsRemoved, this, &SortFilterProxyModel::countChanged);
+}
+
+int SortFilterProxyModel::getCount() const{
+ return rowCount();
+}
+
+int SortFilterProxyModel::getFilterType () const{
+ return mFilterType;
+}
+
+void SortFilterProxyModel::setFilterType (int filterType) {
+ if (getFilterType() != filterType) {
+ mFilterType = filterType;
+ emit filterTypeChanged(filterType);
+ invalidate();
+ }
+}
+
+void SortFilterProxyModel::remove(int index, int count){
+ QSortFilterProxyModel::removeRows(index, count);
+}
diff --git a/linphone-app/src/app/proxyModel/SortFilterProxyModel.hpp b/linphone-app/src/app/proxyModel/SortFilterProxyModel.hpp
new file mode 100644
index 000000000..73ca796d8
--- /dev/null
+++ b/linphone-app/src/app/proxyModel/SortFilterProxyModel.hpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2022 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 SORT_FILTER_PROXY_MODEL_H_
+#define SORT_FILTER_PROXY_MODEL_H_
+
+#include
+
+class SortFilterProxyModel : public QSortFilterProxyModel {
+ Q_OBJECT
+public:
+ Q_PROPERTY(int count READ getCount NOTIFY countChanged)
+ Q_PROPERTY(int filterType READ getFilterType WRITE setFilterType NOTIFY filterTypeChanged)
+
+ SortFilterProxyModel(QObject * parent = nullptr);
+
+ virtual int getCount() const;
+ virtual int getFilterType () const;
+
+ virtual void setFilterType (int filterType);
+
+ Q_INVOKABLE void remove(int index, int count = 1);
+
+signals:
+ void countChanged();
+ void filterTypeChanged(int filterType);
+
+protected:
+ int mFilterType;
+};
+
+#endif
diff --git a/linphone-app/src/components/Components.hpp b/linphone-app/src/components/Components.hpp
index 800df778d..be73712a9 100644
--- a/linphone-app/src/components/Components.hpp
+++ b/linphone-app/src/components/Components.hpp
@@ -40,7 +40,7 @@
#include "conferenceInfo/ConferenceInfoModel.hpp"
#include "conferenceInfo/ConferenceInfoListModel.hpp"
#include "conferenceInfo/ConferenceInfoProxyModel.hpp"
-#include "conferenceScheduler/ConferenceSchedulerHandler.hpp"
+#include "conferenceScheduler/ConferenceScheduler.hpp"
#include "contact/ContactModel.hpp"
#include "contact/VcardModel.hpp"
#include "contacts/ContactsListModel.hpp"
diff --git a/linphone-app/src/components/call/CallModel.cpp b/linphone-app/src/components/call/CallModel.cpp
index ff0b64a2c..bbb5fddc0 100644
--- a/linphone-app/src/components/call/CallModel.cpp
+++ b/linphone-app/src/components/call/CallModel.cpp
@@ -80,7 +80,7 @@ CallModel::CallModel (shared_ptr call){
// Update fields and make a search to know to who the call belong
mMagicSearch = CoreManager::getInstance()->getCore()->createMagicSearch();
- mSearch = std::make_shared(this);
+ mSearch = std::make_shared(this);
QObject::connect(mSearch.get(), SIGNAL(searchReceived(std::list> )), this, SLOT(searchReceived(std::list>)));
mMagicSearch->addListener(mSearch);
@@ -161,9 +161,15 @@ ChatRoomModel * CallModel::getChatRoomModel() const{
return nullptr;
}
-std::shared_ptr CallModel::getConferenceModel(){
- if(mCall->getConference() && !mConferenceModel)
+ConferenceModel * CallModel::getConferenceModel(){
+ return getConferenceSharedModel().get();
+}
+
+QSharedPointer CallModel::getConferenceSharedModel(){
+ if(mCall->getConference() && !mConferenceModel){
mConferenceModel = ConferenceModel::create(mCall->getConference());
+ emit conferenceModelChanged();
+ }
return mConferenceModel;
}
diff --git a/linphone-app/src/components/call/CallModel.hpp b/linphone-app/src/components/call/CallModel.hpp
index b9cc7be88..89b997c44 100644
--- a/linphone-app/src/components/call/CallModel.hpp
+++ b/linphone-app/src/components/call/CallModel.hpp
@@ -22,8 +22,9 @@
#define CALL_MODEL_H_
#include
+#include
#include
-#include "../search/SearchHandler.hpp"
+#include "../search/SearchListener.hpp"
// =============================================================================
class ConferenceModel;
@@ -40,6 +41,7 @@ class CallModel : public QObject {
Q_PROPERTY(ContactModel *contactModel READ getContactModel CONSTANT )
Q_PROPERTY(ChatRoomModel * chatRoomModel READ getChatRoomModel CONSTANT)
+ Q_PROPERTY(ConferenceModel * conferenceModel READ getConferenceModel NOTIFY conferenceModelChanged)
Q_PROPERTY(CallStatus status READ getStatus NOTIFY statusChanged)
Q_PROPERTY(QString callError READ getCallError NOTIFY callErrorChanged)
@@ -112,7 +114,8 @@ public:
ContactModel *getContactModel() const;
ChatRoomModel * getChatRoomModel() const;
- std::shared_ptr getConferenceModel();
+ Q_INVOKABLE ConferenceModel* getConferenceModel();
+ QSharedPointer getConferenceSharedModel();
bool isInConference () const {
return mIsInConference;
@@ -174,6 +177,7 @@ public slots:
signals:
void callErrorChanged (const QString &callError);
void isInConferenceChanged (bool status);
+ void conferenceModelChanged();
void speakerMutedChanged (bool status);
void microMutedChanged (bool status);
void recordingChanged (bool status);
@@ -270,9 +274,9 @@ private:
QVariantList mAudioStats;
QVariantList mVideoStats;
- std::shared_ptr mSearch;
+ std::shared_ptr mSearch;
QString mTransferAddress;
- std::shared_ptr mConferenceModel;
+ QSharedPointer mConferenceModel;
};
#endif // CALL_MODEL_H_
diff --git a/linphone-app/src/components/calls/CallsListModel.cpp b/linphone-app/src/components/calls/CallsListModel.cpp
index bab0d871d..691e7db5e 100644
--- a/linphone-app/src/components/calls/CallsListModel.cpp
+++ b/linphone-app/src/components/calls/CallsListModel.cpp
@@ -183,6 +183,8 @@ void CallsListModel::launchVideoCall (const QString &sipAddress, const QString&
shared_ptr params = core->createCallParams(nullptr);
params->enableVideo(true);
+ params->setVideoDirection(linphone::MediaDirection::SendRecv);
+ params->setConferenceVideoLayout(linphone::ConferenceLayout::Grid);
params->setAccount(core->getDefaultAccount());
CallModel::setRecordFile(params, Utils::coreStringToAppString(address->getUsername()));
CallModel::prepareTransfert(core->inviteAddressWithParams(address, params), prepareTransfertAddress);
diff --git a/linphone-app/src/components/calls/CallsListModel.hpp b/linphone-app/src/components/calls/CallsListModel.hpp
index a0fba1517..78406bc07 100644
--- a/linphone-app/src/components/calls/CallsListModel.hpp
+++ b/linphone-app/src/components/calls/CallsListModel.hpp
@@ -31,7 +31,6 @@
class ChatRoomModel;
class CoreHandlers;
-class ConferenceModel;
class ConferenceInfoModel;
class CallsListModel : public ProxyListModel {
@@ -83,8 +82,6 @@ private:
void removeCall (const std::shared_ptr &call);
void removeCallCb (CallModel *callModel);
- QList> mConferences;
-
std::shared_ptr mCoreHandlers;
};
diff --git a/linphone-app/src/components/camera/Camera.cpp b/linphone-app/src/components/camera/Camera.cpp
index 8ccd49452..56cf28337 100644
--- a/linphone-app/src/components/camera/Camera.cpp
+++ b/linphone-app/src/components/camera/Camera.cpp
@@ -66,6 +66,7 @@ void Camera::resetWindowId() {
QQuickFramebufferObject::Renderer *Camera::createRenderer () const {
QQuickFramebufferObject::Renderer * renderer = NULL;
+ bool useDefaultWindow = false;
if(mIsPreview){
renderer = (QQuickFramebufferObject::Renderer *)CoreManager::getInstance()->getCore()->getNativePreviewWindowId();
if(renderer)
@@ -74,7 +75,6 @@ QQuickFramebufferObject::Renderer *Camera::createRenderer () const {
if(renderer)
CoreManager::getInstance()->getCore()->setNativePreviewWindowId(renderer);
}else{
- bool useDefaultWindow = false;
if(mCallModel){
auto call = mCallModel->getCall();
if(call){
@@ -92,6 +92,7 @@ QQuickFramebufferObject::Renderer *Camera::createRenderer () const {
renderer = (QQuickFramebufferObject::Renderer *)participantDevice->getNativeVideoWindowId();
if(renderer)
participantDevice->setNativeVideoWindowId(NULL);// Reset
+ qWarning() << "Trying to create new window ID for " << participantDevice->getName().c_str() << ", addr=" << participantDevice->getAddress()->asString().c_str();
renderer = (QQuickFramebufferObject::Renderer *) participantDevice->createNativeVideoWindowId();
if(renderer)
participantDevice->setNativeVideoWindowId(renderer);
diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.cpp b/linphone-app/src/components/chat-room/ChatRoomModel.cpp
index f10bb9d40..c471b2d79 100644
--- a/linphone-app/src/components/chat-room/ChatRoomModel.cpp
+++ b/linphone-app/src/components/chat-room/ChatRoomModel.cpp
@@ -478,7 +478,7 @@ QString ChatRoomModel::getParticipantAddress(){
}else{
auto participants = getParticipants();
if(participants->getCount() > 1)
- return participants->getAt(1).objectCast()->getSipAddress();
+ return participants->getAt(1)->getSipAddress();
else
return "";
}
diff --git a/linphone-app/src/components/codecs/AbstractCodecsModel.cpp b/linphone-app/src/components/codecs/AbstractCodecsModel.cpp
index ff95a173a..1e5235da1 100644
--- a/linphone-app/src/components/codecs/AbstractCodecsModel.cpp
+++ b/linphone-app/src/components/codecs/AbstractCodecsModel.cpp
@@ -34,36 +34,14 @@ static inline shared_ptr getCodecFromMap (const QVariantM
// -----------------------------------------------------------------------------
-AbstractCodecsModel::AbstractCodecsModel (QObject *parent) : QAbstractListModel(parent) {}
-
-int AbstractCodecsModel::rowCount (const QModelIndex &) const {
- return mCodecs.count();
-}
-
-QHash AbstractCodecsModel::roleNames () const {
- QHash roles;
- roles[Qt::DisplayRole] = "$codec";
- return roles;
-}
-
-QVariant AbstractCodecsModel::data (const QModelIndex &index, int role) const {
- int row = index.row();
-
- if (!index.isValid() || row < 0 || row >= mCodecs.count())
- return QVariant();
-
- if (role == Qt::DisplayRole)
- return mCodecs[row];
-
- return QVariant();
-}
+AbstractCodecsModel::AbstractCodecsModel (QObject *parent) : ProxyAbstractListModel(parent) {}
// -----------------------------------------------------------------------------
void AbstractCodecsModel::enableCodec (int id, bool status) {
- Q_ASSERT(id >= 0 && id < mCodecs.count());
+ Q_ASSERT(id >= 0 && id < mList.count());
- QVariantMap &map = mCodecs[id];
+ QVariantMap &map = mList[id];
shared_ptr codec = getCodecFromMap(map);
if (codec) {
codec->enable(status);
@@ -77,9 +55,9 @@ void AbstractCodecsModel::moveCodec (int source, int destination) {
}
void AbstractCodecsModel::setBitrate (int id, int bitrate) {
- Q_ASSERT(id >= 0 && id < mCodecs.count());
+ Q_ASSERT(id >= 0 && id < mList.count());
- QVariantMap &map = mCodecs[id];
+ QVariantMap &map = mList[id];
shared_ptr codec = getCodecFromMap(map);
if (codec) {
codec->setNormalBitrate(bitrate);
@@ -89,9 +67,9 @@ void AbstractCodecsModel::setBitrate (int id, int bitrate) {
}
void AbstractCodecsModel::setRecvFmtp (int id, const QString &recvFmtp) {
- Q_ASSERT(id >= 0 && id < mCodecs.count());
+ Q_ASSERT(id >= 0 && id < mList.count());
- QVariantMap &map = mCodecs[id];
+ QVariantMap &map = mList[id];
shared_ptr codec = getCodecFromMap(map);
if (codec) {
codec->setRecvFmtp(Utils::appStringToCoreString(recvFmtp));
@@ -114,7 +92,7 @@ bool AbstractCodecsModel::moveRows (
int limit = sourceRow + count - 1;
{
- int nCodecs = mCodecs.count();
+ int nCodecs = mList.count();
if (
sourceRow < 0 ||
destinationChild < 0 ||
@@ -132,16 +110,16 @@ bool AbstractCodecsModel::moveRows (
if (destinationChild > sourceRow) {
--destinationChild;
for (int i = sourceRow; i <= limit; ++i) {
- mCodecs.move(sourceRow, destinationChild + i - sourceRow);
+ mList.move(sourceRow, destinationChild + i - sourceRow);
}
} else {
for (int i = sourceRow; i <= limit; ++i)
- mCodecs.move(sourceRow + i - sourceRow, destinationChild + i - sourceRow);
+ mList.move(sourceRow + i - sourceRow, destinationChild + i - sourceRow);
}
// Update linphone codecs list.
list> codecs;
- for (const auto &map : mCodecs) {
+ for (const auto &map : mList) {
// Do not update downloadable codecs.
shared_ptr codec = getCodecFromMap(map);
if (codec)
@@ -172,7 +150,7 @@ void AbstractCodecsModel::addCodec (shared_ptr &codec) {
map["recvFmtp"] = Utils::coreStringToAppString(codec->getRecvFmtp());
map["__codec"] = QVariant::fromValue(codec);
- mCodecs << map;
+ mList << map;
}
void AbstractCodecsModel::addDownloadableCodec (
@@ -188,11 +166,11 @@ void AbstractCodecsModel::addDownloadableCodec (
map["installName"] = installName;
map["mime"] = mime;
- mCodecs << map;
+ mList << map;
}
QVariantMap AbstractCodecsModel::getCodecInfo (const QString &mime) const {
- for (const auto &codec : mCodecs)
+ for (const auto &codec : mList)
if (codec.value("mime") == mime)
return codec;
return QVariantMap();
diff --git a/linphone-app/src/components/codecs/AbstractCodecsModel.hpp b/linphone-app/src/components/codecs/AbstractCodecsModel.hpp
index d4f10ce2d..1ee83c15d 100644
--- a/linphone-app/src/components/codecs/AbstractCodecsModel.hpp
+++ b/linphone-app/src/components/codecs/AbstractCodecsModel.hpp
@@ -23,7 +23,7 @@
#include
-#include
+#include "app/proxyModel/ProxyAbstractListModel.hpp"
// =============================================================================
@@ -31,19 +31,14 @@ namespace linphone {
class PayloadType;
}
-class AbstractCodecsModel : public QAbstractListModel {
- Q_OBJECT;
+class AbstractCodecsModel : public ProxyAbstractListModel {
+ Q_OBJECT
- Q_PROPERTY(QString codecsFolder READ getCodecsFolder CONSTANT);
+ Q_PROPERTY(QString codecsFolder READ getCodecsFolder CONSTANT)
public:
AbstractCodecsModel (QObject *parent = Q_NULLPTR);
- int rowCount (const QModelIndex &index = QModelIndex()) const override;
-
- QHash roleNames () const override;
- QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
-
Q_INVOKABLE void enableCodec (int id, bool status);
Q_INVOKABLE void moveCodec (int source, int destination);
@@ -74,8 +69,6 @@ protected:
virtual void updateCodecs (std::list> &codecs) = 0;
static QString getCodecsFolder ();
-
- QList mCodecs;
};
Q_DECLARE_METATYPE(std::shared_ptr);
diff --git a/linphone-app/src/components/codecs/VideoCodecsModel.cpp b/linphone-app/src/components/codecs/VideoCodecsModel.cpp
index c840e67fe..a7fae0fef 100644
--- a/linphone-app/src/components/codecs/VideoCodecsModel.cpp
+++ b/linphone-app/src/components/codecs/VideoCodecsModel.cpp
@@ -139,7 +139,7 @@ void VideoCodecsModel::updateCodecs (list> &co
}
void VideoCodecsModel::load () {
- mCodecs.clear();
+ resetData();
shared_ptr core = CoreManager::getInstance()->getCore();
diff --git a/linphone-app/src/components/conference/ConferenceAddModel.cpp b/linphone-app/src/components/conference/ConferenceAddModel.cpp
index 57be73eee..724c3ae64 100644
--- a/linphone-app/src/components/conference/ConferenceAddModel.cpp
+++ b/linphone-app/src/components/conference/ConferenceAddModel.cpp
@@ -54,7 +54,7 @@ int ConferenceHelperModel::ConferenceAddModel::rowCount (const QModelIndex &) co
QHash ConferenceHelperModel::ConferenceAddModel::roleNames () const {
QHash roles;
- roles[Qt::DisplayRole] = "$sipAddress";
+ roles[Qt::DisplayRole] = "$modelData";
return roles;
}
diff --git a/linphone-app/src/components/conference/ConferenceHelperModel.cpp b/linphone-app/src/components/conference/ConferenceHelperModel.cpp
index a9c43a0d1..e83831bab 100644
--- a/linphone-app/src/components/conference/ConferenceHelperModel.cpp
+++ b/linphone-app/src/components/conference/ConferenceHelperModel.cpp
@@ -52,7 +52,7 @@ ConferenceHelperModel::ConferenceHelperModel (QObject *parent) : QSortFilterProx
QHash ConferenceHelperModel::roleNames () const {
QHash roles;
- roles[Qt::DisplayRole] = "$sipAddress";
+ roles[Qt::DisplayRole] = "$modelData";
return roles;
}
diff --git a/linphone-app/src/components/conference/ConferenceListener.cpp b/linphone-app/src/components/conference/ConferenceListener.cpp
new file mode 100644
index 000000000..cbe88e091
--- /dev/null
+++ b/linphone-app/src/components/conference/ConferenceListener.cpp
@@ -0,0 +1,93 @@
+/*
+ * 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 .
+ */
+
+#include "ConferenceListener.hpp"
+
+#include
+#include
+#include
+#include
+
+#include "app/App.hpp"
+#include "app/paths/Paths.hpp"
+
+
+
+// =============================================================================
+
+ConferenceListener::ConferenceListener () : QObject(nullptr) {
+}
+
+ConferenceListener::~ConferenceListener(){
+}
+
+//-----------------------------------------------------------------------------------------------------------------------
+// LINPHONE LISTENERS
+//-----------------------------------------------------------------------------------------------------------------------
+void ConferenceListener::onParticipantAdded(const std::shared_ptr & conference, const std::shared_ptr & participant){
+ qWarning() << "onParticipantAdded";
+ emit participantAdded(participant);
+}
+void ConferenceListener::onParticipantRemoved(const std::shared_ptr & conference, const std::shared_ptr & participant){
+ qWarning() << "onParticipantRemoved";
+ emit participantRemoved(participant);
+}
+void ConferenceListener::onParticipantDeviceAdded(const std::shared_ptr & conference, const std::shared_ptr & participantDevice){
+ qWarning() << "onParticipantDeviceAdded";
+ qWarning() << "Me devices : " << conference->getMe()->getDevices().size();
+ emit participantDeviceAdded(participantDevice);
+}
+void ConferenceListener::onParticipantDeviceRemoved(const std::shared_ptr & conference, const std::shared_ptr & participantDevice){
+ qWarning() << "onParticipantDeviceRemoved";
+ qWarning() << "Me devices : " << conference->getMe()->getDevices().size();
+ emit participantDeviceRemoved(participantDevice);
+}
+void ConferenceListener::onParticipantAdminStatusChanged(const std::shared_ptr & conference, const std::shared_ptr & participant){
+ qWarning() << "onParticipantAdminStatusChanged";
+}
+void ConferenceListener::onParticipantDeviceLeft(const std::shared_ptr & conference, const std::shared_ptr & participantDevice){
+ qWarning() << "onParticipantDeviceLeft";
+ qWarning() << "Me devices : " << conference->getMe()->getDevices().size();
+ emit participantDeviceLeft(participantDevice);
+}
+void ConferenceListener::onParticipantDeviceJoined(const std::shared_ptr & conference, const std::shared_ptr & participantDevice){
+ qWarning() << "onParticipantDeviceJoined";
+ qWarning() << "Me devices : " << conference->getMe()->getDevices().size();
+ emit participantDeviceJoined(participantDevice);
+}
+void ConferenceListener::onParticipantDeviceMediaAvailabilityChanged(const std::shared_ptr & conference, const std::shared_ptr & participantDevice){
+ qWarning() << "onParticipantDeviceMediaAvailabilityChanged";
+ qWarning() << "ConferenceListener::onParticipantDeviceMediaAvailabilityChanged: " << (int)participantDevice->getStreamAvailability(linphone::StreamType::Video) << ". Me devices : " << conference->getMe()->getDevices().size();
+ emit participantDeviceMediaAvailabilityChanged(participantDevice);
+}
+void ConferenceListener::onStateChanged(const std::shared_ptr & conference, linphone::Conference::State newState){
+ qWarning() << "onStateChanged";
+ emit conferenceStateChanged(newState);
+}
+void ConferenceListener::onSubjectChanged(const std::shared_ptr & conference, const std::string & subject){
+ qWarning() << "onSubjectChanged";
+ emit subjectChanged(subject);
+}
+void ConferenceListener::onAudioDeviceChanged(const std::shared_ptr & conference, const std::shared_ptr & audioDevice){
+ qWarning() << "onAudioDeviceChanged is not yet implemented.";
+}
+
+
+//-----------------------------------------------------------------------------------------------------------------------
\ No newline at end of file
diff --git a/linphone-app/src/components/conference/ConferenceListener.hpp b/linphone-app/src/components/conference/ConferenceListener.hpp
new file mode 100644
index 000000000..7a274d952
--- /dev/null
+++ b/linphone-app/src/components/conference/ConferenceListener.hpp
@@ -0,0 +1,64 @@
+/*
+ * 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 CONFERENCE_LISTENER_H_
+#define CONFERENCE_LISTENER_H_
+
+
+#include
+// =============================================================================
+#include
+#include
+#include
+
+class ConferenceListener : public QObject, public linphone::ConferenceListener{
+ Q_OBJECT
+public:
+ ConferenceListener();
+ virtual ~ConferenceListener();
+
+// LINPHONE LISTENERS
+ virtual void onParticipantAdded(const std::shared_ptr & conference, const std::shared_ptr & participant) override;
+ virtual void onParticipantRemoved(const std::shared_ptr & conference, const std::shared_ptr & participant) override;
+ virtual void onParticipantDeviceAdded(const std::shared_ptr & conference, const std::shared_ptr & participantDevice) override;
+ virtual void onParticipantDeviceRemoved(const std::shared_ptr & conference, const std::shared_ptr & participantDevice) override;
+ virtual void onParticipantAdminStatusChanged(const std::shared_ptr & conference, const std::shared_ptr & participant) override;
+ virtual void onParticipantDeviceLeft(const std::shared_ptr & conference, const std::shared_ptr & device) override;
+ virtual void onParticipantDeviceJoined(const std::shared_ptr & conference, const std::shared_ptr & device) override;
+ virtual void onParticipantDeviceMediaAvailabilityChanged(const std::shared_ptr & conference, const std::shared_ptr & device) override;
+ virtual void onStateChanged(const std::shared_ptr & conference, linphone::Conference::State newState) override;
+ virtual void onSubjectChanged(const std::shared_ptr & conference, const std::string & subject) override;
+ virtual void onAudioDeviceChanged(const std::shared_ptr & conference, const std::shared_ptr & audioDevice) override;
+//---------------------------------------------------------------------------
+
+signals:
+ void participantAdded(const std::shared_ptr & participant);
+ void participantRemoved(const std::shared_ptr & participant);
+ void participantDeviceAdded(const std::shared_ptr & participantDevice);
+ void participantDeviceRemoved(const std::shared_ptr & participantDevice);
+ void participantDeviceLeft(const std::shared_ptr & participantDevice);
+ void participantDeviceJoined(const std::shared_ptr & participantDevice);
+ void participantDeviceMediaAvailabilityChanged(const std::shared_ptr & participantDevice);
+ void conferenceStateChanged(linphone::Conference::State newState);
+ void subjectChanged(const std::string & subject);
+};
+
+
+#endif
diff --git a/linphone-app/src/components/conference/ConferenceModel.cpp b/linphone-app/src/components/conference/ConferenceModel.cpp
index ba4e85a45..ec5488c82 100644
--- a/linphone-app/src/components/conference/ConferenceModel.cpp
+++ b/linphone-app/src/components/conference/ConferenceModel.cpp
@@ -19,6 +19,7 @@
*/
#include "ConferenceModel.hpp"
+#include "ConferenceListener.hpp"
#include
#include
@@ -35,71 +36,88 @@
#include "utils/Constants.hpp"
#include "components/Components.hpp"
+void ConferenceModel::connectTo(ConferenceListener * listener){
+ connect(listener, &ConferenceListener::participantAdded, this, &ConferenceModel::onParticipantAdded);
+ connect(listener, &ConferenceListener::participantRemoved, this, &ConferenceModel::onParticipantRemoved);
+ connect(listener, &ConferenceListener::participantDeviceAdded, this, &ConferenceModel::onParticipantDeviceAdded);
+ connect(listener, &ConferenceListener::participantDeviceRemoved, this, &ConferenceModel::onParticipantDeviceRemoved);
+ connect(listener, &ConferenceListener::participantDeviceLeft, this, &ConferenceModel::onParticipantDeviceLeft);
+ connect(listener, &ConferenceListener::participantDeviceJoined, this, &ConferenceModel::onParticipantDeviceJoined);
+ connect(listener, &ConferenceListener::participantDeviceMediaAvailabilityChanged, this, &ConferenceModel::onParticipantDeviceMediaAvailabilityChanged);
+ connect(listener, &ConferenceListener::conferenceStateChanged, this, &ConferenceModel::onConferenceStateChanged);
+ connect(listener, &ConferenceListener::subjectChanged, this, &ConferenceModel::onSubjectChanged);
+}
+
// =============================================================================
-std::shared_ptr ConferenceModel::create(std::shared_ptr conference, QObject *parent){
- std::shared_ptr model = std::make_shared(conference, parent);
- if(model){
- model->mSelf = model;
- conference->addListener(model);
- return model;
- }
- return nullptr;
+
+QSharedPointer ConferenceModel::create(std::shared_ptr conference, QObject *parent){
+ return QSharedPointer::create(conference, parent);
}
ConferenceModel::ConferenceModel (std::shared_ptr conference, QObject *parent) : QObject(parent) {
App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it when passing by Q_INVOKABLE
mConference = conference;
+ mConferenceListener = std::make_shared();
+ connectTo(mConferenceListener.get());
+ mConference->addListener(mConferenceListener);
}
ConferenceModel::~ConferenceModel(){
- //mChatRoomModel->getChatRoom()->removeListener(mChatRoomModel);
+ mConference->removeListener(mConferenceListener);
}
std::shared_ptr ConferenceModel::getConference()const{
return mConference;
}
+QString ConferenceModel::getSubject() const{
+ return QString::fromStdString(mConference->getSubject());
+}
+
+QDateTime ConferenceModel::getStartDate() const{
+ return QDateTime::fromSecsSinceEpoch(mConference->getStartTime());
+}
+
+qint64 ConferenceModel::getElapsedSeconds() const {
+ return getStartDate().secsTo(QDateTime::currentDateTime());
+}
+
//-----------------------------------------------------------------------------------------------------------------------
// LINPHONE LISTENERS
//-----------------------------------------------------------------------------------------------------------------------
-void ConferenceModel::onParticipantAdded(const std::shared_ptr & conference, const std::shared_ptr & participant){
- qWarning() << "onParticipantAdded is not yet implemented.";
- qWarning() << "Me devices : " << conference->getMe()->getDevices().size();
+void ConferenceModel::onParticipantAdded(const std::shared_ptr & participant){
+ qWarning() << "Me devices : " << mConference->getMe()->getDevices().size();
+ emit participantAdded(participant);
}
-void ConferenceModel::onParticipantRemoved(const std::shared_ptr & conference, const std::shared_ptr & participant){
- qWarning() << "onParticipantRemoved is not yet implemented.";
- qWarning() << "Me devices : " << conference->getMe()->getDevices().size();
+void ConferenceModel::onParticipantRemoved(const std::shared_ptr & participant){
+ qWarning() << "Me devices : " << mConference->getMe()->getDevices().size();
+ emit participantRemoved(participant);
}
-void ConferenceModel::onParticipantDeviceAdded(const std::shared_ptr & conference, const std::shared_ptr & participantDevice){
- qWarning() << "Me devices : " << conference->getMe()->getDevices().size();
+void ConferenceModel::onParticipantDeviceAdded(const std::shared_ptr & participantDevice){
+ qWarning() << "Me devices : " << mConference->getMe()->getDevices().size();
emit participantDeviceAdded(participantDevice);
}
-void ConferenceModel::onParticipantDeviceRemoved(const std::shared_ptr & conference, const std::shared_ptr & participantDevice){
- qWarning() << "Me devices : " << conference->getMe()->getDevices().size();
+void ConferenceModel::onParticipantDeviceRemoved(const std::shared_ptr & participantDevice){
+ qWarning() << "Me devices : " << mConference->getMe()->getDevices().size();
emit participantDeviceRemoved(participantDevice);
}
-void ConferenceModel::onParticipantAdminStatusChanged(const std::shared_ptr & conference, const std::shared_ptr & participant){
-}
-void ConferenceModel::onParticipantDeviceLeft(const std::shared_ptr & conference, const std::shared_ptr & participantDevice){
- qWarning() << "Me devices : " << conference->getMe()->getDevices().size();
+void ConferenceModel::onParticipantDeviceLeft(const std::shared_ptr & participantDevice){
+ qWarning() << "Me devices : " << mConference->getMe()->getDevices().size();
emit participantDeviceLeft(participantDevice);
}
-void ConferenceModel::onParticipantDeviceJoined(const std::shared_ptr & conference, const std::shared_ptr & participantDevice){
- qWarning() << "Me devices : " << conference->getMe()->getDevices().size();
+void ConferenceModel::onParticipantDeviceJoined(const std::shared_ptr & participantDevice){
+ qWarning() << "Me devices : " << mConference->getMe()->getDevices().size();
emit participantDeviceJoined(participantDevice);
}
-void ConferenceModel::onParticipantDeviceMediaAvailabilityChanged(const std::shared_ptr & conference, const std::shared_ptr & participantDevice){
- qWarning() << "ConferenceModel::onParticipantDeviceMediaAvailabilityChanged: " << (int)participantDevice->getStreamAvailability(linphone::StreamType::Video) << ". Me devices : " << conference->getMe()->getDevices().size();
+void ConferenceModel::onParticipantDeviceMediaAvailabilityChanged(const std::shared_ptr & participantDevice){
+ qWarning() << "ConferenceModel::onParticipantDeviceMediaAvailabilityChanged: " << (int)participantDevice->getStreamAvailability(linphone::StreamType::Video) << ". Me devices : " << mConference->getMe()->getDevices().size();
emit participantDeviceMediaAvailabilityChanged(participantDevice);
}
-void ConferenceModel::onStateChanged(const std::shared_ptr & conference, linphone::Conference::State newState){
+void ConferenceModel::onConferenceStateChanged(linphone::Conference::State newState){
emit conferenceStateChanged(newState);
}
-void ConferenceModel::onSubjectChanged(const std::shared_ptr & conference, const std::string & subject){
- qWarning() << "onSubjectChanged is not yet implemented.";
-}
-void ConferenceModel::onAudioDeviceChanged(const std::shared_ptr & conference, const std::shared_ptr & audioDevice){
- qWarning() << "onAudioDeviceChanged is not yet implemented.";
+void ConferenceModel::onSubjectChanged(const std::string& string){
+ emit subjectChanged();
}
diff --git a/linphone-app/src/components/conference/ConferenceModel.hpp b/linphone-app/src/components/conference/ConferenceModel.hpp
index ec36557bf..49d1a716f 100644
--- a/linphone-app/src/components/conference/ConferenceModel.hpp
+++ b/linphone-app/src/components/conference/ConferenceModel.hpp
@@ -28,41 +28,53 @@
#include
#include
-class ConferenceModel : public QObject, public linphone::ConferenceListener{
+class ConferenceListener;
+
+class ConferenceModel : public QObject{
Q_OBJECT
public:
- static std::shared_ptr create(std::shared_ptr chatRoom, QObject *parent = Q_NULLPTR);
+
+ Q_PROPERTY(QString subject READ getSubject NOTIFY subjectChanged)
+ Q_PROPERTY(QDateTime startDate READ getStartDate CONSTANT)
+
+ static QSharedPointer create(std::shared_ptr chatRoom, QObject *parent = Q_NULLPTR);
ConferenceModel(std::shared_ptr content, QObject *parent = Q_NULLPTR);
virtual ~ConferenceModel();
std::shared_ptr getConference()const;
+
+ QString getSubject() const;
+ QDateTime getStartDate() const;
+ Q_INVOKABLE qint64 getElapsedSeconds() const;
-// LINPHONE LISTENERS
- virtual void onParticipantAdded(const std::shared_ptr & conference, const std::shared_ptr & participant) override;
- virtual void onParticipantRemoved(const std::shared_ptr & conference, const std::shared_ptr & participant) override;
- virtual void onParticipantDeviceAdded(const std::shared_ptr & conference, const std::shared_ptr & participantDevice) override;
- virtual void onParticipantDeviceRemoved(const std::shared_ptr & conference, const std::shared_ptr & participantDevice) override;
- virtual void onParticipantAdminStatusChanged(const std::shared_ptr & conference, const std::shared_ptr & participant) override;
- virtual void onParticipantDeviceLeft(const std::shared_ptr & conference, const std::shared_ptr & device) override;
- virtual void onParticipantDeviceJoined(const std::shared_ptr & conference, const std::shared_ptr & device) override;
- virtual void onParticipantDeviceMediaAvailabilityChanged(const std::shared_ptr & conference, const std::shared_ptr & device) override;
- virtual void onStateChanged(const std::shared_ptr & conference, linphone::Conference::State newState) override;
- virtual void onSubjectChanged(const std::shared_ptr & conference, const std::string & subject) override;
- virtual void onAudioDeviceChanged(const std::shared_ptr & conference, const std::shared_ptr & audioDevice) override;
+ virtual void onParticipantAdded(const std::shared_ptr & participant);
+ virtual void onParticipantRemoved(const std::shared_ptr & participant);
+ virtual void onParticipantDeviceAdded(const std::shared_ptr & participantDevice);
+ virtual void onParticipantDeviceRemoved(const std::shared_ptr & participantDevice);
+ virtual void onParticipantDeviceLeft(const std::shared_ptr & device);
+ virtual void onParticipantDeviceJoined(const std::shared_ptr & device);
+ virtual void onParticipantDeviceMediaAvailabilityChanged(const std::shared_ptr & device);
+ virtual void onConferenceStateChanged(linphone::Conference::State newState);
+ virtual void onSubjectChanged(const std::string& subject);
//---------------------------------------------------------------------------
signals:
+ void participantAdded(const std::shared_ptr & participant);
+ void participantRemoved(const std::shared_ptr & participant);
void participantDeviceAdded(const std::shared_ptr & participantDevice);
void participantDeviceRemoved(const std::shared_ptr & participantDevice);
void participantDeviceLeft(const std::shared_ptr & participantDevice);
void participantDeviceJoined(const std::shared_ptr & participantDevice);
void participantDeviceMediaAvailabilityChanged(const std::shared_ptr & participantDevice);
void conferenceStateChanged(linphone::Conference::State newState);
+ void subjectChanged();
private:
+ void connectTo(ConferenceListener * listener);
+
std::shared_ptr mConference;
- std::weak_ptr mSelf;
+ std::shared_ptr mConferenceListener;
};
-Q_DECLARE_METATYPE(std::shared_ptr)
+Q_DECLARE_METATYPE(QSharedPointer)
#endif
diff --git a/linphone-app/src/components/conference/ConferenceProxyModel.cpp b/linphone-app/src/components/conference/ConferenceProxyModel.cpp
index 7448ea665..f487e424f 100644
--- a/linphone-app/src/components/conference/ConferenceProxyModel.cpp
+++ b/linphone-app/src/components/conference/ConferenceProxyModel.cpp
@@ -37,13 +37,7 @@
using namespace std;
-ConferenceProxyModel::ConferenceProxyModel (QObject *parent) : QSortFilterProxyModel(parent) {
- QObject::connect(this, &ConferenceProxyModel::rowsRemoved, [this] { // Warning : called before model remove its items
- emit countChanged(rowCount());
- });
- QObject::connect(this, &ConferenceProxyModel::rowsInserted, [this] {
- emit countChanged(rowCount());
- });
+ConferenceProxyModel::ConferenceProxyModel (QObject *parent) : SortFilterProxyModel(parent) {
setSourceModel(CoreManager::getInstance()->getCallsListModel());
emit conferenceChanged();
diff --git a/linphone-app/src/components/conference/ConferenceProxyModel.hpp b/linphone-app/src/components/conference/ConferenceProxyModel.hpp
index e1eb18308..78d3a0eb5 100644
--- a/linphone-app/src/components/conference/ConferenceProxyModel.hpp
+++ b/linphone-app/src/components/conference/ConferenceProxyModel.hpp
@@ -21,16 +21,14 @@
#ifndef CONFERENCE_PROXY_MODEL_H_
#define CONFERENCE_PROXY_MODEL_H_
-#include
+#include "app/proxyModel/SortFilterProxyModel.hpp"
// =============================================================================
class CallModel;
-class ConferenceProxyModel : public QSortFilterProxyModel {
- Q_OBJECT;
-
- Q_PROPERTY(int count READ getCount NOTIFY countChanged);
+class ConferenceProxyModel : public SortFilterProxyModel {
+ Q_OBJECT
Q_PROPERTY(bool microMuted READ getMicroMuted WRITE setMicroMuted NOTIFY microMutedChanged);
Q_PROPERTY(float microVu READ getMicroVu CONSTANT);
@@ -53,17 +51,11 @@ protected:
Q_INVOKABLE void leave ();
signals:
- void countChanged (int count);
-
void microMutedChanged (bool status);
void recordingChanged (bool status);
void conferenceChanged ();
private:
- int getCount () const {
- return rowCount();
- }
-
bool getMicroMuted () const;
void setMicroMuted (bool status);
float getMicroVu () const;
diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoListModel.cpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoListModel.cpp
index 34b30d5d4..6190e1dd3 100644
--- a/linphone-app/src/components/conferenceInfo/ConferenceInfoListModel.cpp
+++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoListModel.cpp
@@ -38,14 +38,14 @@
ConferenceInfoListModel::ConferenceInfoListModel (QObject *parent) : ProxyListModel(parent) {
//auto conferenceInfos = CoreManager::getInstance()->getCore()->getConferenceInformationList();
//for(auto conferenceInfo : conferenceInfos){
-// auto conferenceInfoModel = ConferenceInfoModel::create( conferenceInfo );
-// mList << conferenceInfoModel;
+ //auto conferenceInfoModel = ConferenceInfoModel::create( conferenceInfo );
+ //mList << conferenceInfoModel;
//mMappedList[conferenceInfoModel->getDateTime().date()].push_back(conferenceInfoModel.get());
-// }
+ //}
}
-
+/*
ConferenceInfoModel* ConferenceInfoListModel::getAt(const int& index) const {
return ProxyListModel::getAt(index).objectCast().get();
}
-
+*/
// -----------------------------------------------------------------------------
diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoListModel.hpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoListModel.hpp
index 95631e513..811019cbc 100644
--- a/linphone-app/src/components/conferenceInfo/ConferenceInfoListModel.hpp
+++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoListModel.hpp
@@ -35,7 +35,7 @@ class ConferenceInfoListModel : public ProxyListModel {
public:
ConferenceInfoListModel (QObject *parent = Q_NULLPTR);
- ConferenceInfoModel* getAt(const int& index) const;
+ // ConferenceInfoModel* getAt(const int& index) const;
};
Q_DECLARE_METATYPE(QList