No action point drag when using sunrise/sunset
This commit is contained in:
parent
4887e4e90a
commit
f74dfbf8b8
2 changed files with 91 additions and 26 deletions
|
@ -32,22 +32,9 @@ Rectangle{
|
||||||
//actionTypeColor: getColor()
|
//actionTypeColor: getColor()
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
id: pointRectMouseArea
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
||||||
//pointRect.border.color: "red"
|
|
||||||
//Fungerar inte: for(var child in myListView.children){
|
|
||||||
// dialog.show("hej?")
|
|
||||||
//}
|
|
||||||
//listmodel har iaf en count-property man kan testa om vi gör om detta till en listmodel...
|
|
||||||
/*var continue = true;
|
|
||||||
while(continue){
|
|
||||||
dialog.show("Count: " + parent.parent.children[2]) //myListView.children[0].children[0].x), parent.x = punktens x, parent.parent.children = siblings... starting from 1
|
|
||||||
continue = false;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//dialog.show("Width: " + Scripts.getBarWidth(pointRect, parent.parent.children));
|
|
||||||
dialog.show(pointRect) //TODO om inte redan i visandes läge....
|
dialog.show(pointRect) //TODO om inte redan i visandes läge....
|
||||||
//dialog.show("Nice dialog with possibility to set type of action, exact time, fuzziness, offset etc") //myListView.children[0].children[0].x), parent.x = punktens x, parent.parent.children = siblings... starting from 1
|
|
||||||
}
|
}
|
||||||
//onPositionChange... maybe emit signal to change in row...
|
//onPositionChange... maybe emit signal to change in row...
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -56,46 +43,79 @@ Rectangle{
|
||||||
drag.minimumX: 0
|
drag.minimumX: 0
|
||||||
drag.maximumX: 685 //TODO make relative!!
|
drag.maximumX: 685 //TODO make relative!!
|
||||||
//TODO make it impossible to overlap (on release)
|
//TODO make it impossible to overlap (on release)
|
||||||
|
//onPositionChanged: { value = (maximum - minimum) * (handle.x-2) / slider.xMax + minimum; }
|
||||||
}
|
}
|
||||||
|
|
||||||
Column{
|
Column{
|
||||||
spacing: 10
|
spacing: 10
|
||||||
Image {
|
Image {
|
||||||
//opacity: 1
|
//opacity: 1
|
||||||
id: actionImage
|
id: actionImage
|
||||||
width: 20; height: 20
|
width: 20; height: 20
|
||||||
source: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/devices.png"
|
source: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/devices.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle{
|
||||||
|
id: trigger
|
||||||
|
|
||||||
|
state: "absolute"
|
||||||
|
width: 20; height: 20
|
||||||
|
|
||||||
|
//TODO state should move the point to correct place... (sunrisetime, sunsettime or absolute (stored value, the one that is dragged)
|
||||||
|
//drag not permitted depending on state...
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "sunrise"
|
||||||
|
PropertyChanges { target: triggerImage; source: "/home/stefan/Downloads/sunrise.png" } //TODO: images!!
|
||||||
|
PropertyChanges { target: pointRectMouseArea; drag.target: undefined }
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "sunset"
|
||||||
|
PropertyChanges { target: triggerImage; source: "/home/stefan/Downloads/sunset.png" } //TODO: images!!
|
||||||
|
PropertyChanges { target: pointRectMouseArea; drag.target: undefined }
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "absolute"
|
||||||
|
PropertyChanges { target: triggerImage; source: "/home/stefan/Downloads/11949889941371111141clock_michael_breuer_01.svg.hi.png" } //TODO: images!!
|
||||||
|
PropertyChanges { target: pointRectMouseArea; drag.target: parent }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
//triggerImage, antingen sol upp, sol ned, eller inte bild utan text m. klockslag
|
//triggerImage, antingen sol upp, sol ned, eller inte bild utan text m. klockslag
|
||||||
id: triggerImage
|
id: triggerImage
|
||||||
|
anchors.fill: parent
|
||||||
width: 20; height: 20
|
width: 20; height: 20
|
||||||
source: "/home/stefan/Downloads/11949889941371111141clock_michael_breuer_01.svg.hi.png"
|
source: "/home/stefan/Downloads/11949889941371111141clock_michael_breuer_01.svg.hi.png"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "on"
|
name: "on"
|
||||||
PropertyChanges { target: pointRect; actionTypeColor: "blue"; actionTypeOpacity: 1 }
|
PropertyChanges { target: pointRect; actionTypeColor: "blue"; actionTypeOpacity: 1 } //TODO: images!!
|
||||||
|
PropertyChanges { target: actionImage; source: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/devices.png" }
|
||||||
},
|
},
|
||||||
State{
|
State{
|
||||||
name: "off"
|
name: "off"
|
||||||
PropertyChanges { target: pointRect; actionTypeColor: "red"; actionTypeOpacity: 1 }
|
PropertyChanges { target: pointRect; actionTypeColor: "gainsboro"; actionTypeOpacity: 0 }
|
||||||
|
PropertyChanges { target: actionImage; source: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/devices-bw.png" }
|
||||||
},
|
},
|
||||||
State{
|
State{
|
||||||
name: "dim"
|
name: "dim"
|
||||||
PropertyChanges { target: pointRect; actionTypeColor: "green"; actionTypeOpacity: 1 }
|
PropertyChanges { target: pointRect; actionTypeColor: "green"; actionTypeOpacity: 1 }
|
||||||
|
PropertyChanges { target: actionImage; source: "/home/stefan/Projects/tellstick/trunk/telldus-gui/TelldusCenter/images/TelldusCenter_128.png" }
|
||||||
//something opacity = dim for example
|
//something opacity = dim for example
|
||||||
},
|
},
|
||||||
State{
|
State{
|
||||||
name: "bell"
|
name: "bell"
|
||||||
PropertyChanges { target: pointRect; actionTypeColor: getLastPointColor() }
|
PropertyChanges { target: pointRect; actionTypeColor: getLastPointColor() }
|
||||||
|
PropertyChanges { target: actionImage; source: "icon.png" }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
function toggleType(){
|
function toggleType(){ //TODO other kind of selection method
|
||||||
print(pointRect.state);
|
print(pointRect.state);
|
||||||
if(pointRect.state == "on"){
|
if(pointRect.state == "on"){
|
||||||
pointRect.state = "off"
|
pointRect.state = "off"
|
||||||
|
@ -111,6 +131,19 @@ Rectangle{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleTrigger(){ //TODO other kind of selection method
|
||||||
|
print(trigger.state);
|
||||||
|
if(trigger.state == "sunrise"){
|
||||||
|
trigger.state = "sunset";
|
||||||
|
}
|
||||||
|
else if(trigger.state == "sunset"){
|
||||||
|
trigger.state = "absolute";
|
||||||
|
}
|
||||||
|
else if(trigger.state == "absolute"){
|
||||||
|
trigger.state = "sunrise";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getLastPointColor(){
|
function getLastPointColor(){
|
||||||
//get previous point:
|
//get previous point:
|
||||||
var prevPoint = null;
|
var prevPoint = null;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
property color buttonColor: "lightgrey"
|
property color buttonColor: "lightgrey"
|
||||||
|
|
||||||
Text{
|
Text{
|
||||||
text: "Toggle type"
|
text: "Toggle Action Type"
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.margins: 2
|
anchors.margins: 2
|
||||||
|
@ -58,13 +58,45 @@
|
||||||
|
|
||||||
color: buttonMouseAreaType.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
|
color: buttonMouseAreaType.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: circleTrigger
|
||||||
|
height: 20
|
||||||
|
width: 100
|
||||||
|
anchors.horizontalCenter: circleType.horizontalCenter
|
||||||
|
y: circleType.y + 30
|
||||||
|
|
||||||
|
property color buttonColor: "lightgrey"
|
||||||
|
|
||||||
|
Text{
|
||||||
|
text: "Toggle Trigger Type"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.margins: 2
|
||||||
|
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
id: buttonMouseAreaTrigger
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
//onEntered: parent.border.color = onHoverColor
|
||||||
|
//onExited: parent.border.color = borderColor
|
||||||
|
onClicked: {
|
||||||
|
container.actionPoint.toggleTrigger();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
color: buttonMouseAreaTrigger.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle { //TODO create common button-class
|
|
||||||
|
Rectangle { //TODO create common button-class
|
||||||
id: closeButton
|
id: closeButton
|
||||||
height: 20
|
height: 20
|
||||||
width: 100
|
width: 100
|
||||||
anchors.horizontalCenter: circleType.right
|
//anchors.horizontalCenter: circleTrigger.right
|
||||||
anchors.horizontalCenterOffset: 30
|
//anchors.horizontalCenterOffset: 30
|
||||||
|
y: circleTrigger.y + 30
|
||||||
|
|
||||||
property color buttonColor: "lightgrey"
|
property color buttonColor: "lightgrey"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue