2 * Copyright 2014-2015 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
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 Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18import Ubuntu.Components 1.1
19import Unity.Application 0.1
24 // to be read from outside
25 readonly property bool fullscreen: application ? application.fullscreen : false
26 property alias interactive: sessionContainer.interactive
27 property bool orientationChangesEnabled: d.supportsSurfaceResize ? d.surfaceOldEnoughToBeResized : true
29 // to be set from outside
30 property QtObject application
31 property int surfaceOrientationAngle
36 // helpers so that we don't have to check for the existence of an application everywhere
37 // (in order to avoid breaking qml binding due to a javascript exception)
38 readonly property string name: root.application ? root.application.name : ""
39 readonly property url icon: root.application ? root.application.icon : ""
40 readonly property int applicationState: root.application ? root.application.state : -1
41 readonly property string splashTitle: root.application ? root.application.splashTitle : ""
42 readonly property url splashImage: root.application ? root.application.splashImage : ""
43 readonly property bool splashShowHeader: root.application ? root.application.splashShowHeader : true
44 readonly property color splashColor: root.application ? root.application.splashColor : "#00000000"
45 readonly property color splashColorHeader: root.application ? root.application.splashColorHeader : "#00000000"
46 readonly property color splashColorFooter: root.application ? root.application.splashColorFooter : "#00000000"
47 readonly property url defaultScreenshot: (root.application && root.application.defaultScreenshot !== undefined) ? root.application.defaultScreenshot : ""
49 // Whether the Application had a surface before but lost it.
50 property bool hadSurface: sessionContainer.surfaceContainer.hadSurface
52 property bool needToTakeScreenshot:
53 sessionContainer.surface && d.surfaceInitialized && screenshotImage.status === Image.Null
54 && d.applicationState === ApplicationInfoInterface.Stopped
55 onNeedToTakeScreenshotChanged: {
56 if (needToTakeScreenshot) {
57 screenshotImage.take();
61 //FIXME - this is a hack to avoid the first few rendered frames as they
62 // might show the UI accommodating due to surface resizes on startup.
63 // Remove this when possible
64 property bool surfaceInitialized: false
66 property bool supportsSurfaceResize:
68 ((application.supportedOrientations & Qt.PortraitOrientation)
69 || (application.supportedOrientations & Qt.InvertedPortraitOrientation))
71 ((application.supportedOrientations & Qt.LandscapeOrientation)
72 || (application.supportedOrientations & Qt.InvertedLandscapeOrientation))
74 property bool surfaceOldEnoughToBeResized: false
80 onTriggered: { if (sessionContainer.surface) {d.surfaceInitialized = true;} }
86 onTriggered: { if (stateGroup.state === "surface") { d.surfaceOldEnoughToBeResized = true; } }
91 objectName: "screenshotImage"
92 source: d.defaultScreenshot
94 antialiasing: !root.interactive
97 // Format: "image://application/$APP_ID/$CURRENT_TIME_MS"
98 // eg: "image://application/calculator-app/123456"
99 var timeMs = new Date().getTime();
100 source = "image://application/" + root.application.appId + "/" + timeMs;
103 // Save memory by using a half-resolution (thus quarter size) screenshot
104 sourceSize.width: root.width / 2
105 sourceSize.height: root.height / 2
113 sourceComponent: Component {
116 title: d.splashTitle ? d.splashTitle : d.name
117 imageSource: d.splashImage
119 showHeader: d.splashShowHeader
120 backgroundColor: d.splashColor
121 headerColor: d.splashColorHeader
122 footerColor: d.splashColorFooter
129 // A fake application might not even have a session property.
130 session: application && application.session ? application.session : null
133 surfaceOrientationAngle: application && application.rotatesWindowContents ? root.surfaceOrientationAngle : 0
136 if (sessionContainer.surface) {
137 surfaceInitTimer.start();
139 d.surfaceInitialized = false;
148 objectName: "applicationWindowStateGroup"
153 d.hadSurface && (!sessionContainer.surface || !d.surfaceInitialized)
155 screenshotImage.status !== Image.Ready
160 !d.hadSurface && (!sessionContainer.surface || !d.surfaceInitialized)
162 screenshotImage.status !== Image.Ready
167 (sessionContainer.surface && d.surfaceInitialized)
169 (d.applicationState !== ApplicationInfoInterface.Stopped
170 || screenshotImage.status !== Image.Ready)
175 screenshotImage.status === Image.Ready
177 (d.applicationState === ApplicationInfoInterface.Stopped
178 || !sessionContainer.surface || !d.surfaceInitialized)
184 from: ""; to: "splashScreen"
185 PropertyAction { target: splashLoader; property: "active"; value: true }
186 PropertyAction { target: sessionContainer.surfaceContainer
187 property: "visible"; value: false }
190 from: "splashScreen"; to: "surface"
191 SequentialAnimation {
192 PropertyAction { target: sessionContainer.surfaceContainer
193 property: "opacity"; value: 0.0 }
194 PropertyAction { target: sessionContainer.surfaceContainer
195 property: "visible"; value: true }
196 UbuntuNumberAnimation { target: sessionContainer.surfaceContainer; property: "opacity";
198 duration: UbuntuAnimation.BriskDuration }
199 ScriptAction { script: {
200 splashLoader.active = false;
201 surfaceIsOldTimer.start();
206 from: "surface"; to: "splashScreen"
207 SequentialAnimation {
208 ScriptAction { script: {
209 surfaceIsOldTimer.stop();
210 d.surfaceOldEnoughToBeResized = false;
211 splashLoader.active = true;
212 sessionContainer.surfaceContainer.visible = true;
214 UbuntuNumberAnimation { target: splashLoader; property: "opacity";
216 duration: UbuntuAnimation.BriskDuration }
217 PropertyAction { target: sessionContainer.surfaceContainer
218 property: "visible"; value: false }
222 from: "surface"; to: "screenshot"
223 SequentialAnimation {
224 ScriptAction { script: {
225 surfaceIsOldTimer.stop();
226 d.surfaceOldEnoughToBeResized = false;
227 screenshotImage.visible = true;
229 UbuntuNumberAnimation { target: screenshotImage; property: "opacity";
231 duration: UbuntuAnimation.BriskDuration }
232 ScriptAction { script: {
233 sessionContainer.surfaceContainer.visible = false;
234 if (sessionContainer.session) { sessionContainer.session.release(); }
239 from: "screenshot"; to: "surface"
240 SequentialAnimation {
241 PropertyAction { target: sessionContainer.surfaceContainer
242 property: "visible"; value: true }
243 UbuntuNumberAnimation { target: screenshotImage; property: "opacity";
245 duration: UbuntuAnimation.BriskDuration }
246 ScriptAction { script: {
247 screenshotImage.visible = false;
248 screenshotImage.source = "";
249 surfaceIsOldTimer.start();
254 from: "splashScreen"; to: "screenshot"
255 SequentialAnimation {
256 PropertyAction { target: screenshotImage
257 property: "visible"; value: true }
258 UbuntuNumberAnimation { target: screenshotImage; property: "opacity";
260 duration: UbuntuAnimation.BriskDuration }
261 PropertyAction { target: splashLoader; property: "active"; value: false }
265 from: "surface"; to: "void"
266 ScriptAction { script: {
267 surfaceIsOldTimer.stop();
268 d.surfaceOldEnoughToBeResized = false;
269 sessionContainer.surfaceContainer.visible = false;
270 if (sessionContainer.session) { sessionContainer.session.release(); }
274 from: "void"; to: "surface"
275 SequentialAnimation {
276 PropertyAction { target: sessionContainer.surfaceContainer; property: "opacity"; value: 0.0 }
277 PropertyAction { target: sessionContainer.surfaceContainer; property: "visible"; value: true }
278 UbuntuNumberAnimation { target: sessionContainer.surfaceContainer; property: "opacity";
280 duration: UbuntuAnimation.BriskDuration }
281 ScriptAction { script: {
282 surfaceIsOldTimer.start();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list