on xenial help sign in
Redesign for pinned apps. Remove thindivider on top of ubuntu dash button (not needed anymore) Fixes: 1377100
050ec52Andrea Cimitan
qml/Launcher/LauncherDelegate.qml+20−33
@@ -27,7 +27,7 @@ Item {
27 property bool itemFocused: false
27 property bool itemFocused: false
28 property real maxAngle: 0
28 property real maxAngle: 0
29 property bool inverted: false
29 property bool inverted: false
30− property bool clipCorner: false
30+ property alias pinned: pin.visible
31
31
32 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
32 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
33 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
33 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
@@ -71,14 +71,31 @@ Item {
71 height: root.itemHeight - units.gu(1)
71 height: root.itemHeight - units.gu(1)
72 }
72 }
73
73
74+ Rectangle {
75+ id: pin
76+ anchors {
77+ left: iconShape.left
78+ top: iconShape.top
79+ topMargin: -units.dp(2)
80+ }
81+ width: units.gu(1)
82+ height: width
83+ radius: width / 2
84+ color: "white"
85+ }
86+
74 UbuntuShape {
87 UbuntuShape {
88+ id: countEmblem
75 objectName: "countEmblem"
89 objectName: "countEmblem"
90+
91+ readonly property real pinMargin: pin.visible ? pin.width + units.gu(1) - anchors.leftMargin : 0
92+
76 anchors {
93 anchors {
77 right: parent.right
94 right: parent.right
78 top: parent.top
95 top: parent.top
79 margins: units.dp(3)
96 margins: units.dp(3)
80 }
97 }
81− width: Math.min(root.itemWidth, Math.max(units.gu(2), countLabel.implicitWidth + units.gu(1)))
98+ width: Math.min(root.itemWidth - pinMargin, Math.max(units.gu(2), countLabel.implicitWidth + units.gu(1)))
82 height: units.gu(2)
99 height: units.gu(2)
83 color: UbuntuColors.orange
100 color: UbuntuColors.orange
84 visible: root.countVisible
101 visible: root.countVisible
@@ -92,7 +109,7 @@ Item {
92 // FIXME: verticalCenter seems to be off wee bit and QML doesn't have a centerLine
109 // FIXME: verticalCenter seems to be off wee bit and QML doesn't have a centerLine
93 // property for Text: https://bugreports.qt-project.org/browse/QTBUG-40479
110 // property for Text: https://bugreports.qt-project.org/browse/QTBUG-40479
94 anchors.verticalCenterOffset: -units.dp(.5)
111 anchors.verticalCenterOffset: -units.dp(.5)
95− width: root.itemWidth - units.gu(1)
112+ width: root.itemWidth - units.gu(1) - countEmblem.pinMargin
96 horizontalAlignment: Text.AlignHCenter
113 horizontalAlignment: Text.AlignHCenter
97 elide: Text.ElideRight
114 elide: Text.ElideRight
98 color: "white"
115 color: "white"
@@ -149,24 +166,6 @@ Item {
149 }
166 }
150 }
167 }
151
168
152− Item {
153− id: clipper
154− anchors.centerIn: parent
155− width: iconItem.width
156− height: iconItem.height
157− Rectangle {
158− anchors {
159− fill: parent
160− topMargin: -units.gu(2)
161− leftMargin: -units.gu(2)
162− rightMargin: -units.gu(2)
163− bottomMargin: units.gu(1.2)
164− }
165− color: "red"
166− rotation: root.rotation + 45
167− }
168− }
169−
170 ShaderEffect {
169 ShaderEffect {
171 id: transformEffect
170 id: transformEffect
172 anchors.centerIn: parent
171 anchors.centerIn: parent
@@ -176,7 +175,6 @@ Item {
176 property real itemOpacity: root.itemOpacity
175 property real itemOpacity: root.itemOpacity
177 property real brightness: Math.max(-1, root.brightness)
176 property real brightness: Math.max(-1, root.brightness)
178 property real angle: root.angle
177 property real angle: root.angle
179− property bool clipCorner: root.clipCorner
180 rotation: root.inverted ? 180 : 0
178 rotation: root.inverted ? 180 : 0
181
179
182 property variant source: ShaderEffectSource {
180 property variant source: ShaderEffectSource {
@@ -185,11 +183,6 @@ Item {
185 hideSource: true
183 hideSource: true
186 }
184 }
187
185
188− property var mask: ShaderEffectSource {
189− sourceItem: clipper
190− hideSource: true
191− }
192−
193 transform: [
186 transform: [
194 // Rotating 3 times at top/bottom because that increases the perspective.
187 // Rotating 3 times at top/bottom because that increases the perspective.
195 // This is a hack, but as QML does not support real 3D coordinates
188 // This is a hack, but as QML does not support real 3D coordinates
@@ -224,19 +217,13 @@ Item {
224 fragmentShader: "
217 fragmentShader: "
225 varying highp vec2 qt_TexCoord0;
218 varying highp vec2 qt_TexCoord0;
226 uniform sampler2D source;
219 uniform sampler2D source;
227− uniform sampler2D mask;
228 uniform lowp float brightness;
220 uniform lowp float brightness;
229 uniform lowp float itemOpacity;
221 uniform lowp float itemOpacity;
230− uniform bool clipCorner;
231 void main(void)
222 void main(void)
232 {
223 {
233 highp vec4 sourceColor = texture2D(source, qt_TexCoord0);
224 highp vec4 sourceColor = texture2D(source, qt_TexCoord0);
234− highp vec4 maskColor = texture2D(mask, qt_TexCoord0);
235 sourceColor.rgb = mix(sourceColor.rgb, vec3(step(0.0, brightness)), abs(brightness));
225 sourceColor.rgb = mix(sourceColor.rgb, vec3(step(0.0, brightness)), abs(brightness));
236 sourceColor *= itemOpacity;
226 sourceColor *= itemOpacity;
237− if (clipCorner) {
238− sourceColor *= maskColor.a;
239− }
240 gl_FragColor = sourceColor;
227 gl_FragColor = sourceColor;
241 }"
228 }"
242 }
229 }
qml/Launcher/LauncherPanel.qml+5−14
@@ -65,15 +65,6 @@ Rectangle {
65 }
65 }
66 }
66 }
67
67
68− ThinDivider {
69− anchors {
70− left: parent.left
71− right: parent.right
72− margins: -mainColumn.anchors.leftMargin
73− }
74− rotation: root.rotation
75− }
76−
77 Item {
68 Item {
78 anchors.left: parent.left
69 anchors.left: parent.left
79 anchors.right: parent.right
70 anchors.right: parent.right
@@ -158,7 +149,7 @@ Rectangle {
158 count: model.count
149 count: model.count
159 countVisible: model.countVisible
150 countVisible: model.countVisible
160 progress: model.progress
151 progress: model.progress
161− clipCorner: model.pinned
152+ pinned: model.pinned
162 itemFocused: model.focused
153 itemFocused: model.focused
163 inverted: root.inverted
154 inverted: root.inverted
164 z: -Math.abs(offset)
155 z: -Math.abs(offset)
@@ -469,10 +460,10 @@ Rectangle {
469 width: itemWidth
460 width: itemWidth
470 rotation: root.rotation
461 rotation: root.rotation
471 itemOpacity: 0.9
462 itemOpacity: 0.9
472− clipCorner: dndArea.draggedIndex > -1 &&
463+ pinned: dndArea.draggedIndex > -1 &&
473− LauncherModel.get(dndArea.draggedIndex).pinned &&
464+ LauncherModel.get(dndArea.draggedIndex).pinned &&
474− !dndArea.preDragging &&
465+ !dndArea.preDragging &&
475− !dndArea.dragging
466+ !dndArea.dragging
476
467
477 function flatten() {
468 function flatten() {
478 fakeDragItemAnimation.start();
469 fakeDragItemAnimation.start();
tests/mocks/Unity/Launcher/MockLauncherModel.cpp+1
@@ -54,6 +54,7 @@ MockLauncherModel::MockLauncherModel(QObject* parent): LauncherModelInterface(pa
54 item = new MockLauncherItem("ubuntu-weather-app", "/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather", this);
54 item = new MockLauncherItem("ubuntu-weather-app", "/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather", this);
55 item->setCount(1234567890);
55 item->setCount(1234567890);
56 item->setCountVisible(true);
56 item->setCountVisible(true);
57+ item->setPinned(true);
57 m_list.append(item);
58 m_list.append(item);
58 item = new MockLauncherItem("notes-app", "/usr/share/applications/notes-app.desktop", "Notepad", "notepad", this);
59 item = new MockLauncherItem("notes-app", "/usr/share/applications/notes-app.desktop", "Notepad", "notepad", this);
59 item->setProgress(50);
60 item->setProgress(50);