summaryrefslogtreecommitdiffstats
path: root/weather-qml/ForecastView.qml
blob: 9aace9cf021688a2c514f9b47ce01abca964f673 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import Qt 4.6

Item {
    id: root
    anchors.fill: parent

    signal present();

    property bool isDay : true;
    property bool isClear : true;
    property string cityName;
    property int lowTemperature;
    property int highTemperature;
    property int currentTemperature;

    function scaledX(x) {
        return x * window.scaleFactorX;
    }

    function scaledY(y) {
        return y * window.scaleFactorY;
    }

    Image {
        id: bg
        x: root.width / 2 - bg.width / 2
        source: root.isDay ? (root.isClear ? "images/bg_day_clear.png" : "images/bg_day_rain.png")
                       : (root.isClear ? "images/bg_night_clear.png" : "images/bg_night_rain.png");
    }

    ForecastLabel {
        id: display1
        x: 110
        z: 99
        width: 260
        height: 180
        anchors.bottomMargin: 115
        anchors.bottom: parent.bottom
        currentTemperature: root.currentTemperature
        lowTemperature: root.lowTemperature
        highTemperature: root.highTemperature
    }

    Text {
        id: cityLabel
        z: 99
        text: root.cityName
        font.family: "Nokia Sans"
        font.pixelSize: 40
        color: "#ffffff"
        horizontalAlignment: "AlignHCenter"
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.leftMargin: 50
        anchors.bottomMargin: 76
        anchors.bottom: parent.bottom
    }

    Connections { target: parent; onPresent: present(); }
}