on xenial help sign in
Drop UbuntuShapeForItem.qml and use a temporary workaround in RunningApplicationTile.qml.
commitc3b9479bfe90fe4c8b76c69f840dd6201656ded8 authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 27 Jun 2013, 16:14 (13 years ago) parent72a85d6
2 files changed+23−101
Components/UbuntuShapeForItem.qml−89 Dash/Apps/RunningApplicationTile.qml+23−12
Components/UbuntuShapeForItem.qmldeleted−89
@@ -1,89 +0,0 @@
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 as Theming
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−Item {
27− id: shape
28−
29− Theming.ItemStyle.class: "UbuntuShape-radius-" + radius
30−
31− property string radius: "small"
32− property url maskSource: Theming.ComponentUtils.style(shape, "maskSource", "")
33− property url borderSource: Theming.ComponentUtils.style(shape, "borderIdle", "")
34− property Item image
35−
36− implicitWidth: units.gu(8)
37− implicitHeight: units.gu(8)
38−
39− onWidthChanged: __updateImageDimensions()
40− onHeightChanged: __updateImageDimensions()
41− onImageChanged: __updateImageDimensions()
42−
43− function __updateImageDimensions() {
44− if (!image) return;
45− image.width = shape.width;
46− image.height = shape.height;
47− image.visible = false;
48− }
49−
50− ShaderEffect {
51− anchors.fill: parent
52− visible: shape.image
53−
54− property ShaderEffectSource mask: ShaderEffectSource {
55− sourceItem: BorderImage {
56− width: shape.width
57− height: shape.height
58− source: shape.maskSource
59− visible: false
60− }
61− }
62−
63− property ShaderEffectSource image: ShaderEffectSource {
64− sourceItem: shape.image
65− }
66−
67− fragmentShader:
68− "
69− varying highp vec2 qt_TexCoord0;
70− uniform lowp float qt_Opacity;
71− uniform sampler2D mask;
72− uniform sampler2D image;
73−
74− void main(void)
75− {
76− lowp vec4 maskColor = texture2D(mask, qt_TexCoord0.st);
77− lowp vec4 imageColor = texture2D(image, qt_TexCoord0.st);
78− gl_FragColor = imageColor * maskColor.a * qt_Opacity;
79− }
80− "
81− }
82−
83− BorderImage {
84− id: border
85−
86− anchors.fill: parent
87− source: shape.borderSource
88− }
89−}
Dash/Apps/RunningApplicationTile.qml+23−12
@@ -57,30 +57,41 @@ AbstractButton {
5757 applicationImage.updateFromCache();
5858 }
5959
60− // FIXME: should use UbuntuShape from SDK
61− UbuntuShapeForItem {
60+ // START-FIXME: should use UbuntuShape from SDK, when it can
61+ // shape arbitrary items.
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 {
6279 id: shapedApplicationImage
6380 anchors {
6481 top: parent.top
6582 horizontalCenter: parent.horizontalCenter
6683 }
6784
85+ radius: "medium"
86+ image: ses
87+
6888 // FIXME: width and height should be defined according to the
6989 // application window's aspect ratio.
7090 width: (application.stage === ApplicationInfo.MainStage && __sideStageEnabled) ?
7191 units.gu(22) : units.gu(11)
7292 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
8393 }
94+ // END-FIXME
8495
8596 UbuntuShape {
8697 id: borderPressed