Use the real devices from telldus-core instead of hardcoded values
This commit is contained in:
parent
042508033e
commit
2b2cb019fa
2 changed files with 67 additions and 68 deletions
|
@ -8,11 +8,10 @@ __postInit__ = function() {
|
||||||
com.telldus.schedulersimplegui = function() {
|
com.telldus.schedulersimplegui = function() {
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
print("START");
|
|
||||||
var v = new com.telldus.qml.view({});
|
var v = new com.telldus.qml.view({});
|
||||||
|
v.setProperty('deviceModel', com.telldus.core.deviceList.getList());
|
||||||
v.load("main.qml");
|
v.load("main.qml");
|
||||||
//var v = new com.telldus.qml.view("");
|
application.addWidget("scheduler.simple", "icon.png", v);
|
||||||
application.addWidget("scheduler.simple", ":/images/devices.png", v);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
import Qt 4.7
|
import Qt 4.7
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Item{
|
Item{
|
||||||
id: main
|
id: main
|
||||||
width: 800 //TODO how?
|
width: 800 //TODO how?
|
||||||
height: 600 //TODO how?
|
height: 600 //TODO how?
|
||||||
|
|
||||||
//height: 200
|
//height: 200
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width:200
|
width:200
|
||||||
|
@ -22,23 +22,23 @@ import Qt 4.7
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
//onClicked: container.clicked(testGrid.)
|
//onClicked: container.clicked(testGrid.)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Text{
|
Text{
|
||||||
id: testItem
|
id: testItem
|
||||||
text: "Hello world!"
|
text: "Hello world!"
|
||||||
//anchors.left: main.left
|
//anchors.left: main.left
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
anchors.verticalCenter: main.verticalCenter
|
anchors.verticalCenter: main.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: testColumn
|
id: testColumn
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
//anchors.bottom: page.bottom; anchors.bottomMargin: 4
|
//anchors.bottom: page.bottom; anchors.bottomMargin: 4
|
||||||
//rows: 6; columns: 1; spacing: 3
|
//rows: 6; columns: 1; spacing: 3
|
||||||
|
|
||||||
Repeater{
|
Repeater{
|
||||||
model: 3
|
model: 3
|
||||||
|
@ -47,7 +47,7 @@ import Qt 4.7
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
height: 50
|
height: 50
|
||||||
//color: "red"
|
//color: "red"
|
||||||
Rectangle { border.color: "blue"; width: 100; height:parent.height;
|
Rectangle { border.color: "blue"; width: 100; height:parent.height;
|
||||||
Text{
|
Text{
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
@ -57,44 +57,44 @@ import Qt 4.7
|
||||||
Rectangle { border.color: "blue"; width: parent.width-100; height:parent.height; }
|
Rectangle { border.color: "blue"; width: parent.width-100; height:parent.height; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle { color: "green"; width: parent.width; height:50; id: row2 }
|
Rectangle { color: "green"; width: parent.width; height:50; id: row2 }
|
||||||
Rectangle { color: "blue"; }
|
Rectangle { color: "blue"; }
|
||||||
Rectangle { color: "yellow"; }
|
Rectangle { color: "yellow"; }
|
||||||
Rectangle { color: "steelblue"; }
|
Rectangle { color: "steelblue"; }
|
||||||
Rectangle { color: "black"; }
|
Rectangle { color: "black"; }
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id: listRow
|
id: listRow
|
||||||
Row{
|
Row{
|
||||||
id: row1
|
id: row1
|
||||||
width: parent.width; //TODO relative
|
width: parent.width; //TODO relative
|
||||||
height: 50
|
height: 50
|
||||||
//color: "red"
|
//color: "red"
|
||||||
Rectangle { border.color: "red"; width: 100; height:parent.height;
|
Rectangle { border.color: "red"; width: 100; height:parent.height;
|
||||||
Text{
|
Text{
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
//text: "Device " + (index + 1) + "Name: " + name
|
//text: "Device " + (index + 1) + "Name: " + name
|
||||||
|
|
||||||
text: devicename + height
|
text: modelData.name + height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rectangle { id: "deviceRow"; border.color: "blue"; width: parent.width-100; height:parent.height;
|
Rectangle { id: "deviceRow"; border.color: "blue"; width: parent.width-100; height:parent.height;
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: deviceMouseArea
|
id: deviceMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
//TODO ändra muspekaren kanske?
|
//TODO ändra muspekaren kanske?
|
||||||
//onEntered: parent.border.color = onHoverColor
|
//onEntered: parent.border.color = onHoverColor
|
||||||
//onExited: parent.border.color = borderColor
|
//onExited: parent.border.color = borderColor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
//ny point här
|
//ny point här
|
||||||
|
|
||||||
var component = Qt.createComponent("ActionPoint.qml")
|
var component = Qt.createComponent("ActionPoint.qml")
|
||||||
var dynamicPoint = component.createObject(deviceRow)
|
var dynamicPoint = component.createObject(deviceRow)
|
||||||
//dynamicPoint.x = mouseX (blir inte kvar)
|
//dynamicPoint.x = mouseX (blir inte kvar)
|
||||||
|
@ -102,30 +102,30 @@ import Qt 4.7
|
||||||
dynamicPoint.x = mouseX - dynamicPoint.width/2 //xposition
|
dynamicPoint.x = mouseX - dynamicPoint.width/2 //xposition
|
||||||
//dynamicPoint.width = mouseX-
|
//dynamicPoint.width = mouseX-
|
||||||
dynamicPoint.border.color = "blue"
|
dynamicPoint.border.color = "blue"
|
||||||
|
|
||||||
var dynamicBar = actionBar.createObject(deviceRow)
|
var dynamicBar = actionBar.createObject(deviceRow)
|
||||||
dynamicBar.hangOnToPoint = dynamicPoint
|
dynamicBar.hangOnToPoint = dynamicPoint
|
||||||
//dynamicBar.color = "blue" //TODO dependent of point type
|
//dynamicBar.color = "blue" //TODO dependent of point type
|
||||||
//dynamicBar.anchors.left = dynamicPoint.right
|
//dynamicBar.anchors.left = dynamicPoint.right
|
||||||
//dynamicBar.width = 100 //TODO dependent of this and next point position
|
//dynamicBar.width = 100 //TODO dependent of this and next point position
|
||||||
|
|
||||||
//deviceRow.add(point)
|
//deviceRow.add(point)
|
||||||
//TODO destroy? (only to remove them if needed)
|
//TODO destroy? (only to remove them if needed)
|
||||||
//TODO komponenter med stor bokstav kanske?
|
//TODO komponenter med stor bokstav kanske?
|
||||||
//om detta inte fungerar, testa med pathview...
|
//om detta inte fungerar, testa med pathview...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView.onAdd: SequentialAnimation {
|
ListView.onAdd: SequentialAnimation {
|
||||||
PropertyAction { target: row1; property: "height"; value: 0 }
|
PropertyAction { target: row1; property: "height"; value: 0 }
|
||||||
NumberAnimation { target: row1; property: "height"; to: 50; duration: 250; easing.type: Easing.InOutQuad }
|
NumberAnimation { target: row1; property: "height"; to: 50; duration: 250; easing.type: Easing.InOutQuad }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
id: myModel
|
id: myModel
|
||||||
ListElement {
|
ListElement {
|
||||||
devicename: "Storsalen"
|
devicename: "Storsalen"
|
||||||
|
@ -137,20 +137,20 @@ import Qt 4.7
|
||||||
devicename: "Västra uthuset"
|
devicename: "Västra uthuset"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: myListView
|
id: myListView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
model: myModel
|
model: deviceModel
|
||||||
delegate: listRow
|
delegate: listRow
|
||||||
//snapMode: ListView.SnapToItem
|
//snapMode: ListView.SnapToItem
|
||||||
//highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
|
//highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
|
||||||
focus: true
|
focus: true
|
||||||
footer: addButtonComponent
|
footer: addButtonComponent
|
||||||
header: timeline
|
header: timeline
|
||||||
}
|
}
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id: timeline
|
id: timeline
|
||||||
Item{
|
Item{
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -159,12 +159,12 @@ import Qt 4.7
|
||||||
height: 30
|
height: 30
|
||||||
border.color: "red"
|
border.color: "red"
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
Row{
|
Row{
|
||||||
//x: 100
|
//x: 100
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.horizontalCenterOffset: parent.width/24
|
anchors.horizontalCenterOffset: parent.width/24
|
||||||
|
|
||||||
width: listRow.width
|
width: listRow.width
|
||||||
height: listRow.height
|
height: listRow.height
|
||||||
spacing: (parent.width-124)/24
|
spacing: (parent.width-124)/24
|
||||||
|
@ -180,8 +180,8 @@ import Qt 4.7
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id: addButtonComponent
|
id: addButtonComponent
|
||||||
//anchors { left: myListView.left; top: myListView.top; margins: 20 }
|
//anchors { left: myListView.left; top: myListView.top; margins: 20 }
|
||||||
Row {
|
Row {
|
||||||
|
@ -194,15 +194,15 @@ import Qt 4.7
|
||||||
width: 100
|
width: 100
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.verticalCenterOffset: 30
|
anchors.verticalCenterOffset: 30
|
||||||
|
|
||||||
property color buttonColor: "lightgrey"
|
property color buttonColor: "lightgrey"
|
||||||
|
|
||||||
Text{
|
Text{
|
||||||
text: "Add an item"
|
text: "Add an item"
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.margins: 2
|
anchors.margins: 2
|
||||||
|
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: buttonMouseArea
|
id: buttonMouseArea
|
||||||
|
@ -216,13 +216,13 @@ import Qt 4.7
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
|
color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id: actionBar
|
id: actionBar
|
||||||
Rectangle{
|
Rectangle{
|
||||||
|
@ -233,37 +233,37 @@ import Qt 4.7
|
||||||
color: "blue" //TODO, dependent on hangOnToPoint
|
color: "blue" //TODO, dependent on hangOnToPoint
|
||||||
anchors.verticalCenter: hangOnToPoint.verticalCenter
|
anchors.verticalCenter: hangOnToPoint.verticalCenter
|
||||||
anchors.left: hangOnToPoint.horizontalCenter
|
anchors.left: hangOnToPoint.horizontalCenter
|
||||||
|
|
||||||
z: 110
|
z: 110
|
||||||
/* couldnt get this to work:
|
/* couldnt get this to work:
|
||||||
* (if it works later on, try to set opacity for actionPoint in this way too)
|
* (if it works later on, try to set opacity for actionPoint in this way too)
|
||||||
states: State {
|
states: State {
|
||||||
name: "myState"; when: hangOnToPoint != undefined
|
name: "myState"; when: hangOnToPoint != undefined
|
||||||
PropertyChanges { target: barRectangle; anchors.verticalCenter: hangOnToPoint.verticalCenter; anchors.left: hangOnToPoint.horizontalCenter }
|
PropertyChanges { target: barRectangle; anchors.verticalCenter: hangOnToPoint.verticalCenter; anchors.left: hangOnToPoint.horizontalCenter }
|
||||||
//anchors.verticalCenter: hangOnToPoint.verticalCenter
|
//anchors.verticalCenter: hangOnToPoint.verticalCenter
|
||||||
//anchors.left: hangOnToPoint.horizontalCenter
|
//anchors.left: hangOnToPoint.horizontalCenter
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog {
|
Dialog {
|
||||||
id: dialog
|
id: dialog
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
z: 150
|
z: 150
|
||||||
}
|
}
|
||||||
|
|
||||||
//opacity vid dimning?
|
//opacity vid dimning?
|
||||||
//linjens färg etc (state) beror ju på närmaste punkt föres sort... Punkten kan finnas osynlig (tidigare dag) också...
|
//linjens färg etc (state) beror ju på närmaste punkt föres sort... Punkten kan finnas osynlig (tidigare dag) också...
|
||||||
//kan man liksom göra hela linjen (från en vecka tillbaka) men inte visa den? Om det är vettigt... Då hade man tom kunnat zooma en vacker dag
|
//kan man liksom göra hela linjen (från en vecka tillbaka) men inte visa den? Om det är vettigt... Då hade man tom kunnat zooma en vacker dag
|
||||||
//properties, ställa in dem...
|
//properties, ställa in dem...
|
||||||
//fuzziness
|
//fuzziness
|
||||||
/*
|
/*
|
||||||
* Dialog {
|
* Dialog {
|
||||||
id: dialog
|
id: dialog
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
z: 100
|
z: 100
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue