Files

148 lines
4.0 KiB
QML
Raw Permalink Normal View History

2024-04-01 18:45:00 +07:00
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import "../Controls2"
import "../Controls2/TextTypes"
2024-04-06 22:29:51 +07:00
import SortFilterProxyModel 0.2
2024-04-01 18:45:00 +07:00
import InstalledAppsModel 1.0
2024-07-07 13:42:38 +03:00
import Style 1.0
2024-04-01 18:45:00 +07:00
DrawerType2 {
id: root
anchors.fill: parent
expandedHeight: parent.height * 0.9
onAboutToShow: {
PageController.showBusyIndicator(true)
installedAppsModel.updateModel()
PageController.showBusyIndicator(false)
}
InstalledAppsModel {
id: installedAppsModel
}
2024-12-31 04:16:52 +01:00
expandedStateContent: Item {
2024-04-01 18:45:00 +07:00
id: container
implicitHeight: expandedHeight
ColumnLayout {
id: backButton
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
2024-04-06 22:29:51 +07:00
anchors.bottom: searchField.top
2024-04-01 18:45:00 +07:00
anchors.topMargin: 16
BackButtonType {
backButtonImage: "qrc:/images/controls/arrow-left.svg"
backButtonFunction: function() {
2024-12-31 04:16:52 +01:00
root.closeTriggered()
2024-04-01 18:45:00 +07:00
}
}
Header2Type {
id: header
Layout.fillWidth: true
Layout.topMargin: 16
Layout.rightMargin: 16
Layout.leftMargin: 16
headerText: qsTr("Choose application")
}
ListViewType {
2024-04-01 18:45:00 +07:00
id: listView
Layout.fillWidth: true
Layout.fillHeight: true
Layout.topMargin: 16
Layout.rightMargin: 16
Layout.leftMargin: 16
2024-04-06 22:29:51 +07:00
model: SortFilterProxyModel {
id: proxyInstalledAppsModel
sourceModel: installedAppsModel
filters: RegExpFilter {
roleName: "appName"
pattern: ".*" + searchField.textField.text + ".*"
caseSensitivity: Qt.CaseInsensitive
}
}
2024-04-01 18:45:00 +07:00
ButtonGroup {
id: buttonGroup
}
delegate: ColumnLayout {
width: listView.width
2024-04-01 18:45:00 +07:00
RowLayout {
CheckBoxType {
Layout.fillWidth: true
2024-04-01 18:45:00 +07:00
text: appName
checked: isAppSelected
onCheckedChanged: {
installedAppsModel.selectedStateChanged(proxyInstalledAppsModel.mapToSource(index), checked)
2024-04-01 18:45:00 +07:00
}
}
2024-04-01 18:45:00 +07:00
Image {
source: "image://installedAppImage/" + appIcon
2024-04-01 18:45:00 +07:00
sourceSize.width: 24
sourceSize.height: 24
2024-04-01 18:45:00 +07:00
Layout.rightMargin: 48
2024-04-01 18:45:00 +07:00
}
}
DividerType {}
2024-04-01 18:45:00 +07:00
}
}
}
2024-04-06 22:29:51 +07:00
TextFieldWithHeaderType {
id: searchField
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: addButton.top
anchors.bottomMargin: 16
anchors.rightMargin: 16
anchors.leftMargin: 16
backgroundColor: AmneziaStyle.color.slateGray
2024-04-06 22:29:51 +07:00
textField.placeholderText: qsTr("application name")
2024-04-06 22:29:51 +07:00
}
2024-04-01 18:45:00 +07:00
BasicButtonType {
id: addButton
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: 16
anchors.rightMargin: 16
anchors.leftMargin: 16
text: qsTr("Add selected")
clickedFunc: function() {
PageController.showBusyIndicator(true)
2024-04-06 22:29:51 +07:00
AppSplitTunnelingController.addApps(installedAppsModel.getSelectedAppsInfo())
2024-04-01 18:45:00 +07:00
PageController.showBusyIndicator(false)
2024-12-31 04:16:52 +01:00
root.closeTriggered()
2024-04-01 18:45:00 +07:00
}
}
}
}