This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
app/qml/components/ConnectionDelegate.qml
Dorian Zedler 1e09ebe027 too many changes to document.
Summary:
- cleaned some stuff up in qml
- separated the timer and the main.qml and put it into "SpeedTimer.qml"
- continued on implementing the base conn connection
- started to get the whole time meassuring procedure out of qml and into c++
  -> added new class (SpeedTimer) for that
2018-10-04 18:35:29 +02:00

98 lines
2.3 KiB
QML

import QtQuick 2.0
import QtQuick.Controls 2.2
import "../styles"
ItemDelegate {
id: control
property var status
property var connect
property string type
text: qsTr(type)
enabled: status.status === "disconnected"
onClicked: {
connect(type)
if(status.status !== "connected"){
statusIndicator.color_override = "red"
shortDelay.start()
}
}
contentItem: Text {
text: parent.text
color: StyleSettings.textColor
font.pixelSize: options_stack.text_pixelSize
}
Timer {
id: shortDelay
running: false
repeat: false
interval: 1500
onTriggered: {
statusIndicator.color_override = ""
}
}
Item {
id: statusItem
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
height: parent.font.pixelSize
width: height
Rectangle {
id: statusIndicator
property string color_override: ""
anchors.fill: parent
color: color_override === "" ? status.status === "connected" ? "#c1ff32":"transparent":color_override
opacity: status.status === "connecting" ? 0:1
radius: height * 0.5
border.color: "grey"
border.width: height * 0.1
Behavior on color {
ColorAnimation {
duration: 200
}
}
Behavior on opacity {
NumberAnimation {
duration: 800
}
}
}
ProgressCircle {
id: prog
anchors.fill: parent
opacity: status.status === "connecting" ? 1:0
lineWidth: height * 0.1
arcBegin: 0
arcEnd: 0
colorCircle: "grey"
onColorCircleChanged: prog.repaint()
Timer {
id: prog_refresh
running: status.status === "connecting"
interval: 1
repeat: true
onTriggered: {
prog.arcEnd = 360 * ( status.progress / 100 )
}
}
Behavior on opacity {
NumberAnimation {
duration: 200
}
}
}
}
}