linphone-desktop/linphone-app/ui/modules/Common/Form/Switch.qml
Julien Wadel 5eba9a5ece Create a plugin system
- Add feedback on errors
- More generic import requests
- Replace storing password by a native popup that ask passwork when needed
- Store passwords in settings file
- Import Feedback in advanced settings tab
- Use English as default translator if no translations are found
- Add OpenSSL packaging for Windows to deal with Qt connections
- Add option to overwrite plugin if exists
- Plugin load/unload managment. Hot-Dynamic load of plugins. Safely test the loaded plugin
- Set plugin data with default value when all GUI items are loaded
- Rewrite folder priority
- Add filename info from pluginloader
- Add plugin versionning
- Specify inputs for saving
- Copy desktop headers in OUTPUT to be used by external projects
- Add a plugins folder auto-managed by cmake
- Remove obsolete contact api submodule
- Clean plugin example
- Add specific behaviour for plugin type : inputs have been splitted by Capability.
- Update save/load to be more generic and add clean function for configurations
- Instantiate Importer List model
- Add IDE integration for plugins
- Set input fields to be dependent of capability
- Change signals interface to take account capability
2021-01-13 21:04:23 +01:00

105 lines
2.6 KiB
QML

import QtQuick 2.7
import QtQuick.Controls 2.2
import Common 1.0
import Common.Styles 1.0
// =============================================================================
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()
}
}