mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-19 16:38:28 +00:00
- set defaults for LDAP - add unsaving a server - adapt design for LDAP (placement, debug and verifications options) - Add hidden options in linphonerc to hide local sip account, start video call button and start chat button
105 lines
2.6 KiB
QML
105 lines
2.6 KiB
QML
import QtQuick 2.7
|
|
import QtQuick.Controls 2.2 as Controls
|
|
|
|
import Common 1.0
|
|
import Common.Styles 1.0
|
|
|
|
// =============================================================================
|
|
|
|
Controls.Switch {
|
|
id: control
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
property bool enabled: true
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
signal clicked
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
checked: false
|
|
|
|
indicator: Rectangle {
|
|
implicitHeight: SwitchStyle.indicator.height
|
|
implicitWidth: SwitchStyle.indicator.width
|
|
|
|
border.color: control.enabled
|
|
? (
|
|
control.checked
|
|
? SwitchStyle.indicator.border.color.checked
|
|
: SwitchStyle.indicator.border.color.normal
|
|
) : SwitchStyle.indicator.border.color.disabled
|
|
|
|
color: control.enabled
|
|
? (
|
|
control.checked
|
|
? SwitchStyle.indicator.color.checked
|
|
: SwitchStyle.indicator.color.normal
|
|
) : SwitchStyle.indicator.color.disabled
|
|
|
|
radius: SwitchStyle.indicator.radius
|
|
x: control.leftPadding
|
|
y: parent.height / 2 - height / 2
|
|
|
|
Rectangle {
|
|
id: sphere
|
|
|
|
height: SwitchStyle.sphere.size
|
|
width: SwitchStyle.sphere.size
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
border.color: control.enabled
|
|
?
|
|
(
|
|
control.checked
|
|
? (
|
|
control.down
|
|
? SwitchStyle.sphere.border.color.pressed
|
|
: SwitchStyle.sphere.border.color.checked
|
|
) : SwitchStyle.sphere.border.color.normal
|
|
) : SwitchStyle.sphere.border.color.disabled
|
|
|
|
color: control.enabled
|
|
?
|
|
(
|
|
control.down
|
|
? SwitchStyle.sphere.color.pressed
|
|
: SwitchStyle.sphere.color.normal
|
|
) : SwitchStyle.sphere.color.disabled
|
|
|
|
radius: width / 2
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
states: State {
|
|
when: control.checked
|
|
|
|
PropertyChanges {
|
|
target: sphere
|
|
x: parent.width - width
|
|
}
|
|
}
|
|
|
|
transitions: Transition {
|
|
NumberAnimation {
|
|
properties: 'x'
|
|
|
|
duration: SwitchStyle.animation.duration
|
|
easing.type: Easing.InOutQuad
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
|
|
onClicked: control.enabled && control.clicked()
|
|
onPressed: control.enabled && control.forceActiveFocus()
|
|
}
|
|
}
|