From a541df0cd4f49c33afbffe35eae08c6b19e1ee39 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Fri, 15 Apr 2022 18:13:00 +0200 Subject: [PATCH] Backup --- linphone-app/CMakeLists.txt | 20 +- .../assets/images/camera_preview_custom.svg | 44 ++++ linphone-app/resources.qrc | 1 + linphone-app/src/app/App.cpp | 1 + linphone-app/src/app/main.cpp | 8 +- .../app/proxyModel/ProxyAbstractListModel.hpp | 108 +++++++++ .../app/proxyModel/ProxyAbstractMapModel.hpp | 114 +++++++++ .../app/proxyModel/ProxyAbstractObject.hpp | 47 ++++ .../src/app/proxyModel/ProxyListModel.cpp | 88 +------ .../src/app/proxyModel/ProxyListModel.hpp | 62 +++-- .../src/app/proxyModel/ProxyMapModel.cpp | 93 -------- .../SortFilterAbstractProxyModel.hpp | 41 ++++ .../app/proxyModel/SortFilterProxyModel.cpp | 47 ++++ .../app/proxyModel/SortFilterProxyModel.hpp | 49 ++++ linphone-app/src/components/Components.hpp | 2 +- .../src/components/call/CallModel.cpp | 12 +- .../src/components/call/CallModel.hpp | 12 +- .../src/components/calls/CallsListModel.cpp | 2 + .../src/components/calls/CallsListModel.hpp | 3 - linphone-app/src/components/camera/Camera.cpp | 3 +- .../components/chat-room/ChatRoomModel.cpp | 2 +- .../components/codecs/AbstractCodecsModel.cpp | 50 ++-- .../components/codecs/AbstractCodecsModel.hpp | 15 +- .../components/codecs/VideoCodecsModel.cpp | 2 +- .../conference/ConferenceAddModel.cpp | 2 +- .../conference/ConferenceHelperModel.cpp | 2 +- .../conference/ConferenceListener.cpp | 93 ++++++++ .../conference/ConferenceListener.hpp | 64 +++++ .../components/conference/ConferenceModel.cpp | 84 ++++--- .../components/conference/ConferenceModel.hpp | 44 ++-- .../conference/ConferenceProxyModel.cpp | 8 +- .../conference/ConferenceProxyModel.hpp | 14 +- .../ConferenceInfoListModel.cpp | 10 +- .../ConferenceInfoListModel.hpp | 2 +- .../conferenceInfo/ConferenceInfoMapModel.cpp | 46 +--- .../conferenceInfo/ConferenceInfoMapModel.hpp | 30 +-- .../conferenceInfo/ConferenceInfoModel.cpp | 19 +- .../conferenceInfo/ConferenceInfoModel.hpp | 5 +- .../ConferenceInfoProxyListModel.cpp | 98 ++++++++ .../ConferenceInfoProxyListModel.hpp} | 42 ++-- .../ConferenceInfoProxyModel.cpp | 51 ++-- .../ConferenceInfoProxyModel.hpp | 27 +-- ...lerHandler.cpp => ConferenceScheduler.cpp} | 36 +-- .../ConferenceScheduler.hpp | 57 +++++ .../ConferenceSchedulerListener.cpp | 42 ++++ ...er.hpp => ConferenceSchedulerListener.hpp} | 23 +- .../src/components/ldap/LdapModel.hpp | 2 +- .../ParticipantDeviceListModel.cpp | 153 +++++++++--- .../ParticipantDeviceListModel.hpp | 10 + .../participant/ParticipantDeviceModel.cpp | 11 +- .../participant/ParticipantDeviceModel.hpp | 2 + .../ParticipantDeviceProxyModel.cpp | 34 +-- .../ParticipantDeviceProxyModel.hpp | 12 +- .../participant/ParticipantProxyModel.cpp | 2 +- .../{SearchHandler.cpp => SearchListener.cpp} | 6 +- .../{SearchHandler.hpp => SearchListener.hpp} | 10 +- .../search/SearchSipAddressesModel.cpp | 64 +---- .../search/SearchSipAddressesModel.hpp | 20 +- .../sip-addresses/SipAddressesModel.cpp | 2 +- .../tunnel/TunnelConfigListModel.cpp | 58 +---- .../tunnel/TunnelConfigListModel.hpp | 19 +- .../components/tunnel/TunnelConfigModel.hpp | 2 +- .../Linphone/Chat/ChatCalendarMessage.qml | 34 ++- .../modules/Linphone/Codecs/CodecsViewer.qml | 18 +- .../Linphone/Menus/SipAddressesMenu.qml | 8 +- .../Styles/Chat/ChatCalendarMessageStyle.qml | 16 ++ .../Linphone/View/ParticipantsView.qml | 4 +- .../Linphone/View/SipAddressesView.qml | 7 +- .../ui/views/App/Calls/CallsWindow.qml | 15 ++ .../ui/views/App/Calls/VideoConference.qml | 225 +++++++++--------- .../ui/views/App/Main/Conferences.qml | 29 ++- .../views/App/Main/Dialogs/NewConference.qml | 15 +- .../Settings/Dialogs/SettingsVideoPreview.qml | 32 ++- .../App/Styles/Calls/CallsWindowStyle.qml | 12 + .../App/Styles/Calls/VideoConferenceStyle.qml | 14 +- .../App/Styles/Main/ConferencesStyle.qml | 3 +- linphone-sdk | 2 +- 77 files changed, 1588 insertions(+), 878 deletions(-) create mode 100644 linphone-app/assets/images/camera_preview_custom.svg create mode 100644 linphone-app/src/app/proxyModel/ProxyAbstractListModel.hpp create mode 100644 linphone-app/src/app/proxyModel/ProxyAbstractMapModel.hpp create mode 100644 linphone-app/src/app/proxyModel/ProxyAbstractObject.hpp delete mode 100644 linphone-app/src/app/proxyModel/ProxyMapModel.cpp create mode 100644 linphone-app/src/app/proxyModel/SortFilterAbstractProxyModel.hpp create mode 100644 linphone-app/src/app/proxyModel/SortFilterProxyModel.cpp create mode 100644 linphone-app/src/app/proxyModel/SortFilterProxyModel.hpp create mode 100644 linphone-app/src/components/conference/ConferenceListener.cpp create mode 100644 linphone-app/src/components/conference/ConferenceListener.hpp create mode 100644 linphone-app/src/components/conferenceInfo/ConferenceInfoProxyListModel.cpp rename linphone-app/src/{app/proxyModel/ProxyMapModel.hpp => components/conferenceInfo/ConferenceInfoProxyListModel.hpp} (52%) rename linphone-app/src/components/conferenceScheduler/{ConferenceSchedulerHandler.cpp => ConferenceScheduler.cpp} (57%) create mode 100644 linphone-app/src/components/conferenceScheduler/ConferenceScheduler.hpp create mode 100644 linphone-app/src/components/conferenceScheduler/ConferenceSchedulerListener.cpp rename linphone-app/src/components/conferenceScheduler/{ConferenceSchedulerHandler.hpp => ConferenceSchedulerListener.hpp} (65%) rename linphone-app/src/components/search/{SearchHandler.cpp => SearchListener.cpp} (82%) rename linphone-app/src/components/search/{SearchHandler.hpp => SearchListener.hpp} (85%) 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*) #endif diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoMapModel.cpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoMapModel.cpp index cdc3c0519..189fbb0f6 100644 --- a/linphone-app/src/components/conferenceInfo/ConferenceInfoMapModel.cpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoMapModel.cpp @@ -35,10 +35,11 @@ #include "ConferenceInfoProxyModel.hpp" #include "ConferenceInfoListModel.hpp" #include "ConferenceInfoModel.hpp" +#include "ConferenceInfoProxyListModel.hpp" // ============================================================================= -ConferenceInfoMapModel::ConferenceInfoMapModel (QObject *parent) : QAbstractListModel(parent) { +ConferenceInfoMapModel::ConferenceInfoMapModel (QObject *parent) : ProxyAbstractMapModel*>(parent) { auto conferenceInfos = CoreManager::getInstance()->getCore()->getConferenceInformationList(); auto me = CoreManager::getInstance()->getCore()->getDefaultAccount()->getParams()->getIdentityAddress(); for(auto conferenceInfo : conferenceInfos){ @@ -51,43 +52,16 @@ ConferenceInfoMapModel::ConferenceInfoMapModel (QObject *parent) : QAbstractList if(haveMe){ auto conferenceInfoModel = ConferenceInfoModel::create( conferenceInfo ); QDate t = conferenceInfoModel->getDateTime().date(); - if( !mMappedList.contains(t)) - mMappedList[t] = new ConferenceInfoProxyModel(new ConferenceInfoListModel(), this); + if( !mMappedList.contains(t)){ + //auto proxy = new SortFilterAbstractProxyModel(new ConferenceInfoListModel(), this); + auto proxy = new ConferenceInfoProxyListModel(this); + connect(this, &ConferenceInfoMapModel::filterTypeChanged, proxy, &ConferenceInfoProxyListModel::setFilterType); + mMappedList[t] = proxy; + } + //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 +// ----------------------------------------------------------------------------- \ No newline at end of file diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoMapModel.hpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoMapModel.hpp index 92d8c38b3..050ecffec 100644 --- a/linphone-app/src/components/conferenceInfo/ConferenceInfoMapModel.hpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoMapModel.hpp @@ -22,29 +22,23 @@ #define _CONFERENCE_INFO_MAP_MODEL_H_ #include -#include #include +#include "app/proxyModel/ProxyAbstractMapModel.hpp" +#include "app/proxyModel/SortFilterAbstractProxyModel.hpp" + +class ConferenceInfoListModel; + // ============================================================================= -class ConferenceInfoProxyModel; - -class ConferenceInfoMapModel : public QAbstractListModel { - Q_OBJECT - +class ConferenceInfoMapModel : public ProxyAbstractMapModel*> { + Q_OBJECT + public: - ConferenceInfoMapModel (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 setConferenceInfoFilter (int filterMode); - -private: - QMap mMappedList; - + ConferenceInfoMapModel (QObject *parent = Q_NULLPTR); +signals: + void filterTypeChanged(int filterType); + }; Q_DECLARE_METATYPE(ConferenceInfoMapModel*) #endif diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp index d48b5ccc2..78c567ef9 100644 --- a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp @@ -45,7 +45,7 @@ #include "components/contact/ContactModel.hpp" #include "components/contact/VcardModel.hpp" #include "components/contacts/ContactsListModel.hpp" -#include "components/conferenceScheduler/ConferenceSchedulerHandler.hpp" +#include "components/conferenceScheduler/ConferenceScheduler.hpp" #include "components/core/CoreHandlers.hpp" #include "components/core/CoreManager.hpp" #include "components/notifier/Notifier.hpp" @@ -74,13 +74,7 @@ using namespace std; // ----------------------------------------------------------------------------- QSharedPointer ConferenceInfoModel::create(std::shared_ptr conferenceInfo){ - QSharedPointer model = QSharedPointer::create(conferenceInfo); - if(model){ - model->mSelf = model; - //chatRoom->addListener(model); - return model; - }else - return nullptr; + return QSharedPointer::create(conferenceInfo); } ConferenceInfoModel::ConferenceInfoModel (QObject * parent) : QObject(parent){ @@ -157,6 +151,7 @@ bool ConferenceInfoModel::isScheduled() const{ void ConferenceInfoModel::setDateTime(const QDateTime& dateTime){ mConferenceInfo->setDateTime(dateTime.toMSecsSinceEpoch() / 1000); + qWarning() << "Set DateTime: " << mConferenceInfo->getDateTime() << " from " << dateTime.toMSecsSinceEpoch() / 1000; emit dateTimeChanged(); } @@ -201,10 +196,9 @@ void ConferenceInfoModel::createConference(const int& securityLevel, const int& qInfo() << "Conference creation of " << getSubject() << " at " << securityLevel << " security, organized by " << getOrganizer();// and with " << conferenceInfo->getConferenceInfo()->getParticipants().size(); if( true || isScheduled()){ - mConferenceSchedulerHandler = ConferenceSchedulerHandler::create(this); - connect(mConferenceSchedulerHandler.get(), &ConferenceSchedulerHandler::invitationsSent, this, &ConferenceInfoModel::onInvitationsSent); - - mConferenceSchedulerHandler->getConferenceScheduler()->setInfo(mConferenceInfo); + mConferenceScheduler = ConferenceScheduler::create(); + connect(mConferenceScheduler.get(), &ConferenceScheduler::invitationsSent, this, &ConferenceInfoModel::onInvitationsSent); + mConferenceScheduler->getConferenceScheduler()->setInfo(mConferenceInfo); }else{ auto conferenceParameters = core->createConferenceParams(nullptr); conferenceParameters->enableAudio(true); @@ -233,6 +227,5 @@ void ConferenceInfoModel::createConference(const int& securityLevel, const int& void ConferenceInfoModel::onInvitationsSent(const std::list> & failedInvitations) { - mConferenceSchedulerHandler->getConferenceScheduler()->removeListener(mConferenceSchedulerHandler); emit invitationsSent(); } \ No newline at end of file diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.hpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.hpp index 30b2fd850..38a026608 100644 --- a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.hpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.hpp @@ -27,7 +27,7 @@ #include class ParticipantListModel; -class ConferenceSchedulerHandler; +class ConferenceScheduler; class ConferenceInfoModel : public QObject { Q_OBJECT @@ -97,9 +97,8 @@ signals: private: std::shared_ptr mConferenceInfo; - std::shared_ptr mConferenceSchedulerHandler = nullptr; + QSharedPointer mConferenceScheduler= nullptr; - QWeakPointer mSelf; // For Linphone listener bool mIsScheduled = true; }; diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyListModel.cpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyListModel.cpp new file mode 100644 index 000000000..2e1c096e3 --- /dev/null +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyListModel.cpp @@ -0,0 +1,98 @@ +/* + * 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 "ConferenceInfoProxyListModel.hpp" + +#include "components/call/CallModel.hpp" +#include "components/core/CoreManager.hpp" + +#include "ConferenceInfoListModel.hpp" +#include "ConferenceInfoMapModel.hpp" + + +// ============================================================================= + +using namespace std; + +//--------------------------------------------------------------------------------------------- + +ConferenceInfoProxyListModel::ConferenceInfoProxyListModel (QObject *parent) : SortFilterAbstractProxyModel(new ConferenceInfoListModel(parent), parent) { + //setFilterType(0); + //connect(this, &ConferenceInfoProxyListModel::filterTypeChanged, qobject_cast(sourceModel()), &ConferenceInfoListModel::filterTypeChanged); +} + +bool ConferenceInfoProxyListModel::filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const { + auto listModel = qobject_cast(sourceModel()); + if(listModel){ + QModelIndex index = listModel->index(sourceRow, 0, QModelIndex()); + const ConferenceInfoModel* ics = sourceModel()->data(index).value(); + if(ics){ + QDateTime currentDateTime = QDateTime::currentDateTime(); + if( mFilterType == 0){ + return ics->getEndDateTime() < currentDateTime; + }else if( mFilterType == 1){ + return ics->getDateTime() >= currentDateTime; + } + } + } + return true; +/* + bool show = false; + QModelIndex index = sourceModel()->index(sourceRow, 0, QModelIndex()); + const ConferenceInfoListModel* ics = sourceModel()->data(index).value(); + + + if( mEntryTypeFilter == ConferenceType::Ended && ics->eventModel.value() != nullptr) + show = true; + else if( mEntryTypeFilter == ChatRoomModel::EntryType::MessageEntry && eventModel.value() != nullptr) + show = true; + else if( mEntryTypeFilter == ChatRoomModel::EntryType::NoticeEntry && eventModel.value() != nullptr) + show = true; + } + if( show && mFilterText != ""){ + QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); + auto eventModel = sourceModel()->data(index); + ChatMessageModel * chatModel = eventModel.value(); + if( chatModel){ + QRegularExpression search(QRegularExpression::escape(mFilterText), QRegularExpression::CaseInsensitiveOption | QRegularExpression::UseUnicodePropertiesOption); + show = chatModel->mContent.contains(search); + } + } + return show;*/ +} + +bool ConferenceInfoProxyListModel::lessThan (const QModelIndex &left, const QModelIndex &right) const { + return true; +/* + const ConferenceInfoListModel* deviceA = sourceModel()->data(left).value(); + const ConferenceInfoListModel* deviceB = sourceModel()->data(right).value(); + + return deviceA->getAt(0)->getDateTime() < deviceB->getAt(0)->getDateTime(); + */ +} +/* +QVariant ConferenceInfoProxyModel::getAt(int row){ + QModelIndex sourceIndex = mapToSource(this->index(row, 0)); + return sourceModel()->data(sourceIndex); +} + +void ConferenceInfoProxyModel::add(QSharedPointer conferenceInfoModel){ + qobject_cast(sourceModel())->add(conferenceInfoModel); +}*/ \ No newline at end of file diff --git a/linphone-app/src/app/proxyModel/ProxyMapModel.hpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyListModel.hpp similarity index 52% rename from linphone-app/src/app/proxyModel/ProxyMapModel.hpp rename to linphone-app/src/components/conferenceInfo/ConferenceInfoProxyListModel.hpp index 92d8c38b3..cd7be52a4 100644 --- a/linphone-app/src/app/proxyModel/ProxyMapModel.hpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyListModel.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Belledonne Communications SARL. + * Copyright (c) 2010-2020 Belledonne Communications SARL. * * This file is part of linphone-desktop * (see https://www.linphone.org). @@ -18,33 +18,31 @@ * along with this program. If not, see . */ -#ifndef _CONFERENCE_INFO_MAP_MODEL_H_ -#define _CONFERENCE_INFO_MAP_MODEL_H_ +#ifndef CONFERENCE_INFO_PROXY_LIST_MODEL_H_ +#define CONFERENCE_INFO_PROXY_LIST_MODEL_H_ + +#include +#include + +#include "ConferenceInfoModel.hpp" +#include "app/proxyModel/SortFilterAbstractProxyModel.hpp" -#include -#include -#include // ============================================================================= -class ConferenceInfoProxyModel; +class QWindow; +class ConferenceInfoListModel; -class ConferenceInfoMapModel : public QAbstractListModel { - Q_OBJECT +class ConferenceInfoProxyListModel : public SortFilterAbstractProxyModel { + Q_OBJECT + public: - ConferenceInfoMapModel (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 setConferenceInfoFilter (int filterMode); - -private: - QMap mMappedList; - + ConferenceInfoProxyListModel (QObject *parent = Q_NULLPTR); + +protected: + bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override; + bool lessThan (const QModelIndex &left, const QModelIndex &right) const override; }; -Q_DECLARE_METATYPE(ConferenceInfoMapModel*) + #endif diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyModel.cpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyModel.cpp index 6225f34e4..61c65dcf4 100644 --- a/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyModel.cpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyModel.cpp @@ -18,43 +18,39 @@ * along with this program. If not, see . */ +#include "ConferenceInfoProxyModel.hpp" + #include "components/call/CallModel.hpp" #include "components/core/CoreManager.hpp" #include "ConferenceInfoListModel.hpp" #include "ConferenceInfoMapModel.hpp" -#include "ConferenceInfoProxyModel.hpp" +#include "ConferenceInfoProxyListModel.hpp" // ============================================================================= using namespace std; -ConferenceInfoProxyModel::ConferenceInfoProxyModel (QObject *parent) : QSortFilterProxyModel(parent) { - mEntryTypeFilter = ConferenceType::Scheduled; - setSourceModel(new ConferenceInfoMapModel()); - sort(0, Qt::DescendingOrder); -} +//--------------------------------------------------------------------------------------------- -ConferenceInfoProxyModel::ConferenceInfoProxyModel (ConferenceInfoListModel * list, QObject *parent) : QSortFilterProxyModel(parent) { - mEntryTypeFilter = ConferenceType::Scheduled; - setSourceModel(list); - sort(0, Qt::DescendingOrder); -} - -int ConferenceInfoProxyModel::getConferenceInfoFilter () { - return mEntryTypeFilter; -} - -void ConferenceInfoProxyModel::setConferenceInfoFilter (int filterMode) { - if (getConferenceInfoFilter() != filterMode) { - mEntryTypeFilter = filterMode; - invalidate(); - emit conferenceInfoFilterChanged(filterMode); - } +ConferenceInfoProxyModel::ConferenceInfoProxyModel (QObject *parent) : SortFilterAbstractProxyModel(new ConferenceInfoMapModel(parent), parent) { + setFilterType((int)Scheduled); + connect(this, &ConferenceInfoProxyModel::filterTypeChanged, qobject_cast(sourceModel()), &ConferenceInfoMapModel::filterTypeChanged); } bool ConferenceInfoProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const { - return true; + QModelIndex index = sourceModel()->index(sourceRow, 0, QModelIndex()); + const ConferenceInfoMapModel* ics = sourceModel()->data(index).value(); + if(ics){ + int r = ics->rowCount(); + return r > 0; + } + const ConferenceInfoProxyListModel* listModel = sourceModel()->data(index).value(); + if(listModel){ + int r = listModel->rowCount(); + return r > 0; + } + return false; /* bool show = false; QModelIndex index = sourceModel()->index(sourceRow, 0, QModelIndex()); @@ -81,12 +77,15 @@ bool ConferenceInfoProxyModel::filterAcceptsRow (int sourceRow, const QModelInde } bool ConferenceInfoProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right) const { + return true; +/* const ConferenceInfoListModel* deviceA = sourceModel()->data(left).value(); const ConferenceInfoListModel* deviceB = sourceModel()->data(right).value(); - return deviceA->getAt(0)->getDateTime() < deviceB->getAt(0)->getDateTime(); + return deviceA->getAt(0)->getDateTime() < deviceB->getAt(0)->getDateTime(); + */ } - +/* QVariant ConferenceInfoProxyModel::getAt(int row){ QModelIndex sourceIndex = mapToSource(this->index(row, 0)); return sourceModel()->data(sourceIndex); @@ -94,4 +93,4 @@ QVariant ConferenceInfoProxyModel::getAt(int row){ void ConferenceInfoProxyModel::add(QSharedPointer conferenceInfoModel){ qobject_cast(sourceModel())->add(conferenceInfoModel); -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyModel.hpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyModel.hpp index 6475b7eeb..9ba12aac4 100644 --- a/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyModel.hpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoProxyModel.hpp @@ -25,40 +25,29 @@ #include #include "ConferenceInfoModel.hpp" +#include "app/proxyModel/SortFilterAbstractProxyModel.hpp" + // ============================================================================= class QWindow; -class ConferenceInfoListModel; +class ConferenceInfoMapModel; -class ConferenceInfoProxyModel : public QSortFilterProxyModel { + +class ConferenceInfoProxyModel : public SortFilterAbstractProxyModel { class ChatRoomModelFilter; Q_OBJECT public: - - Q_PROPERTY(int conferenceInfoFilter READ getConferenceInfoFilter WRITE setConferenceInfoFilter NOTIFY conferenceInfoFilterChanged) - enum ConferenceType { Ended, Scheduled, Invitations }; Q_ENUM(ConferenceType) - + ConferenceInfoProxyModel (QObject *parent = Q_NULLPTR); - ConferenceInfoProxyModel (ConferenceInfoListModel * list, QObject *parent = Q_NULLPTR); - - int getConferenceInfoFilter (); - Q_INVOKABLE void setConferenceInfoFilter (int filterMode); - - Q_INVOKABLE QVariant getAt(int row); - - void add(QSharedPointer conferenceInfoModel); - -signals: - void conferenceInfoFilterChanged(int); - + protected: bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override; bool lessThan (const QModelIndex &left, const QModelIndex &right) const override; @@ -68,7 +57,7 @@ private: ConferenceInfoModel *getConferenceInfoModel() const; void setConferenceInfoModel (ConferenceInfoModel *conferenceInfoModel); - int mEntryTypeFilter; + QSharedPointer mConferenceInfoModel; }; diff --git a/linphone-app/src/components/conferenceScheduler/ConferenceSchedulerHandler.cpp b/linphone-app/src/components/conferenceScheduler/ConferenceScheduler.cpp similarity index 57% rename from linphone-app/src/components/conferenceScheduler/ConferenceSchedulerHandler.cpp rename to linphone-app/src/components/conferenceScheduler/ConferenceScheduler.cpp index 1374ccc80..c81419b50 100644 --- a/linphone-app/src/components/conferenceScheduler/ConferenceSchedulerHandler.cpp +++ b/linphone-app/src/components/conferenceScheduler/ConferenceScheduler.cpp @@ -18,38 +18,42 @@ * along with this program. If not, see . */ -#include "ConferenceSchedulerHandler.hpp" +#include "ConferenceScheduler.hpp" +#include "ConferenceSchedulerListener.hpp" #include #include "app/App.hpp" #include "components/core/CoreManager.hpp" -// ============================================================================= -std::shared_ptr ConferenceSchedulerHandler::create( QObject *parent){ - std::shared_ptr model = std::make_shared(parent); - if(model){ - model->mSelf = model; - model->mConferenceScheduler->addListener(model); - return model; - } - return nullptr; +void ConferenceScheduler::connectTo(ConferenceSchedulerListener * listener){ + connect(listener, &ConferenceSchedulerListener::stateChanged, this, &ConferenceScheduler::onStateChanged); + connect(listener, &ConferenceSchedulerListener::invitationsSent, this, &ConferenceScheduler::onInvitationsSent); } -ConferenceSchedulerHandler::ConferenceSchedulerHandler (QObject * parent) : QObject(parent){ +// ============================================================================= +QSharedPointer ConferenceScheduler::create( QObject *parent){ + return QSharedPointer::create(parent); +} + +ConferenceScheduler::ConferenceScheduler (QObject * parent) : QObject(parent){ App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it when passing by Q_INVOKABLE mConferenceScheduler = CoreManager::getInstance()->getCore()->createConferenceScheduler(); + mConferenceSchedulerListener = std::make_shared(); + connectTo(mConferenceSchedulerListener.get()); + mConferenceScheduler->addListener(mConferenceSchedulerListener); } -ConferenceSchedulerHandler::~ConferenceSchedulerHandler () { +ConferenceScheduler::~ConferenceScheduler () { + mConferenceScheduler->removeListener(mConferenceSchedulerListener); } -std::shared_ptr ConferenceSchedulerHandler::getConferenceScheduler(){ +std::shared_ptr ConferenceScheduler::getConferenceScheduler(){ return mConferenceScheduler; } -void ConferenceSchedulerHandler::onStateChanged(const std::shared_ptr & conferenceScheduler, linphone::ConferenceSchedulerState state) { +void ConferenceScheduler::onStateChanged(linphone::ConferenceSchedulerState state) { emit stateChanged(state); - qWarning() << "ConferenceSchedulerHandler::onStateChanged : " << (int)state; + qWarning() << "ConferenceScheduler::onStateChanged : " << (int)state; if( state == linphone::ConferenceSchedulerState::Ready) { std::shared_ptr params = CoreManager::getInstance()->getCore()->createDefaultChatRoomParams(); params->setBackend(linphone::ChatRoomBackend::Basic); @@ -57,6 +61,6 @@ void ConferenceSchedulerHandler::onStateChanged(const std::shared_ptr & conferenceScheduler, const std::list> & failedInvitations) { +void ConferenceScheduler::onInvitationsSent( const std::list> & failedInvitations) { emit invitationsSent(failedInvitations); } \ No newline at end of file diff --git a/linphone-app/src/components/conferenceScheduler/ConferenceScheduler.hpp b/linphone-app/src/components/conferenceScheduler/ConferenceScheduler.hpp new file mode 100644 index 000000000..ecc2e5407 --- /dev/null +++ b/linphone-app/src/components/conferenceScheduler/ConferenceScheduler.hpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2021-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 CONFERENCE_SCHEDULER_H_ +#define CONFERENCE_SCHEDULER_H_ + +#include +#include +#include + +class ConferenceSchedulerListener; + +class ConferenceScheduler : public QObject { + Q_OBJECT + +public: + static QSharedPointer create(QObject *parent = Q_NULLPTR); + ConferenceScheduler (QObject * parent = nullptr); + virtual ~ConferenceScheduler (); + std::shared_ptr getConferenceScheduler(); + + virtual void onStateChanged(linphone::ConferenceSchedulerState state); + virtual void onInvitationsSent(const std::list> & failedInvitations); + +signals: + void stateChanged(linphone::ConferenceSchedulerState state); + void invitationsSent(const std::list> & failedInvitations); + +private: + + void connectTo(ConferenceSchedulerListener * listener); + + std::shared_ptr mConferenceScheduler; + std::shared_ptr mConferenceSchedulerListener; + +}; + +Q_DECLARE_METATYPE(QSharedPointer) + +#endif diff --git a/linphone-app/src/components/conferenceScheduler/ConferenceSchedulerListener.cpp b/linphone-app/src/components/conferenceScheduler/ConferenceSchedulerListener.cpp new file mode 100644 index 000000000..95264a569 --- /dev/null +++ b/linphone-app/src/components/conferenceScheduler/ConferenceSchedulerListener.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021-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 "ConferenceSchedulerListener.hpp" + +#include +#include "app/App.hpp" +#include "components/core/CoreManager.hpp" + +// ============================================================================= + +ConferenceSchedulerListener::ConferenceSchedulerListener () : QObject(nullptr){ +} + +ConferenceSchedulerListener::~ConferenceSchedulerListener () { +} + + +void ConferenceSchedulerListener::onStateChanged(const std::shared_ptr & conferenceScheduler, linphone::ConferenceSchedulerState state) { + emit stateChanged(state); +} + +void ConferenceSchedulerListener::onInvitationsSent(const std::shared_ptr & conferenceScheduler, const std::list> & failedInvitations) { + emit invitationsSent(failedInvitations); +} \ No newline at end of file diff --git a/linphone-app/src/components/conferenceScheduler/ConferenceSchedulerHandler.hpp b/linphone-app/src/components/conferenceScheduler/ConferenceSchedulerListener.hpp similarity index 65% rename from linphone-app/src/components/conferenceScheduler/ConferenceSchedulerHandler.hpp rename to linphone-app/src/components/conferenceScheduler/ConferenceSchedulerListener.hpp index 9bd478836..86e518458 100644 --- a/linphone-app/src/components/conferenceScheduler/ConferenceSchedulerHandler.hpp +++ b/linphone-app/src/components/conferenceScheduler/ConferenceSchedulerListener.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Belledonne Communications SARL. + * Copyright (c) 2021-2022 Belledonne Communications SARL. * * This file is part of linphone-desktop * (see https://www.linphone.org). @@ -18,23 +18,19 @@ * along with this program. If not, see . */ -#ifndef CONFERENCE_SCHEDULER_HANDLER_H_ -#define CONFERENCE_SCHEDULER_HANDLER_H_ +#ifndef CONFERENCE_SCHEDULER_LISTENER_H_ +#define CONFERENCE_SCHEDULER_LISTENER_H_ #include #include #include -class ConferenceSchedulerHandler : public QObject - , public linphone::ConferenceSchedulerListener -{ +class ConferenceSchedulerListener : public QObject, public linphone::ConferenceSchedulerListener { Q_OBJECT public: - static std::shared_ptr create(QObject *parent = Q_NULLPTR); - ConferenceSchedulerHandler (QObject * parent = nullptr); - ~ConferenceSchedulerHandler (); - std::shared_ptr getConferenceScheduler(); + ConferenceSchedulerListener(); + virtual ~ConferenceSchedulerListener(); virtual void onStateChanged(const std::shared_ptr & conferenceScheduler, linphone::ConferenceSchedulerState state) override; virtual void onInvitationsSent(const std::shared_ptr & conferenceScheduler, const std::list> & failedInvitations) override; @@ -42,13 +38,6 @@ public: signals: void stateChanged(linphone::ConferenceSchedulerState state); void invitationsSent(const std::list> & failedInvitations); - -private: - std::shared_ptr mConferenceScheduler; - std::weak_ptr mSelf; // Used for Linphone Listener - }; -Q_DECLARE_METATYPE(std::shared_ptr) - #endif diff --git a/linphone-app/src/components/ldap/LdapModel.hpp b/linphone-app/src/components/ldap/LdapModel.hpp index 41425f0aa..00c0a748a 100644 --- a/linphone-app/src/components/ldap/LdapModel.hpp +++ b/linphone-app/src/components/ldap/LdapModel.hpp @@ -21,7 +21,7 @@ #ifndef LDAP_MODEL_H_ #define LDAP_MODEL_H_ -#include +#include #include #include diff --git a/linphone-app/src/components/participant/ParticipantDeviceListModel.cpp b/linphone-app/src/components/participant/ParticipantDeviceListModel.cpp index 79713f51d..903358cae 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceListModel.cpp +++ b/linphone-app/src/components/participant/ParticipantDeviceListModel.cpp @@ -32,10 +32,10 @@ ParticipantDeviceListModel::ParticipantDeviceListModel (std::shared_ptr participant, QObject *parent) : ProxyListModel(parent) { std::list> devices = participant->getDevices() ; - auto previewModel = ParticipantDeviceModel::create(nullptr, true); - mList << previewModel; + //auto previewModel = ParticipantDeviceModel::create(nullptr, true); + //mList << previewModel; for(auto device : devices){ - auto deviceModel = ParticipantDeviceModel::create(device, false); + auto deviceModel = ParticipantDeviceModel::create(device, isMe(device)); connect(this, &ParticipantDeviceListModel::securityLevelChanged, deviceModel.get(), &ParticipantDeviceModel::onSecurityLevelChanged); mList << deviceModel; } @@ -44,12 +44,12 @@ ParticipantDeviceListModel::ParticipantDeviceListModel (std::shared_ptrisConference()) { mCallModel = callModel; - auto conferenceModel = callModel->getConferenceModel(); - auto previewModel = ParticipantDeviceModel::create(nullptr, true); - mList << previewModel; + auto conferenceModel = callModel->getConferenceSharedModel(); + //auto previewModel = ParticipantDeviceModel::create(nullptr, true); + //mList << previewModel; std::list> devices = conferenceModel->getConference()->getParticipantDeviceList(); for(auto device : devices){ - auto deviceModel = ParticipantDeviceModel::create(device, false); + auto deviceModel = ParticipantDeviceModel::create(device, isMe(device)); connect(this, &ParticipantDeviceListModel::securityLevelChanged, deviceModel.get(), &ParticipantDeviceModel::onSecurityLevelChanged); mList << deviceModel; } @@ -63,33 +63,36 @@ ParticipantDeviceListModel::ParticipantDeviceListModel (CallModel * callModel, Q updateDevices(devices); qWarning() << "Instanciate Participant Device list model with " << mList.size() << " devices"; */ + connect(conferenceModel.get(), &ConferenceModel::participantAdded, this, &ParticipantDeviceListModel::onParticipantAdded); + connect(conferenceModel.get(), &ConferenceModel::participantRemoved, this, &ParticipantDeviceListModel::onParticipantRemoved); connect(conferenceModel.get(), &ConferenceModel::participantDeviceAdded, this, &ParticipantDeviceListModel::onParticipantDeviceAdded); connect(conferenceModel.get(), &ConferenceModel::participantDeviceRemoved, this, &ParticipantDeviceListModel::onParticipantDeviceRemoved); + connect(conferenceModel.get(), &ConferenceModel::participantDeviceJoined, this, &ParticipantDeviceListModel::onParticipantDeviceJoined); + connect(conferenceModel.get(), &ConferenceModel::participantDeviceLeft, this, &ParticipantDeviceListModel::onParticipantDeviceLeft); connect(conferenceModel.get(), &ConferenceModel::conferenceStateChanged, this, &ParticipantDeviceListModel::onConferenceStateChanged); + connect(conferenceModel.get(), &ConferenceModel::participantDeviceMediaAvailabilityChanged, this, &ParticipantDeviceListModel::onParticipantDeviceMediaAvailabilityChanged); } } void ParticipantDeviceListModel::updateDevices(std::shared_ptr participant){ std::list> devices = participant->getDevices() ; - auto previewModel = ParticipantDeviceModel::create(nullptr, true); + //auto previewModel = ParticipantDeviceModel::create(nullptr, true); beginResetModel(); qWarning() << "Update devices from participant"; mList.clear(); - mList << previewModel; + //mList << previewModel; for(auto device : devices){ - auto deviceModel = ParticipantDeviceModel::create(device, false); + auto deviceModel = ParticipantDeviceModel::create(device, isMe(device)); connect(this, &ParticipantDeviceListModel::securityLevelChanged, deviceModel.get(), &ParticipantDeviceModel::onSecurityLevelChanged); mList << deviceModel; } endResetModel(); - emit countChanged(); - emit layoutChanged(); } void ParticipantDeviceListModel::updateDevices(const std::list>& devices, const bool& isMe){ /* QList> devicesToAdd; - //auto meDevices = mCallModel->getConferenceModel()->getConference()->getMe()->getDevices(); + //auto meDevices = mCallModel->getConferenceSharedModel()->getConference()->getMe()->getDevices(); for(auto device : devices){ auto deviceAddress = device->getAddress(); //bool isMe = false; @@ -117,21 +120,96 @@ void ParticipantDeviceListModel::updateDevices(const std::list deviceToAdd){ + qWarning() << "Adding device " << deviceToAdd->getAddress()->asString().c_str(); + for(auto item : mList) { + auto deviceModel = item.objectCast(); + if(deviceModel->getDevice() == deviceToAdd) { + qWarning() << "Device already exist. Send video update event"; + emit deviceModel->videoEnabledChanged(); + return false; + } + } + + auto deviceModel = ParticipantDeviceModel::create(deviceToAdd, isMe(deviceToAdd)); + connect(this, &ParticipantDeviceListModel::securityLevelChanged, deviceModel.get(), &ParticipantDeviceModel::onSecurityLevelChanged); + ProxyListModel::add(deviceModel); + qWarning() << "Device added. Count=" << mList.count(); + return true; +} + +bool ParticipantDeviceListModel::remove(std::shared_ptr deviceToRemove){ + int row = 0; + for(auto device : mList){ + if( device.objectCast()->getDevice() == deviceToRemove){ + removeRow(row); + return true; + }else + ++row; + } + return false; +} + +QSharedPointer ParticipantDeviceListModel::get(std::shared_ptr deviceToGet, int * index){ + int row = 0; + for(auto item : mList){ + auto device = item.objectCast(); + if( device->getDevice() == deviceToGet){ + if(index) + *index = row; + return device; + }else + ++row; + } + return nullptr; +} + +bool ParticipantDeviceListModel::isMe(std::shared_ptr deviceToCheck)const{ + if(mCallModel){ + auto devices = mCallModel->getConferenceModel()->getConference()->getMe()->getDevices(); + auto deviceToCheckAddress = deviceToCheck->getAddress(); + for(auto device : devices){ + if(deviceToCheckAddress == device->getAddress()) + return true; + } + } + return false; +} + +bool ParticipantDeviceListModel::isMeAlone() const{ + for(auto item : mList){ + auto device = item.objectCast(); + if( !isMe(device->getDevice())) + return false; + } + return true; +} + void ParticipantDeviceListModel::onSecurityLevelChanged(std::shared_ptr device){ emit securityLevelChanged(device); } //---------------------------------------------------------------------------------------------------------- +void ParticipantDeviceListModel::onParticipantAdded(const std::shared_ptr & participant){ + std::list> devices = participant->getDevices() ; + for(auto device : devices) + add(device); +} + +void ParticipantDeviceListModel::onParticipantRemoved(const std::shared_ptr & participant){ + std::list> devices = participant->getDevices() ; + for(auto device : devices) + remove(device); +} void ParticipantDeviceListModel::onParticipantDeviceAdded(const std::shared_ptr & participantDevice){ - auto conferenceModel = mCallModel->getConferenceModel(); + qWarning() << "Adding new device : " << mList.count(); + auto conferenceModel = mCallModel->getConferenceSharedModel(); std::list> devices = conferenceModel->getConference()->getParticipantDeviceList(); for(auto realParticipantDevice : devices){ if( realParticipantDevice == participantDevice){ - auto deviceModel = ParticipantDeviceModel::create(realParticipantDevice, false); - connect(this, &ParticipantDeviceListModel::securityLevelChanged, deviceModel.get(), &ParticipantDeviceModel::onSecurityLevelChanged); - add(deviceModel); + add(realParticipantDevice); return; } } @@ -139,31 +217,38 @@ void ParticipantDeviceListModel::onParticipantDeviceAdded(const std::shared_ptr< } void ParticipantDeviceListModel::onParticipantDeviceRemoved(const std::shared_ptr & participantDevice){ - qWarning() << "Removing participant"; - int row = 0; - for(auto device : mList){ - if( device.objectCast()->getDevice() == participantDevice){ - removeRow(row); - return; - } - ++row; - } - qWarning() << "No participant device found from const linphone::ParticipantDevice at onParticipantDeviceRemoved"; + qWarning() << "Removing participant device : " << mList.count(); + if(!remove(participantDevice)) + qWarning() << "No participant device found from const linphone::ParticipantDevice at onParticipantDeviceRemoved"; } void ParticipantDeviceListModel::onParticipantDeviceJoined(const std::shared_ptr & participantDevice){ - qWarning() << "onParticipantDeviceJoined is not yet implemented. Current participants count: " << mList.size(); + onParticipantDeviceAdded(participantDevice); + /* + for(auto item : mList) { + auto device = item.objectCast(); + if(device->getDevice() == participantDevice) { + emit device->videoEnabledChanged(); + return; + } + }*/ } void ParticipantDeviceListModel::onParticipantDeviceLeft(const std::shared_ptr & participantDevice){ - qWarning() << "onParticipantDeviceLeft is not yet implemented. Current participants count: " << mList.size(); + for(auto item : mList) { + auto device = item.objectCast(); + if(device->getDevice() == participantDevice) { + emit device->videoEnabledChanged(); + return; + } + } } void ParticipantDeviceListModel::onConferenceStateChanged(linphone::Conference::State newState){ if(newState == linphone::Conference::State::Created){ if(mCallModel && mCallModel->isConference()) { - auto conferenceModel = mCallModel->getConferenceModel(); - updateDevices(mCallModel->getConferenceModel()->getConference()->getMe()->getDevices(), true); + auto conferenceModel = mCallModel->getConferenceSharedModel(); + updateDevices(conferenceModel->getConference()->getMe()->getDevices(), true); updateDevices(conferenceModel->getConference()->getParticipantDeviceList(), false); } @@ -188,4 +273,10 @@ void ParticipantDeviceListModel::onConferenceStateChanged(linphone::Conference:: } */ } +} + +void ParticipantDeviceListModel::onParticipantDeviceMediaAvailabilityChanged(const std::shared_ptr & participantDevice){ + auto device = get(participantDevice); + if(device) + emit device->videoEnabledChanged(); } \ No newline at end of file diff --git a/linphone-app/src/components/participant/ParticipantDeviceListModel.hpp b/linphone-app/src/components/participant/ParticipantDeviceListModel.hpp index c3243cced..595c71099 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceListModel.hpp +++ b/linphone-app/src/components/participant/ParticipantDeviceListModel.hpp @@ -42,13 +42,23 @@ public: void updateDevices(std::shared_ptr participant); void updateDevices(const std::list>& devices, const bool& isMe); + bool add(std::shared_ptr deviceToAdd); + bool remove(std::shared_ptr deviceToAdd); + QSharedPointer get(std::shared_ptr deviceToGet, int * index = nullptr); + + bool isMe(std::shared_ptr device)const; + bool isMeAlone() const; + public slots: 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 onParticipantDeviceJoined(const std::shared_ptr & participantDevice); void onParticipantDeviceLeft(const std::shared_ptr & participantDevice); void onConferenceStateChanged(linphone::Conference::State newState); + void onParticipantDeviceMediaAvailabilityChanged(const std::shared_ptr & participantDevice); signals: void securityLevelChanged(std::shared_ptr device); diff --git a/linphone-app/src/components/participant/ParticipantDeviceModel.cpp b/linphone-app/src/components/participant/ParticipantDeviceModel.cpp index d362b3948..6fa5320b7 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceModel.cpp +++ b/linphone-app/src/components/participant/ParticipantDeviceModel.cpp @@ -84,6 +84,10 @@ QString ParticipantDeviceModel::getName() const{ return mParticipantDevice ? Utils::coreStringToAppString(mParticipantDevice->getName()) : "NoName"; } +QString ParticipantDeviceModel::getDisplayName() const{ + return mParticipantDevice ? Utils::getDisplayName(mParticipantDevice->getAddress()) : ""; +} + int ParticipantDeviceModel::getSecurityLevel() const{ if( mParticipantDevice) { int security = (int)mParticipantDevice->getSecurityLevel(); @@ -106,9 +110,9 @@ std::shared_ptr ParticipantDeviceModel::getDevice( } bool ParticipantDeviceModel::isVideoEnabled() const{ - if(mParticipantDevice) - qWarning() << "VideoEnabled: " << (int)mParticipantDevice->getStreamAvailability(linphone::StreamType::Video); - return mParticipantDevice && mParticipantDevice->getStreamAvailability(linphone::StreamType::Video); + bool enabled = mParticipantDevice && mParticipantDevice->getStreamAvailability(linphone::StreamType::Video) || isMe();// && mCall && mCall->getVideoEnabled(); + qWarning() << "VideoEnabled: " << enabled; + return enabled; } bool ParticipantDeviceModel::isMe() const{ @@ -130,6 +134,7 @@ void ParticipantDeviceModel::onConferenceJoined(const std::shared_ptr & participantDevice) { } void ParticipantDeviceModel::onStreamCapabilityChanged(const std::shared_ptr & participantDevice, linphone::MediaDirection direction, linphone::StreamType streamType) { + emit videoEnabledChanged(); } void ParticipantDeviceModel::onStreamAvailabilityChanged(const std::shared_ptr & participantDevice, bool available, linphone::StreamType streamType) { emit videoEnabledChanged(); diff --git a/linphone-app/src/components/participant/ParticipantDeviceModel.hpp b/linphone-app/src/components/participant/ParticipantDeviceModel.hpp index b2c1790c9..1919df8ac 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceModel.hpp +++ b/linphone-app/src/components/participant/ParticipantDeviceModel.hpp @@ -44,6 +44,7 @@ public: static QSharedPointer create(std::shared_ptr device, const bool& isMe = false, QObject *parent = nullptr); //static std::shared_ptr create(CallModel * call, const bool& isMe = true, QObject *parent = nullptr); + Q_PROPERTY(QString displayName READ getDisplayName CONSTANT) Q_PROPERTY(QString name READ getName CONSTANT) Q_PROPERTY(QString address READ getAddress CONSTANT) Q_PROPERTY(int securityLevel READ getSecurityLevel NOTIFY securityLevelChanged) @@ -52,6 +53,7 @@ public: Q_PROPERTY(bool isMe READ isMe CONSTANT) QString getName() const; + QString getDisplayName() const; QString getAddress() const; int getSecurityLevel() const; time_t getTimeOfJoining() const; diff --git a/linphone-app/src/components/participant/ParticipantDeviceProxyModel.cpp b/linphone-app/src/components/participant/ParticipantDeviceProxyModel.cpp index 8501407cb..02b2c5cd2 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceProxyModel.cpp +++ b/linphone-app/src/components/participant/ParticipantDeviceProxyModel.cpp @@ -30,7 +30,7 @@ // ============================================================================= -ParticipantDeviceProxyModel::ParticipantDeviceProxyModel (QObject *parent) : QSortFilterProxyModel(parent){ +ParticipantDeviceProxyModel::ParticipantDeviceProxyModel (QObject *parent) : SortFilterProxyModel(parent){ } bool ParticipantDeviceProxyModel::filterAcceptsRow ( @@ -39,10 +39,15 @@ bool ParticipantDeviceProxyModel::filterAcceptsRow ( ) const { Q_UNUSED(sourceRow) Q_UNUSED(sourceParent) - const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); - const ParticipantDeviceModel *device = index.data().value(); - - return device && (isShowMe() || !device->isMe()); + auto listModel = qobject_cast(sourceModel()); + /* + if(mFilterType == 1 && listModel->rowCount() <= 2){ + return sourceRow == 0; + }else{*/ + const QModelIndex index = listModel->index(sourceRow, 0, sourceParent); + const ParticipantDeviceModel *device = index.data().value(); + return device && (isShowMe() || !device->isMe()); + //} } bool ParticipantDeviceProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right) const { @@ -63,27 +68,21 @@ CallModel * ParticipantDeviceProxyModel::getCallModel() const{ return mCallModel; } -int ParticipantDeviceProxyModel::getCount() const{ - ParticipantDeviceListModel* devices = qobject_cast(sourceModel()); - if(devices) - return devices->rowCount(); - else - return 0; -} - bool ParticipantDeviceProxyModel::isShowMe() const{ return mShowMe; } void ParticipantDeviceProxyModel::setCallModel(CallModel * callModel){ + setFilterType(1); mCallModel = callModel; auto sourceModel = new ParticipantDeviceListModel(mCallModel); - connect(sourceModel, &ParticipantDeviceListModel::countChanged, this, &ParticipantDeviceProxyModel::countChanged); + connect(sourceModel, &ParticipantDeviceListModel::countChanged, this, &ParticipantDeviceProxyModel::onCountChanged); setSourceModel(sourceModel); emit countChanged(); } void ParticipantDeviceProxyModel::setParticipant(ParticipantModel * participant){ + setFilterType(0); auto sourceModel = participant->getParticipantDevices().get(); connect(sourceModel, &ParticipantDeviceListModel::countChanged, this, &ParticipantDeviceProxyModel::countChanged); setSourceModel(sourceModel); @@ -95,4 +94,11 @@ void ParticipantDeviceProxyModel::setShowMe(const bool& show){ mShowMe = show; emit showMeChanged(); } +} + +void ParticipantDeviceProxyModel::onCountChanged(){ + auto listModel = qobject_cast(sourceModel()); + if(mFilterType == 1 || mFilterType == 2){ + //if( listModel->getCount() + } } \ No newline at end of file diff --git a/linphone-app/src/components/participant/ParticipantDeviceProxyModel.hpp b/linphone-app/src/components/participant/ParticipantDeviceProxyModel.hpp index fe2e4d504..762e3e822 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceProxyModel.hpp +++ b/linphone-app/src/components/participant/ParticipantDeviceProxyModel.hpp @@ -27,26 +27,24 @@ #include #include #include -#include +#include "app/proxyModel/SortFilterProxyModel.hpp" class ParticipantDeviceListModel; class ParticipantDeviceModel; class ParticipantModel; class CallModel; -class ParticipantDeviceProxyModel : public QSortFilterProxyModel { +class ParticipantDeviceProxyModel : public SortFilterProxyModel { Q_OBJECT public: Q_PROPERTY(CallModel * callModel READ getCallModel WRITE setCallModel NOTIFY callModelChanged) - Q_PROPERTY(int count READ getCount NOTIFY countChanged) Q_PROPERTY(bool showMe READ isShowMe WRITE setShowMe NOTIFY showMeChanged) ParticipantDeviceProxyModel (QObject *parent = nullptr); Q_INVOKABLE ParticipantDeviceModel* getAt(int row); CallModel * getCallModel() const; - Q_INVOKABLE int getCount() const; bool isShowMe() const; @@ -54,16 +52,18 @@ public: void setParticipant(ParticipantModel * participant); void setShowMe(const bool& show); +public slots: + void onCountChanged(); + signals: void callModelChanged(); - void countChanged(); void showMeChanged(); protected: virtual bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override; virtual bool lessThan (const QModelIndex &left, const QModelIndex &right) const override; - std::shared_ptr mDevices; + QSharedPointer mDevices; CallModel * mCallModel; bool mShowMe = false; }; diff --git a/linphone-app/src/components/participant/ParticipantProxyModel.cpp b/linphone-app/src/components/participant/ParticipantProxyModel.cpp index ab44575f3..396c8435e 100644 --- a/linphone-app/src/components/participant/ParticipantProxyModel.cpp +++ b/linphone-app/src/components/participant/ParticipantProxyModel.cpp @@ -61,7 +61,7 @@ QVariantList ParticipantProxyModel::getParticipants() const{ QVariantList participants; ParticipantListModel * list = qobject_cast(sourceModel()); for(int i = 0 ; i < list->rowCount() ; ++i) - participants << QVariant::fromValue(list->getAt(i)); + participants << QVariant::fromValue(list->getAt(i)); return participants; } diff --git a/linphone-app/src/components/search/SearchHandler.cpp b/linphone-app/src/components/search/SearchListener.cpp similarity index 82% rename from linphone-app/src/components/search/SearchHandler.cpp rename to linphone-app/src/components/search/SearchListener.cpp index bdad44900..7a17e21e0 100644 --- a/linphone-app/src/components/search/SearchHandler.cpp +++ b/linphone-app/src/components/search/SearchListener.cpp @@ -17,15 +17,15 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include "SearchHandler.hpp" +#include "SearchListener.hpp" #include "linphone/api/c-search-result.h" // ============================================================================= -SearchHandler::SearchHandler(QObject * parent) : QObject(parent){ +SearchListener::SearchListener(QObject * parent) : QObject(parent){ } -void SearchHandler::onSearchResultsReceived(const std::shared_ptr & magicSearch){ +void SearchListener::onSearchResultsReceived(const std::shared_ptr & magicSearch){ emit searchReceived(magicSearch->getLastSearch()); } diff --git a/linphone-app/src/components/search/SearchHandler.hpp b/linphone-app/src/components/search/SearchListener.hpp similarity index 85% rename from linphone-app/src/components/search/SearchHandler.hpp rename to linphone-app/src/components/search/SearchListener.hpp index 1a7256312..19fb0ffad 100644 --- a/linphone-app/src/components/search/SearchHandler.hpp +++ b/linphone-app/src/components/search/SearchListener.hpp @@ -18,21 +18,21 @@ * along with this program. If not, see . */ -#ifndef SEARCH_HANDLER_H_ -#define SEARCH_HANDLER_H_ +#ifndef SEARCH_LISTENER_H_ +#define SEARCH_LISTENER_H_ #include #include #include // ============================================================================= -class SearchHandler : public QObject, public linphone::MagicSearchListener{ +class SearchListener : public QObject, public linphone::MagicSearchListener{ Q_OBJECT public: - SearchHandler(QObject * parent = nullptr); + SearchListener(QObject * parent = nullptr); virtual void onSearchResultsReceived(const std::shared_ptr & magicSearch); signals: void searchReceived(std::list> ); }; Q_DECLARE_METATYPE(std::shared_ptr); -#endif // SEARCH_HANDLER_H_ +#endif diff --git a/linphone-app/src/components/search/SearchSipAddressesModel.cpp b/linphone-app/src/components/search/SearchSipAddressesModel.cpp index 5e06eae7b..6a1d3e3a4 100644 --- a/linphone-app/src/components/search/SearchSipAddressesModel.cpp +++ b/linphone-app/src/components/search/SearchSipAddressesModel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2020 Belledonne Communications SARL. + * Copyright (c) 2010-2022 Belledonne Communications SARL. * * This file is part of linphone-desktop * (see https://www.linphone.org). @@ -46,11 +46,11 @@ using namespace std; // ----------------------------------------------------------------------------- -SearchSipAddressesModel::SearchSipAddressesModel (QObject *parent) : QAbstractListModel(parent) { +SearchSipAddressesModel::SearchSipAddressesModel (QObject *parent) : ProxyListModel(parent) { mMagicSearch = CoreManager::getInstance()->getCore()->createMagicSearch(); - mSearch = std::make_shared(this); - QObject::connect(mSearch.get(), &SearchHandler::searchReceived, this, &SearchSipAddressesModel::searchReceived, Qt::QueuedConnection); + mSearch = std::make_shared(this); + QObject::connect(mSearch.get(), &SearchListener::searchReceived, this, &SearchSipAddressesModel::searchReceived, Qt::QueuedConnection); mMagicSearch->addListener(mSearch); } @@ -61,67 +61,23 @@ SearchSipAddressesModel::~SearchSipAddressesModel(){ // ----------------------------------------------------------------------------- -int SearchSipAddressesModel::rowCount (const QModelIndex &) const { - return mAddresses.count(); -} - -QHash SearchSipAddressesModel::roleNames () const { - QHash roles; - roles[Qt::DisplayRole] = "$sipAddress"; - return roles; -} - -QVariant SearchSipAddressesModel::data (const QModelIndex &index, int role) const { - int row = index.row(); - - if (!index.isValid() || row < 0 || row >= mAddresses.count()) - return QVariant(); - - if (role == Qt::DisplayRole) - return QVariant::fromValue(mAddresses[row].get()); - - return QVariant(); -} - -// ----------------------------------------------------------------------------- - -bool SearchSipAddressesModel::removeRow (int row, const QModelIndex &parent) { - return removeRows(row, 1, parent); -} - -bool SearchSipAddressesModel::removeRows (int row, int count, const QModelIndex &parent) { - int limit = row + count - 1; - - if (row < 0 || count < 0 || limit >= mAddresses.count()) - return false; - - beginRemoveRows(parent, row, limit); - - for (int i = 0; i < count; ++i) - mAddresses.removeAt(row); - - endRemoveRows(); - - return true; -} - void SearchSipAddressesModel::setFilter(const QString& filter){ mMagicSearch->getContactListFromFilterAsync(filter.toStdString(),""); //searchReceived(mMagicSearch->getContactListFromFilter(Utils::appStringToCoreString(filter),"")); // Just to show how to use sync method } void SearchSipAddressesModel::searchReceived(std::list> results){ - QList > addresses; + QList > addresses; for(auto it = results.begin() ; it != results.end() ; ++it){ auto linphoneFriend = (*it)->getFriend(); auto address = (*it)->getAddress(); if( linphoneFriend || address) - addresses << std::make_shared(linphoneFriend,address ); + addresses << QSharedPointer::create(linphoneFriend,address ); } beginResetModel(); - mAddresses.clear(); - mAddresses = addresses; - if(mAddresses.size() > 0 )// remove self - mAddresses.pop_back(); + mList.clear(); + mList = addresses; + if(mList.size() > 0 )// remove self + mList.pop_back(); endResetModel(); } diff --git a/linphone-app/src/components/search/SearchSipAddressesModel.hpp b/linphone-app/src/components/search/SearchSipAddressesModel.hpp index b9b27fbce..16c655b8e 100644 --- a/linphone-app/src/components/search/SearchSipAddressesModel.hpp +++ b/linphone-app/src/components/search/SearchSipAddressesModel.hpp @@ -21,45 +21,35 @@ #ifndef SEARCH_SIP_ADDRESSES_MODEL_H_ #define SEARCH_SIP_ADDRESSES_MODEL_H_ -#include #include #include #include -#include "SearchHandler.hpp" +#include "SearchListener.hpp" +#include "app/proxyModel/ProxyListModel.hpp" // ============================================================================= class SearchResultModel; -class SearchSipAddressesModel : public QAbstractListModel { +class SearchSipAddressesModel : public ProxyListModel { Q_OBJECT public: SearchSipAddressesModel (QObject *parent = Q_NULLPTR); ~SearchSipAddressesModel(); - 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 setFilter (const QString &pattern); - QList > mAddresses; + //QList > mAddresses; // And instance of Magic search std::shared_ptr mMagicSearch; // Callback when searching - std::shared_ptr mSearch; + std::shared_ptr mSearch; public slots: void searchReceived(std::list> results); - -private: - bool removeRow (int row, const QModelIndex &parent = QModelIndex()); - bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()) override; - }; Q_DECLARE_METATYPE(SearchSipAddressesModel *); diff --git a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp index b7a284cfb..c96e18f41 100644 --- a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp +++ b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp @@ -88,7 +88,7 @@ int SipAddressesModel::rowCount (const QModelIndex &) const { QHash SipAddressesModel::roleNames () const { QHash roles; - roles[Qt::DisplayRole] = "$sipAddress"; + roles[Qt::DisplayRole] = "$modelData"; return roles; } diff --git a/linphone-app/src/components/tunnel/TunnelConfigListModel.cpp b/linphone-app/src/components/tunnel/TunnelConfigListModel.cpp index dbf93bd42..d1e2cbffb 100644 --- a/linphone-app/src/components/tunnel/TunnelConfigListModel.cpp +++ b/linphone-app/src/components/tunnel/TunnelConfigListModel.cpp @@ -29,31 +29,23 @@ // ============================================================================= -TunnelConfigListModel::TunnelConfigListModel (std::shared_ptr tunnel, QObject *parent) : QAbstractListModel(parent) { +TunnelConfigListModel::TunnelConfigListModel (std::shared_ptr tunnel, QObject *parent) : ProxyListModel(parent) { std::list> tunnelConfigs = tunnel->getServers() ; for(auto config : tunnelConfigs){ - auto configModel = std::make_shared(config); + auto configModel = QSharedPointer::create(config); mList << configModel; } if( mList.size() == 0) { - mList << std::make_shared(linphone::Factory::get()->createTunnelConfig()); + mList << QSharedPointer::create(linphone::Factory::get()->createTunnelConfig()); } } -int TunnelConfigListModel::rowCount (const QModelIndex &index) const{ - return mList.count(); -} - -int TunnelConfigListModel::count(){ - return mList.count(); -} - void TunnelConfigListModel::updateTunnelConfigs(std::shared_ptr tunnel){ std::list> tunnelConfigs = tunnel->getServers() ; beginResetModel(); mList.clear(); for(auto config : tunnelConfigs){ - mList << std::make_shared(config); + mList << QSharedPointer::create(config); } endResetModel(); emit layoutChanged(); @@ -62,7 +54,7 @@ void TunnelConfigListModel::updateTunnelConfigs(std::shared_ptr tunnel){ tunnel->cleanServers(); for(auto config : mList){ - tunnel->addServer(config->getTunnelConfig()); + tunnel->addServer(config.objectCast()->getTunnelConfig()); } updateTunnelConfigs(tunnel); return true; @@ -71,7 +63,7 @@ bool TunnelConfigListModel::apply(std::shared_ptr tunnel){ void TunnelConfigListModel::addTunnelConfig(){ int row = rowCount(); beginInsertRows(QModelIndex(),row,row); - mList << std::make_shared(linphone::Factory::get()->createTunnelConfig()); + mList << QSharedPointer::create(linphone::Factory::get()->createTunnelConfig()); endInsertRows(); } @@ -84,41 +76,3 @@ void TunnelConfigListModel::removeTunnelConfig(std::shared_ptr tunnel->removeServer(model->getTunnelConfig()); } } - -QHash TunnelConfigListModel::roleNames () const { - QHash roles; - roles[Qt::DisplayRole] = "$tunnelConfig"; - return roles; -} - -QVariant TunnelConfigListModel::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(); -} - -bool TunnelConfigListModel::removeRow (int row, const QModelIndex &parent){ - return removeRows(row, 1, parent); -} - -bool TunnelConfigListModel::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; -} diff --git a/linphone-app/src/components/tunnel/TunnelConfigListModel.hpp b/linphone-app/src/components/tunnel/TunnelConfigListModel.hpp index f70a6abbf..bc2b558f9 100644 --- a/linphone-app/src/components/tunnel/TunnelConfigListModel.hpp +++ b/linphone-app/src/components/tunnel/TunnelConfigListModel.hpp @@ -27,36 +27,23 @@ #include #include #include -#include +#include "app/proxyModel/ProxyListModel.hpp" class TunnelConfigModel; -class TunnelConfigListModel : public QAbstractListModel { +class TunnelConfigListModel : public ProxyListModel { Q_OBJECT public: TunnelConfigListModel (std::shared_ptr tunnel, QObject *parent = nullptr); - int rowCount (const QModelIndex &index = QModelIndex()) const override; - int count(); - void updateTunnelConfigs(std::shared_ptr tunnel); bool apply(std::shared_ptr tunnel); void addTunnelConfig(); void removeTunnelConfig(std::shared_ptr tunnel, TunnelConfigModel * model); - virtual QHash roleNames () const override; - virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override; - - -private: - bool removeRow (int row, const QModelIndex &parent = QModelIndex()); - virtual bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()) override; - - QList> mList; - }; -Q_DECLARE_METATYPE(std::shared_ptr) +Q_DECLARE_METATYPE(QSharedPointer) #endif // TUNNEL_CONFIG_LIST_MODEL_H_ diff --git a/linphone-app/src/components/tunnel/TunnelConfigModel.hpp b/linphone-app/src/components/tunnel/TunnelConfigModel.hpp index 5b99784ed..2614b4a44 100644 --- a/linphone-app/src/components/tunnel/TunnelConfigModel.hpp +++ b/linphone-app/src/components/tunnel/TunnelConfigModel.hpp @@ -70,6 +70,6 @@ private: }; -Q_DECLARE_METATYPE(std::shared_ptr) +Q_DECLARE_METATYPE(QSharedPointer) #endif // TUNNEL_CONFIG_MODEL diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatCalendarMessage.qml b/linphone-app/ui/modules/Linphone/Chat/ChatCalendarMessage.qml index ab1346c99..549ebb38d 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatCalendarMessage.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatCalendarMessage.qml @@ -27,6 +27,9 @@ Loader{ property int fitHeight: active && item ? item.fitHeight + ChatCalendarMessageStyle.heightMargin*2 : 0 property int fitWidth: active && item ? Math.max(item.fitWidth, maxWidth/2) + ChatCalendarMessageStyle.widthMargin*2 : 0 property bool containsMouse: false + property int gotoButtonMode: -1 //-1: hide, 0:goto, 1:MoreInfo + property bool isExpanded : false + width: parent.width height: fitHeight @@ -35,7 +38,7 @@ Loader{ sourceComponent: MouseArea{ id: loadedItem - property int fitHeight: layout.fitHeight + property int fitHeight: layout.fitHeight + ChatCalendarMessageStyle.heightMargin property int fitWidth: layout.fitWidth anchors.fill: parent @@ -139,13 +142,40 @@ Loader{ text: mainItem.conferenceInfoModel.displayNamesToString } ActionButton{ + visible: mainItem.gotoButtonMode >= 0 Layout.preferredHeight: iconSize Layout.preferredWidth: height isCustom: true - colorSet: ChatCalendarMessageStyle.gotoButton + colorSet: mainItem.gotoButtonMode == 0 ? ChatCalendarMessageStyle.gotoButton : ChatCalendarMessageStyle.infoButton backgroundRadius: width/2 + onClicked: mainItem.isExpanded = !mainItem.isExpanded } } + Text{ + id: descriptionTitle + visible: mainItem.isExpanded + Layout.fillWidth: true + Layout.minimumWidth: implicitWidth + Layout.leftMargin: 10 + color: ChatCalendarMessageStyle.subject.color + font.pointSize: ChatCalendarMessageStyle.subject.pointSize + font.weight: Font.Bold + + text: 'Description :' + } + Text{ + id: description + visible: mainItem.isExpanded + Layout.fillWidth: true + Layout.minimumWidth: implicitWidth + Layout.leftMargin: 10 + color: ChatCalendarMessageStyle.description.color + font.pointSize: ChatCalendarMessageStyle.description.pointSize + //font.weight: Font.Bold + elide: Text.ElideRight + maximumLineCount: 100 + text: mainItem.conferenceInfoModel.description + } } } } diff --git a/linphone-app/ui/modules/Linphone/Codecs/CodecsViewer.qml b/linphone-app/ui/modules/Linphone/Codecs/CodecsViewer.qml index ef3234919..a9adb9692 100644 --- a/linphone-app/ui/modules/Linphone/Codecs/CodecsViewer.qml +++ b/linphone-app/ui/modules/Linphone/Codecs/CodecsViewer.qml @@ -119,7 +119,7 @@ Column { Rectangle { id: content - readonly property bool isDownloadable: Boolean($codec.downloadUrl) + readonly property bool isDownloadable: Boolean($modelData.downloadUrl) Drag.active: dragArea.held Drag.source: dragArea @@ -145,23 +145,23 @@ Column { CodecAttribute { Layout.preferredWidth: CodecsViewerStyle.column.mimeWidth - text: $codec.mime + text: $modelData.mime } CodecAttribute { Layout.preferredWidth: CodecsViewerStyle.column.encoderDescriptionWidth - text: $codec.encoderDescription || '' + text: $modelData.encoderDescription || '' } CodecAttribute { Layout.preferredWidth: CodecsViewerStyle.column.clockRateWidth - text: $codec.clockRate || '' + text: $modelData.clockRate || '' } NumericField { Layout.preferredWidth: CodecsViewerStyle.column.bitrateWidth - readOnly: content.isDownloadable || !$codec.isVbr - text: $codec.bitrate || '' + readOnly: content.isDownloadable || !$modelData.isVbr + text: $modelData.bitrate || '' onEditingFinished: view.model.setBitrate(index, text) } @@ -169,7 +169,7 @@ Column { TextField { Layout.preferredWidth: CodecsViewerStyle.column.recvFmtpWidth readOnly: content.isDownloadable - text: $codec.recvFmtp || '' + text: $modelData.recvFmtp || '' onEditingFinished: view.model.setRecvFmtp(index, text) } @@ -177,10 +177,10 @@ Column { Switch { Layout.fillWidth: true - checked: Boolean($codec.enabled) + checked: Boolean($modelData.enabled) onClicked: !checked && content.isDownloadable - ? downloadRequested($codec) + ? downloadRequested($modelData) : view.model.enableCodec(index, !checked) } } diff --git a/linphone-app/ui/modules/Linphone/Menus/SipAddressesMenu.qml b/linphone-app/ui/modules/Linphone/Menus/SipAddressesMenu.qml index 29766e9c4..9188bf3be 100644 --- a/linphone-app/ui/modules/Linphone/Menus/SipAddressesMenu.qml +++ b/linphone-app/ui/modules/Linphone/Menus/SipAddressesMenu.qml @@ -38,7 +38,7 @@ Item { model.clear() sipAddresses.forEach(function (sipAddress) { - model.append({ $sipAddress: sipAddress }) + model.append({ $modelData: sipAddress }) }) } @@ -97,7 +97,7 @@ Item { elide: Text.ElideRight font.pointSize: SipAddressesMenuStyle.entry.text.pointSize height: parent.height - text: $sipAddress + text: $modelData verticalAlignment: Text.AlignVCenter } @@ -109,9 +109,9 @@ Item { onClicked: { menu.close() if( menu.callback) - menu.callback($sipAddress) + menu.callback($modelData) else - sipAddressesMenu.sipAddressClicked($sipAddress) + sipAddressesMenu.sipAddressClicked($modelData) } } } diff --git a/linphone-app/ui/modules/Linphone/Styles/Chat/ChatCalendarMessageStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Chat/ChatCalendarMessageStyle.qml index c9bafd014..7e821ba8f 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Chat/ChatCalendarMessageStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Chat/ChatCalendarMessageStyle.qml @@ -49,6 +49,11 @@ QtObject { property int pointSize: Units.dp * 11 property color color: ColorsList.add(sectionName+'_subject', 'j').color } + property QtObject description: QtObject { + property int spacing: 5 + property int pointSize: Units.dp * 9 + property color color: ColorsList.add(sectionName+'_description', 'j').color + } property QtObject participants: QtObject { property int spacing: 5 property int pointSize: Units.dp * 9 @@ -68,6 +73,17 @@ QtObject { property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_f_h', icon, 's_h_b_fg').color property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_f_p', icon, 's_p_b_fg').color } + property QtObject infoButton: QtObject{ + property int iconSize: 35 + property string name : 'info' + property string icon : 'menu_info_custom' + property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_b_n', icon, 'me_n_b_bg').color + property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_b_h', icon, 'me_h_b_bg').color + property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_b_p', icon, 'me_p_b_bg').color + property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_f_n', icon, 'me_n_b_fg').color + property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_f_h', icon, 'me_h_b_fg').color + property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_f_p', icon, 'me_p_b_fg').color + } property QtObject organizer: QtObject { property color color: ColorsList.add(sectionName+'_conference_organizer', 'j').color diff --git a/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml b/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml index ccc39754b..60a8fe20d 100644 --- a/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml +++ b/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml @@ -127,7 +127,7 @@ ScrollableListView { }) Icon{ visible: modelData.secure>0 && - (sipAddressesView.actions[index].secureIconVisibleHandler ? sipAddressesView.actions[index].secureIconVisibleHandler({sipAddres:$sipAddress}) : true) + (sipAddressesView.actions[index].secureIconVisibleHandler ? sipAddressesView.actions[index].secureIconVisibleHandler({sipAddres:$modelData}) : true) icon: modelData.secure === 2?'secure_level_2':'secure_level_1' iconSize:parent.height/2 anchors.top:parent.top @@ -293,7 +293,7 @@ ScrollableListView { } Icon{ visible: modelData.secure>0 && - (sipAddressesView.actions[index].secureIconVisibleHandler ? sipAddressesView.actions[index].secureIconVisibleHandler({sipAddres:$sipAddress}) : true) + (sipAddressesView.actions[index].secureIconVisibleHandler ? sipAddressesView.actions[index].secureIconVisibleHandler({sipAddres:$modelData}) : true) icon: modelData.secure === 2?'secure_level_2':'secure_level_1' iconSize: parent.height/2 anchors.top:parent.top diff --git a/linphone-app/ui/modules/Linphone/View/SipAddressesView.qml b/linphone-app/ui/modules/Linphone/View/SipAddressesView.qml index fedfcff75..8edbe66b3 100644 --- a/linphone-app/ui/modules/Linphone/View/SipAddressesView.qml +++ b/linphone-app/ui/modules/Linphone/View/SipAddressesView.qml @@ -284,21 +284,20 @@ ScrollableListView { active: sipAddressesView.showSwitch // Resolve a random Qt crash from using indicator on switch. This way, switch is not loaded. // https://bugreports.qt.io/browse/QTBUG-82285. } - Repeater { model: sipAddressesView.actions ActionButton { isCustom: true backgroundRadius: 90 - colorSet: $modelData.colorSet + colorSet: sipAddressesView.actions[index].colorSet tooltipText:$modelData.tooltipText?$modelData.tooltipText:'' - visible: $modelData.visible + visible: sipAddressesView.actions[index].visible onClicked: {// Do not use $modelData on functions : Qt bug sipAddressesView.actions[index].handler(sipAddressEntry.entry) } Icon{ - visible: $modelData.secure>0 && + visible: sipAddressesView.actions[index].secure>0 && // Do not use $modelData on functions : Qt bug (sipAddressesView.actions[index].secureIconVisibleHandler ? sipAddressesView.actions[index].secureIconVisibleHandler(sipAddressEntry.entry) : true) icon: 'secure_on' diff --git a/linphone-app/ui/views/App/Calls/CallsWindow.qml b/linphone-app/ui/views/App/Calls/CallsWindow.qml index 1f9bbf0af..c53301f11 100644 --- a/linphone-app/ui/views/App/Calls/CallsWindow.qml +++ b/linphone-app/ui/views/App/Calls/CallsWindow.qml @@ -31,6 +31,7 @@ Window { }); readonly property bool chatIsOpened: !rightPaned.isClosed() + readonly property bool callsIsOpened: !mainPaned.isClosed() // --------------------------------------------------------------------------- @@ -76,6 +77,7 @@ Window { // --------------------------------------------------------------------------- Paned { + id: mainPaned anchors.fill: parent defaultChildAWidth: CallsWindowStyle.callsList.defaultWidth maximumLeftLimit: CallsWindowStyle.callsList.maximumWidth @@ -86,6 +88,7 @@ Window { // ------------------------------------------------------------------------- childA: Rectangle { + id: leftPaned anchors.fill: parent color: CallsWindowStyle.callsList.color @@ -140,6 +143,16 @@ Window { } } } + ActionButton { + anchors.right: parent.right + anchors.rightMargin: 15 + anchors.verticalCenter: parent.verticalCenter + isCustom: true + backgroundRadius: 4 + colorSet: CallsWindowStyle.callsList.closeButton + + onClicked: mainPaned.close() + } } Calls { @@ -240,6 +253,8 @@ Window { id: videoConference VideoConference { callModel: window.call + listCallsOpened: window.callsIsOpened + onOpenListCallsRequest: mainPaned.open() } } diff --git a/linphone-app/ui/views/App/Calls/VideoConference.qml b/linphone-app/ui/views/App/Calls/VideoConference.qml index 89d2fca00..c6be77eda 100644 --- a/linphone-app/ui/views/App/Calls/VideoConference.qml +++ b/linphone-app/ui/views/App/Calls/VideoConference.qml @@ -1,6 +1,7 @@ import QtQuick 2.7 import QtQuick.Layouts 1.3 import QtQml.Models 2.12 +import QtGraphicalEffects 1.12 import Common 1.0 import Common.Styles 1.0 @@ -14,6 +15,7 @@ import App.Styles 1.0 // Temp import 'Incall.js' as Logic +import 'qrc:/ui/scripts/Utils/utils.js' as Utils // ============================================================================= @@ -21,24 +23,15 @@ Rectangle { id: conference property CallModel callModel + property ConferenceModel conferenceModel: callModel && callModel.getConferenceModel() property var _fullscreen: null - /* - onCallModelChanged: if(callModel) { - grid.setParticipantDevicesMode() - }else - grid.setTestMode() - */ + property bool listCallsOpened: true + + signal openListCallsRequest() // --------------------------------------------------------------------------- color: VideoConferenceStyle.backgroundColor - /* - Component.onCompleted: { - if(!callModel){ - grid.setTestMode() - }else - grid.setParticipantDevicesMode() - } - */ + Connections { target: callModel @@ -65,17 +58,29 @@ Rectangle { isCustom: true backgroundRadius: width/2 colorSet: VideoConferenceStyle.buttons.callsList + visible: !listCallsOpened + onClicked: openListCallsRequest() } ActionButton{ + id: keypadButton isCustom: true backgroundRadius: width/2 colorSet: VideoConferenceStyle.buttons.dialpad + onClicked: telKeypad.visible = !telKeypad.visible } // Title Text{ + Timer{ + id: elapsedTimeRefresher + running: true + interval: 1000 + repeat: true + onTriggered: parent.elaspedTime = ' - ' +Utils.formatElapsedTime(conferenceModel.getElapsedSeconds()) + } + property string elaspedTime horizontalAlignment: Qt.AlignHCenter Layout.fillWidth: true - text: 'Sujet de la conférence' + ' - ' + '02:23:12' + text: conferenceModel.subject+ elaspedTime color: VideoConferenceStyle.title.color font.pointSize: VideoConferenceStyle.title.pointSize } @@ -169,20 +174,29 @@ Rectangle { delegate: Rectangle{ id: avatarCell property ParticipantDeviceModel currentDevice: gridModel.participantDevices.getAt(index) - onCurrentDeviceChanged: console.log("currentDevice changed: " +currentDevice +", me:"+currentDevice.isMe+" ["+index+"]") + onCurrentDeviceChanged: console.log("currentDevice changed: " +currentDevice + (currentDevice?", me:"+currentDevice.isMe:'')+" ["+index+"]") color: /*!conference.callModel && gridModel.defaultList.get(index).color ? gridModel.defaultList.get(index).color : */'#AAAAAAAA' //color: gridModel.model.get(index) && gridModel.model.get(index).color ? gridModel.model.get(index).color : '' // modelIndex is a custom index because by Mosaic modelisation, it is not accessible. //color: $modelData.color ? $modelData.color : '' - radius: grid.radius + radius: 50//grid.radius height: grid.cellHeight - 5 width: grid.cellWidth - 5 - Component.onCompleted: console.log("Completed: ["+index+"] " +currentDevice.peerAddress+", isMe:"+currentDevice.isMe) + Component.onCompleted: console.log("Completed: ["+index+"] " +(currentDevice?currentDevice.peerAddress+", isMe:"+currentDevice.isMe : '') ) + Rectangle{ + id: showArea + anchors.fill: parent + radius: 50 + visible:false + color: 'red' + } + Item { id: container anchors.fill: parent - anchors.margins: CallStyle.container.margins - visible: conference.callModel + //anchors.margins: CallStyle.container.margins + //visible: conference.callModel + visible: false //Layout.fillWidth: true //Layout.fillHeight: true //Layout.margins: CallStyle.container.margins @@ -218,14 +232,9 @@ Rectangle { onT_fullscreenChanged: console.log("_fullscreen changed: " +t_fullscreen+ " ["+index+"]") onTCallModelChanged: console.log("CallModel changed: " +tCallModel+ " ["+index+"]") - active: !resetActive //avatarCell.currentDevice && (avatarCell.currentDevice.videoEnabled && !conference._fullscreen) - onActiveChanged: {console.log("Active Changed: "+active+ " ["+index+"]") - if(!active && resetActive){ - resetActive = false - active = true - } - } - property int cameraMode: avatarCell.currentDevice ? + active: !resetActive && avatarCell.currentDevice && (avatarCell.currentDevice.videoEnabled && !conference._fullscreen) + + property int cameraMode: isVideoEnabled ? avatarCell.currentDevice.isMe ? 1 : 2 : 0 @@ -242,10 +251,20 @@ Rectangle { //height: container.height //width: container.width anchors.fill: parent - onRequestNewRenderer: {cameraLoader.resetActive = true} + onRequestNewRenderer: {cameraLoader.resetActive = true; cameraLoader.resetActive = false} Component.onCompleted: console.log("Camera completed"+ " ["+index+"]") Component.onDestruction: console.log("Camera destroyed"+ " ["+index+"]") + Text{ + anchors.right: parent.right + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.margins: 10 + elide: Text.ElideRight + maximumLineCount: 1 + text: avatarCell.currentDevice.displayName + color: 'white' + } } } Component { @@ -255,79 +274,44 @@ Rectangle { anchors.fill: parent //participantDeviceModel: avatarCell.currentDevice isPreview: true - onRequestNewRenderer: {cameraLoader.resetActive = true} + onRequestNewRenderer: {cameraLoader.resetActive = true; cameraLoader.resetActive = false} Component.onCompleted: console.log("Preview completed"+ " ["+index+"]") Component.onDestruction: console.log("Preview destroyed"+ " ["+index+"]") + ActionButton{ + anchors.right: parent.right + anchors.top: parent.top + anchors.rightMargin: 15 + anchors.topMargin: 15 + isCustom: true + colorSet: VideoConferenceStyle.buttons.closePreview + onClicked: grid.remove( index) + } } } } - Rectangle{ - anchors.fill: parent - color: avatarCell.currentDevice.isMe ? '#09FF0000' : '#0900FF00' - } } + + OpacityMask{ + anchors.fill: parent + source: container + maskSource: showArea + invert:false + + visible: conference.callModel +// rotation: 180 + } + + /* MouseArea{ anchors.fill: parent onClicked: {grid.remove( index)} } + */ } } } } - - /* - GridLayout { - id: grid - Layout.fillHeight: true - Layout.fillWidth: true - Layout.leftMargin: 70 - Layout.rightMargin: 70 - Layout.topMargin: 15 - Layout.bottomMargin: 20 - Layout.alignment: Qt.AlignCenter - - columns: 3 - property int radius : 8 - Rectangle{ - Layout.fillHeight: true - Layout.fillWidth: true - color: 'red' - radius: parent.radius - } - Rectangle{ - Layout.fillHeight: true - Layout.fillWidth: true - color: 'green' - radius: parent.radius - } - Rectangle{ - Layout.fillHeight: true - Layout.fillWidth: true - color: 'orange' - radius: parent.radius - } - Rectangle{ - Layout.fillHeight: true - Layout.fillWidth: true - color: 'yellow' - radius: parent.radius - } - Rectangle{ - Layout.fillHeight: true - Layout.fillWidth: true - Layout.columnSpan: 2 - color: 'blue' - radius: parent.radius - } - Rectangle{ - Layout.fillHeight: true - Layout.fillWidth: true - color: 'pink' - radius: parent.radius - } - } - */ // ------------------------------------------------------------------------- // Action Buttons. // ------------------------------------------------------------------------- @@ -355,54 +339,70 @@ Rectangle { // Action buttons RowLayout{ Layout.alignment: Qt.AlignCenter - spacing: 10 + spacing: 30 RowLayout{ + spacing: 10 Row { spacing: 2 + visible: SettingsModel.muteMicrophoneEnabled + property bool microMuted: callModel.microMuted VuMeter { + enabled: !parent.microMuted Timer { interval: 50 repeat: true + running: parent.enabled + + onTriggered: parent.value = callModel.microVu } } ActionSwitch { id: micro isCustom: true backgroundRadius: 90 - colorSet: enabled ? VideoConferenceStyle.buttons.microOn : VideoConferenceStyle.buttons.microOff + colorSet: parent.microMuted ? VideoConferenceStyle.buttons.microOff : VideoConferenceStyle.buttons.microOn + onClicked: callModel.microMuted = !parent.microMuted } } Row { spacing: 2 - + property bool speakerMuted: callModel.speakerMuted VuMeter { + enabled: !parent.speakerMuted Timer { interval: 50 repeat: true + running: parent.enabled + onTriggered: parent.value = callModel.speakerVu } } ActionSwitch { id: speaker isCustom: true backgroundRadius: 90 - colorSet: enabled ? VideoConferenceStyle.buttons.speakerOn : VideoConferenceStyle.buttons.speakerOff + colorSet: parent.speakerMuted ? VideoConferenceStyle.buttons.speakerOff : VideoConferenceStyle.buttons.speakerOn + onClicked: callModel.speakerMuted = !parent.speakerMuted } } ActionSwitch { id: camera isCustom: true backgroundRadius: 90 - colorSet: conference.callModel && conference.callModel.videoEnabled ? VideoConferenceStyle.buttons.cameraOn : VideoConferenceStyle.buttons.cameraOff - //updating: conference.callModel.videoEnabled && conference.callModel.updating - onClicked: if(conference.callModel) conference.callModel.videoEnabled = !conference.callModel.videoEnabled + colorSet: callModel && callModel.videoEnabled ? VideoConferenceStyle.buttons.cameraOn : VideoConferenceStyle.buttons.cameraOff + updating: callModel.videoEnabled && callModel.updating + onClicked: if(callModel) callModel.videoEnabled = !callModel.videoEnabled } } RowLayout{ + spacing: 10 ActionButton{ isCustom: true backgroundRadius: width/2 - colorSet: VideoConferenceStyle.buttons.pause + visible: SettingsModel.callPauseEnabled + updating: callModel.updating + colorSet: callModel.pausedByUser ? VideoConferenceStyle.buttons.play : VideoConferenceStyle.buttons.pause + onClicked: callModel.pausedByUser = !callModel.pausedByUser } ActionButton{ isCustom: true @@ -422,6 +422,7 @@ Rectangle { isCustom: true backgroundRadius: width/2 colorSet: VideoConferenceStyle.buttons.chat + visible: false // TODO for next version } ActionButton{ isCustom: true @@ -434,42 +435,34 @@ Rectangle { isCustom: true backgroundRadius: 4 colorSet: VideoConferenceStyle.buttons.callQuality - percentageDisplayed: 0 - //onClicked: Logic.openCallStatistics() - - // See: http://www.linphone.org/docs/liblinphone/group__call__misc.html#ga62c7d3d08531b0cc634b797e273a0a73 + onClicked: {console.log("opening stats");Logic.openCallStatistics();console.log("Stats should be opened")} Timer { interval: 500 repeat: true running: true triggeredOnStart: true - onTriggered: { - callQuality.percentageDisplayed = (callQuality.percentageDisplayed + 10 ) % 110 - /* // Note: `quality` is in the [0, 5] interval and -1. - var quality = call.quality + var quality = callModel.quality if(quality >= 0) callQuality.percentageDisplayed = quality * 100 / 5 else callQuality.percentageDisplayed = 0 -*/ } } - /* + CallStatistics { id: callStatistics - call: incall.call - width: container.width - - relativeTo: callQuality + call: callModel + width: conference.width + relativeTo: keypadButton relativeY: CallStyle.header.stats.relativeY - onClosed: Logic.handleCallStatisticsClosed() - }*/ + onOpened: console.log("Stats Opened: " +call+", " +width +", "+relativeY) + } } ActionButton{ isCustom: true @@ -479,4 +472,14 @@ Rectangle { } } } + // --------------------------------------------------------------------------- + // TelKeypad. + // --------------------------------------------------------------------------- + + TelKeypad { + id: telKeypad + + call: callModel + visible: SettingsModel.showTelKeypadAutomatically + } } diff --git a/linphone-app/ui/views/App/Main/Conferences.qml b/linphone-app/ui/views/App/Main/Conferences.qml index 729d7f5c9..caf6a6657 100644 --- a/linphone-app/ui/views/App/Main/Conferences.qml +++ b/linphone-app/ui/views/App/Main/Conferences.qml @@ -12,10 +12,10 @@ import App.Styles 1.0 // ============================================================================= ColumnLayout { - id: container - property int filterMode: ConferenceInfoProxyModel.ConferenceType.Scheduled + id: mainItem + property int filterType: -1 spacing: 0 - + Component.onCompleted: filterType = ConferenceInfoProxyModel.Scheduled // --------------------------------------------------------------------------- // Title // --------------------------------------------------------------------------- @@ -26,9 +26,9 @@ ColumnLayout { color: ConferencesStyle.bar.backgroundColor Text{ - anchors.verticalCenter: parent.center anchors.fill: parent - verticalAlignment: Qt.AlignCenter + verticalAlignment: Qt.AlignVCenter + anchors.leftMargin: 40 text: 'Mes conférences' @@ -54,9 +54,10 @@ ColumnLayout { 'PROGRAMMEES', 'INVITATIONS' ] - + selectedButton: mainItem.filterType onClicked: { - mainItem.filterMode = (button === 0 ? ConferenceInfoProxyModel.ConferenceType.Ended : button === 1 ?ConferenceInfoProxyModel.ConferenceType.Scheduled : ConferenceInfoProxyModel.ConferenceType.Invitations); + mainItem.filterType = (button === 0 ? ConferenceInfoProxyModel.Ended : button === 1 ?ConferenceInfoProxyModel.Scheduled : ConferenceInfoProxyModel.Invitations); + //mainItem.filterType = button } } } @@ -80,12 +81,12 @@ ColumnLayout { section { criteria: ViewSection.FullString delegate: sectionHeading - property: 'date' + property: '$modelKey' } model: ConferenceInfoProxyModel{ id: conferencesProxyModel - + filterType: mainItem.filterType } // ----------------------------------------------------------------------- @@ -147,17 +148,18 @@ ColumnLayout { GridView{ id: calendarGrid //anchors.fill: parent - cellWidth: (container.width-20)/2 + cellWidth: (mainItem.width-20)/2 cellHeight: 100 model: $modelData height: cellHeight * ( (count+1) /2) - width: container.width - 20 + width: mainItem.width - 20 delegate:Rectangle { id: entry width: calendarGrid.cellWidth -10 height: calendarGrid.cellHeight -10 radius: 6 - color: ConferencesStyle.conference.backgroundColor.normal + color: mainItem.filterType == ConferenceInfoProxyModel.Ended ? ConferencesStyle.conference.backgroundColor.ended + : ConferencesStyle.conference.backgroundColor.scheduled border.color: calendarMessage.containsMouse ? ConferencesStyle.conference.selectedBorder.color : 'transparent' border.width: ConferencesStyle.conference.selectedBorder.width ChatCalendarMessage{ @@ -165,6 +167,9 @@ ColumnLayout { conferenceInfoModel: $modelData width: calendarGrid.cellWidth maxWidth: calendarGrid.cellWidth + gotoButtonMode: mainItem.filterType == ConferenceInfoProxyModel.Scheduled ? 1 + : mainItem.filterType == ConferenceInfoProxyModel.Ended ? -1 + : 0 } } } diff --git a/linphone-app/ui/views/App/Main/Dialogs/NewConference.qml b/linphone-app/ui/views/App/Main/Dialogs/NewConference.qml index 195311d4d..062b320fe 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/NewConference.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/NewConference.qml @@ -107,9 +107,18 @@ DialogPlus { conferenceInfoModel.isScheduled = scheduledSwitch.checked if( scheduledSwitch.checked){ var startDateTime = new Date() - startDateTime.setDate(dateField.getDate()) - startDateTime.setTime(timeField.getTime()) - conferenceInfoModel.dateTime = startDateTime + var d = dateField.getDate() + var t = timeField.getTime() + console.log("A " +startDateTime) + startDateTime.setFullYear(d.getFullYear(), d.getMonth(), d.getDate()) + console.log("B " +startDateTime) + startDateTime.setHours(t.getHours()) + console.log("C " +startDateTime) + startDateTime.setMinutes(t.getMinutes()) + console.log("D " +startDateTime) + startDateTime.setSeconds(0) + console.log("E " +startDateTime) + conferenceInfoModel.dateTime = startDateTime conferenceInfoModel.duration = durationField.text } conferenceInfoModel.subject = subject.text diff --git a/linphone-app/ui/views/App/Settings/Dialogs/SettingsVideoPreview.qml b/linphone-app/ui/views/App/Settings/Dialogs/SettingsVideoPreview.qml index 30940ed81..ebdd70e64 100644 --- a/linphone-app/ui/views/App/Settings/Dialogs/SettingsVideoPreview.qml +++ b/linphone-app/ui/views/App/Settings/Dialogs/SettingsVideoPreview.qml @@ -1,4 +1,5 @@ import QtQuick 2.7 +import QtGraphicalEffects 1.12 import Common 1.0 import Linphone 1.0 @@ -26,10 +27,39 @@ DialogPlus { Loader{ id: previewLoader anchors.fill: parent - sourceComponent: CameraPreview { + sourceComponent: Item{ + anchors.fill: parent + + Rectangle{ + id: showArea + anchors.fill: parent + radius: 50 + visible:false + color: 'red' + } + Rectangle{ + id: test + anchors.fill: parent + visible:false + color: 'green' + } + CameraPreview { + id: camera anchors.fill: parent onRequestNewRenderer: previewLoader.active = false + visible: false } + + OpacityMask{ + anchors.fill: camera + source: camera + maskSource: showArea + invert:false + + visible: true + rotation: 180 + } + } active: true onActiveChanged: { console.log("Active changed : " +active) diff --git a/linphone-app/ui/views/App/Styles/Calls/CallsWindowStyle.qml b/linphone-app/ui/views/App/Styles/Calls/CallsWindowStyle.qml index c98dcc121..21d4af931 100644 --- a/linphone-app/ui/views/App/Styles/Calls/CallsWindowStyle.qml +++ b/linphone-app/ui/views/App/Styles/Calls/CallsWindowStyle.qml @@ -48,6 +48,18 @@ QtObject { property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 'ma_h_b_fg').color property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 'ma_p_b_fg').color } + + property QtObject closeButton: QtObject{ + property int iconSize: 40 + property string name : 'close' + property string icon : 'close_custom' + property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_b_n', icon, 'l_n_b_bg').color + property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_b_h', icon, 'l_h_b_bg').color + property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_b_p', icon, 'l_p_b_bg').color + property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_f_n', icon, 'l_n_b_fg').color + property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_f_h', icon, 'l_h_b_fg').color + property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_f_p', icon, 'l_p_b_fg').color + } } property QtObject chat: QtObject { diff --git a/linphone-app/ui/views/App/Styles/Calls/VideoConferenceStyle.qml b/linphone-app/ui/views/App/Styles/Calls/VideoConferenceStyle.qml index 1158542bd..3aadd2740 100644 --- a/linphone-app/ui/views/App/Styles/Calls/VideoConferenceStyle.qml +++ b/linphone-app/ui/views/App/Styles/Calls/VideoConferenceStyle.qml @@ -394,11 +394,21 @@ QtObject { property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 'me_h_b_inv_fg').color property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 'me_p_b_inv_fg').color } +//------------------------------------------------------------------------------ + property QtObject closePreview: QtObject { + property int iconSize: 40 + property string icon : 'close_custom' + property string name : 'close_preview' + property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 'me_n_b_inv_bg').color + property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 'me_h_b_inv_bg').color + property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 'me_p_b_inv_bg').color + property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_n', icon, 'me_n_b_inv_fg').color + property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 'me_h_b_inv_fg').color + property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 'me_p_b_inv_fg').color + } //------------------------------------------------------------------------------ - - property QtObject history: QtObject { property int iconSize: 40 property string icon : 'history_custom' diff --git a/linphone-app/ui/views/App/Styles/Main/ConferencesStyle.qml b/linphone-app/ui/views/App/Styles/Main/ConferencesStyle.qml index 691ec6161..b5c181492 100644 --- a/linphone-app/ui/views/App/Styles/Main/ConferencesStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/ConferencesStyle.qml @@ -35,7 +35,8 @@ QtObject { property int spacing: 15 property QtObject backgroundColor: QtObject { - property color normal: ColorsList.add(sectionName+'_conference_bg_n', 'conference_bg').color + property color ended: ColorsList.add(sectionName+'_conference_ended_bg', 'conference_bg').color + property color scheduled: ColorsList.add(sectionName+'_conference_scheduled_bg', 'e').color property color hovered: ColorsList.add(sectionName+'_conference_bg_h', 'g10').color } diff --git a/linphone-sdk b/linphone-sdk index 28110434a..9791a5bc6 160000 --- a/linphone-sdk +++ b/linphone-sdk @@ -1 +1 @@ -Subproject commit 28110434a26de7d9eaec988ce045504d5818e385 +Subproject commit 9791a5bc6cdce83db83c11af9b4c0e29bf9805a5