blob: 3cff938686d51f3d5bfc916de98378cdf56fb445 [file] [log] [blame]
agsantos78726ec2020-08-18 17:41:05 -04001/**
2 * Copyright (C) 2020 by Savoir-faire Linux
3 * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
Sébastien Blin1f915762020-08-03 13:27:42 -04004 *
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 {
agsantos78726ec2020-08-18 17:41:05 -040030 id: root
Sébastien Blin1f915762020-08-03 13:27:42 -040031
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
agsantos78726ec2020-08-18 17:41:05 -040046 Layout.maximumWidth: JamiTheme.maximumWidthSettingsView
47 anchors.centerIn: parent
Sébastien Blin1f915762020-08-03 13:27:42 -040048
ababia284cae2020-08-10 12:33:34 +020049 signal backArrowClicked
50
Sébastien Blin1f915762020-08-03 13:27:42 -040051 ColumnLayout {
agsantos78726ec2020-08-18 17:41:05 -040052 anchors.fill: root
Sébastien Blin1f915762020-08-03 13:27:42 -040053
ababia284cae2020-08-10 12:33:34 +020054 RowLayout {
agsantos78726ec2020-08-18 17:41:05 -040055 id:pageTitle
ababia284cae2020-08-10 12:33:34 +020056 Layout.preferredHeight: 64
agsantos78726ec2020-08-18 17:41:05 -040057 Layout.leftMargin: 16
58 Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Sébastien Blin1f915762020-08-03 13:27:42 -040059
ababia284cae2020-08-10 12:33:34 +020060 HoverableButton {
ababia284cae2020-08-10 12:33:34 +020061 Layout.preferredWidth: 30
ababia284cae2020-08-10 12:33:34 +020062
63 radius: 30
64 source: "qrc:/images/icons/ic_arrow_back_24px.svg"
65 backgroundColor: "white"
66 onExitColor: "white"
67
Yang Wangb97bde42020-08-07 11:24:18 -040068 toolTipText: qsTr("Toggle to display side panel")
69 hoverEnabled: true
ababia284cae2020-08-10 12:33:34 +020070 visible: mainViewWindow.sidePanelHidden
71
72 onClicked: {
73 backArrowClicked()
74 }
75 }
76
77 Label {
78 Layout.fillWidth: true
ababia284cae2020-08-10 12:33:34 +020079
80 text: qsTr("Plugin")
81
agsantos78726ec2020-08-18 17:41:05 -040082 font.pointSize: JamiTheme.titleFontSize
ababia284cae2020-08-10 12:33:34 +020083 font.kerning: true
84
85 horizontalAlignment: Text.AlignLeft
86 verticalAlignment: Text.AlignVCenter
87 }
Sébastien Blin1f915762020-08-03 13:27:42 -040088 }
89
90 ScrollView {
91 id: pluginScrollView
92 Layout.fillHeight: true
93 Layout.fillWidth: true
94
Sébastien Blin1f915762020-08-03 13:27:42 -040095 focus: true
96
97 clip: true
98
99 ColumnLayout {
100 id: pluginViewLayout
agsantos78726ec2020-08-18 17:41:05 -0400101 width: root.width
Sébastien Blin1f915762020-08-03 13:27:42 -0400102
103 ToggleSwitch {
104 id: enabledplugin
agsantos78726ec2020-08-18 17:41:05 -0400105 Layout.fillWidth: true
Sébastien Blin1f915762020-08-03 13:27:42 -0400106 Layout.topMargin: 15
agsantos78726ec2020-08-18 17:41:05 -0400107 Layout.leftMargin: 16
108 Layout.rightMargin: 16
Sébastien Blin1f915762020-08-03 13:27:42 -0400109
110 labelText: "Enable"
agsantos78726ec2020-08-18 17:41:05 -0400111 fontPointSize: JamiTheme.headerFontSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400112
113 onSwitchToggled: {
114 slotSetPluginEnabled(checked)
ababia284cae2020-08-10 12:33:34 +0200115
Sébastien Blin1f915762020-08-03 13:27:42 -0400116 pluginListSettingsView.visible = checked
Sébastien Blin1f915762020-08-03 13:27:42 -0400117 if (pluginListSettingsView.visible) {
118 pluginListSettingsView.updatePluginListDisplayed()
agsantos78726ec2020-08-18 17:41:05 -0400119 } else {
120 ClientWrapper.pluginModel.toggleCallMediaHandler("", true)
121 pluginListSettingsView.hidePreferences()
Sébastien Blin1f915762020-08-03 13:27:42 -0400122 }
123 }
124 }
ababia284cae2020-08-10 12:33:34 +0200125
agsantos78726ec2020-08-18 17:41:05 -0400126 PluginListSettingsView {
127 id: pluginListSettingsView
128 Layout.fillWidth: true
129 Layout.leftMargin: 16
130 Layout.rightMargin: 16
131 Layout.alignment: Qt.AlignHCenter
Sébastien Blin1f915762020-08-03 13:27:42 -0400132
agsantos78726ec2020-08-18 17:41:05 -0400133 pluginListPreferencesView: pluginListPreferencesView
Sébastien Blin1f915762020-08-03 13:27:42 -0400134
agsantos78726ec2020-08-18 17:41:05 -0400135 Layout.topMargin: 15
136 Layout.minimumHeight: 0
137 Layout.preferredHeight: childrenRect.height
138 }
Sébastien Blin1f915762020-08-03 13:27:42 -0400139
agsantos78726ec2020-08-18 17:41:05 -0400140 PluginListPreferencesView {
141 id: pluginListPreferencesView
142 Layout.fillWidth: true
143 Layout.leftMargin: 16
144 Layout.rightMargin: 16
145 Layout.minimumHeight: 0
146 Layout.preferredHeight: childrenRect.height
Sébastien Blin1f915762020-08-03 13:27:42 -0400147
agsantos78726ec2020-08-18 17:41:05 -0400148 onUpdatePluginList:{
149 pluginListSettingsView.updatePluginListDisplayed()
Sébastien Blin1f915762020-08-03 13:27:42 -0400150 }
151 }
152 }
153 }
154 }
155}