on xenial help sign in
Bring back UbuntuShapeForItem.qml
bff9fafMichał Sawicz
Components/UbuntuShapeForItem.qmlnew file+46
@@ -0,0 +1,46 @@
1+/*
2+ * Copyright (C) 2012 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.0
18+import Ubuntu.Components 0.1
19+
20+/* FIXME: This component is duplicating the UbuntuShape from the SDK, but shapes more
21+ * general (Item-based) components. This ability should be incorporated into the SDK's
22+ * UbuntuShape so this file can be removed.
23+ * Bug: https://bugs.launchpad.net/tavastia/+bug/1089595
24+ */
25+
26+
27+Item {
28+ id: root
29+
30+ property alias radius: shape.radius
31+ property alias image: source.sourceItem
32+
33+ ShaderEffectSource {
34+ id: source
35+ width: 1
36+ height: 1
37+ hideSource: true
38+ }
39+
40+ Shape {
41+ id: shape
42+ image: source
43+
44+ anchors.fill: parent
45+ }
46+}
Dash/Apps/RunningApplicationTile.qml+12−23
@@ -57,41 +57,30 @@ AbstractButton {
57 applicationImage.updateFromCache();
57 applicationImage.updateFromCache();
58 }
58 }
59
59
60− // START-FIXME: should use UbuntuShape from SDK, when it can
60+ // FIXME: should use UbuntuShape from SDK
61− // shape arbitrary items.
61+ UbuntuShapeForItem {
62−
63− ShaderEffectSource {
64− id: ses
65− sourceItem: ApplicationImage {
66− id: applicationImage
67− source: application
68− width: shapedApplicationImage.width
69− height: shapedApplicationImage.height
70− fillMode: ApplicationImage.PreserveAspectCrop
71− }
72−
73− width: 1
74− height: 1
75− hideSource: true
76− }
77−
78− Shape {
79 id: shapedApplicationImage
62 id: shapedApplicationImage
80 anchors {
63 anchors {
81 top: parent.top
64 top: parent.top
82 horizontalCenter: parent.horizontalCenter
65 horizontalCenter: parent.horizontalCenter
83 }
66 }
84
67
85− radius: "medium"
86− image: ses
87−
88 // FIXME: width and height should be defined according to the
68 // FIXME: width and height should be defined according to the
89 // application window's aspect ratio.
69 // application window's aspect ratio.
90 width: (application.stage === ApplicationInfo.MainStage && __sideStageEnabled) ?
70 width: (application.stage === ApplicationInfo.MainStage && __sideStageEnabled) ?
91 units.gu(22) : units.gu(11)
71 units.gu(22) : units.gu(11)
92 height: (__sideStageEnabled) ? units.gu(22) : units.gu(19)
72 height: (__sideStageEnabled) ? units.gu(22) : units.gu(19)
73+ radius: "medium"
74+ image: applicationImage
75+ }
76+
77+ ApplicationImage {
78+ id: applicationImage
79+ source: application
80+ width: shapedApplicationImage.width
81+ height: shapedApplicationImage.height
82+ fillMode: ApplicationImage.PreserveAspectCrop
93 }
83 }
94− // END-FIXME
95
84
96 UbuntuShape {
85 UbuntuShape {
97 id: borderPressed
86 id: borderPressed