File: example_networking_status.qml

package info (click to toggle)
lomiri-indicator-network 1.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,164 kB
  • sloc: cpp: 23,705; xml: 2,868; python: 652; ansic: 224; sh: 54; makefile: 21
file content (67 lines) | stat: -rw-r--r-- 2,028 bytes parent folder | download | duplicates (3)
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
/*
 * Copyright (C) 2014 Canonical Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


import QtQuick 2.0
import Lomiri.Components 0.1
import Lomiri.Connectivity 1.0

MainView {
    id: root
    objectName: "mainView"
    applicationName: "Connectivity"

    width: units.gu(100)
    height: units.gu(75)

    property real margins: units.gu(2)
    property real buttonWidth: units.gu(9)
    
    property var statusMap: ["Offline", "Connecting", "Online"]

    Connections {
        target: Connectivity

        // full status can be retrieved from the base C++ class
        // status property
        onStatusChanged: console.log("Status: " + statusMap[Connectivity.status])

        onOnlineChanged: console.log("Online: " + Connectivity.online)
    }

    Page {
        title: i18n.tr("Networking Status")

        Column {
            anchors.centerIn: parent
            Label {
                // use the online property
                text: Connectivity.online ? "Online" : "Not online"
                fontSize: "large"
            }
            Label {
                // use the status property
                text: "Status: " + statusMap[Connectivity.status]
                fontSize: "large"
            }
            Label {
                // use the limitedBandwidth property
                text: Connectivity.limitedBandwidth ? "Bandwidth limited" : "Bandwidth not limited"
                fontSize: "large"
            }
        }
    }
}