~ubuntu-branches/ubuntu/vivid/qtcreator-plugin-ubuntu/vivid

« back to all changes in this revision

Viewing changes to share/qtcreator/ubuntu/qml/Components/FeatureStateItem.qml

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Benjamin Zeller
  • Date: 2015-01-30 06:05:59 UTC
  • mfrom: (1.1.81)
  • Revision ID: package-import@ubuntu.com-20150130060559-1kirdtmm6bl6eb26
Tags: 3.1.1+15.04.20150130-0ubuntu1
[ Benjamin Zeller ]
Refactoring of the publish Tab

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
import QtQuick.Layouts 1.0
 
3
import Ubuntu.Components 1.0
 
4
import Ubuntu.Components.ListItems 1.0 as ListItem
 
5
import Ubuntu.DevicesModel 0.1
 
6
 
 
7
ListItem.Standard {
 
8
    id: item
 
9
    property var input: null
 
10
    property string inputRole
 
11
    property alias checkable: switchbox.enabled
 
12
 
 
13
    onInputChanged: {
 
14
        if(input == FeatureState.Available)
 
15
            switchbox.checked = true;
 
16
        else
 
17
            switchbox.checked = false;
 
18
    }
 
19
 
 
20
    selected: false
 
21
    control: Row {
 
22
        ActivityIndicator {
 
23
            visible: input === FeatureState.Unknown
 
24
            running: visible
 
25
        }
 
26
        Switch {
 
27
            id: switchbox
 
28
            visible: input !== FeatureState.Unknown
 
29
            checked: input === FeatureState.Available
 
30
            enabled: checkable
 
31
            onCheckedChanged: {
 
32
                if (checked && input == FeatureState.NotAvailable) {
 
33
                    devicesModel.set(index,inputRole,true);
 
34
                    checked = true;
 
35
                }
 
36
                else if ((!checked) && input == FeatureState.Available) {
 
37
                    devicesModel.set(index,inputRole,false);
 
38
                    checked = false;
 
39
                }
 
40
            }
 
41
        }
 
42
    }
 
43
}