diff --git a/qml.qrc b/qml.qrc
index 950a8e3b..81ef94d6 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -44,8 +44,9 @@
src/settingsview/components/VideoSettings.qml
src/settingsview/components/GeneralSettingsPage.qml
src/settingsview/components/PluginSettingsPage.qml
- src/settingsview/components/PluginListSettingsView.qml
- src/settingsview/components/PluginListPreferencesView.qml
+ src/settingsview/components/PluginListView.qml
+ src/settingsview/components/PluginPreferencesView.qml
+ src/settingsview/components/PluginPreferencesListView.qml
src/settingsview/components/CurrentAccountSettings.qml
src/settingsview/components/UserIdentity.qml
src/settingsview/components/JamiUserIdentity.qml
diff --git a/src/constant/JamiStrings.qml b/src/constant/JamiStrings.qml
index 832e170f..f8a4856f 100644
--- a/src/constant/JamiStrings.qml
+++ b/src/constant/JamiStrings.qml
@@ -489,11 +489,9 @@ Item {
property string clearAvatar: qsTr("Clear avatar image")
property string takePhoto: qsTr("Take photo")
- // PluginSettingsPage
+ // Plugins
property string enable: qsTr("Enable")
-
- // PluginListPreferencesView
- property string pluginPreferences: qsTr("%1\nPreferences")
+ property string pluginPreferences: qsTr("Preferences")
property string reset: qsTr("Reset")
property string uninstall: qsTr("Uninstall")
property string resetPreferences: qsTr("Reset Preferences")
@@ -502,18 +500,17 @@ Item {
property string uninstallPlugin: qsTr("Uninstall plugin")
property string pluginResetConfirmation: qsTr("Are you sure you wish to reset %1 preferences?")
property string pluginUninstallConfirmation: qsTr("Are you sure you wish to uninstall %1?")
-
- // PluginItemDelegate
property string showHidePrefs: qsTr("Display or hide preferences")
-
- // PluginListSettingsView
property string addNewPlugin: qsTr("Add new plugin")
property string goBackToPluginsList: qsTr("Go back to plugins list")
-
- // PreferenceItemDelegate
property string selectFile: qsTr("Select a file")
property string select: qsTr("Select")
property string chooseImageFile: qsTr("Choose image file")
+ property string tipGeneralPluginSettingsDisplay: qsTr("Display or hide General plugin settings")
+ property string tipAccountPluginSettingsDisplay: qsTr("Display or hide Account plugin settings")
+ property string installedPlugins: qsTr("Installed plugins")
+ property string pluginFiles: qsTr("Plugin Files")
+ property string loadUnload: qsTr("Load/Unload")
// ProfilePage
property string profileSharedWithContacts: qsTr("Profile is only shared with contacts")
diff --git a/src/mainview/components/PluginHandlerItemDelegate.qml b/src/mainview/components/PluginHandlerItemDelegate.qml
index 0785d1c8..f59fd662 100644
--- a/src/mainview/components/PluginHandlerItemDelegate.qml
+++ b/src/mainview/components/PluginHandlerItemDelegate.qml
@@ -59,7 +59,6 @@ ItemDelegate {
}
Label {
- id: labelDeviceId
Layout.leftMargin: 8
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
diff --git a/src/mainview/components/PluginHandlerPicker.qml b/src/mainview/components/PluginHandlerPicker.qml
index 39f5d944..2c3fb4ce 100644
--- a/src/mainview/components/PluginHandlerPicker.qml
+++ b/src/mainview/components/PluginHandlerPicker.qml
@@ -226,6 +226,7 @@ Popup {
model: PreferenceItemListModel {
id: handlerPickerPrefsModel
lrcInstance: LRCInstance
+ accountId_: LRCInstance.currentAccountId
mediaHandlerName_: handlerName
pluginId_: pluginId
}
@@ -250,13 +251,14 @@ Popup {
lrcInstance: LRCInstance
preferenceKey : PreferenceKey
+ accountId_: LRCInstance.currentAccountId
pluginId: PluginId
}
onClicked: pluginhandlerPreferencePickerListView.currentIndex = index
onBtnPreferenceClicked: {
- PluginModel.setPluginPreference(pluginId, "", preferenceKey, preferenceNewValue)
+ PluginModel.setPluginPreference(pluginId, LRCInstance.currentAccountId, preferenceKey, preferenceNewValue)
handlerPickerPrefsModel.reset()
}
}
diff --git a/src/pluginadapter.cpp b/src/pluginadapter.cpp
index 4d34dadc..2b528c89 100644
--- a/src/pluginadapter.cpp
+++ b/src/pluginadapter.cpp
@@ -48,10 +48,12 @@ PluginAdapter::getChatHandlerSelectableModel(const QString& accountId, const QSt
}
QVariant
-PluginAdapter::getPluginPreferencesCategories(const QString& pluginId, bool removeLast)
+PluginAdapter::getPluginPreferencesCategories(const QString& pluginId,
+ const QString& accountId,
+ bool removeLast)
{
QStringList categories;
- auto preferences = lrcInstance_->pluginModel().getPluginPreferences(pluginId);
+ auto preferences = lrcInstance_->pluginModel().getPluginPreferences(pluginId, accountId);
for (auto& preference : preferences) {
if (!preference["category"].isEmpty())
categories.push_back(preference["category"]);
@@ -65,7 +67,7 @@ PluginAdapter::getPluginPreferencesCategories(const QString& pluginId, bool remo
void
PluginAdapter::updateHandlersListCount()
{
- if (lrcInstance_->pluginModel().getPluginsEnabled()) {
+ if (isEnabled_) {
set_callMediaHandlersListCount(lrcInstance_->pluginModel().getCallMediaHandlers().size());
set_chatHandlersListCount(lrcInstance_->pluginModel().getChatHandlers().size());
} else {
diff --git a/src/pluginadapter.h b/src/pluginadapter.h
index a1a5c7cb..89ac680e 100644
--- a/src/pluginadapter.h
+++ b/src/pluginadapter.h
@@ -46,6 +46,7 @@ protected:
Q_INVOKABLE QVariant getChatHandlerSelectableModel(const QString& accountId,
const QString& peerId);
Q_INVOKABLE QVariant getPluginPreferencesCategories(const QString& pluginId,
+ const QString& accountId,
bool removeLast = false);
private:
diff --git a/src/pluginlistmodel.cpp b/src/pluginlistmodel.cpp
index d8724c81..48c9a918 100644
--- a/src/pluginlistmodel.cpp
+++ b/src/pluginlistmodel.cpp
@@ -87,6 +87,7 @@ PluginListModel::reset()
beginResetModel();
installedPlugins_.clear();
installedPlugins_ = lrcInstance_->pluginModel().getInstalledPlugins();
+ filterPlugins(installedPlugins_);
endResetModel();
}
@@ -108,6 +109,7 @@ void
PluginListModel::addPlugin()
{
auto newList = lrcInstance_->pluginModel().getInstalledPlugins();
+ filterPlugins(newList);
if (newList.size() <= installedPlugins_.size())
return;
@@ -119,6 +121,22 @@ PluginListModel::addPlugin()
}
beginInsertRows(QModelIndex(), index, index);
- installedPlugins_ = lrcInstance_->pluginModel().getInstalledPlugins();
+ installedPlugins_ = newList;
endInsertRows();
-}
\ No newline at end of file
+}
+
+void
+PluginListModel::filterPlugins(VectorString& list)
+{
+ if (!lrcInstance_ || !filterAccount_)
+ return;
+
+ for (auto it = list.begin(); it != list.end();) {
+ auto prefs = lrcInstance_->pluginModel()
+ .getPluginPreferences(*it, lrcInstance_->get_currentAccountId());
+ if (prefs.empty()) {
+ it = list.erase(it);
+ } else
+ it++;
+ }
+}
diff --git a/src/pluginlistmodel.h b/src/pluginlistmodel.h
index dd9412b0..1d571af0 100644
--- a/src/pluginlistmodel.h
+++ b/src/pluginlistmodel.h
@@ -25,7 +25,7 @@ class LRCInstance;
class PluginListModel : public AbstractListModelBase
{
Q_OBJECT
-
+ QML_PROPERTY(bool, filterAccount)
public:
enum Role { PluginName = Qt::UserRole + 1, PluginId, PluginIcon, IsLoaded };
Q_ENUM(Role)
@@ -53,5 +53,6 @@ public:
Q_INVOKABLE void addPlugin();
private:
+ void filterPlugins(VectorString& list);
VectorString installedPlugins_ {};
};
diff --git a/src/pluginlistpreferencemodel.cpp b/src/pluginlistpreferencemodel.cpp
index 34c3375e..6e5de44a 100644
--- a/src/pluginlistpreferencemodel.cpp
+++ b/src/pluginlistpreferencemodel.cpp
@@ -35,7 +35,9 @@ PluginListPreferenceModel::populateLists()
preferenceList_.clear();
if (pluginId_.isEmpty())
return;
- const auto preferences = lrcInstance_->pluginModel().getPluginPreferences(pluginId_);
+ auto preferences = lrcInstance_->pluginModel().getPluginPreferences(pluginId_, "");
+ if (!accountId__.isEmpty())
+ preferences.append(lrcInstance_->pluginModel().getPluginPreferences(pluginId_, accountId__));
for (const auto& preference : preferences) {
if (preference["key"] == preferenceKey_) {
if (preference.find("entries") != preference.end()
@@ -92,37 +94,6 @@ PluginListPreferenceModel::roleNames() const
return roles;
}
-QModelIndex
-PluginListPreferenceModel::index(int row, int column, const QModelIndex& parent) const
-{
- Q_UNUSED(parent);
- if (column != 0) {
- return QModelIndex();
- }
-
- if (row >= 0 && row < rowCount()) {
- return createIndex(row, column);
- }
- return QModelIndex();
-}
-
-QModelIndex
-PluginListPreferenceModel::parent(const QModelIndex& child) const
-{
- Q_UNUSED(child);
- return QModelIndex();
-}
-
-Qt::ItemFlags
-PluginListPreferenceModel::flags(const QModelIndex& index) const
-{
- auto flags = QAbstractItemModel::flags(index) | Qt::ItemNeverHasChildren | Qt::ItemIsSelectable;
- if (!index.isValid()) {
- return QAbstractItemModel::flags(index);
- }
- return flags;
-}
-
void
PluginListPreferenceModel::reset()
{
diff --git a/src/pluginlistpreferencemodel.h b/src/pluginlistpreferencemodel.h
index a364b8df..e72a42f8 100644
--- a/src/pluginlistpreferencemodel.h
+++ b/src/pluginlistpreferencemodel.h
@@ -25,11 +25,11 @@
class PluginListPreferenceModel : public AbstractListModelBase
{
Q_OBJECT
- Q_PROPERTY(QString pluginId READ pluginId WRITE setPluginId)
- Q_PROPERTY(QString preferenceKey READ preferenceKey WRITE setPreferenceKey)
Q_PROPERTY(QString preferenceNewValue READ preferenceNewValue WRITE setPreferenceNewValue)
- Q_PROPERTY(int idx READ idx WRITE setIdx)
- Q_PROPERTY(int optSize READ optSize)
+ Q_PROPERTY(QString pluginId READ pluginId WRITE setPluginId)
+ QML_PROPERTY(QString, preferenceKey)
+ QML_PROPERTY(int, idx)
+ QML_PROPERTY(QString, accountId_)
public:
enum Role { PreferenceValue = Qt::UserRole + 1, PreferenceEntryValue };
Q_ENUM(Role)
@@ -47,9 +47,6 @@ public:
* Override role name as access point in qml.
*/
QHash roleNames() const override;
- QModelIndex index(int row, int column = 0, const QModelIndex& parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex& child) const;
- Qt::ItemFlags flags(const QModelIndex& index) const;
/*
* This function is to reset the model when there's new account added.
@@ -66,29 +63,17 @@ public:
{
preferenceNewValue_ = preferenceNewValue;
}
- void setPreferenceKey(const QString preferenceKey)
- {
- preferenceKey_ = preferenceKey;
- }
+
void setPluginId(const QString pluginId)
{
pluginId_ = pluginId;
populateLists();
}
- void setIdx(const int index)
- {
- idx_ = index;
- }
-
- int idx()
- {
- return idx_;
- }
QString preferenceCurrentValue()
{
return lrcInstance_->pluginModel().getPluginPreferencesValues(pluginId_,
- accountId_)[preferenceKey_];
+ accountId__)[preferenceKey_];
}
QString preferenceNewValue()
@@ -96,25 +81,15 @@ public:
preferenceNewValue_ = preferenceValuesList_[idx_];
return preferenceNewValue_;
}
- QString preferenceKey()
- {
- return preferenceKey_;
- }
+
QString pluginId()
{
return pluginId_;
}
- int optSize()
- {
- return preferenceValuesList_.size();
- }
private:
QString pluginId_ = "";
- QString preferenceKey_ = "";
QString preferenceNewValue_ = "";
QStringList preferenceValuesList_;
QStringList preferenceList_;
- int idx_ = 0;
- QString accountId_ = "";
};
diff --git a/src/preferenceitemlistmodel.cpp b/src/preferenceitemlistmodel.cpp
index 2fa13a3a..1db871a9 100644
--- a/src/preferenceitemlistmodel.cpp
+++ b/src/preferenceitemlistmodel.cpp
@@ -88,7 +88,8 @@ PreferenceItemListModel::data(const QModelIndex& index, int role) const
}
}
const auto dependsOn = details["dependsOn"].split(",");
- const auto preferences = lrcInstance_->pluginModel().getPluginPreferences(pluginId__);
+ const auto preferences = lrcInstance_->pluginModel().getPluginPreferences(pluginId__,
+ accountId__);
const auto prefValues = lrcInstance_->pluginModel().getPluginPreferencesValues(pluginId__,
accountId__);
bool enabled = true;
@@ -182,7 +183,7 @@ PreferenceItemListModel::preferencesCount()
if (!preferenceList_.isEmpty())
return preferenceList_.size();
if (mediaHandlerName__.isEmpty()) {
- auto preferences = lrcInstance_->pluginModel().getPluginPreferences(pluginId__);
+ auto preferences = lrcInstance_->pluginModel().getPluginPreferences(pluginId__, accountId__);
if (category__ != "all")
for (auto& preference : preferences) {
if (preference["category"] == category__)
@@ -192,7 +193,9 @@ PreferenceItemListModel::preferencesCount()
preferenceList_ = preferences;
return preferenceList_.size();
} else {
- auto preferences = lrcInstance_->pluginModel().getPluginPreferences(pluginId__);
+ auto preferences = lrcInstance_->pluginModel().getPluginPreferences(pluginId__, "");
+ preferences.append(
+ lrcInstance_->pluginModel().getPluginPreferences(pluginId__, accountId__));
for (auto& preference : preferences) {
QStringList scopeList = preference["scope"].split(",");
if (scopeList.contains(mediaHandlerName__))
diff --git a/src/preferenceitemlistmodel.h b/src/preferenceitemlistmodel.h
index 6be16f8b..c6d6f643 100644
--- a/src/preferenceitemlistmodel.h
+++ b/src/preferenceitemlistmodel.h
@@ -30,7 +30,6 @@ class PreferenceItemListModel : public AbstractListModelBase
QML_PROPERTY(QString, category_)
QML_PROPERTY(QString, mediaHandlerName_)
QML_PROPERTY(QString, accountId_)
- QML_RO_PROPERTY(int, preferencesCount_)
public:
enum Role {
PreferenceKey = Qt::UserRole + 1,
diff --git a/src/settingsview/components/PluginItemDelegate.qml b/src/settingsview/components/PluginItemDelegate.qml
index 54cb8b0f..a7c51aff 100644
--- a/src/settingsview/components/PluginItemDelegate.qml
+++ b/src/settingsview/components/PluginItemDelegate.qml
@@ -29,14 +29,29 @@ import "../../commoncomponents"
ItemDelegate {
id: root
- property string pluginName : ""
+ property string pluginName: ""
property string pluginId: ""
property string pluginIcon: ""
property bool isLoaded: false
- height: pluginListPreferencesView.visible ? implicitHeight + pluginListPreferencesView.effectiveHeight : implicitHeight
+ property string activeId: ""
+ height: pluginPreferencesView.visible ? implicitHeight + pluginPreferencesView.childrenRect.height : implicitHeight
+
+ signal settingsClicked
+
+ onActiveIdChanged: {
+ pluginPreferencesView.visible = activeId != pluginId ? false : !pluginPreferencesView.visible
+ }
+
+ SimpleMessageDialog {
+ id: msgDialog
+
+ buttonTitles: [JamiStrings.optionOk, JamiStrings.optionCancel]
+ buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue,
+ SimpleMessageDialog.ButtonStyle.TintedBlack]
+ }
ColumnLayout {
- anchors.fill: parent
+ width: parent.width
RowLayout {
Layout.fillWidth: true
@@ -64,7 +79,6 @@ ItemDelegate {
}
Label {
- id: labelDeviceId
Layout.fillHeight: true
Layout.fillWidth: true
Layout.topMargin: 8
@@ -85,8 +99,7 @@ ItemDelegate {
Layout.rightMargin: 8
width: 20
- ToolTip.visible: hovered
- ToolTip.text: qsTr("Load/Unload")
+ tooltipText: JamiStrings.loadUnload
checked: isLoaded
onSwitchToggled: {
@@ -110,17 +123,17 @@ ItemDelegate {
imageColor: JamiTheme.textColor
toolTipText: JamiStrings.showHidePrefs
- onClicked: pluginListPreferencesView.visible = !pluginListPreferencesView.visible
+ onClicked: settingsClicked()
}
}
- PluginListPreferencesView {
- id: pluginListPreferencesView
+ PluginPreferencesView {
+ id: pluginPreferencesView
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
Layout.rightMargin: JamiTheme.preferredMarginSize
- Layout.preferredHeight: effectiveHeight
+ Layout.preferredHeight: pluginPreferencesView.childrenRect.height
}
}
}
diff --git a/src/settingsview/components/PluginListSettingsView.qml b/src/settingsview/components/PluginListView.qml
similarity index 86%
rename from src/settingsview/components/PluginListSettingsView.qml
rename to src/settingsview/components/PluginListView.qml
index 4eab6ed6..423d2f2d 100644
--- a/src/settingsview/components/PluginListSettingsView.qml
+++ b/src/settingsview/components/PluginListView.qml
@@ -30,6 +30,8 @@ import "../../commoncomponents"
Rectangle {
id: root
+ property string activePlugin: ""
+
visible: false
color: JamiTheme.secondaryBackgroundColor
@@ -40,8 +42,7 @@ Rectangle {
title: JamiStrings.selectPluginInstall
folder: StandardPaths.writableLocation(StandardPaths.DownloadLocation)
- nameFilters: [qsTr("Plugin Files") + " (*.jpl)", qsTr(
- "All files") + " (*)"]
+ nameFilters: [JamiStrings.pluginFiles + " (*.jpl)", JamiStrings.allFiles + " (*)"]
onAccepted: {
var url = UtilsAdapter.getAbsPath(file.toString())
@@ -51,15 +52,15 @@ Rectangle {
}
ColumnLayout {
- id: pluginListViewLayout
anchors.left: root.left
anchors.right: root.right
+ anchors.bottomMargin: 20
Label {
Layout.fillWidth: true
Layout.preferredHeight: 25
- text: qsTr("Installed plugins")
+ text: JamiStrings.installedPlugins
font.pointSize: JamiTheme.headerFontSize
font.kerning: true
color: JamiTheme.textColor
@@ -91,12 +92,13 @@ Rectangle {
}
ListView {
- id: pluginListView
+ id: pluginList
Layout.fillWidth: true
Layout.minimumHeight: 0
- Layout.preferredHeight: childrenRect.height
Layout.bottomMargin: 10
+ Layout.preferredHeight: childrenRect.height
+ clip: true
model: PluginListModel {
id: installedPluginsModel
@@ -107,23 +109,26 @@ Rectangle {
}
}
- maximumFlickVelocity: 1024
-
delegate: PluginItemDelegate {
id: pluginItemDelegate
- width: pluginListView.width
- implicitHeight: 40
+ width: pluginList.width
+ implicitHeight: 50
pluginName: PluginName
pluginId: PluginId
pluginIcon: PluginIcon
isLoaded: IsLoaded
+ activeId: root.activePlugin
background: Rectangle {
anchors.fill: parent
color: "transparent"
}
+
+ onSettingsClicked: {
+ root.activePlugin = root.activePlugin === pluginId ? "" : pluginId
+ }
}
}
}
diff --git a/src/settingsview/components/PluginListPreferencesView.qml b/src/settingsview/components/PluginPreferencesListView.qml
similarity index 68%
rename from src/settingsview/components/PluginListPreferencesView.qml
rename to src/settingsview/components/PluginPreferencesListView.qml
index 16409c28..d9ce915c 100644
--- a/src/settingsview/components/PluginListPreferencesView.qml
+++ b/src/settingsview/components/PluginPreferencesListView.qml
@@ -29,7 +29,9 @@ import "../../commoncomponents"
Rectangle {
id: root
- property int effectiveHeight: visible ? implicitHeight : 0
+ property string accountId: ""
+ property int count: pluginPreferenceView.count + pluginPreferenceViewCategory.count
+
implicitHeight: childrenRect.height
onVisibleChanged: {
if (visible) {
@@ -38,8 +40,21 @@ Rectangle {
}
}
+ color: "transparent"
+
+ Connections {
+ target: LRCInstance
+
+ function onCurrentAccountIdChanged() {
+ if (accountId) {
+ preferencesPerCategoryModel.reset()
+ generalPreferencesModel.reset()
+ }
+ }
+ }
+
property string category: categories.length > 0 ? categories[0] : category ? category : ""
- property var categories: PluginAdapter.getPluginPreferencesCategories(pluginId)
+ property var categories: PluginAdapter.getPluginPreferencesCategories(pluginId, accountId)
property string generalCategory: categories.length <= 1 ? "all" : ""
visible: false
@@ -48,54 +63,15 @@ Rectangle {
{
if (isLoaded) {
PluginModel.unloadPlugin(pluginId)
- PluginModel.setPluginPreference(pluginId, "", preferenceKey, preferenceNewValue)
+ PluginModel.setPluginPreference(pluginId, accountId, preferenceKey, preferenceNewValue)
PluginModel.loadPlugin(pluginId)
} else
- PluginModel.setPluginPreference(pluginId, "", preferenceKey, preferenceNewValue)
- }
-
- SimpleMessageDialog {
- id: msgDialog
-
- buttonTitles: [JamiStrings.optionOk, JamiStrings.optionCancel]
- buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue,
- SimpleMessageDialog.ButtonStyle.TintedBlack]
+ PluginModel.setPluginPreference(pluginId, accountId, preferenceKey, preferenceNewValue)
}
ColumnLayout {
anchors.left: root.left
anchors.right: root.right
- anchors.bottomMargin: 10
-
- Label{
- Layout.topMargin: 34
- Layout.alignment: Qt.AlignHCenter
- height: 64
- background: Rectangle {
- Image {
- anchors.centerIn: parent
- source: pluginIcon === "" ? "" : "file:" + pluginIcon
- sourceSize: Qt.size(256, 256)
- height: 64
- width: 64
- mipmap: true
- }
- }
- }
-
- Label {
- Layout.alignment: Qt.AlignHCenter
- Layout.topMargin: 24
- height: JamiTheme.preferredFieldHeight
-
- text: JamiStrings.pluginPreferences.arg(pluginName)
- font.pointSize: JamiTheme.headerFontSize
- font.kerning: true
- color: JamiTheme.textColor
-
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
Rectangle {
id: prefsByCategory
@@ -122,7 +98,7 @@ Rectangle {
Repeater {
id: gridModel
- model: categories.length % 2 === 1 ? PluginAdapter.getPluginPreferencesCategories(pluginId, true) : root.categories
+ model: categories.length % 2 === 1 ? PluginAdapter.getPluginPreferencesCategories(pluginId, accountId, true) : root.categories
Button {
id: repDelegate
Layout.fillWidth: true
@@ -192,6 +168,7 @@ Rectangle {
id: preferencesPerCategoryModel
lrcInstance: LRCInstance
category_: category
+ accountId_: accountId
pluginId_: pluginId
onCategory_Changed: {
@@ -221,6 +198,7 @@ Rectangle {
lrcInstance: LRCInstance
preferenceKey : PreferenceKey
+ accountId_: accountId
pluginId: PluginId
}
@@ -249,6 +227,7 @@ Rectangle {
id: generalPreferencesModel
lrcInstance: LRCInstance
category_: generalCategory
+ accountId_: accountId
pluginId_: pluginId
onCategory_Changed: {
@@ -278,6 +257,7 @@ Rectangle {
lrcInstance: LRCInstance
preferenceKey : PreferenceKey
+ accountId_: accountId
pluginId: PluginId
}
@@ -288,77 +268,38 @@ Rectangle {
}
}
- RowLayout {
- Layout.topMargin: 10
- Layout.bottomMargin: 10
- Layout.preferredHeight: 30
- Layout.fillWidth: true
+ MaterialButton {
+ id: resetButton
- MaterialButton {
- id: resetButton
+ Layout.alignment: Qt.AlignCenter
- Layout.fillWidth: true
- preferredHeight: JamiTheme.preferredFieldHeight
+ preferredWidth: JamiTheme.preferredFieldWidth
+ preferredHeight: JamiTheme.preferredFieldHeight
- color: JamiTheme.buttonTintedBlack
- hoveredColor: JamiTheme.buttonTintedBlackHovered
- pressedColor: JamiTheme.buttonTintedBlackPressed
- outlined: true
+ color: JamiTheme.buttonTintedBlack
+ hoveredColor: JamiTheme.buttonTintedBlackHovered
+ pressedColor: JamiTheme.buttonTintedBlackPressed
+ outlined: true
- iconSource: JamiResources.settings_backup_restore_24dp_svg
+ iconSource: JamiResources.settings_backup_restore_24dp_svg
- text: JamiStrings.reset
+ text: JamiStrings.reset
- onClicked: {
- msgDialog.buttonCallBacks = [function () {
- if (isLoaded) {
- PluginModel.unloadPlugin(pluginId)
- PluginModel.resetPluginPreferencesValues(pluginId, "")
- PluginModel.loadPlugin(pluginId)
- } else {
- PluginModel.resetPluginPreferencesValues(pluginId, "")
- }
- preferencesPerCategoryModel.reset()
- generalPreferencesModel.reset()
- }]
- msgDialog.openWithParameters(JamiStrings.resetPreferences,
- JamiStrings.pluginResetConfirmation.arg(pluginName))
- }
+ onClicked: {
+ msgDialog.buttonCallBacks = [function () {
+ if (isLoaded) {
+ PluginModel.unloadPlugin(pluginId)
+ PluginModel.resetPluginPreferencesValues(pluginId, accountId)
+ PluginModel.loadPlugin(pluginId)
+ } else {
+ PluginModel.resetPluginPreferencesValues(pluginId, accountId)
+ }
+ preferencesPerCategoryModel.reset()
+ generalPreferencesModel.reset()
+ }]
+ msgDialog.openWithParameters(JamiStrings.resetPreferences,
+ JamiStrings.pluginResetConfirmation.arg(pluginName))
}
-
- MaterialButton {
- id: uninstallButton
-
- Layout.fillWidth: true
- preferredHeight: JamiTheme.preferredFieldHeight
-
- color: JamiTheme.buttonTintedBlack
- hoveredColor: JamiTheme.buttonTintedBlackHovered
- pressedColor: JamiTheme.buttonTintedBlackPressed
- outlined: true
-
- iconSource: JamiResources.delete_24dp_svg
-
- text: JamiStrings.uninstall
-
- onClicked: {
- msgDialog.buttonCallBacks = [function () {
- PluginModel.uninstallPlugin(pluginId)
- installedPluginsModel.removePlugin(index)
- }]
- msgDialog.openWithParameters(JamiStrings.uninstallPlugin,
- JamiStrings.pluginUninstallConfirmation.arg(pluginName))
- }
- }
- }
-
- Rectangle {
- Layout.bottomMargin: 10
- height: 2
- Layout.fillWidth: true
- color: "transparent"
- border.width: 1
- border.color: JamiTheme.separationLine
}
}
}
diff --git a/src/settingsview/components/PluginPreferencesView.qml b/src/settingsview/components/PluginPreferencesView.qml
new file mode 100644
index 00000000..d8b57074
--- /dev/null
+++ b/src/settingsview/components/PluginPreferencesView.qml
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2022 by Savoir-faire Linux
+ * Author: Aline Gondim Santos
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Layouts 1.15
+
+import net.jami.Adapters 1.1
+import net.jami.Models 1.1
+import net.jami.Constants 1.1
+
+import "../../commoncomponents"
+
+Rectangle {
+ id: root
+
+ color: "transparent"
+
+ visible: false
+
+ ColumnLayout {
+ anchors.left: root.left
+ anchors.right: root.right
+ anchors.bottomMargin: 10
+
+ Label{
+ Layout.topMargin: 34
+ Layout.alignment: Qt.AlignHCenter
+ height: 64
+ background: Rectangle {
+ Image {
+ anchors.centerIn: parent
+ source: pluginIcon === "" ? JamiResources.plugins_24dp_svg : "file:" + pluginIcon
+ sourceSize: Qt.size(256, 256)
+ height: 64
+ width: 64
+ mipmap: true
+ }
+ }
+ }
+
+ Label {
+ Layout.alignment: Qt.AlignHCenter
+ Layout.topMargin: 24
+ height: JamiTheme.preferredFieldHeight
+
+ text: "%1\n%2".arg(pluginName).arg(JamiStrings.pluginPreferences)
+ font.pointSize: JamiTheme.headerFontSize
+ font.kerning: true
+ color: JamiTheme.textColor
+
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ RowLayout {
+ Layout.fillWidth: true
+
+ Text {
+ Layout.fillWidth: true
+ Layout.preferredHeight: JamiTheme.preferredFieldHeight
+
+ font.pointSize: JamiTheme.headerFontSize
+ font.kerning: true
+
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ color: JamiTheme.textColor
+
+ text: qsTr("General")
+ elide: Text.ElideRight
+ }
+
+ PushButton {
+ Layout.preferredWidth: JamiTheme.preferredFieldHeight
+ Layout.preferredHeight: JamiTheme.preferredFieldHeight
+ Layout.alignment: Qt.AlignHCenter
+
+ imageColor: JamiTheme.textColor
+ toolTipText: JamiStrings.tipGeneralPluginSettingsDisplay
+
+ preferredSize: 32
+ source: pluginGeneralSettingsView.visible ?
+ JamiResources.expand_less_24dp_svg :
+ JamiResources.expand_more_24dp_svg
+
+ onClicked: {
+ pluginGeneralSettingsView.visible = !pluginGeneralSettingsView.visible
+ }
+ }
+ }
+
+ PluginPreferencesListView {
+ id: pluginGeneralSettingsView
+ visible: false
+ Layout.fillWidth: true
+ }
+
+ RowLayout {
+ Layout.fillWidth: true
+ visible: pluginAccountSettingsView.count > 0
+
+ Text {
+ Layout.fillWidth: true
+ Layout.preferredHeight: JamiTheme.preferredFieldHeight
+
+ font.pointSize: JamiTheme.headerFontSize
+ font.kerning: true
+
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ color: JamiTheme.textColor
+
+ text: qsTr("Account")
+ elide: Text.ElideRight
+ }
+
+ PushButton {
+ Layout.preferredWidth: JamiTheme.preferredFieldHeight
+ Layout.preferredHeight: JamiTheme.preferredFieldHeight
+ Layout.alignment: Qt.AlignHCenter
+
+ imageColor: JamiTheme.textColor
+ toolTipText: JamiStrings.tipAccountPluginSettingsDisplay
+
+ preferredSize: 32
+ source: pluginAccountSettingsView.visible ?
+ JamiResources.expand_less_24dp_svg :
+ JamiResources.expand_more_24dp_svg
+
+ onClicked: {
+ pluginAccountSettingsView.visible = !pluginAccountSettingsView.visible
+ }
+ }
+ }
+
+ PluginPreferencesListView {
+ id: pluginAccountSettingsView
+ visible: false
+ Layout.fillWidth: true
+ accountId: LRCInstance.currentAccountId
+ }
+
+ MaterialButton {
+ id: uninstallButton
+
+ Layout.alignment: Qt.AlignCenter
+
+ preferredWidth: JamiTheme.preferredFieldWidth
+ preferredHeight: JamiTheme.preferredFieldHeight
+
+ color: JamiTheme.buttonTintedBlack
+ hoveredColor: JamiTheme.buttonTintedBlackHovered
+ pressedColor: JamiTheme.buttonTintedBlackPressed
+ outlined: true
+ toolTipText: JamiStrings.pluginUninstallConfirmation.arg(pluginName)
+ iconSource: JamiResources.delete_24dp_svg
+
+ text: JamiStrings.uninstall
+
+ onClicked: {
+ msgDialog.buttonCallBacks = [function () {
+ pluginPreferencesView.visible = false
+ PluginModel.uninstallPlugin(pluginId)
+ installedPluginsModel.removePlugin(index)
+ }]
+ msgDialog.openWithParameters(JamiStrings.uninstallPlugin,
+ JamiStrings.pluginUninstallConfirmation.arg(pluginName))
+ }
+ }
+
+ Rectangle {
+ Layout.bottomMargin: 10
+ height: 2
+ Layout.fillWidth: true
+ color: "transparent"
+ border.width: 1
+ border.color: JamiTheme.separationLine
+ }
+ }
+}
diff --git a/src/settingsview/components/PluginSettingsPage.qml b/src/settingsview/components/PluginSettingsPage.qml
index 3c0e401b..a10da491 100644
--- a/src/settingsview/components/PluginSettingsPage.qml
+++ b/src/settingsview/components/PluginSettingsPage.qml
@@ -55,11 +55,14 @@ Rectangle {
labelText: JamiStrings.enable
fontPointSize: JamiTheme.headerFontSize
- onSwitchToggled: PluginAdapter.isEnabled = checked
+ onSwitchToggled: {
+ PluginModel.setPluginsEnabled(checked)
+ PluginAdapter.isEnabled = checked
+ }
}
- PluginListSettingsView {
- id: pluginListSettingsView
+ PluginListView {
+ id: pluginListView
visible: PluginAdapter.isEnabled