123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467 |
- /**
- * Copyright © 2010 Digia Plc
- * Copyright © 2010 Nokia Corporation
- *
- * All rights reserved.
- *
- * Nokia and Nokia Connecting People are registered trademarks of
- * Nokia Corporation.
- * Java and all Java-based marks are trademarks or registered
- * trademarks of
- * Sun Microsystems, Inc. Other product and company names
- * mentioned herein may be
- * trademarks or trade names of their respective owners.
- *
- *
- * Subject to the conditions below, you may, without charge:
- *
- * · Use, copy, modify and/or merge copies of this software and
- * associated documentation files (the "Software")
- *
- * · Publish, distribute, sub-licence and/or sell new software
- * derived from or incorporating the Software.
- *
- *
- * This file, unmodified, shall be included with all copies or
- * substantial portions
- * of the Software that are distributed in source code form.
- *
- * The Software cannot constitute the primary value of any new
- * software derived
- * from or incorporating the Software.
- *
- * Any person dealing with the Software shall not misrepresent
- * the source of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
- * KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
- import Qt 4.7
- import "javascript/sql.js" as HCS
- import "javascript/energyView.js" as Graph
- import "../colibri"
- import "../colibri/gradients"
- import "styles"
- Item {
- id: structure
- property CLStyle style : StyleHomeControlSystem{}
- property bool dummyBool : false
- signal closeWindow()
- width: 640
- height: 424
- onDummyBoolChanged: {
- if( viewi2.z > 0 ) Graph.loadConsumption();
- }
- Component.onCompleted: Graph.loadConsumption();
- MouseArea {
- anchors.fill: parent;
- }
- Rectangle{
- id: rec
- width: structure.width*0.955
- height: structure.height*0.88
- color: structure.style.selectionColor
- anchors.horizontalCenter: parent.horizontalCenter
- radius:7
- y: energyCLTab.tabHeight
- }
- RoomExitButton {
- windowWidth: structure.width
- windowHeight: structure.height
- style: structure.style
- z: 5
- onClicked: structure.closeWindow();
- }
- CLTab {
- id: energyCLTab
- style: structure.style
- tabHeight: parent.width*0.07
- contentColor: "transparent"
- borderColor: "transparent"
- tabColorWhenSelected:style.selectionColor
- tabColor:style.colorWhenDefault
- headerMarginSides: parent.width*0.03
- anchors.fill:parent
- Item {
- id: viewi1
- width: parent.width
- height: parent.height * 1.038
- anchors.bottom: parent.bottom
- property string title : "Monthly history"
- Image {
- source: "images/control_bg_trans_420x275_png.png";
- anchors.fill: parent;
- smooth: true
- opacity:0.7
- }
- Rectangle {
- id: graph
- width: structure.width * 0.7
- height: structure.height * 0.55
- x: structure.width * 0.22
- anchors.verticalCenter: parent.verticalCenter
- color: "transparent"
- Rectangle {
- id: graphRect
- border.width: 2
- border.color: style.borderColor
- width: parent.width - border.width
- height: parent.height - border.width
- x: border.width / 2
- color:"transparent"
- CLHistogram {
- id: histogram
- width: parent.width - parent.border.width/2
- height: parent.height - parent.border.width/2
- x: parent.border.width / 2
- y: parent.border.width / 2
- style: structure.style
- colorWhenDefault: structure.style.textColor
- gradientDefaultOn: false
- Component.onCompleted: Graph.onStartUp()
- gradientWhenDefault: style.gradientWhenDefault
- }
- }
- }
- Text {
- text: histogram.maxValue + " - "
- verticalAlignment: Text.AlignVCenter
- anchors.right: graph.left
- anchors.verticalCenter: graph.top
- font.pixelSize: 1 + Math.round( 19 * (structure.height/424) )
- color: structure.style.textColor
- }
- Text {
- text: Math.round(histogram.maxValue*0.75) + " - "
- verticalAlignment: Text.AlignVCenter
- anchors.right: graph.left
- anchors.verticalCenter: graph.verticalCenter
- anchors.verticalCenterOffset: -Math.round(graph.height*0.25)
- font.pixelSize: 1 + Math.round( 19 * (structure.height/424) )
- color: structure.style.textColor
- }
- Text {
- text: Math.round(histogram.maxValue*0.5) + " - "
- verticalAlignment: Text.AlignVCenter
- anchors.right: graph.left
- anchors.verticalCenter: graph.verticalCenter
- font.pixelSize: 1 + Math.round( 19 * (structure.height/424) )
- color: structure.style.textColor
- }
- Text {
- text: Math.round(histogram.maxValue*0.25) + " - "
- verticalAlignment: Text.AlignVCenter
- anchors.right: graph.left
- anchors.verticalCenter: graph.verticalCenter
- anchors.verticalCenterOffset: Math.round(graph.height*0.25)
- font.pixelSize: 1 + Math.round( 19 * (structure.height/424) )
- color: structure.style.textColor
- }
- Text {
- text: "0 - "
- verticalAlignment: Text.AlignVCenter
- anchors.right: graph.left
- anchors.verticalCenter: graph.bottom
- anchors.verticalCenterOffset: -3
- font.pixelSize: 1 + Math.round( 19 * (structure.height/424) )
- color: structure.style.textColor
- }
- Rectangle {
- id: controls
- gradient: style.gradientWhenDefault //Blue{}
- height: Math.round( 40 * (graph.height / (424*0.55)) )
- anchors.left: graph.left
- anchors.right: graph.right
- anchors.bottom: graph.top
- anchors.bottomMargin: 0
- Text {
- id: weekYear
- text: "Year " + Graph.yearNumber()
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.8 );
- anchors.centerIn: parent
- font.bold: true
- }
- Rectangle {
- height: parent.height
- width: parent.width / 2
- anchors.left: parent.left
- color: "transparent"
- Text {
- text: "<<"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.8 );
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.leftMargin: 5
- font.bold: true
- }
- MouseArea {
- anchors.fill: parent
- onClicked: Graph.showWeek( Graph.currentWeek + 1 );
- }
- }
- Rectangle {
- height: parent.height
- width: parent.width / 2
- anchors.right: parent.right
- color: "transparent"
- Text {
- text: ">>"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.8 );
- anchors.verticalCenter: parent.verticalCenter
- anchors.right: parent.right
- anchors.rightMargin: 5
- font.bold: true
- }
- MouseArea {
- anchors.fill: parent
- onClicked: Graph.showWeek( Graph.currentWeek - 1 );
- }
- }
- }
- Rectangle {
- id: dayNames
- gradient: structure.style.gradientWhenDefault
- height: Math.round( 40 * (graph.height / (424*0.55)) )
- anchors.left: graph.left
- anchors.right: graph.right
- anchors.top: graph.bottom
- anchors.topMargin: -1
- Rectangle {
- height: parent.height
- width: histogram.width - 2*histogram.spacing
- x: histogram.spacing
- anchors.centerIn: parent
- color: "transparent"
- Row {
- anchors.fill: parent
- spacing: histogram.spacing
- Text {
- text: "J"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.5 );
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- width: Math.round( ( (parent.width) - (histogram.spacing*(histogram.countVisible()-1)) ) / histogram.countVisible() );
- }
- Text {
- text: "F"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.5 );
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- width: Math.round( ( (parent.width) - (histogram.spacing*(histogram.countVisible()-1)) ) / histogram.countVisible() );
- }
- Text {
- text: "M"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.5 );
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- width: Math.round( ( (parent.width) - (histogram.spacing*(histogram.countVisible()-1)) ) / histogram.countVisible() );
- }
- Text {
- text: "A"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.5 );
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- width: Math.round( ( (parent.width) - (histogram.spacing*(histogram.countVisible()-1)) ) / histogram.countVisible() );
- }
- Text {
- text: "M"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.5 );
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- width: Math.round( ( (parent.width) - (histogram.spacing*(histogram.countVisible()-1)) ) / histogram.countVisible() );
- }
- Text {
- text: "J"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.5 );
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- width: Math.round( ( (parent.width) - (histogram.spacing*(histogram.countVisible()-1)) ) / histogram.countVisible() );
- }
- Text {
- text: "J"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.5 );
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- width: Math.round( ( (parent.width) - (histogram.spacing*(histogram.countVisible()-1)) ) / histogram.countVisible() );
- }
- Text {
- text: "A"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.5 );
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- width: Math.round( ( (parent.width) - (histogram.spacing*(histogram.countVisible()-1)) ) / histogram.countVisible() );
- }
- Text {
- text: "S"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.5 );
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- width: Math.round( ( (parent.width) - (histogram.spacing*(histogram.countVisible()-1)) ) / histogram.countVisible() );
- }
- Text {
- text: "O"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.5 );
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- width: Math.round( ( (parent.width) - (histogram.spacing*(histogram.countVisible()-1)) ) / histogram.countVisible() );
- }
- Text {
- text: "N"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.5 );
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- width: Math.round( ( (parent.width) - (histogram.spacing*(histogram.countVisible()-1)) ) / histogram.countVisible() );
- }
- Text {
- text: "D"
- color: structure.style.textColor
- font.pixelSize: 1 + Math.round( parent.height * 0.5 );
- font.bold: true
- horizontalAlignment: Text.AlignHCenter
- width: Math.round( ( (parent.width) - (histogram.spacing*(histogram.countVisible()-1)) ) / histogram.countVisible() );
- }
- }
- }
- }
- }
- Item {
- id: viewi2
- width: parent.width
- height: parent.height * 1.04
- anchors.bottom: parent.bottom
- property string title : "Current consumption"
- Image {
- source: "images/control_bg_trans_420x275_png.png";
- anchors.fill: parent;
- smooth: true
- opacity:0.7
- }
- MouseArea {
- anchors.fill: parent;
- }
- Text {
- text: "Current consumption (kWh)"
- font.pointSize:0.001 + structure.height*0.04
- color: structure.style.textColor
- x: Math.round( structure.width * 0.05 )
- y: Math.round( structure.height * 0.2 )
- }
- Grid {
- id: grid
- columns: 2
- spacing: 2
- x: Math.round( structure.width * 0.10 )
- y: Math.round( structure.height * 0.3 )
- z: 2
- Text { text: "Lights "; font.pixelSize: 1 + Math.round( 21 * (structure.height / 404) ); horizontalAlignment: Text.AlignLeft; color: structure.style.textColor; }
- Text { text: " 60"; id: lightsW; font.pixelSize: 1 + Math.round( 21 * (structure.height / 404) ); horizontalAlignment: Text.AlignRight; color: structure.style.textColor; }
- Text { text: "AV "; font.pixelSize: 1 + Math.round( 21 * (structure.height / 404) ); horizontalAlignment: Text.AlignLeft; color: structure.style.textColor; }
- Text { text: " 60"; id: avW; font.pixelSize: 1 + Math.round( 21 * (structure.height / 404) ); horizontalAlignment: Text.AlignRight; color: structure.style.textColor; }
- Text { text: "Appliances "; font.pixelSize: 1 + Math.round( 21 * (structure.height / 404) ); horizontalAlignment: Text.AlignLeft; color: structure.style.textColor; }
- Text { text: " 60"; id: machinesW; font.pixelSize: 1 + Math.round( 21 * (structure.height / 404) ); horizontalAlignment: Text.AlignRight; color: structure.style.textColor; }
- Text { text: "Sauna "; font.pixelSize: 1 + Math.round( 21 * (structure.height / 404) ); horizontalAlignment: Text.AlignLeft; color: structure.style.textColor; }
- Text { text: " 60"; id: saunaW; font.pixelSize: 1 + Math.round( 21 * (structure.height / 404) ); horizontalAlignment: Text.AlignRight; color: structure.style.textColor; }
- Text { text: "Heating "; font.pixelSize: 1 + Math.round( 21 * (structure.height / 404) ); horizontalAlignment: Text.AlignLeft; color: structure.style.textColor; }
- Text { text: " 60"; id: heatingW; font.pixelSize: 1 + Math.round( 21 * (structure.height / 404) ); horizontalAlignment: Text.AlignRight; color: structure.style.textColor; }
- Text { text: "Misc. "; font.pixelSize: 1 + Math.round( 21 * (structure.height / 404) ); horizontalAlignment: Text.AlignLeft; color: structure.style.textColor; }
- Text { text: " 60"; id: miscW; font.pixelSize: 1 + Math.round( 21 * (structure.height / 404) ); horizontalAlignment: Text.AlignRight; color: structure.style.textColor; }
- }
- CLHistogram {
- id: histogram2
- height: structure.width - (grid.x) - (20 * (structure.width/518)) //structure.width - (grid.x + grid.width + 15) - (20 * (structure.width/518))
- width: grid.height
- spacing: 1
- clip: false
- anchors.verticalCenter: grid.verticalCenter
- x: grid.x - ( (histogram2.width - histogram2.height) / 2) //grid.x + grid.width - ( (histogram2.width - histogram2.height) / 2) + 15
- rotation: 90
- style: structure.style
- colorWhenDefault:style.bgColor
- z: 1
- }
- Rectangle {
- id: ruler
- color: "black"
- width: grid.width + 20
- anchors.horizontalCenter: grid.horizontalCenter
- height: 1
- anchors.top: grid.bottom
- anchors.topMargin: 4
- }
- Text {
- text: "Total"
- font.pixelSize: 1 + Math.round( 21 * (structure.height / 424) )
- anchors.top: ruler.bottom
- anchors.topMargin: 6
- anchors.left: ruler.left
- anchors.leftMargin: 10
- color: structure.style.textColor
- }
- Text {
- id: total
- text: "600"
- font.pixelSize: 1 + Math.round( 21 * (structure.height / 424) )
- anchors.top: ruler.bottom
- anchors.topMargin: 6
- anchors.right: ruler.right
- anchors.rightMargin: 10
- color: structure.style.textColor
- }
- }
- }
- }
|