@@ -0,0 +1,107 @@
1+/*
2+ * Copyright 2014 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.1
18+import QtQuick.Layouts 1.1
19+import Ubuntu.Components 0.1
20+import Unity.Application 0.1
21+
22+ColumnLayout {
23+ id: root
24+
25+ property var session
26+ property var childSessions: session ? session.childSessions : 0
27+ property bool removable: false
28+
29+ property var screenshotIds: [ "gallery", "map", "facebook", "camera", "browser", "music", "twitter"]
30+
31+ Column {
32+ Layout.fillWidth: true
33+ visible: repeater.count
34+ spacing: units.gu(1)
35+
36+ Repeater {
37+ id: repeater
38+ model: root.childSessions
39+ delegate: Rectangle {
40+ border {
41+ color: "black"
42+ width: 1
43+ }
44+ anchors {
45+ left: parent.left
46+ right: parent.right
47+ leftMargin: units.gu(1)
48+ rightMargin: units.gu(1)
49+ }
50+ height: loader.height
51+
52+ Rectangle {
53+ anchors.fill: parent
54+ color: Qt.rgba(Math.random(), Math.random(), Math.random(), 0.4 )
55+ }
56+
57+ Loader {
58+ id: loader
59+ visible: status == Loader.Ready
60+ source: Qt.resolvedUrl("RecursingChildSessionControl.qml")
61+
62+ anchors {
63+ left: parent.left
64+ right: parent.right
65+ }
66+
67+ onLoaded: {
68+ item.session = modelData;
69+ item.removable = true;
70+ }
71+ }
72+ }
73+ }
74+ }
75+
76+ Item {
77+ Layout.fillWidth: true
78+ Layout.preferredHeight: buttonLayout.height + units.gu(1)
79+
80+ RowLayout {
81+ id: buttonLayout
82+ anchors {
83+ top: parent.top; topMargin: units.gu(0.5)
84+ left: parent.left; leftMargin: units.gu(1)
85+ }
86+
87+ Button {
88+ enabled: root.session
89+ text: removable ? "Remove" : "Release"
90+ onClicked: {
91+ if (removable) root.session.removed();
92+ else root.session.release();
93+ }
94+ }
95+
96+ Button {
97+ enabled: root.session !== null
98+ text: "Add Child"
99+ onClicked: {
100+ var screenshot = Math.round(Math.random() * screenshotIds.length);
101+ console.log(screenshot)
102+ var session = ApplicationTest.addChildSession(root.session, root.screenshotIds[screenshot]);
103+ }
104+ }
105+ }
106+ }
107+}