agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 1 | /** |
| 2 | * Copyright (C) 2020 by Savoir-faire Linux |
| 3 | * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com> |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 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 { |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 30 | id: root |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 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 |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 46 | Layout.maximumWidth: JamiTheme.maximumWidthSettingsView |
| 47 | anchors.centerIn: parent |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 48 | |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 49 | signal backArrowClicked |
| 50 | |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 51 | ColumnLayout { |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 52 | anchors.fill: root |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 53 | |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 54 | RowLayout { |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 55 | id:pageTitle |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 56 | Layout.preferredHeight: 64 |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 57 | Layout.leftMargin: 16 |
| 58 | Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 59 | |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 60 | HoverableButton { |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 61 | Layout.preferredWidth: 30 |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 62 | |
| 63 | radius: 30 |
| 64 | source: "qrc:/images/icons/ic_arrow_back_24px.svg" |
| 65 | backgroundColor: "white" |
| 66 | onExitColor: "white" |
| 67 | |
Yang Wang | b97bde4 | 2020-08-07 11:24:18 -0400 | [diff] [blame] | 68 | toolTipText: qsTr("Toggle to display side panel") |
| 69 | hoverEnabled: true |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 70 | visible: mainViewWindow.sidePanelHidden |
| 71 | |
| 72 | onClicked: { |
| 73 | backArrowClicked() |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | Label { |
| 78 | Layout.fillWidth: true |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 79 | |
| 80 | text: qsTr("Plugin") |
| 81 | |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 82 | font.pointSize: JamiTheme.titleFontSize |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 83 | font.kerning: true |
| 84 | |
| 85 | horizontalAlignment: Text.AlignLeft |
| 86 | verticalAlignment: Text.AlignVCenter |
| 87 | } |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | ScrollView { |
| 91 | id: pluginScrollView |
| 92 | Layout.fillHeight: true |
| 93 | Layout.fillWidth: true |
| 94 | |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 95 | focus: true |
| 96 | |
| 97 | clip: true |
| 98 | |
| 99 | ColumnLayout { |
| 100 | id: pluginViewLayout |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 101 | width: root.width |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 102 | |
| 103 | ToggleSwitch { |
| 104 | id: enabledplugin |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 105 | Layout.fillWidth: true |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 106 | Layout.topMargin: 15 |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 107 | Layout.leftMargin: 16 |
| 108 | Layout.rightMargin: 16 |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 109 | |
| 110 | labelText: "Enable" |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 111 | fontPointSize: JamiTheme.headerFontSize |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 112 | |
| 113 | onSwitchToggled: { |
| 114 | slotSetPluginEnabled(checked) |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 115 | |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 116 | pluginListSettingsView.visible = checked |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 117 | if (pluginListSettingsView.visible) { |
| 118 | pluginListSettingsView.updatePluginListDisplayed() |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 119 | } else { |
| 120 | ClientWrapper.pluginModel.toggleCallMediaHandler("", true) |
| 121 | pluginListSettingsView.hidePreferences() |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 122 | } |
| 123 | } |
| 124 | } |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 125 | |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 126 | PluginListSettingsView { |
| 127 | id: pluginListSettingsView |
| 128 | Layout.fillWidth: true |
| 129 | Layout.leftMargin: 16 |
| 130 | Layout.rightMargin: 16 |
| 131 | Layout.alignment: Qt.AlignHCenter |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 132 | |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 133 | pluginListPreferencesView: pluginListPreferencesView |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 134 | |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 135 | Layout.topMargin: 15 |
| 136 | Layout.minimumHeight: 0 |
| 137 | Layout.preferredHeight: childrenRect.height |
| 138 | } |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 139 | |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 140 | 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 Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 147 | |
agsantos | 78726ec | 2020-08-18 17:41:05 -0400 | [diff] [blame^] | 148 | onUpdatePluginList:{ |
| 149 | pluginListSettingsView.updatePluginListDisplayed() |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 150 | } |
| 151 | } |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | } |