1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-04-21 21:52:03 +02:00

PluginView: refactor the ui to a better view

Gitlab: #1306

Change-Id: Ic3d952408c352715f2cd611dad63cf92cfb81ff0
This commit is contained in:
Xavier Jouslin de Noray 2023-08-08 11:55:20 -04:00
parent 8c728374a7
commit b1ca6cf861
24 changed files with 437 additions and 237 deletions

View file

@ -8,28 +8,34 @@
.st2{fill:url(#SVGID_3_);} .st2{fill:url(#SVGID_3_);}
.st3{fill:url(#SVGID_4_);} .st3{fill:url(#SVGID_4_);}
</style> </style>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-12.6549" y1="165.4979" x2="165.4206" y2="343.5734"> <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-12.625" y1="262.475" x2="165.425" y2="84.425" gradientTransform="matrix(1 0 0 -1 0 428)">
<stop offset="0" style="stop-color:#3A3A3A"/> <stop offset="0" style="stop-color:#7E7E7E"/>
<stop offset="1" style="stop-color:#818181"/> <stop offset="1" style="stop-color:#E9FFFF"/>
</linearGradient> </linearGradient>
<path class="st0" d="M1.6,154v21.5v1.4c0.2,0,0.4,0,0.6,0c21.8,0,39.5,17.7,39.5,39.5c0,21.8-17.7,39.5-39.5,39.5 <path class="st0" d="M1.6,154v21.5v1.4c0.2,0,0.4,0,0.6,0c21.8,0,39.5,17.7,39.5,39.5S24,255.9,2.2,255.9c-0.2,0-0.4,0-0.6,0V408
c-0.2,0-0.4,0-0.6,0V408H101V152c0.2,0.1,0.3,0.1,0.5,0.2V51.4L1.6,154z"/> H101V152c0.2,0.1,0.3,0.1,0.5,0.2V51.4L1.6,154z"/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="227.3426" y1="84.8295" x2="405.4313" y2="262.9182"> <linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="227.375" y1="343.175" x2="405.475" y2="165.075" gradientTransform="matrix(1 0 0 -1 0 428)">
<stop offset="0" style="stop-color:#3A3A3A"/> <stop offset="0" style="stop-color:#999999"/>
<stop offset="1" style="stop-color:#717171"/> <stop offset="0.3476" style="stop-color:#9B9B9B"/>
<stop offset="0.525" style="stop-color:#A1A3A3"/>
<stop offset="0.6639" style="stop-color:#ABB0B0"/>
<stop offset="0.7828" style="stop-color:#BAC3C3"/>
<stop offset="0.8889" style="stop-color:#CDDCDC"/>
<stop offset="0.9845" style="stop-color:#E5F9F9"/>
<stop offset="1" style="stop-color:#E9FFFF"/>
</linearGradient> </linearGradient>
<path class="st1" d="M386.9,176.8L386.9,176.8l0-157.8h-93.7v256c-0.1-0.1-0.3-0.1-0.4-0.2v100.8l94.2-96.7v-23.2h0 <path class="st1" d="M386.9,176.8L386.9,176.8V19h-93.7v256c-0.1-0.1-0.3-0.1-0.4-0.2v100.8l94.2-96.7v-23.2l0,0
c21.8,0,39.5-17.7,39.5-39.5C426.4,194.5,408.7,176.8,386.9,176.8z"/> c21.8,0,39.5-17.7,39.5-39.5C426.4,194.5,408.7,176.8,386.9,176.8z"/>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="1.6097" y1="86.4966" x2="395.2845" y2="86.4966"> <linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="1.6" y1="341.5" x2="395.2748" y2="341.5" gradientTransform="matrix(1 0 0 -1 0 428)">
<stop offset="0" style="stop-color:#818181"/> <stop offset="0" style="stop-color:#999999"/>
<stop offset="1" style="stop-color:#3A3A3A"/> <stop offset="0.9889" style="stop-color:#E9FFFF"/>
</linearGradient> </linearGradient>
<path class="st2" d="M181.3,19C126.4,19,1.6,31.5,1.6,154c0,0,49.3-42.7,136.9-25s160.9-0.7,207.6-49.1 <path class="st2" d="M181.3,19C126.4,19,1.6,31.5,1.6,154c0,0,49.3-42.7,136.9-25s160.9-0.7,207.6-49.1
c18.6-19.3,32.4-39.6,40.2-60.9H181.3z"/> c18.6-19.3,32.4-39.6,40.2-60.9H181.3z"/>
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="-553.2536" y1="-1072.2665" x2="-159.5788" y2="-1072.2665" gradientTransform="matrix(-1 0 0 -1 -166.3346 -728.8083)"> <linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="-723.2346" y1="1360.2583" x2="-329.5598" y2="1360.2583" gradientTransform="matrix(-1 0 0 1 -336.3346 -1016.8083)">
<stop offset="0" style="stop-color:#818181"/> <stop offset="0" style="stop-color:#E9FFFF"/>
<stop offset="1" style="stop-color:#3A3A3A"/> <stop offset="1" style="stop-color:#999999"/>
</linearGradient> </linearGradient>
<path class="st3" d="M207.2,408c54.9,0,179.7-11.9,179.7-129.1c0,0-49.3,40.8-136.9,23.9c-87.6-16.9-160.9,0.7-207.6,47 <path class="st3" d="M207.2,408c54.9,0,179.7-11.9,179.7-129.1c0,0-49.3,40.8-136.9,23.9s-160.9,0.7-207.6,47
C23.8,368.3,10.1,387.6,2.2,408H207.2z"/> C23.8,368.3,10.1,387.6,2.2,408H207.2z"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

View file

@ -85,7 +85,7 @@ ItemDelegate {
id: prefLlabel id: prefLlabel
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.leftMargin: 8 Layout.leftMargin: 20
text: preferenceName text: preferenceName
color: JamiTheme.textColor color: JamiTheme.textColor
@ -103,7 +103,7 @@ ItemDelegate {
normalColor: JamiTheme.primaryBackgroundColor normalColor: JamiTheme.primaryBackgroundColor
Layout.alignment: Qt.AlignRight | Qt.AlingVCenter Layout.alignment: Qt.AlignRight | Qt.AlingVCenter
Layout.rightMargin: 8 Layout.rightMargin: 20
Layout.preferredWidth: preferredSize Layout.preferredWidth: preferredSize
Layout.preferredHeight: preferredSize Layout.preferredHeight: preferredSize
imageColor: JamiTheme.textColor imageColor: JamiTheme.textColor
@ -119,7 +119,7 @@ ItemDelegate {
visible: preferenceType === PreferenceItemListModel.SWITCH visible: preferenceType === PreferenceItemListModel.SWITCH
Layout.alignment: Qt.AlignRight | Qt.AlingVCenter Layout.alignment: Qt.AlignRight | Qt.AlingVCenter
Layout.rightMargin: 16 Layout.rightMargin: 20
Layout.preferredHeight: 30 Layout.preferredHeight: 30
Layout.preferredWidth: 30 Layout.preferredWidth: 30
checked: preferenceCurrentValue === "1" checked: preferenceCurrentValue === "1"
@ -134,7 +134,7 @@ ItemDelegate {
visible: preferenceType === PreferenceItemListModel.LIST visible: preferenceType === PreferenceItemListModel.LIST
Layout.preferredWidth: root.width / 2 - 8 Layout.preferredWidth: root.width / 2 - 8
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
Layout.rightMargin: 4 Layout.rightMargin: 20
font.pointSize: JamiTheme.settingsFontSize font.pointSize: JamiTheme.settingsFontSize
font.kerning: true font.kerning: true
@ -157,7 +157,7 @@ ItemDelegate {
buttontextHeightMargin: JamiTheme.buttontextHeightMargin buttontextHeightMargin: JamiTheme.buttontextHeightMargin
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
Layout.rightMargin: 4 Layout.rightMargin: 20
text: UtilsAdapter.fileName(preferenceCurrentValue) text: UtilsAdapter.fileName(preferenceCurrentValue)
toolTipText: JamiStrings.chooseImageFile toolTipText: JamiStrings.chooseImageFile
@ -176,7 +176,7 @@ ItemDelegate {
Layout.preferredWidth: root.width / 2 - 8 Layout.preferredWidth: root.width / 2 - 8
Layout.preferredHeight: 30 Layout.preferredHeight: 30
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
Layout.rightMargin: 4 Layout.rightMargin: 20
visible: preferenceType === PreferenceItemListModel.EDITTEXT visible: preferenceType === PreferenceItemListModel.EDITTEXT
width: root.width / 2 - 8 width: root.width / 2 - 8

View file

@ -31,7 +31,9 @@ Item {
property alias source: image.source property alias source: image.source
property alias status: image.status property alias status: image.status
property alias fillMode: image.fillMode
property alias cache: image.cache property alias cache: image.cache
property alias image: image
property alias mirror: image.mirror property alias mirror: image.mirror
property string color: "transparent" property string color: "transparent"
property bool hovered: false property bool hovered: false

View file

@ -427,7 +427,6 @@ Item {
property string linkDescription: qsTr("This account is created and stored locally, if you want to use it on another device you have to link the new device to this account.") property string linkDescription: qsTr("This account is created and stored locally, if you want to use it on another device you have to link the new device to this account.")
property string linkAnotherDevice: qsTr("Link device") property string linkAnotherDevice: qsTr("Link device")
// NameRegistrationDialog // NameRegistrationDialog
property string setUsername: qsTr("Set username") property string setUsername: qsTr("Set username")
property string registeringName: qsTr("Registering name") property string registeringName: qsTr("Registering name")
@ -625,9 +624,13 @@ Item {
property string editPreference: qsTr("Edit preference") property string editPreference: qsTr("Edit preference")
property string onOff: qsTr("On/Off") property string onOff: qsTr("On/Off")
property string choosePlugin: qsTr("Choose Plugin") property string choosePlugin: qsTr("Choose Plugin")
property string versionPlugin: qsTr("Version %1")
property string lastUpdate: qsTr("Last update %1")
property string by: qsTr("By %1")
property string proposedBy: qsTr("Proposed by %1")
// ProfilePage // ProfilePage
property string information: qsTr("Information") property string information: qsTr("Information")
property string moreInformation: qsTr("More information")
property string profile: qsTr("Profile") property string profile: qsTr("Profile")
// RevokeDevicePasswordDialog // RevokeDevicePasswordDialog

View file

@ -58,10 +58,12 @@ Item {
property color blackColor: "#000000" property color blackColor: "#000000"
property color redColor: "red" property color redColor: "red"
property color whiteColor: "#ffffff" property color whiteColor: "#ffffff"
property color darkBlueGreen: "#123F4A"
property color darkGreyColor: "#272727" property color darkGreyColor: "#272727"
property color darkGreyColorOpacityFade: "#cc000000" // 80%
property color darkGreyColorOpacity: "#be272727" // 77% property color darkGreyColorOpacity: "#be272727" // 77%
property color tintedBlue: darkTheme ? lightTintedBlue : darkTintedBlue property color tintedBlue: darkTheme ? lightTintedBlue : darkTintedBlue
property color lightTintedBlue:"#03B9E9" property color lightTintedBlue: "#03B9E9"
property color darkTintedBlue: "#005699" property color darkTintedBlue: "#005699"
property color sysColor: "#F0EFEF" property color sysColor: "#F0EFEF"
@ -386,8 +388,12 @@ Item {
property real pluginHandlersPopupViewHeight: 200 property real pluginHandlersPopupViewHeight: 200
property real pluginHandlersPopupViewDelegateHeight: 50 property real pluginHandlersPopupViewDelegateHeight: 50
property color pluginDefaultBackgroundColor: "#666666" property color pluginDefaultBackgroundColor: "#666666"
property real remotePluginWidthDelegate: 350 property real remotePluginMinimumDelegateWidth: 430
property real remotePluginHeightDelegate: 400 property real remotePluginMinimumDelegateHeight: 260
property real remotePluginMaximumDelegateWidth: 645
property real remotePluginMaximumDelegateHeight: 390
property real remotePluginDelegateWidth: remotePluginMinimumDelegateWidth * baseZoom
property real remotePluginDelegateHeight: remotePluginMinimumDelegateHeight * baseZoom
property color pluginViewBackgroundColor: darkTheme ? "#000000" : "#F0EFEF" property color pluginViewBackgroundColor: darkTheme ? "#000000" : "#F0EFEF"
property real secondaryDialogDimension: 500 property real secondaryDialogDimension: 500

View file

@ -29,9 +29,11 @@ Item {
property alias source: image.source property alias source: image.source
property string defaultImage: "" property string defaultImage: ""
property string downloadUrl: "" property string downloadUrl: ""
property alias imageLayer: image.layer
property string fileExtension: downloadUrl.substring(downloadUrl.lastIndexOf("."), downloadUrl.length) property string fileExtension: downloadUrl.substring(downloadUrl.lastIndexOf("."), downloadUrl.length)
property string localPath: "" property string localPath: ""
property int imageFillMode: 0 property int imageFillMode: 0
property alias image: image
AnimatedImage { AnimatedImage {
id: image id: image

View file

@ -420,7 +420,7 @@ Control {
icon.source: JamiResources.plugins_24dp_svg icon.source: JamiResources.plugins_24dp_svg
icon.color: "white" icon.color: "white"
text: JamiStrings.viewPlugin text: JamiStrings.viewPlugin
enabled: PluginAdapter.isEnabled && PluginAdapter.callMediaHandlersListCount enabled: PluginAdapter.callMediaHandlersListCount
onEnabledChanged: CallOverlayModel.setEnabled(this, pluginsAction.enabled) onEnabledChanged: CallOverlayModel.setEnabled(this, pluginsAction.enabled)
}, },
Action { Action {

View file

@ -221,7 +221,7 @@ Rectangle {
JamiPushButton { JamiPushButton {
id: selectPluginButton id: selectPluginButton
visible: PluginAdapter.isEnabled && PluginAdapter.chatHandlersListCount && interactionButtonsVisibility visible: PluginAdapter.chatHandlersListCount && interactionButtonsVisibility
source: JamiResources.plugins_24dp_svg source: JamiResources.plugins_24dp_svg
toolTipText: JamiStrings.showPlugins toolTipText: JamiStrings.showPlugins

View file

@ -131,7 +131,6 @@ Popup {
delegate: PluginHandlerItemDelegate { delegate: PluginHandlerItemDelegate {
id: pluginHandlerItemDelegate id: pluginHandlerItemDelegate
visible: PluginModel.getPluginsEnabled()
width: pluginhandlerPickerListView.width width: pluginhandlerPickerListView.width
height: JamiTheme.pluginHandlersPopupViewDelegateHeight height: JamiTheme.pluginHandlersPopupViewDelegateHeight

View file

@ -44,13 +44,11 @@ PluginAdapter::PluginAdapter(LRCInstance* instance, QObject* parent, QString bas
{ {
QML_REGISTERSINGLETONTYPE_POBJECT(NS_MODELS, pluginStoreListModel_, "PluginStoreListModel"); QML_REGISTERSINGLETONTYPE_POBJECT(NS_MODELS, pluginStoreListModel_, "PluginStoreListModel");
QML_REGISTERSINGLETONTYPE_POBJECT(NS_MODELS, pluginListModel_, "PluginListModel") QML_REGISTERSINGLETONTYPE_POBJECT(NS_MODELS, pluginListModel_, "PluginListModel")
set_isEnabled(lrcInstance_->pluginModel().getPluginsEnabled());
updateHandlersListCount(); updateHandlersListCount();
connect(&lrcInstance_->pluginModel(), connect(&lrcInstance_->pluginModel(),
&lrc::api::PluginModel::modelUpdated, &lrc::api::PluginModel::modelUpdated,
this, this,
&PluginAdapter::updateHandlersListCount); &PluginAdapter::updateHandlersListCount);
connect(this, &PluginAdapter::isEnabledChanged, this, &PluginAdapter::updateHandlersListCount);
connect(pluginVersionManager_, connect(pluginVersionManager_,
&PluginVersionManager::versionStatusChanged, &PluginVersionManager::versionStatusChanged,
pluginListModel_, pluginListModel_,
@ -75,6 +73,10 @@ PluginAdapter::PluginAdapter(LRCInstance* instance, QObject* parent, QString bas
&PluginListModel::setVersionStatus, &PluginListModel::setVersionStatus,
pluginStoreListModel_, pluginStoreListModel_,
&PluginStoreListModel::onVersionStatusChanged); &PluginStoreListModel::onVersionStatusChanged);
connect(pluginVersionManager_,
&PluginVersionManager::newVersionAvailable,
pluginListModel_,
&PluginListModel::onNewVersionAvailable);
getPluginsFromStore(); getPluginsFromStore();
} }
@ -177,13 +179,8 @@ PluginAdapter::getPluginPreferencesCategories(const QString& pluginId,
void void
PluginAdapter::updateHandlersListCount() PluginAdapter::updateHandlersListCount()
{ {
if (isEnabled_) { set_callMediaHandlersListCount(lrcInstance_->pluginModel().getCallMediaHandlers().size());
set_callMediaHandlersListCount(lrcInstance_->pluginModel().getCallMediaHandlers().size()); set_chatHandlersListCount(lrcInstance_->pluginModel().getChatHandlers().size());
set_chatHandlersListCount(lrcInstance_->pluginModel().getChatHandlers().size());
} else {
set_callMediaHandlersListCount(0);
set_chatHandlersListCount(0);
}
} }
void void
@ -203,3 +200,9 @@ PluginAdapter::getIconUrl(const QString& pluginId) const
{ {
return baseUrl_ + "/icons/" + pluginId + "?arch=" + Utils::getPlatformString(); return baseUrl_ + "/icons/" + pluginId + "?arch=" + Utils::getPlatformString();
} }
QString
PluginAdapter::getBackgroundImageUrl(const QString& pluginId) const
{
return baseUrl_ + "/backgrounds/" + pluginId + "?arch=" + Utils::getPlatformString();
}

View file

@ -38,7 +38,6 @@ class PluginAdapter final : public QmlAdapterBase
Q_OBJECT Q_OBJECT
QML_PROPERTY(int, callMediaHandlersListCount) QML_PROPERTY(int, callMediaHandlersListCount)
QML_PROPERTY(int, chatHandlersListCount) QML_PROPERTY(int, chatHandlersListCount)
QML_PROPERTY(bool, isEnabled)
public: public:
explicit PluginAdapter(LRCInstance* instance, explicit PluginAdapter(LRCInstance* instance,
@ -55,6 +54,7 @@ public:
Q_INVOKABLE void cancelDownload(const QString& pluginId); Q_INVOKABLE void cancelDownload(const QString& pluginId);
Q_INVOKABLE void setAutoUpdate(bool state); Q_INVOKABLE void setAutoUpdate(bool state);
Q_INVOKABLE QString getIconUrl(const QString& pluginId) const; Q_INVOKABLE QString getIconUrl(const QString& pluginId) const;
Q_INVOKABLE QString getBackgroundImageUrl(const QString& pluginId) const;
protected: protected:
Q_INVOKABLE QVariant getMediaHandlerSelectableModel(const QString& callId); Q_INVOKABLE QVariant getMediaHandlerSelectableModel(const QString& callId);

View file

@ -62,16 +62,24 @@ PluginListModel::data(const QModelIndex& index, int role) const
switch (role) { switch (role) {
case Role::PluginName: case Role::PluginName:
return QVariant(details.name); return QVariant(details.name);
case Role::PluginVersion:
return QVariant(details.version);
case Role::PluginDescription: case Role::PluginDescription:
return QVariant(details.description); return QVariant(details.description);
case Role::PluginId: case Role::PluginId:
return QVariant(installedPlugins_.at(index.row())); return QVariant(installedPlugins_.at(index.row()));
case Role::PluginIcon: case Role::PluginIcon:
return QVariant(details.iconPath); return QVariant(details.iconPath);
case Role::PluginImage:
return QVariant(details.imagePath);
case Role::IsLoaded: case Role::IsLoaded:
return QVariant(details.loaded); return QVariant(details.loaded);
case Role::PluginAuthor:
return QVariant(details.author);
case Role::Status: case Role::Status:
return QVariant(pluginStatus_.value(installedPlugins_.at(index.row()))); return QVariant(pluginStatus_.value(installedPlugins_.at(index.row())));
case Role::NewPluginAvailable:
return QVariant(newVersionAvailable_.value(installedPlugins_.at(index.row())));
} }
return QVariant(); return QVariant();
} }
@ -83,9 +91,13 @@ PluginListModel::roleNames() const
roles[PluginName] = "PluginName"; roles[PluginName] = "PluginName";
roles[PluginId] = "PluginId"; roles[PluginId] = "PluginId";
roles[PluginIcon] = "PluginIcon"; roles[PluginIcon] = "PluginIcon";
roles[PluginImage] = "PluginImage";
roles[PluginVersion] = "PluginVersion";
roles[PluginAuthor] = "PluginAuthor";
roles[IsLoaded] = "IsLoaded"; roles[IsLoaded] = "IsLoaded";
roles[Status] = "Status"; roles[Status] = "Status";
roles[PluginDescription] = "PluginDescription"; roles[PluginDescription] = "PluginDescription";
roles[NewPluginAvailable] = "NewPluginAvailable";
return roles; return roles;
} }
@ -164,6 +176,41 @@ PluginListModel::filterPlugins(VectorString& list) const
list.cend()); list.cend());
} }
void
PluginListModel::onNewVersionAvailable(const QString& pluginId, const QString& version)
{
// check if pluginId exists in installedPlugins_
auto pluginIndex = -1;
for (auto& p : installedPlugins_) {
auto details = lrcInstance_->pluginModel().getPluginDetails(p);
if (details.name == pluginId) {
pluginIndex = installedPlugins_.indexOf(p, -1);
break;
}
}
if (pluginIndex == -1) {
return;
}
newVersionAvailable_[pluginId] = version;
pluginChanged(pluginIndex);
}
void
PluginListModel::deleteLatestVersion(const QString& pluginId)
{
auto pluginIndex = -1;
for (auto& p : installedPlugins_) {
auto details = lrcInstance_->pluginModel().getPluginDetails(p);
if (details.name == pluginId) {
pluginIndex = installedPlugins_.indexOf(p, -1);
break;
}
}
if (pluginIndex == -1) {
return;
}
newVersionAvailable_.remove(pluginId);
}
void void
PluginListModel::onVersionStatusChanged(const QString& pluginId, PluginStatus::Role status) PluginListModel::onVersionStatusChanged(const QString& pluginId, PluginStatus::Role status)
{ {

View file

@ -32,7 +32,11 @@ public:
PluginName = Qt::UserRole + 1, PluginName = Qt::UserRole + 1,
PluginDescription, PluginDescription,
PluginId, PluginId,
PluginVersion,
PluginAuthor,
PluginImage,
PluginIcon, PluginIcon,
NewPluginAvailable,
IsLoaded, IsLoaded,
Status Status
}; };
@ -60,6 +64,7 @@ public:
Q_INVOKABLE void pluginChanged(int index); Q_INVOKABLE void pluginChanged(int index);
Q_INVOKABLE void addPlugin(); Q_INVOKABLE void addPlugin();
Q_INVOKABLE void disableAllPlugins(); Q_INVOKABLE void disableAllPlugins();
Q_INVOKABLE void deleteLatestVersion(const QString& pluginId);
Q_SIGNALS: Q_SIGNALS:
void versionCheckRequested(const QString& pluginId); void versionCheckRequested(const QString& pluginId);
@ -68,10 +73,12 @@ Q_SIGNALS:
void disabled(const QString& pluginId); void disabled(const QString& pluginId);
public Q_SLOTS: public Q_SLOTS:
void onVersionStatusChanged(const QString& pluginId, PluginStatus::Role status); void onVersionStatusChanged(const QString& pluginId, PluginStatus::Role status);
void onNewVersionAvailable(const QString& pluginId, const QString& version);
private: private:
LRCInstance* lrcInstance_ = nullptr; LRCInstance* lrcInstance_ = nullptr;
void filterPlugins(VectorString& list) const; void filterPlugins(VectorString& list) const;
VectorString installedPlugins_ {}; VectorString installedPlugins_ {};
QMap<QString, PluginStatus::Role> pluginStatus_ {}; QMap<QString, PluginStatus::Role> pluginStatus_ {};
QMap<QString, QString> newVersionAvailable_ {};
}; };

View file

@ -68,6 +68,7 @@ public Q_SLOTS:
Q_SIGNALS: Q_SIGNALS:
void versionStatusChanged(const QString& pluginId, PluginStatus::Role status); void versionStatusChanged(const QString& pluginId, PluginStatus::Role status);
void newVersionAvailable(const QString& pluginId, const QString& version);
private: private:
QString baseUrl; QString baseUrl;

View file

@ -34,6 +34,9 @@ ItemDelegate {
property string pluginAuthor property string pluginAuthor
property string pluginShortDescription property string pluginShortDescription
property int pluginStatus property int pluginStatus
property string backgroundLocalPath: UtilsAdapter.getCachePath() + '/backgrounds/' + pluginName + '.jpg'
property string iconLocalPath: UtilsAdapter.getCachePath() + '/icons/' + pluginName + '.svg'
readonly property real scalingFactor: 1 + hovered * 0.02
property string installButtonStatus: { property string installButtonStatus: {
switch (pluginStatus) { switch (pluginStatus) {
case PluginStatus.DOWNLOADING: case PluginStatus.DOWNLOADING:
@ -52,8 +55,6 @@ ItemDelegate {
} }
} }
background: null
function presentErrorMessage() { function presentErrorMessage() {
viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", { viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", {
"title": JamiStrings.installationFailed, "title": JamiStrings.installationFailed,
@ -69,9 +70,35 @@ ItemDelegate {
anchors.fill: parent anchors.fill: parent
radius: 5 radius: 5
} }
background: null
Page { Page {
id: plugin id: plugin
anchors.fill: parent anchors.fill: parent
background: CachedImage {
id: background
defaultImage: JamiResources.default_plugin_background_jpg
downloadUrl: PluginAdapter.getBackgroundImageUrl(pluginName)
anchors.fill: parent
localPath: root.localPath === undefined ? '' : root.localPath
imageFillMode: Image.PreserveAspectCrop
LinearGradient {
id: gradient
anchors.fill: parent
start: Qt.point(0, height / 3)
gradient: Gradient {
GradientStop {
position: 0.0
color: JamiTheme.transparentColor
}
GradientStop {
position: 1.0
color: JamiTheme.darkGreyColorOpacityFade
}
}
}
}
layer { layer {
enabled: true enabled: true
effect: OpacityMask { effect: OpacityMask {
@ -81,12 +108,8 @@ ItemDelegate {
header: Control { header: Control {
leftPadding: 20 leftPadding: 20
rightPadding: 5 rightPadding: 5
bottomPadding: 20
topPadding: 5 topPadding: 5
background: Rectangle { bottomPadding: 20
id: headerBackground
color: hovered ? Qt.lighter(pluginBackground, 1.9) : Qt.lighter(pluginBackground, 2)
}
contentItem: ColumnLayout { contentItem: ColumnLayout {
SpinningAnimation { SpinningAnimation {
id: buttonContainer id: buttonContainer
@ -96,7 +119,7 @@ ItemDelegate {
Layout.topMargin: 2 Layout.topMargin: 2
Layout.preferredHeight: install.height Layout.preferredHeight: install.height
Layout.preferredWidth: install.width Layout.preferredWidth: install.width
color: "black" color: JamiTheme.whiteColor
outerCutRadius: install.radius outerCutRadius: install.radius
spinningAnimationDuration: 5000 spinningAnimationDuration: 5000
mode: { mode: {
@ -109,9 +132,10 @@ ItemDelegate {
MaterialButton { MaterialButton {
id: install id: install
hoverEnabled: pluginStatus !== PluginStatus.INSTALLING hoverEnabled: pluginStatus !== PluginStatus.INSTALLING
secHoveredColor: Qt.darker(headerBackground.color, 1.1)
buttontextHeightMargin: 10.0 buttontextHeightMargin: 10.0
secHoveredColor: JamiTheme.darkBlueGreen
radius: JamiTheme.chatViewHeaderButtonRadius radius: JamiTheme.chatViewHeaderButtonRadius
TextMetrics { TextMetrics {
id: installTextSize id: installTextSize
@ -120,7 +144,7 @@ ItemDelegate {
font.capitalization: Font.Medium font.capitalization: Font.Medium
text: install.text text: install.text
} }
contentColorProvider: "black" contentColorProvider: JamiTheme.whiteColor
onClicked: installPlugin() onClicked: installPlugin()
secondary: true secondary: true
preferredWidth: installTextSize.width + JamiTheme.buttontextWizzardPadding preferredWidth: installTextSize.width + JamiTheme.buttontextWizzardPadding
@ -139,56 +163,24 @@ ItemDelegate {
} }
} }
RowLayout { RowLayout {
spacing: 10 Layout.alignment: Qt.AlignCenter
CachedImage { CachedImage {
id: icon id: icon
defaultImage: JamiResources.plugins_default_icon_svg defaultImage: JamiResources.plugins_default_icon_svg
onSourceChanged: { width: 65
if (source == defaultImage) { height: 65
pluginBackground = JamiTheme.pluginDefaultBackgroundColor;
return;
}
pluginBackground = PluginStoreListModel.computeAverageColorOfImage(source);
}
width: 55
height: 55
downloadUrl: PluginAdapter.getIconUrl(pluginName) downloadUrl: PluginAdapter.getIconUrl(pluginName)
fileExtension: '.svg' localPath: root.iconLocalPath
localPath: UtilsAdapter.getCachePath() + '/plugins/' + pluginName + '.svg'
}
ColumnLayout {
width: parent.width
Label {
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
text: pluginName
font.kerning: true
color: "black"
font.pointSize: JamiTheme.tinyCreditsTextSize
textFormat: Text.PlainText
wrapMode: Text.WrapAnywhere
}
// Label {
// Layout.fillWidth: true
// color: "black"
// text: pluginShortDescription
// font.pointSize: JamiTheme.settingsFontSize
// textFormat: Text.PlainText
// wrapMode: Text.WordWrap
// }
} }
} }
} }
} }
Rectangle {
id: contentContainer
anchors.fill: parent
color: hovered ? JamiTheme.smartListHoveredColor : JamiTheme.pluginViewBackgroundColor
}
JamiFlickable { JamiFlickable {
anchors.fill: parent anchors.fill: parent
anchors.margins: 20 anchors.rightMargin: 20
contentHeight: description.height anchors.leftMargin: 20
anchors.bottomMargin: 5
contentHeight: body.height
clip: true clip: true
flickableDirection: Flickable.VerticalFlick flickableDirection: Flickable.VerticalFlick
ScrollBar.vertical: JamiScrollBar { ScrollBar.vertical: JamiScrollBar {
@ -197,12 +189,24 @@ ItemDelegate {
} }
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ColumnLayout { ColumnLayout {
id: body
width: parent.width width: parent.width
Label {
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
text: pluginName
font.kerning: true
font.bold: true
color: JamiTheme.whiteColor
font.pixelSize: hovered ? JamiTheme.popuptextSize * scalingFactor : JamiTheme.popuptextSize
textFormat: Text.PlainText
wrapMode: Text.WrapAnywhere
}
Text { Text {
id: description id: description
Layout.preferredWidth: contentContainer.width Layout.fillWidth: true
font.pixelSize: JamiTheme.popuptextSize font.pixelSize: hovered ? JamiTheme.popuptextSize * scalingFactor : JamiTheme.popuptextSize
color: JamiTheme.textColor color: JamiTheme.whiteColor
text: pluginDescription text: pluginDescription
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
horizontalAlignment: Qt.AlignLeft horizontalAlignment: Qt.AlignLeft
@ -213,21 +217,19 @@ ItemDelegate {
} }
} }
footer: Control { footer: Control {
padding: 20 leftPadding: 20
background: Rectangle { bottomPadding: 20
color: hovered ? JamiTheme.smartListHoveredColor : JamiTheme.pluginViewBackgroundColor rightPadding: 20
}
contentItem: Text { contentItem: Text {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: implicitHeight Layout.preferredHeight: implicitHeight
Layout.topMargin: 8
Layout.leftMargin: 8 Layout.leftMargin: 8
color: JamiTheme.textColor color: JamiTheme.whiteColor
font.pointSize: JamiTheme.settingsFontSize font.pixelSize: hovered ? JamiTheme.settingsFontSize * scalingFactor : JamiTheme.settingsFontSize
font.kerning: true font.kerning: true
font.italic: true font.italic: true
text: "By " + pluginAuthor text: JamiStrings.by.arg(pluginAuthor)
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }

View file

@ -32,13 +32,13 @@ Rectangle {
if (pluginLoader.item !== undefined) { if (pluginLoader.item !== undefined) {
return -1; return -1;
} else { } else {
if (pluginListView.currentIndex === null) { if (pluginListView.currentIndex === 0) {
return -1; return -1;
} }
return pluginListView.currentIndex; return pluginListView.currentIndex;
} }
} }
visible: PluginAdapter.isEnabled && count visible: count
color: JamiTheme.secondaryBackgroundColor color: JamiTheme.secondaryBackgroundColor
ColumnLayout { ColumnLayout {
@ -48,7 +48,6 @@ Rectangle {
RowLayout { RowLayout {
Layout.preferredHeight: JamiTheme.settingsHeaderpreferredHeight Layout.preferredHeight: JamiTheme.settingsHeaderpreferredHeight
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: 20
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
Label { Label {
Layout.fillWidth: true Layout.fillWidth: true
@ -58,7 +57,7 @@ Rectangle {
color: JamiTheme.textColor color: JamiTheme.textColor
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignBottom
} }
HeaderToggleSwitch { HeaderToggleSwitch {
labelText: "auto update" labelText: "auto update"

View file

@ -27,6 +27,7 @@ Rectangle {
id: root id: root
property string accountId: "" property string accountId: ""
required property string pluginId required property string pluginId
required property bool isLoaded
width: parent.width width: parent.width
property int count: pluginPreferenceView.count + pluginPreferenceViewCategory.count property int count: pluginPreferenceView.count + pluginPreferenceViewCategory.count
@ -274,7 +275,7 @@ Rectangle {
onClicked: viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", { onClicked: viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", {
"title": JamiStrings.resetPreferences, "title": JamiStrings.resetPreferences,
"infoText": JamiStrings.pluginResetConfirmation.arg(pluginName), "infoText": JamiStrings.pluginResetConfirmation.arg(pluginId),
"buttonTitles": [JamiStrings.optionOk, JamiStrings.optionCancel], "buttonTitles": [JamiStrings.optionOk, JamiStrings.optionCancel],
"buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue, SimpleMessageDialog.ButtonStyle.TintedBlack], "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue, SimpleMessageDialog.ButtonStyle.TintedBlack],
"buttonCallBacks": [function () { "buttonCallBacks": [function () {

View file

@ -18,11 +18,13 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import net.jami.Adapters 1.1 import Qt5Compat.GraphicalEffects
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
import net.jami.Models 1.1 import net.jami.Models 1.1
import net.jami.Adapters 1.1
import net.jami.Constants 1.1 import net.jami.Constants 1.1
import "../../commoncomponents" import "../../commoncomponents"
import "../../mainview/components"
Item { Item {
id: root id: root
@ -49,21 +51,47 @@ Item {
color: JamiTheme.pluginViewBackgroundColor color: JamiTheme.pluginViewBackgroundColor
} }
header: Control { header: Control {
padding: 10 id: preferenceHeader
background: Rectangle { width: root.width
color: JamiTheme.pluginViewBackgroundColor background: ResponsiveImage {
id: background
anchors.fill: preferenceHeader
fillMode: Image.PreserveAspectCrop
source: PluginImage === "" ? JamiResources.default_plugin_background_jpg : "file:" + PluginImage
FastBlur {
anchors.fill: parent
source: background.image
radius: 64
}
LinearGradient {
id: gradient
anchors.fill: parent
start: Qt.point(0, height / 3)
gradient: Gradient {
GradientStop {
position: 0.0
color: JamiTheme.transparentColor
}
GradientStop {
position: 1.0
color: JamiTheme.darkGreyColorOpacityFade
}
}
}
} }
contentItem: ColumnLayout { contentItem: ColumnLayout {
width: parent.width width: parent.width
PushButton { JamiPushButton {
id: closeButton id: closeButton
normalColor: "transparent" normalColor: Qt.rgba(124, 124, 124, 0.36)
hoveredColor: JamiTheme.smartListHoveredColor hoveredColor: Qt.rgba(124, 124, 124, 0.75)
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
Layout.topMargin: 10
Layout.rightMargin: 35
Layout.preferredWidth: JamiTheme.preferredFieldHeight Layout.preferredWidth: JamiTheme.preferredFieldHeight
Layout.preferredHeight: childrenRect.height Layout.preferredHeight: childrenRect.height
imageColor: JamiTheme.textColor imageColor: JamiTheme.blackColor
toolTipText: JamiStrings.closeSettings toolTipText: JamiStrings.closeSettings
preferredSize: 32 preferredSize: 32
@ -73,54 +101,36 @@ Item {
} }
} }
RowLayout { ResponsiveImage {
Layout.preferredWidth: parent.width Layout.bottomMargin: 10
ResponsiveImage { Layout.rightMargin: 10
Layout.bottomMargin: 10 Layout.alignment: Qt.AlignCenter
Layout.rightMargin: 10 containerWidth: 100
containerWidth: 64 containerHeight: 100
containerHeight: 64 source: PluginIcon === "" ? JamiResources.plugins_default_icon_svg : "file:" + PluginIcon
source: PluginIcon === "" ? JamiResources.plugins_default_icon_svg : "file:" + PluginIcon }
}
Label {
text: PluginName
font.pixelSize: JamiTheme.settingsTitlePixelSize
font.kerning: true
color: JamiTheme.textColor
textFormat: Text.PlainText
}
Item { Label {
Layout.fillHeight: true Layout.leftMargin: 20
Layout.fillWidth: true text: PluginName
MaterialButton { font.pixelSize: JamiTheme.settingsDescriptionPixelSize
id: update font.kerning: true
anchors.right: parent.right font.bold: true
buttontextHeightMargin: 0.0 color: JamiTheme.whiteColor
TextMetrics { textFormat: Text.PlainText
id: updateTextSize
font.weight: Font.Bold
font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize
font.capitalization: Font.AllUppercase
text: JamiStrings.updateDialogTitle
}
visible: Status === PluginStatus.UPDATABLE
secondary: true
preferredWidth: updateTextSize.width
text: JamiStrings.updateDialogTitle
fontSize: 15
}
}
} }
JamiFlickable { JamiFlickable {
Layout.fillWidth: true Layout.leftMargin: 20
Layout.bottomMargin: 20
Layout.preferredWidth: root.width
Layout.preferredHeight: childrenRect.height Layout.preferredHeight: childrenRect.height
Layout.minimumHeight: childrenRect.height Layout.minimumHeight: childrenRect.height
Layout.maximumHeight: 88 Layout.maximumHeight: 88
contentWidth: description.width contentWidth: description.width
contentHeight: description.height contentHeight: description.height
clip: true clip: true
boundsBehavior: Flickable.StopAtBounds
flickableDirection: Flickable.VerticalFlick flickableDirection: Flickable.VerticalFlick
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
@ -129,12 +139,12 @@ Item {
} }
Text { Text {
id: description id: description
width: settings.width - 2 * scrollBar.width width: settings.width - (2 * scrollBar.width + 20)
text: PluginDescription text: PluginDescription
font.pixelSize: JamiTheme.popuptextSize font.pixelSize: JamiTheme.popuptextSize
color: JamiTheme.textColor color: JamiTheme.whiteColor
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
textFormat: Text.PlainText textFormat: Text.MarkdownText
} }
} }
} }
@ -145,26 +155,121 @@ Item {
} }
JamiFlickable { JamiFlickable {
anchors.fill: parent anchors.fill: parent
width: root.width
contentHeight: contentItem.childrenRect.height contentHeight: contentItem.childrenRect.height
topMargin: JamiTheme.preferredSettingsBottomMarginSize topMargin: 20
bottomMargin: JamiTheme.preferredSettingsBottomMarginSize bottomMargin: JamiTheme.preferredSettingsBottomMarginSize
boundsBehavior: Flickable.StopAtBounds
ScrollBar.horizontal.visible: false ScrollBar.horizontal.visible: false
contentItem.children: ColumnLayout { contentItem.children: ColumnLayout {
width: root.width width: root.width
PluginPreferencesListView { ColumnLayout {
id: pluginGeneralSettingsView width: parent.width
Layout.fillWidth: true Label {
pluginId: PluginId Layout.leftMargin: 20
Layout.fillWidth: true
text: JamiStrings.settings
font.pixelSize: JamiTheme.settingsDescriptionPixelSize
font.bold: true
font.kerning: true
color: JamiTheme.textColor
}
PluginPreferencesListView {
id: pluginGeneralSettingsView
Layout.fillWidth: true
pluginId: PluginId
isLoaded: IsLoaded
}
PluginPreferencesListView {
id: pluginAccountSettingsView
Layout.fillWidth: true
accountId: LRCInstance.currentAccountId
pluginId: PluginId
isLoaded: IsLoaded
}
} }
PluginPreferencesListView { Rectangle {
id: pluginAccountSettingsView width: parent.width
Layout.fillWidth: true height: childrenRect.height + 40
accountId: LRCInstance.currentAccountId Layout.topMargin: 20
pluginId: PluginId color: JamiTheme.pluginViewBackgroundColor
ColumnLayout {
width: parent.width
anchors.top: parent.top
anchors.left: parent.left
anchors.topMargin: 20
anchors.bottomMargin: 20
anchors.leftMargin: 20
Label {
Layout.fillWidth: true
text: JamiStrings.moreInformation
font.pixelSize: JamiTheme.settingsDescriptionPixelSize
font.bold: true
font.kerning: true
color: JamiTheme.textColor
}
Label {
Layout.fillWidth: true
text: JamiStrings.versionPlugin.arg(PluginVersion)
font.pixelSize: JamiTheme.headerFontSize
font.kerning: true
color: JamiTheme.textColor
}
Item {
width: parent.width
height: childrenRect.height
visible: Status === PluginStatus.UPDATABLE
Label {
width: parent.width
text: JamiStrings.lastUpdate.arg(NewPluginAvailable)
font.pixelSize: JamiTheme.headerFontSize
font.kerning: true
color: JamiTheme.textColor
}
Item {
width: parent.width
height: childrenRect.height
anchors.right: parent.right
anchors.rightMargin: 40
MaterialButton {
id: update
anchors.right: parent.right
buttontextHeightMargin: 0.0
TextMetrics {
id: updateTextSize
font.weight: Font.Bold
font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize
font.capitalization: Font.AllUppercase
text: JamiStrings.updateDialogTitle
}
secondary: true
preferredWidth: updateTextSize.width
text: JamiStrings.updateDialogTitle
fontSize: 15
onClicked: {
PluginModel.deleteLatestVersion(PluginName);
PluginAdapter.installRemotePlugin(PluginName);
}
}
}
}
Label {
visible: PluginAuthor !== ''
Layout.fillWidth: true
color: JamiTheme.textColor
font.pointSize: JamiTheme.settingsFontSize
font.kerning: true
font.italic: true
text: JamiStrings.proposedBy.arg(PluginAuthor)
wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter
}
}
} }
MaterialButton { MaterialButton {
id: uninstallButton id: uninstallButton
Layout.topMargin: 20
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
preferredWidth: JamiTheme.preferredFieldWidth preferredWidth: JamiTheme.preferredFieldWidth

View file

@ -33,7 +33,28 @@ SettingsPageBase {
anchors.leftMargin: JamiTheme.preferredSettingsMarginSize anchors.leftMargin: JamiTheme.preferredSettingsMarginSize
ColumnLayout { ColumnLayout {
id: generalSettings id: generalSettings
Layout.maximumWidth: 3 * (JamiTheme.remotePluginWidthDelegate + 20) Layout.maximumWidth: {
let width = 0;
if (JamiTheme.remotePluginDelegateWidth < JamiTheme.remotePluginMinimumDelegateWidth) {
width = 3 * (JamiTheme.remotePluginMinimumDelegateWidth + 20);
} else if (JamiTheme.remotePluginDelegateWidth > JamiTheme.remotePluginMaximumDelegateWidth) {
width = 3 * (JamiTheme.remotePluginMaximumDelegateWidth + 20);
} else {
width = 3 * (JamiTheme.remotePluginDelegateWidth + 20);
}
return pluginRemoteList.remotePluginHovered ? width + 10 : width;
}
Layout.minimumWidth: {
let width = 0;
if (JamiTheme.remotePluginDelegateWidth < JamiTheme.remotePluginMinimumDelegateWidth) {
width = JamiTheme.remotePluginMinimumDelegateWidth + 10;
} else if (JamiTheme.remotePluginDelegateWidth > JamiTheme.remotePluginMaximumDelegateWidth) {
width = JamiTheme.remotePluginMaximumDelegateWidth + 10;
} else {
width = JamiTheme.remotePluginDelegateWidth + 10;
}
return pluginRemoteList.remotePluginHovered ? width + 10 : width;
}
Layout.preferredWidth: parent.width Layout.preferredWidth: parent.width
Layout.rightMargin: 80 Layout.rightMargin: 80
spacing: JamiTheme.settingsBlockSpacing spacing: JamiTheme.settingsBlockSpacing
@ -52,6 +73,7 @@ SettingsPageBase {
} }
// View of available plugins in the store // View of available plugins in the store
PluginStoreListView { PluginStoreListView {
id: pluginRemoteList
Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
} }

View file

@ -25,7 +25,9 @@ import net.jami.Constants 1.1
import "../../commoncomponents" import "../../commoncomponents"
ColumnLayout { ColumnLayout {
id: root
property bool storeAvailable: true property bool storeAvailable: true
property bool remotePluginHovered: false
Component.onCompleted: { Component.onCompleted: {
PluginAdapter.getPluginsFromStore(); PluginAdapter.getPluginsFromStore();
} }
@ -53,20 +55,44 @@ ColumnLayout {
sourceComponent: Flow { sourceComponent: Flow {
id: pluginStoreList id: pluginStoreList
height: childrenRect.height height: childrenRect.height
spacing: 20 spacing: 10
Repeater { Repeater {
model: PluginStoreListModel model: PluginStoreListModel
onCountChanged: {
delegate: PluginAvailableDelagate { root.visible = count > 0
id: pluginItemDelegate }
width: JamiTheme.remotePluginWidthDelegate delegate: Item {
height: JamiTheme.remotePluginHeightDelegate id: wrapper
pluginName: Name function widthProvider() {
pluginIcon: IconPath if (JamiTheme.remotePluginDelegateWidth < JamiTheme.remotePluginMinimumDelegateWidth) {
pluginDescription: Description return JamiTheme.remotePluginMinimumDelegateWidth;
pluginAuthor: Author } else if (JamiTheme.remotePluginDelegateWidth > JamiTheme.remotePluginMaximumDelegateWidth) {
pluginShortDescription: "" return JamiTheme.remotePluginMaximumDelegateWidth;
pluginStatus: Status }
return JamiTheme.remotePluginDelegateWidth;
}
function heightProvider() {
if (JamiTheme.remotePluginDelegateHeight < JamiTheme.remotePluginMinimumDelegateHeight) {
return JamiTheme.remotePluginMinimumDelegateHeight;
} else if (JamiTheme.remotePluginDelegateHeight > JamiTheme.remotePluginMaximumDelegateHeight) {
return JamiTheme.remotePluginMaximumDelegateHeight;
}
return JamiTheme.remotePluginDelegateHeight;
}
width: widthProvider() + 10
height: heightProvider() + 6
PluginAvailableDelegate {
id: pluginItemDelegate
anchors.centerIn: parent
width: wrapper.widthProvider() * scalingFactor
height: wrapper.heightProvider() * scalingFactor
pluginName: Name
pluginIcon: IconPath
pluginDescription: Description
pluginAuthor: Author
pluginShortDescription: ""
pluginStatus: Status
}
} }
} }
} }

View file

@ -43,7 +43,9 @@ struct PluginDetails
QString description = ""; QString description = "";
QString path = ""; QString path = "";
QString version = ""; QString version = "";
QString author = "";
QString iconPath = ""; QString iconPath = "";
QString imagePath = "";
bool loaded = false; bool loaded = false;
}; };
@ -63,18 +65,6 @@ public:
PluginModel(); PluginModel();
~PluginModel(); ~PluginModel();
/**
* Enable/disable plugins
* @param if plugin enabled
*/
Q_INVOKABLE void setPluginsEnabled(bool enable);
/**
* Get if plugins are enabled
* @return plugins enabled
*/
Q_INVOKABLE bool getPluginsEnabled() const;
/** /**
* Get list of installed plugins * Get list of installed plugins
* @return plugins installed * @return plugins installed

View file

@ -67,24 +67,6 @@ PluginModel::PluginModel()
PluginModel::~PluginModel() {} PluginModel::~PluginModel() {}
void
PluginModel::setPluginsEnabled(bool enable)
{
PluginManager::instance().setPluginsEnabled(enable);
if (!enable)
Q_EMIT chatHandlerStatusUpdated(false);
else
Q_EMIT chatHandlerStatusUpdated(getChatHandlers().size() > 0);
Q_EMIT modelUpdated();
}
bool
PluginModel::getPluginsEnabled() const
{
return PluginManager::instance().getPluginsEnabled();
}
VectorString VectorString
PluginModel::getInstalledPlugins() const PluginModel::getInstalledPlugins() const
{ {
@ -111,6 +93,8 @@ PluginModel::getPluginDetails(const QString& path)
result.description = details["description"]; result.description = details["description"];
result.path = path; result.path = path;
result.iconPath = details["iconPath"]; result.iconPath = details["iconPath"];
result.imagePath = details["imagePath"];
result.author = details["author"];
result.version = details["version"]; result.version = details["version"];
} }
if (!pluginsPath_.contains(result.id)) { if (!pluginsPath_.contains(result.id)) {
@ -127,32 +111,29 @@ PluginModel::getPluginDetails(const QString& path)
bool bool
PluginModel::installPlugin(const QString& jplPath, bool force) PluginModel::installPlugin(const QString& jplPath, bool force)
{ {
if (getPluginsEnabled()) { auto result = PluginManager::instance().installPlugin(jplPath, force);
auto result = PluginManager::instance().installPlugin(jplPath, force); Q_EMIT modelUpdated();
Q_EMIT modelUpdated(); if (result != 0) {
if (result != 0) { switch (result) {
switch (result) { case PluginInstallStatus::PLUGIN_ALREADY_INSTALLED:
case PluginInstallStatus::PLUGIN_ALREADY_INSTALLED: qWarning() << "Plugin already installed";
qWarning() << "Plugin already installed"; break;
break; case PluginInstallStatus::PLUGIN_OLD_VERSION:
case PluginInstallStatus::PLUGIN_OLD_VERSION: qWarning() << "Plugin already installed with a newer version";
qWarning() << "Plugin already installed with a newer version"; break;
break; case PluginInstallStatus::SIGNATURE_VERIFICATION_FAILED:
case PluginInstallStatus::SIGNATURE_VERIFICATION_FAILED: qWarning() << "Signature verification failed";
qWarning() << "Signature verification failed"; break;
break; case PluginInstallStatus::CERTIFICATE_VERIFICATION_FAILED:
case PluginInstallStatus::CERTIFICATE_VERIFICATION_FAILED: qWarning() << "Certificate verification failed";
qWarning() << "Certificate verification failed"; break;
break; case PluginInstallStatus::INVALID_PLUGIN:
case PluginInstallStatus::INVALID_PLUGIN: qWarning() << "Invalid plugin";
qWarning() << "Invalid plugin"; break;
break;
}
} }
pluginsPath_[getPluginDetails(jplPath).id] = jplPath;
return result == 0;
} }
return false; pluginsPath_[getPluginDetails(jplPath).id] = jplPath;
return result == 0;
} }
bool bool
@ -196,7 +177,7 @@ PluginModel::loadPlugin(const QString& path)
bool status = PluginManager::instance().loadPlugin(path); bool status = PluginManager::instance().loadPlugin(path);
Q_EMIT modelUpdated(); Q_EMIT modelUpdated();
if (getChatHandlers().size() > 0) if (getChatHandlers().size() > 0)
Q_EMIT chatHandlerStatusUpdated(getPluginsEnabled()); Q_EMIT chatHandlerStatusUpdated(true);
return status; return status;
} }

View file

@ -64,7 +64,6 @@ Item {
spyDownloadSuccessful.wait() spyDownloadSuccessful.wait()
compare(findChild(cachedImage,"image").source, Qt.url("file://"+localPath), "image source") compare(findChild(cachedImage,"image").source, Qt.url("file://"+localPath), "image source")
compare(findChild(cachedImage,"default_img").visible,false, "default_img visible")
} }
@ -78,8 +77,7 @@ Item {
spyDownloadFailed.wait() spyDownloadFailed.wait()
compare(findChild(cachedImage,"image").source,"", "image source") compare(findChild(cachedImage,"image").source,cachedImage.defaultImage, "image source")
compare(findChild(cachedImage,"image").visible,true, "default_img visible")
} }
} }
} }