Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019-2020 by Savoir-faire Linux |
| 3 | * Author: Yang Wang <yang.wang@savoirfairelinux.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | import QtQuick 2.15 |
| 20 | import QtQuick.Window 2.14 |
| 21 | import QtQuick.Controls 2.14 |
| 22 | import QtQuick.Controls.Universal 2.12 |
| 23 | import QtQuick.Layouts 1.3 |
| 24 | import Qt.labs.platform 1.1 |
| 25 | import QtGraphicalEffects 1.14 |
| 26 | import net.jami.Models 1.0 |
| 27 | import "../../commoncomponents" |
| 28 | |
| 29 | Rectangle { |
| 30 | id: pluginSettingsRect |
| 31 | |
| 32 | function populatePluginSettings(){ |
| 33 | // settings |
| 34 | enabledplugin.checked = ClientWrapper.pluginModel.getPluginsEnabled() |
| 35 | pluginListSettingsView.visible = enabledplugin.checked |
| 36 | if (pluginListSettingsView.visible) { |
| 37 | pluginListSettingsView.updatePluginListDisplayed() |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | function slotSetPluginEnabled(state){ |
| 42 | ClientWrapper.pluginModel.setPluginsEnabled(state) |
| 43 | } |
| 44 | |
| 45 | Layout.fillHeight: true |
| 46 | Layout.fillWidth: true |
| 47 | |
| 48 | ColumnLayout { |
| 49 | anchors.fill: parent |
| 50 | spacing: 6 |
| 51 | |
| 52 | width: parent.width |
| 53 | height: parent.height |
| 54 | |
| 55 | Label { |
| 56 | width: parent.width |
| 57 | height: parent.height |
| 58 | |
| 59 | Layout.leftMargin: 35 |
| 60 | Layout.topMargin: 15 |
| 61 | Layout.alignment: Qt.AlignTop |
| 62 | |
| 63 | text: qsTr("Plugin") |
| 64 | |
| 65 | font.pointSize: 15 |
| 66 | font.kerning: true |
| 67 | |
| 68 | horizontalAlignment: Text.AlignBottom |
| 69 | verticalAlignment: Text.AlignVCenter |
| 70 | } |
| 71 | |
| 72 | ScrollView { |
| 73 | id: pluginScrollView |
| 74 | Layout.fillHeight: true |
| 75 | Layout.fillWidth: true |
| 76 | |
| 77 | width: parent.width |
| 78 | height: parent.height |
| 79 | focus: true |
| 80 | |
| 81 | clip: true |
| 82 | |
| 83 | ColumnLayout { |
| 84 | id: pluginViewLayout |
| 85 | Layout.fillHeight: true |
| 86 | Layout.fillWidth: true |
| 87 | |
| 88 | ToggleSwitch { |
| 89 | id: enabledplugin |
| 90 | |
| 91 | Layout.topMargin: 15 |
| 92 | Layout.leftMargin: 36 |
| 93 | |
| 94 | labelText: "Enable" |
| 95 | fontPointSize: 13 |
| 96 | |
| 97 | onSwitchToggled: { |
| 98 | slotSetPluginEnabled(checked) |
| 99 | |
| 100 | pluginListSettingsView.visible = checked |
| 101 | if (!checked) { |
| 102 | pluginListPreferencesView.visible = checked |
| 103 | } |
| 104 | if (pluginListSettingsView.visible) { |
| 105 | pluginListSettingsView.updatePluginListDisplayed() |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | ColumnLayout { |
| 110 | spacing: 6 |
| 111 | Layout.fillHeight: true |
| 112 | width:380 |
| 113 | height:100 |
| 114 | |
| 115 | // instantiate plugin list setting page |
| 116 | PluginListSettingsView { |
| 117 | id: pluginListSettingsView |
| 118 | |
| 119 | width:380 |
| 120 | height:265 |
| 121 | Layout.leftMargin: 35 |
| 122 | Layout.topMargin: 15 |
| 123 | Layout.alignment: Qt.AlignHCenter |
| 124 | |
| 125 | pluginListPreferencesView: pluginListPreferencesView |
| 126 | |
| 127 | onScrollView:{ } |
| 128 | } |
| 129 | |
| 130 | PluginListPreferencesView { |
| 131 | id: pluginListPreferencesView |
| 132 | |
| 133 | width:380 |
| 134 | Layout.minimumHeight: 175 |
| 135 | Layout.preferredHeight: height |
| 136 | Layout.maximumHeight: 1000 |
| 137 | Layout.alignment: Qt.AlignHCenter |
| 138 | Layout.leftMargin: 55 |
| 139 | |
| 140 | onUpdatePluginList:{ |
| 141 | pluginListSettingsView.updateAndShowPluginsSlot() |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | } |