mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-30 11:43:36 +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.color: "white"
|
||||
text: JamiStrings.viewPlugin
|
||||
enabled: UtilsAdapter.checkShowPluginsButton(true)
|
||||
enabled: PluginAdapter.callMediaHandlersListCount
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -330,8 +330,7 @@ Control {
|
|||
if (!isAudioOnly && !isSIP)
|
||||
CallOverlayModel.addSecondaryControl(shareAction)
|
||||
CallOverlayModel.addSecondaryControl(recordAction)
|
||||
if (UtilsAdapter.checkShowPluginsButton(true))
|
||||
CallOverlayModel.addSecondaryControl(pluginsAction)
|
||||
CallOverlayModel.addSecondaryControl(pluginsAction)
|
||||
overflowItemCount = CallOverlayModel.secondaryModel().rowCount()
|
||||
|
||||
muteAudioAction.checked = isAudioMuted
|
||||
|
|
|
@ -159,7 +159,7 @@ ContextMenuAutoLoader {
|
|||
GeneralMenuItem {
|
||||
id: viewPlugin
|
||||
|
||||
canTrigger: UtilsAdapter.checkShowPluginsButton(true)
|
||||
canTrigger: PluginAdapter.callMediaHandlersListCount
|
||||
itemName: JamiStrings.viewPlugin
|
||||
iconSource: "qrc:/images/icons/extension_24dp.svg"
|
||||
onClicked: {
|
||||
|
|
|
@ -186,14 +186,7 @@ Rectangle {
|
|||
PushButton {
|
||||
id: selectPluginButton
|
||||
|
||||
visible: UtilsAdapter.checkShowPluginsButton(false)
|
||||
|
||||
Connections {
|
||||
target: PluginAdapter
|
||||
function onPluginHandlersUpdateStatus() {
|
||||
selectPluginButton.visible = UtilsAdapter.checkShowPluginsButton(false)
|
||||
}
|
||||
}
|
||||
visible: PluginAdapter.chatHandlersListCount
|
||||
|
||||
anchors.right: sendContactRequestButton.visible ?
|
||||
sendContactRequestButton.left :
|
||||
|
|
|
@ -22,7 +22,13 @@
|
|||
|
||||
PluginAdapter::PluginAdapter(LRCInstance* instance, QObject* parent)
|
||||
: QmlAdapterBase(instance, parent)
|
||||
{}
|
||||
{
|
||||
updateHandlersListCount();
|
||||
connect(&lrcInstance_->pluginModel(),
|
||||
&lrc::api::PluginModel::modelUpdated,
|
||||
this,
|
||||
&PluginAdapter::updateHandlersListCount);
|
||||
}
|
||||
|
||||
QVariant
|
||||
PluginAdapter::getMediaHandlerSelectableModel(const QString& callId)
|
||||
|
@ -81,3 +87,15 @@ PluginAdapter::getPluginPreferencesCategories(const QString& pluginId, bool remo
|
|||
categories.pop_back();
|
||||
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
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_PROPERTY(int, callMediaHandlersListCount)
|
||||
QML_PROPERTY(int, chatHandlersListCount)
|
||||
|
||||
public:
|
||||
explicit PluginAdapter(LRCInstance* instance, QObject* parent = nullptr);
|
||||
~PluginAdapter() = default;
|
||||
|
@ -55,6 +58,8 @@ Q_SIGNALS:
|
|||
void pluginUninstalled();
|
||||
|
||||
private:
|
||||
void updateHandlersListCount();
|
||||
|
||||
std::unique_ptr<PluginHandlerItemListModel> pluginHandlerListModel_;
|
||||
std::unique_ptr<PreferenceItemListModel> preferenceItemListModel_;
|
||||
std::unique_ptr<PluginItemListModel> pluginItemListModel_;
|
||||
|
|
|
@ -300,17 +300,6 @@ UtilsAdapter::getAbsPath(QString path)
|
|||
#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
|
||||
UtilsAdapter::fileName(const QString& path)
|
||||
{
|
||||
|
|
|
@ -71,7 +71,6 @@ public:
|
|||
Q_INVOKABLE QString toFileInfoName(QString inputFileName);
|
||||
Q_INVOKABLE QString toFileAbsolutepath(QString inputFileName);
|
||||
Q_INVOKABLE QString getAbsPath(QString path);
|
||||
Q_INVOKABLE bool checkShowPluginsButton(bool isCall);
|
||||
Q_INVOKABLE QString fileName(const QString& path);
|
||||
Q_INVOKABLE QString getExt(const QString& path);
|
||||
Q_INVOKABLE bool isImage(const QString& fileExt);
|
||||
|
|
Loading…
Add table
Reference in a new issue