mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-06 07:45:51 +02:00
plugins: add callId to API
Change-Id: Ieb4b8c1b507cdc8905e364c375df76e30b7c87c6
This commit is contained in:
parent
7dc455e943
commit
3d65bb562b
6 changed files with 43 additions and 14 deletions
|
@ -21,14 +21,17 @@ import QtQuick.Controls 2.14
|
||||||
import QtQuick.Layouts 1.14
|
import QtQuick.Layouts 1.14
|
||||||
import QtQuick.Controls.Universal 2.14
|
import QtQuick.Controls.Universal 2.14
|
||||||
import net.jami.Models 1.0
|
import net.jami.Models 1.0
|
||||||
|
import net.jami.Adapters 1.0
|
||||||
|
|
||||||
import "../../commoncomponents"
|
import "../../commoncomponents"
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
id: root
|
id: root
|
||||||
function toggleMediaHandlerSlot(mediaHandlerId, isLoaded) {
|
function toggleMediaHandlerSlot(mediaHandlerId, isLoaded) {
|
||||||
PluginModel.toggleCallMediaHandler(mediaHandlerId, !isLoaded)
|
var callId = UtilsAdapter.getCallId(callStackViewWindow.responsibleAccountId,
|
||||||
mediahandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel()
|
callStackViewWindow.responsibleConvUid)
|
||||||
|
PluginModel.toggleCallMediaHandler(mediaHandlerId, callId, !isLoaded)
|
||||||
|
mediahandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(callId)
|
||||||
}
|
}
|
||||||
|
|
||||||
width: 350
|
width: 350
|
||||||
|
@ -93,7 +96,11 @@ Popup {
|
||||||
Layout.preferredWidth: mediahandlerPickerPopupRect.width
|
Layout.preferredWidth: mediahandlerPickerPopupRect.width
|
||||||
Layout.preferredHeight: 200
|
Layout.preferredHeight: 200
|
||||||
|
|
||||||
model: PluginAdapter.getMediaHandlerSelectableModel()
|
model: {
|
||||||
|
var callId = UtilsAdapter.getCallId(callStackViewWindow.responsibleAccountId,
|
||||||
|
callStackViewWindow.responsibleConvUid)
|
||||||
|
return PluginAdapter.getMediaHandlerSelectableModel(callId)
|
||||||
|
}
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
|
@ -235,7 +242,9 @@ Popup {
|
||||||
|
|
||||||
onAboutToShow: {
|
onAboutToShow: {
|
||||||
// Reset the model on each show.
|
// 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 {
|
background: Rectangle {
|
||||||
|
|
|
@ -18,9 +18,11 @@
|
||||||
|
|
||||||
#include "mediahandleritemlistmodel.h"
|
#include "mediahandleritemlistmodel.h"
|
||||||
|
|
||||||
MediaHandlerItemListModel::MediaHandlerItemListModel(QObject* parent)
|
MediaHandlerItemListModel::MediaHandlerItemListModel(QObject* parent, const QString& callId)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
{}
|
{
|
||||||
|
callId_ = callId;
|
||||||
|
}
|
||||||
|
|
||||||
MediaHandlerItemListModel::~MediaHandlerItemListModel() {}
|
MediaHandlerItemListModel::~MediaHandlerItemListModel() {}
|
||||||
|
|
||||||
|
@ -59,10 +61,11 @@ MediaHandlerItemListModel::data(const QModelIndex& index, int role) const
|
||||||
|
|
||||||
auto details = LRCInstance::pluginModel().getCallMediaHandlerDetails(
|
auto details = LRCInstance::pluginModel().getCallMediaHandlerDetails(
|
||||||
mediahandlerList.at(index.row()));
|
mediahandlerList.at(index.row()));
|
||||||
auto status = LRCInstance::pluginModel().getCallMediaHandlerStatus();
|
auto status = LRCInstance::pluginModel().getCallMediaHandlerStatus(callId_);
|
||||||
bool loaded = false;
|
bool loaded = false;
|
||||||
if (status["name"] == details.id)
|
for (const auto& mediaHandler : status[callId_])
|
||||||
loaded = true;
|
if (mediaHandler == details.id)
|
||||||
|
loaded = true;
|
||||||
if (!details.pluginId.isEmpty()) {
|
if (!details.pluginId.isEmpty()) {
|
||||||
details.pluginId.remove(details.pluginId.size() - 5, 5);
|
details.pluginId.remove(details.pluginId.size() - 5, 5);
|
||||||
}
|
}
|
||||||
|
@ -132,3 +135,15 @@ MediaHandlerItemListModel::reset()
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
|
MediaHandlerItemListModel::callId()
|
||||||
|
{
|
||||||
|
return callId_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MediaHandlerItemListModel::setCallId(QString callId)
|
||||||
|
{
|
||||||
|
callId_ = callId;
|
||||||
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
};
|
};
|
||||||
Q_ENUM(Role)
|
Q_ENUM(Role)
|
||||||
|
|
||||||
explicit MediaHandlerItemListModel(QObject* parent = 0);
|
explicit MediaHandlerItemListModel(QObject* parent = 0, const QString& callId = QString(""));
|
||||||
~MediaHandlerItemListModel();
|
~MediaHandlerItemListModel();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -59,4 +59,10 @@ public:
|
||||||
* This function is to reset the model when there's new account added.
|
* This function is to reset the model when there's new account added.
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void reset();
|
Q_INVOKABLE void reset();
|
||||||
|
|
||||||
|
QString callId();
|
||||||
|
void setCallId(QString callId);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString callId_ = QString("");
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,9 +25,9 @@ PluginAdapter::PluginAdapter(QObject* parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QVariant
|
QVariant
|
||||||
PluginAdapter::getMediaHandlerSelectableModel()
|
PluginAdapter::getMediaHandlerSelectableModel(const QString& callId)
|
||||||
{
|
{
|
||||||
mediaHandlerListModel_.reset(new MediaHandlerItemListModel(this));
|
mediaHandlerListModel_.reset(new MediaHandlerItemListModel(this, callId));
|
||||||
return QVariant::fromValue(mediaHandlerListModel_.get());
|
return QVariant::fromValue(mediaHandlerListModel_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void safeInit() override {};
|
void safeInit() override {};
|
||||||
|
|
||||||
Q_INVOKABLE QVariant getMediaHandlerSelectableModel();
|
Q_INVOKABLE QVariant getMediaHandlerSelectableModel(const QString& callId = QString(""));
|
||||||
Q_INVOKABLE QVariant getPluginSelectableModel();
|
Q_INVOKABLE QVariant getPluginSelectableModel();
|
||||||
Q_INVOKABLE QVariant getPluginPreferencesModel(const QString& pluginId,
|
Q_INVOKABLE QVariant getPluginPreferencesModel(const QString& pluginId,
|
||||||
const QString& mediaHandlerName = "");
|
const QString& mediaHandlerName = "");
|
||||||
|
|
|
@ -65,7 +65,6 @@ Rectangle {
|
||||||
|
|
||||||
pluginListSettingsView.visible = checked
|
pluginListSettingsView.visible = checked
|
||||||
if (!pluginListSettingsView.visible) {
|
if (!pluginListSettingsView.visible) {
|
||||||
PluginModel.toggleCallMediaHandler("", true)
|
|
||||||
pluginListSettingsView.hidePreferences()
|
pluginListSettingsView.hidePreferences()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue