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

180 lines
5.3 KiB
QML
Raw Normal View History

2021-07-28 16:13:29 +07:00
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtGraphicalEffects 1.12
2021-08-09 00:41:52 +07:00
import PageEnum 1.0
2021-08-19 01:27:22 +03:00
import "../Controls"
import "./"
import "../Config"
2021-07-28 16:13:29 +07:00
2021-09-14 00:39:07 +03:00
PageBase {
2021-07-28 16:13:29 +07:00
id: root
2021-09-14 00:39:07 +03:00
page: PageEnum.ServersList
logic: ServerListLogic
2021-09-08 15:09:16 +03:00
BackButton {
2021-07-28 16:13:29 +07:00
id: back
}
2021-09-08 21:24:09 +03:00
Caption {
id: caption
text: qsTr("Servers")
2021-10-21 18:10:28 +03:00
width: undefined
2021-07-28 16:13:29 +07:00
}
2022-02-05 15:52:14 +03:00
SvgButtonType {
anchors.verticalCenter: caption.verticalCenter
2021-09-08 21:24:09 +03:00
anchors.leftMargin: 10
2021-10-21 18:10:28 +03:00
anchors.left: caption.right
width: 27
height: 27
2022-02-05 15:52:14 +03:00
icon.source: "qrc:/images/svg/control_point_black_24dp.svg"
2021-08-09 00:41:52 +07:00
onClicked: {
UiLogic.goToPage(PageEnum.Start);
2021-07-28 16:13:29 +07:00
}
}
2022-02-05 15:52:14 +03:00
2021-07-28 16:13:29 +07:00
ListView {
id: listWidget_servers
x: 20
2021-10-21 18:10:28 +03:00
anchors.top: caption.bottom
anchors.topMargin: 15
width: parent.width
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
2021-09-03 22:15:05 +03:00
model: ServerListLogic.serverListModel
2021-07-28 16:13:29 +07:00
spacing: 5
2021-10-21 18:10:28 +03:00
clip: true
2021-07-28 16:13:29 +07:00
delegate: Item {
height: 60
2021-10-21 18:10:28 +03:00
width: root.width - 40
2021-08-09 00:41:52 +07:00
MouseArea {
id: ms
anchors.fill: parent
hoverEnabled: true
onClicked: {
2021-10-28 00:04:54 +03:00
if (GC.isMobile()) {
ServerListLogic.onServerListPushbuttonSettingsClicked(index)
}
else {
listWidget_servers.currentIndex = index
}
2021-08-09 00:41:52 +07:00
mouse.accepted = false
}
onEntered: {
mouseExitAni.stop()
mouseEnterAni.start()
}
onExited: {
mouseEnterAni.stop()
mouseExitAni.start()
}
}
2021-07-28 16:13:29 +07:00
LinearGradient {
visible: !ms.containsMouse
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(0, height)
gradient: Gradient {
GradientStop { position: 0.0; color: "#FAFBFE" }
GradientStop { position: 1.0; color: "#ECEEFF" }
}
}
LinearGradient {
visible: ms.containsMouse
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(0, height)
gradient: Gradient {
GradientStop { position: 0.0; color: "#FAFBFE" }
GradientStop { position: 1.0; color: "#DCDEDF" }
}
}
LabelType {
id: label_address
x: 20
y: 40
width: 141
height: 16
text: address
}
Text {
x: 10
y: 10
width: 181
height: 21
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
font.bold: true
color: "#181922"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
2021-08-09 00:41:52 +07:00
text: desc
2021-07-28 16:13:29 +07:00
}
ImageButtonType {
2021-10-21 18:10:28 +03:00
x: parent.width - 30
2021-11-17 15:01:48 +03:00
y: 15
width: 30
height: 30
2021-07-28 16:13:29 +07:00
checkable: true
icon.source: checked ? "qrc:/images/check.png"
: "qrc:/images/uncheck.png"
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-03 22:15:05 +03:00
ServerListLogic.onServerListPushbuttonDefaultClicked(index)
2021-08-09 00:41:52 +07:00
}
checked: is_default
enabled: !is_default
2021-07-28 16:13:29 +07:00
}
2022-02-05 15:52:14 +03:00
SvgButtonType {
2021-08-09 00:41:52 +07:00
id: pushButtonSetting
2021-11-17 20:24:45 +03:00
x: parent.width - 70
2021-11-17 15:01:48 +03:00
y: 15
width: 30
height: 30
2022-02-05 15:52:14 +03:00
icon.source: "qrc:/images/svg/settings_black_24dp.svg"
2021-10-21 18:10:28 +03:00
opacity: 0
2021-08-09 00:41:52 +07:00
OpacityAnimator {
id: mouseEnterAni
target: pushButtonSetting;
from: 0;
to: 1;
duration: 150
running: false
easing.type: Easing.InOutQuad
}
OpacityAnimator {
id: mouseExitAni
target: pushButtonSetting;
from: 1;
to: 0;
duration: 150
running: false
easing.type: Easing.InOutQuad
2021-07-28 16:13:29 +07:00
}
2021-10-21 18:10:28 +03:00
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
onEntered: {
mouseExitAni.stop()
mouseEnterAni.start()
}
onExited: {
mouseEnterAni.stop()
mouseExitAni.start()
}
onClicked: {
ServerListLogic.onServerListPushbuttonSettingsClicked(index)
}
}
2021-07-28 16:13:29 +07:00
}
}
}
}