Files
amnezia-client/client/ui/qml/Pages/PageSites.qml
T

195 lines
4.9 KiB
QML
Raw Normal View History

2021-07-28 16:13:29 +07:00
import QtQuick 2.12
import QtQuick.Controls 2.12
2021-08-09 00:41:52 +07:00
import Qt.labs.platform 1.0
import QtQuick.Dialogs 1.0
2021-08-19 01:27:22 +03:00
import "./"
import "../Controls"
import "../Config"
2021-08-09 00:41:52 +07:00
2021-07-28 16:13:29 +07:00
Item {
id: root
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#333333"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: qsTr("Web site/Hostname/IP address/Subnet")
x: 20
y: 110
width: 311
height: 21
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 20
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignTop
2021-09-03 20:17:13 +03:00
text: SitesLogic.labelSitesAddCustomText
2021-07-28 16:13:29 +07:00
x: 20
y: 40
width: 340
height: 60
}
TextFieldType {
x: 20
y: 140
width: 231
height: 31
placeholderText: qsTr("yousite.com or IP address")
2021-09-03 20:17:13 +03:00
text: SitesLogic.lineEditSitesAddCustomText
2021-08-09 00:41:52 +07:00
onEditingFinished: {
2021-09-03 20:17:13 +03:00
SitesLogic.lineEditSitesAddCustomText = text
2021-08-09 00:41:52 +07:00
}
onAccepted: {
2021-09-03 20:17:13 +03:00
SitesLogic.onPushButtonAddCustomSitesClicked()
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
BlueButtonType {
id: sites_add
x: 260
y: 140
width: 51
height: 31
font.pixelSize: 24
text: "+"
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-03 20:17:13 +03:00
SitesLogic.onPushButtonAddCustomSitesClicked()
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
BlueButtonType {
id: sites_delete
x: 80
y: 589
width: 231
height: 31
font.pixelSize: 16
text: qsTr("Delete selected")
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-03 20:17:13 +03:00
SitesLogic.onPushButtonSitesDeleteClicked(tb.currentRow)
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
BasicButtonType {
id: sites_import
x: 320
y: 140
width: 51
height: 31
background: Rectangle {
anchors.fill: parent
radius: 4
color: parent.containsMouse ? "#211966" : "#100A44"
}
font.pixelSize: 16
contentItem: Item {
anchors.fill: parent
Image {
anchors.centerIn: parent
width: 20
height: 20
source: "qrc:/images/folder.png"
fillMode: Image.Stretch
}
}
antialiasing: true
2021-08-09 00:41:52 +07:00
onClicked: {
fileDialog.open()
}
}
FileDialog {
id: fileDialog
title: qsTr("Import IP addresses")
visible: false
folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
onAccepted: {
2021-09-03 20:17:13 +03:00
SitesLogic.onPushButtonSitesImportClicked(fileUrl)
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
2021-08-09 01:34:25 +07:00
ListView {
2021-07-28 16:13:29 +07:00
id: tb
x: 20
y: 200
width: 341
height: 371
2021-08-09 01:34:25 +07:00
spacing: 1
2021-07-28 16:13:29 +07:00
clip: true
property int currentRow: -1
2021-09-03 20:17:13 +03:00
model: SitesLogic.tableViewSitesModel
2021-07-28 16:13:29 +07:00
delegate: Item {
2021-08-09 01:34:25 +07:00
implicitWidth: 170 * 2
2021-07-28 16:13:29 +07:00
implicitHeight: 30
2021-08-09 01:34:25 +07:00
Item {
width: 170
height: 30
anchors.left: parent.left
id: c1
Rectangle {
anchors.top: parent.top
width: parent.width
height: 1
color: "lightgray"
visible: index !== tb.currentRow
}
Rectangle {
anchors.fill: parent
color: "#63B4FB"
visible: index === tb.currentRow
2021-07-28 16:13:29 +07:00
2021-08-09 01:34:25 +07:00
}
Text {
text: url_path
anchors.fill: parent
leftPadding: 10
verticalAlignment: Text.AlignVCenter
}
2021-07-28 16:13:29 +07:00
}
2021-08-09 01:34:25 +07:00
Item {
anchors.left: c1.right
width: 170
height: 30
Rectangle {
anchors.top: parent.top
width: parent.width
height: 1
color: "lightgray"
visible: index !== tb.currentRow
}
Rectangle {
anchors.fill: parent
color: "#63B4FB"
visible: index === tb.currentRow
2021-07-28 16:13:29 +07:00
2021-08-09 01:34:25 +07:00
}
Text {
text: ip
anchors.fill: parent
leftPadding: 10
verticalAlignment: Text.AlignVCenter
}
2021-07-28 16:13:29 +07:00
}
MouseArea {
anchors.fill: parent
onClicked: {
2021-08-09 01:34:25 +07:00
tb.currentRow = index
2021-07-28 16:13:29 +07:00
}
}
}
}
}