summaryrefslogtreecommitdiffstats
path: root/examples/applicationmanager/process-status/system-ui/ApplicationDisplay.qml
blob: 8c1b0b6b876bf91b76e2baafe4ffa6bbe488ab6a (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
61
62
63
64
65
66
67
68
69
70
71
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick 2.4
import QtApplicationManager.SystemUI 2.0
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11

Frame {
    id: root
    property string name
    property var application

    width: 450

    RowLayout {
        width: parent.width

        Column {
            id: iconAndText

            Image {
                source: root.application.icon
                MouseArea {
                    anchors.fill: parent
                    onClicked: root.application.runState === Am.Running ? application.stop() : application.start()
                }
            }
            Label {
                font.pixelSize: 18
                text: root.name
            }

        }

        Frame {
            opacity: root.application.runState === Am.Running ? 1 : 0
            Layout.fillWidth: true

            ColumnLayout {
                width: parent.width
                TabBar {
                    id: tabBar
                    Layout.fillWidth: true
                    TabButton {
                        text: "Stats"
                        font.pixelSize: 15
                    }
                    TabButton {
                        text: "CPU Graph"
                        font.pixelSize: 15
                    }
                }

                StackLayout {
                    Layout.fillWidth: true
                    currentIndex: tabBar.currentIndex
                    Stats {
                        application: root.application
                    }
                    CpuGraph {
                        application: root.application
                    }
                }
            }
        }

    }
}