blob: a9d59d0ed71272b6ddf141b2d8740da5d6c9f08f [file] [log] [blame]
Sébastien Blin1f915762020-08-03 13:27:42 -04001/*
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
19import QtQuick 2.15
20import QtQuick.Window 2.14
21import QtQuick.Controls 2.14
22import QtQuick.Controls.Universal 2.12
23import QtQuick.Layouts 1.3
24import Qt.labs.platform 1.1
25import QtGraphicalEffects 1.14
26import net.jami.Models 1.0
27import "../../commoncomponents"
28
29Rectangle {
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
ababia284cae2020-08-10 12:33:34 +020048 signal backArrowClicked
49
Sébastien Blin1f915762020-08-03 13:27:42 -040050 ColumnLayout {
51 anchors.fill: parent
52 spacing: 6
53
54 width: parent.width
55 height: parent.height
Sébastien Blin1f915762020-08-03 13:27:42 -040056
ababia284cae2020-08-10 12:33:34 +020057 RowLayout {
Sébastien Blin1f915762020-08-03 13:27:42 -040058
ababia284cae2020-08-10 12:33:34 +020059 Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
60 Layout.leftMargin: 16
61 Layout.fillWidth: true
62 Layout.maximumHeight: 64
63 Layout.minimumHeight: 64
64 Layout.preferredHeight: 64
Sébastien Blin1f915762020-08-03 13:27:42 -040065
ababia284cae2020-08-10 12:33:34 +020066 HoverableButton {
Sébastien Blin1f915762020-08-03 13:27:42 -040067
ababia284cae2020-08-10 12:33:34 +020068 Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
69 Layout.preferredWidth: 30
70 Layout.preferredHeight: 30
71
72 radius: 30
73 source: "qrc:/images/icons/ic_arrow_back_24px.svg"
74 backgroundColor: "white"
75 onExitColor: "white"
76
77 visible: mainViewWindow.sidePanelHidden
78
79 onClicked: {
80 backArrowClicked()
81 }
82 }
83
84 Label {
85 Layout.fillWidth: true
86 Layout.minimumHeight: 25
87 Layout.preferredHeight: 25
88 Layout.maximumHeight: 25
89
90 text: qsTr("Plugin")
91
92 font.pointSize: 15
93 font.kerning: true
94
95 horizontalAlignment: Text.AlignLeft
96 verticalAlignment: Text.AlignVCenter
97 }
Sébastien Blin1f915762020-08-03 13:27:42 -040098 }
99
100 ScrollView {
101 id: pluginScrollView
102 Layout.fillHeight: true
103 Layout.fillWidth: true
104
105 width: parent.width
106 height: parent.height
107 focus: true
108
109 clip: true
110
111 ColumnLayout {
112 id: pluginViewLayout
113 Layout.fillHeight: true
114 Layout.fillWidth: true
115
116 ToggleSwitch {
117 id: enabledplugin
118
119 Layout.topMargin: 15
120 Layout.leftMargin: 36
121
122 labelText: "Enable"
123 fontPointSize: 13
124
125 onSwitchToggled: {
126 slotSetPluginEnabled(checked)
ababia284cae2020-08-10 12:33:34 +0200127
Sébastien Blin1f915762020-08-03 13:27:42 -0400128 pluginListSettingsView.visible = checked
129 if (!checked) {
130 pluginListPreferencesView.visible = checked
131 }
132 if (pluginListSettingsView.visible) {
133 pluginListSettingsView.updatePluginListDisplayed()
134 }
135 }
136 }
137 ColumnLayout {
138 spacing: 6
139 Layout.fillHeight: true
140 width:380
141 height:100
ababia284cae2020-08-10 12:33:34 +0200142
Sébastien Blin1f915762020-08-03 13:27:42 -0400143 // instantiate plugin list setting page
144 PluginListSettingsView {
145 id: pluginListSettingsView
146
147 width:380
148 height:265
149 Layout.leftMargin: 35
150 Layout.topMargin: 15
151 Layout.alignment: Qt.AlignHCenter
152
153 pluginListPreferencesView: pluginListPreferencesView
154
155 onScrollView:{ }
156 }
157
158 PluginListPreferencesView {
159 id: pluginListPreferencesView
160
161 width:380
162 Layout.minimumHeight: 175
163 Layout.preferredHeight: height
164 Layout.maximumHeight: 1000
165 Layout.alignment: Qt.AlignHCenter
166 Layout.leftMargin: 55
167
168 onUpdatePluginList:{
169 pluginListSettingsView.updateAndShowPluginsSlot()
170 }
171 }
172 }
173 }
174 }
175 }
176}