Skip to content
Snippets Groups Projects
Commit 3d65bb56 authored by Aline Gondim Santos's avatar Aline Gondim Santos
Browse files

plugins: add callId to API

Change-Id: Ieb4b8c1b507cdc8905e364c375df76e30b7c87c6
parent 7dc455e9
Branches
Tags
No related merge requests found
......@@ -21,14 +21,17 @@ import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import QtQuick.Controls.Universal 2.14
import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../commoncomponents"
Popup {
id: root
function toggleMediaHandlerSlot(mediaHandlerId, isLoaded) {
PluginModel.toggleCallMediaHandler(mediaHandlerId, !isLoaded)
mediahandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel()
var callId = UtilsAdapter.getCallId(callStackViewWindow.responsibleAccountId,
callStackViewWindow.responsibleConvUid)
PluginModel.toggleCallMediaHandler(mediaHandlerId, callId, !isLoaded)
mediahandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(callId)
}
width: 350
......@@ -93,7 +96,11 @@ Popup {
Layout.preferredWidth: mediahandlerPickerPopupRect.width
Layout.preferredHeight: 200
model: PluginAdapter.getMediaHandlerSelectableModel()
model: {
var callId = UtilsAdapter.getCallId(callStackViewWindow.responsibleAccountId,
callStackViewWindow.responsibleConvUid)
return PluginAdapter.getMediaHandlerSelectableModel(callId)
}
clip: true
......@@ -235,7 +242,9 @@ Popup {
onAboutToShow: {
// Reset the model on each show.
mediahandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel()
var callId = UtilsAdapter.getCallId(callStackViewWindow.responsibleAccountId,
callStackViewWindow.responsibleConvUid)
mediahandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(callId)
}
background: Rectangle {
......
......@@ -18,9 +18,11 @@
#include "mediahandleritemlistmodel.h"
MediaHandlerItemListModel::MediaHandlerItemListModel(QObject* parent)
MediaHandlerItemListModel::MediaHandlerItemListModel(QObject* parent, const QString& callId)
: QAbstractListModel(parent)
{}
{
callId_ = callId;
}
MediaHandlerItemListModel::~MediaHandlerItemListModel() {}
......@@ -59,10 +61,11 @@ MediaHandlerItemListModel::data(const QModelIndex& index, int role) const
auto details = LRCInstance::pluginModel().getCallMediaHandlerDetails(
mediahandlerList.at(index.row()));
auto status = LRCInstance::pluginModel().getCallMediaHandlerStatus();
auto status = LRCInstance::pluginModel().getCallMediaHandlerStatus(callId_);
bool loaded = false;
if (status["name"] == details.id)
loaded = true;
for (const auto& mediaHandler : status[callId_])
if (mediaHandler == details.id)
loaded = true;
if (!details.pluginId.isEmpty()) {
details.pluginId.remove(details.pluginId.size() - 5, 5);
}
......@@ -132,3 +135,15 @@ MediaHandlerItemListModel::reset()
beginResetModel();
endResetModel();
}
QString
MediaHandlerItemListModel::callId()
{
return callId_;
}
void
MediaHandlerItemListModel::setCallId(QString callId)
{
callId_ = callId;
}
......@@ -38,7 +38,7 @@ public:
};
Q_ENUM(Role)
explicit MediaHandlerItemListModel(QObject* parent = 0);
explicit MediaHandlerItemListModel(QObject* parent = 0, const QString& callId = QString(""));
~MediaHandlerItemListModel();
/*
......@@ -59,4 +59,10 @@ public:
* This function is to reset the model when there's new account added.
*/
Q_INVOKABLE void reset();
QString callId();
void setCallId(QString callId);
private:
QString callId_ = QString("");
};
......@@ -25,9 +25,9 @@ PluginAdapter::PluginAdapter(QObject* parent)
{}
QVariant
PluginAdapter::getMediaHandlerSelectableModel()
PluginAdapter::getMediaHandlerSelectableModel(const QString& callId)
{
mediaHandlerListModel_.reset(new MediaHandlerItemListModel(this));
mediaHandlerListModel_.reset(new MediaHandlerItemListModel(this, callId));
return QVariant::fromValue(mediaHandlerListModel_.get());
}
......
......@@ -38,7 +38,7 @@ public:
protected:
void safeInit() override {};
Q_INVOKABLE QVariant getMediaHandlerSelectableModel();
Q_INVOKABLE QVariant getMediaHandlerSelectableModel(const QString& callId = QString(""));
Q_INVOKABLE QVariant getPluginSelectableModel();
Q_INVOKABLE QVariant getPluginPreferencesModel(const QString& pluginId,
const QString& mediaHandlerName = "");
......
......@@ -65,7 +65,6 @@ Rectangle {
pluginListSettingsView.visible = checked
if (!pluginListSettingsView.visible) {
PluginModel.toggleCallMediaHandler("", true)
pluginListSettingsView.hidePreferences()
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment