~ubuntu-branches/ubuntu/saucy/plasma-mobile/saucy

« back to all changes in this revision

Viewing changes to containments/appletstrip/contents/ui/PlasmoidContainer.qml

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-12-22 01:58:11 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20121222015811-zqq9spgc9e0gin07
Tags: 3.0-0ubuntu1
* New upstream release
* Update install files
* Run wrap-and-sort
* Add plasma-mobile-dev
* Drop plasma-active-keyboardcontainer

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    id: plasmoidContainer
26
26
    anchors.top: appletsRow.top
27
27
    anchors.bottom: appletsRow.bottom
 
28
    width: main.width/appletColumns
28
29
 
29
30
    //FIXME: this is due to the disappear anim managed by the applet itslef
30
31
    scale: applet.scale
31
32
 
32
 
    property QGraphicsWidget applet
 
33
    property alias applet: appletContainer.applet
33
34
 
34
35
    onAppletChanged: {
35
36
        applet.appletDestroyed.connect(appletDestroyed)
36
 
        applet.parent = plasmoidContainer
37
 
 
38
37
        appletTimer.running = true
39
38
    }
40
39
 
41
 
    //FIXME: this delay is because backgroundHints gets updated only after a while in qml applets
 
40
    MobileComponents.AppletContainer {
 
41
        id: appletContainer
 
42
 
 
43
        anchors {
 
44
            fill: parent
 
45
            leftMargin: parent.margins.left
 
46
            rightMargin: parent.margins.right
 
47
            topMargin: parent.margins.top
 
48
            bottomMargin: parent.margins.bottom + runButton.height
 
49
        }
 
50
        onAppletChanged: {
 
51
            appletTimer.running = true
 
52
        }
 
53
    }
 
54
 
 
55
 
42
56
    Timer {
43
57
        id: appletTimer
44
58
        interval: 250
48
62
            if (applet.backgroundHints != 0) {
49
63
                plasmoidContainer.imagePath = "widgets/background"
50
64
            } else {
51
 
                plasmoidContainer.imagePath = "invalid"
 
65
                plasmoidContainer.imagePath = "widgets/translucentbackground"
52
66
            }
53
67
            applet.backgroundHints = "NoBackground"
54
 
 
55
 
            applet.x = plasmoidContainer.margins.left
56
 
            applet.y = plasmoidContainer.margins.top
57
 
            height = appletsRow.height
58
 
            width = Math.max(main.width/appletColumns, applet.minimumSize.width + plasmoidContainer.margins.left + plasmoidContainer.margins.right)
59
 
            applet.width = width - plasmoidContainer.margins.left - plasmoidContainer.margins.right
60
 
            applet.height = height - plasmoidContainer.margins.top - plasmoidContainer.margins.bottom - runButton.height
61
68
        }
62
69
    }
63
70
 
 
71
 
64
72
    function appletDestroyed()
65
73
    {
66
74
        plasmoidContainer.destroy()
104
112
        }
105
113
        z: applet.z + 1
106
114
    }
107
 
 
108
 
    onHeightChanged: {
109
 
        if (applet) {
110
 
            applet.height = height
111
 
            var ratio = applet.preferredSize.width/applet.preferredSize.height
112
 
            applet.width = main.width/appletColumns
113
 
            width = applet.width
114
 
        }
115
 
    }
116
115
}