mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-01 04:33:39 +02:00
pluginadapter: add handler list count properties
All plugin buttons will be listening on these properties to decide visibility or enabled Change-Id: Id04f9b533e6aba26033c27a607fa531ce65ac588
This commit is contained in:
parent
db800b9b36
commit
9568f1c9ab
7 changed files with 28 additions and 25 deletions
|
@ -295,7 +295,7 @@ Control {
|
||||||
icon.source: "qrc:/images/icons/plugins-24px.svg"
|
icon.source: "qrc:/images/icons/plugins-24px.svg"
|
||||||
icon.color: "white"
|
icon.color: "white"
|
||||||
text: JamiStrings.viewPlugin
|
text: JamiStrings.viewPlugin
|
||||||
enabled: UtilsAdapter.checkShowPluginsButton(true)
|
enabled: PluginAdapter.callMediaHandlersListCount
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -330,8 +330,7 @@ Control {
|
||||||
if (!isAudioOnly && !isSIP)
|
if (!isAudioOnly && !isSIP)
|
||||||
CallOverlayModel.addSecondaryControl(shareAction)
|
CallOverlayModel.addSecondaryControl(shareAction)
|
||||||
CallOverlayModel.addSecondaryControl(recordAction)
|
CallOverlayModel.addSecondaryControl(recordAction)
|
||||||
if (UtilsAdapter.checkShowPluginsButton(true))
|
CallOverlayModel.addSecondaryControl(pluginsAction)
|
||||||
CallOverlayModel.addSecondaryControl(pluginsAction)
|
|
||||||
overflowItemCount = CallOverlayModel.secondaryModel().rowCount()
|
overflowItemCount = CallOverlayModel.secondaryModel().rowCount()
|
||||||
|
|
||||||
muteAudioAction.checked = isAudioMuted
|
muteAudioAction.checked = isAudioMuted
|
||||||
|
|
|
@ -159,7 +159,7 @@ ContextMenuAutoLoader {
|
||||||
GeneralMenuItem {
|
GeneralMenuItem {
|
||||||
id: viewPlugin
|
id: viewPlugin
|
||||||
|
|
||||||
canTrigger: UtilsAdapter.checkShowPluginsButton(true)
|
canTrigger: PluginAdapter.callMediaHandlersListCount
|
||||||
itemName: JamiStrings.viewPlugin
|
itemName: JamiStrings.viewPlugin
|
||||||
iconSource: "qrc:/images/icons/extension_24dp.svg"
|
iconSource: "qrc:/images/icons/extension_24dp.svg"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
|
@ -186,14 +186,7 @@ Rectangle {
|
||||||
PushButton {
|
PushButton {
|
||||||
id: selectPluginButton
|
id: selectPluginButton
|
||||||
|
|
||||||
visible: UtilsAdapter.checkShowPluginsButton(false)
|
visible: PluginAdapter.chatHandlersListCount
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: PluginAdapter
|
|
||||||
function onPluginHandlersUpdateStatus() {
|
|
||||||
selectPluginButton.visible = UtilsAdapter.checkShowPluginsButton(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.right: sendContactRequestButton.visible ?
|
anchors.right: sendContactRequestButton.visible ?
|
||||||
sendContactRequestButton.left :
|
sendContactRequestButton.left :
|
||||||
|
|
|
@ -22,7 +22,13 @@
|
||||||
|
|
||||||
PluginAdapter::PluginAdapter(LRCInstance* instance, QObject* parent)
|
PluginAdapter::PluginAdapter(LRCInstance* instance, QObject* parent)
|
||||||
: QmlAdapterBase(instance, parent)
|
: QmlAdapterBase(instance, parent)
|
||||||
{}
|
{
|
||||||
|
updateHandlersListCount();
|
||||||
|
connect(&lrcInstance_->pluginModel(),
|
||||||
|
&lrc::api::PluginModel::modelUpdated,
|
||||||
|
this,
|
||||||
|
&PluginAdapter::updateHandlersListCount);
|
||||||
|
}
|
||||||
|
|
||||||
QVariant
|
QVariant
|
||||||
PluginAdapter::getMediaHandlerSelectableModel(const QString& callId)
|
PluginAdapter::getMediaHandlerSelectableModel(const QString& callId)
|
||||||
|
@ -81,3 +87,15 @@ PluginAdapter::getPluginPreferencesCategories(const QString& pluginId, bool remo
|
||||||
categories.pop_back();
|
categories.pop_back();
|
||||||
return categories;
|
return categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PluginAdapter::updateHandlersListCount()
|
||||||
|
{
|
||||||
|
if (lrcInstance_->pluginModel().getPluginsEnabled()) {
|
||||||
|
set_callMediaHandlersListCount(lrcInstance_->pluginModel().getCallMediaHandlers().size());
|
||||||
|
set_chatHandlersListCount(lrcInstance_->pluginModel().getChatHandlers().size());
|
||||||
|
} else {
|
||||||
|
set_callMediaHandlersListCount(0);
|
||||||
|
set_chatHandlersListCount(0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,6 +31,9 @@
|
||||||
class PluginAdapter final : public QmlAdapterBase
|
class PluginAdapter final : public QmlAdapterBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_PROPERTY(int, callMediaHandlersListCount)
|
||||||
|
QML_PROPERTY(int, chatHandlersListCount)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PluginAdapter(LRCInstance* instance, QObject* parent = nullptr);
|
explicit PluginAdapter(LRCInstance* instance, QObject* parent = nullptr);
|
||||||
~PluginAdapter() = default;
|
~PluginAdapter() = default;
|
||||||
|
@ -55,6 +58,8 @@ Q_SIGNALS:
|
||||||
void pluginUninstalled();
|
void pluginUninstalled();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateHandlersListCount();
|
||||||
|
|
||||||
std::unique_ptr<PluginHandlerItemListModel> pluginHandlerListModel_;
|
std::unique_ptr<PluginHandlerItemListModel> pluginHandlerListModel_;
|
||||||
std::unique_ptr<PreferenceItemListModel> preferenceItemListModel_;
|
std::unique_ptr<PreferenceItemListModel> preferenceItemListModel_;
|
||||||
std::unique_ptr<PluginItemListModel> pluginItemListModel_;
|
std::unique_ptr<PluginItemListModel> pluginItemListModel_;
|
||||||
|
|
|
@ -300,17 +300,6 @@ UtilsAdapter::getAbsPath(QString path)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
UtilsAdapter::checkShowPluginsButton(bool isCall)
|
|
||||||
{
|
|
||||||
if (isCall)
|
|
||||||
return lrcInstance_->pluginModel().getPluginsEnabled()
|
|
||||||
&& (lrcInstance_->pluginModel().getCallMediaHandlers().size() > 0);
|
|
||||||
else
|
|
||||||
return lrcInstance_->pluginModel().getPluginsEnabled()
|
|
||||||
&& (lrcInstance_->pluginModel().getChatHandlers().size() > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
UtilsAdapter::fileName(const QString& path)
|
UtilsAdapter::fileName(const QString& path)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,7 +71,6 @@ public:
|
||||||
Q_INVOKABLE QString toFileInfoName(QString inputFileName);
|
Q_INVOKABLE QString toFileInfoName(QString inputFileName);
|
||||||
Q_INVOKABLE QString toFileAbsolutepath(QString inputFileName);
|
Q_INVOKABLE QString toFileAbsolutepath(QString inputFileName);
|
||||||
Q_INVOKABLE QString getAbsPath(QString path);
|
Q_INVOKABLE QString getAbsPath(QString path);
|
||||||
Q_INVOKABLE bool checkShowPluginsButton(bool isCall);
|
|
||||||
Q_INVOKABLE QString fileName(const QString& path);
|
Q_INVOKABLE QString fileName(const QString& path);
|
||||||
Q_INVOKABLE QString getExt(const QString& path);
|
Q_INVOKABLE QString getExt(const QString& path);
|
||||||
Q_INVOKABLE bool isImage(const QString& fileExt);
|
Q_INVOKABLE bool isImage(const QString& fileExt);
|
||||||
|
|
Loading…
Add table
Reference in a new issue