StatusDisplay.qml 2.35 KB
Newer Older
1
2
3
4
5
6
import QtQuick 1.0
import "MainView.js" as Plotter

Rectangle {
    id: statusDisplay

7
    property real percentage : root.progress
8

9
    width: Math.max(200, statusText.width+20);
10
11
12
13
14
15
16
17
18
19
20
21
22
    height: displayColumn.height + 20

    visible: false;

    color: "#CCD0CC"
    border.width: 1
    border.color: "#AAAEAA";
    radius: 4

    Column {
        id: displayColumn
        y: 10
        spacing: 5
23
        width: parent.width
24
25
26
        Text {
            id: statusText
            horizontalAlignment: "AlignHCenter"
27
            anchors.horizontalCenter: parent.horizontalCenter
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
        }

        Rectangle {
            id: progressBar

            visible: false

            width: statusDisplay.width - 20
            height: 20
            x: 10
            color: "transparent"
            border.width: 1
            border.color: "#AAAEAA"
            Rectangle {
                x: 1
                y: 1
                width: (parent.width-1) * statusDisplay.percentage
                color: Qt.rgba(0.37 + 0.2*(1 - statusDisplay.percentage), 0.58, 0.37, 1);
                height: parent.height-1
            }
        }
    }

    states: [
        // no data available
        State {
54
            when: (root.eventCount == 0) && !elapsedTimer.running;
55
56
57
58
59
60
61
62
63
            PropertyChanges {
                target: statusDisplay
                visible: true
            }

            PropertyChanges {
                target: statusText
                text: qsTr("No QML events recorded");
            }
64
            onCompleted: root.clearDisplay();
65
66
67
        },
        // running app
        State {
68
            when: elapsedTimer.running;
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
            PropertyChanges {
                target: statusDisplay
                visible: true
            }

            PropertyChanges {
                target: statusText
                text: qsTr("Profiling application");
            }
        },
        // loading data
        State {
            name: "loading"
            when: (!root.dataAvailable) && (root.eventCount > 0);
            PropertyChanges {
                target: statusDisplay
                visible: true
            }

            PropertyChanges {
                target: statusText
                text: qsTr("Loading data");
            }

            PropertyChanges {
                target: progressBar
                visible: true
            }
        }
    ]

}