From a8be1f0271263f1931263f9c73be191fe109d14e Mon Sep 17 00:00:00 2001 From: Xavier Jouslin de Noray <xavier.jouslindenoray@savoirfairelinux.com> Date: Tue, 14 Nov 2023 08:18:09 -0500 Subject: [PATCH] PlatformPluginSupport: add info if plugins are not available for none supported platform Gitlab: #1404 Change-Id: Iaa43a705d1b5e7cf9b960bdf1863d325e4a5332b --- src/app/constant/JamiStrings.qml | 1 + src/app/pluginadapter.cpp | 5 ++ src/app/pluginadapter.h | 1 + .../components/PluginStoreListView.qml | 49 +++++++++++++++++-- src/libclient/api/pluginmodel.h | 2 +- 5 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/app/constant/JamiStrings.qml b/src/app/constant/JamiStrings.qml index a40318278..219b18679 100644 --- a/src/app/constant/JamiStrings.qml +++ b/src/app/constant/JamiStrings.qml @@ -626,6 +626,7 @@ Item { property string installMannuallyDescription: qsTr("Install an extension directly from your device.") property string pluginStoreTitle: qsTr("Available") property string pluginStoreNotAvailable: qsTr("Plugins store is not available") + property string storeNotSupportedPlatform: qsTr("The Jami Extension Store currently has no extension available for the platform in use. Check again later!") property string pluginPreferences: qsTr("Preferences") property string installationFailed: qsTr("Installation failed") property string pluginInstallationFailed: qsTr("The installation of the plugin failed") diff --git a/src/app/pluginadapter.cpp b/src/app/pluginadapter.cpp index 1ca2c4065..c3b22b245 100644 --- a/src/app/pluginadapter.cpp +++ b/src/app/pluginadapter.cpp @@ -102,8 +102,13 @@ PluginAdapter::getPluginsFromStore() auto result = QJsonDocument::fromJson(data).array(); auto pluginsInstalled = lrcInstance_->pluginModel().getPluginsId(); QList<QVariantMap> plugins; + if (result.size() == 0) { + Q_EMIT storeNotAvailableForPlatform(); + return; + } for (const auto& plugin : result) { auto qPlugin = plugin.toVariant().toMap(); + if (!qPlugin.contains("id")) { qPlugin["id"] = qPlugin["name"]; } diff --git a/src/app/pluginadapter.h b/src/app/pluginadapter.h index afd02c263..a7048631d 100644 --- a/src/app/pluginadapter.h +++ b/src/app/pluginadapter.h @@ -68,6 +68,7 @@ protected: bool removeLast = false); Q_SIGNALS: void storeNotAvailable(); + void storeNotAvailableForPlatform(); private: void updateHandlersListCount(); diff --git a/src/app/settingsview/components/PluginStoreListView.qml b/src/app/settingsview/components/PluginStoreListView.qml index 02fa930fa..f6e697d56 100644 --- a/src/app/settingsview/components/PluginStoreListView.qml +++ b/src/app/settingsview/components/PluginStoreListView.qml @@ -19,6 +19,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform +import Qt5Compat.GraphicalEffects import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -28,6 +29,8 @@ ColumnLayout { id: root property bool storeAvailable: true property bool remotePluginHovered: false + property bool storeAvailableForPlatform: true + Component.onCompleted: { PluginAdapter.getPluginsFromStore(); } @@ -36,6 +39,9 @@ ColumnLayout { function onStoreNotAvailable() { storeAvailable = false; } + function onStoreNotAvailableForPlatform() { + storeAvailableForPlatform = false; + } } Label { Layout.fillWidth: true @@ -57,10 +63,8 @@ ColumnLayout { height: childrenRect.height spacing: 10 Repeater { + id: pluginStoreRepeater model: PluginStoreListModel - onCountChanged: { - root.visible = count > 0; - } delegate: Item { id: wrapper function widthProvider() { @@ -111,4 +115,43 @@ ColumnLayout { text: JamiStrings.pluginStoreNotAvailable } } + Loader { + id: platormNotAvailableLoader + Layout.fillWidth: true + active: !storeAvailableForPlatform && storeAvailable + Layout.preferredHeight: active ? JamiTheme.materialButtonPreferredHeight + 10 : 0 + sourceComponent: Rectangle { + width: platormNotAvailableLoader.width + height: platormNotAvailableLoader.height + color: JamiTheme.lightTintedBlue + radius: 5 + RowLayout { + width: parent.width + height: parent.height + ResponsiveImage { + layer { + enabled: true + effect: ColorOverlay { + color: JamiTheme.darkTintedBlue + } + } + Layout.leftMargin: 5 + Layout.alignment: Qt.AlignRight | Qt.AlignHCenter + width: JamiTheme.popuptextSize + height: JamiTheme.popuptextSize + source: JamiResources.outline_info_24dp_svg + } + Text { + Scaffold { + } + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter | Qt.AlignRight + wrapMode: Text.WordWrap + color: JamiTheme.blackColor + font.pixelSize: JamiTheme.popuptextSize + text: JamiStrings.storeNotSupportedPlatform + } + } + } + } } diff --git a/src/libclient/api/pluginmodel.h b/src/libclient/api/pluginmodel.h index 9dee4df00..3fd4500ad 100644 --- a/src/libclient/api/pluginmodel.h +++ b/src/libclient/api/pluginmodel.h @@ -102,7 +102,7 @@ public: */ QString getPluginPath(const QString& pluginId); - MapStringString getPlatformInfo(); + Q_INVOKABLE MapStringString getPlatformInfo(); /** * @brief fetch all plugins path and id * -- GitLab