Commit 543d6be7 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(src/components/conference/ConferenceHelperModel): display sip addresses...

feat(src/components/conference/ConferenceHelperModel): display sip addresses linked to calls in first
parent 53cd7ef3
......@@ -21,6 +21,7 @@
*/
#include "../../app/App.hpp"
#include "../../utils/Utils.hpp"
#include "../core/CoreManager.hpp"
#include "../sip-addresses/SipAddressesProxyModel.hpp"
#include "ConferenceAddModel.hpp"
......@@ -32,16 +33,23 @@ using namespace std;
// =============================================================================
ConferenceHelperModel::ConferenceHelperModel (QObject *parent) : QSortFilterProxyModel(parent) {
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
mConference = core->getConference();
mCore = CoreManager::getInstance()->getCore();
mConference = mCore->getConference();
if (!mConference)
mConference = core->createConferenceWithParams(core->createConferenceParams());
mConference = mCore->createConferenceWithParams(mCore->createConferenceParams());
mConferenceAddModel = new ConferenceAddModel(this);
App::getInstance()->getEngine()->setObjectOwnership(mConferenceAddModel, QQmlEngine::CppOwnership);
QObject::connect(this, &CallsListModel::rowsRemoved, [this] {
invalidate();
});
QObject::connect(this, &CallsListModel::rowsInserted, [this] {
invalidate();
});
setSourceModel(new SipAddressesProxyModel(this));
sort(0);
}
QHash<int, QByteArray> ConferenceHelperModel::roleNames () const {
......@@ -64,3 +72,16 @@ bool ConferenceHelperModel::filterAcceptsRow (int sourceRow, const QModelIndex &
return !mConferenceAddModel->contains(data["sipAddress"].toString());
}
// -----------------------------------------------------------------------------
bool ConferenceHelperModel::lessThan (const QModelIndex &left, const QModelIndex &right) const {
shared_ptr<linphone::Call> callA = mCore->findCallFromUri(
::Utils::appStringToCoreString(left.data().toMap()["sipAddress"].toString())
);
shared_ptr<linphone::Call> callB = mCore->findCallFromUri(
::Utils::appStringToCoreString(right.data().toMap()["sipAddress"].toString())
);
return callA && !callB;
}
......@@ -37,6 +37,7 @@ class ConferenceAddModel;
namespace linphone {
class Conference;
class Core;
}
class ConferenceHelperModel : public QSortFilterProxyModel {
......@@ -56,6 +57,7 @@ public:
protected:
bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override;
bool lessThan (const QModelIndex &left, const QModelIndex &right) const override;
private:
ConferenceAddModel *getConferenceAddModel () const {
......@@ -64,6 +66,7 @@ private:
ConferenceAddModel *mConferenceAddModel;
std::shared_ptr<linphone::Core> mCore;
std::shared_ptr<linphone::Conference> mConference;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment