on xenial help sign in
Workarounds for concierge mode.

Approved by: Pawel Stolowski, Michael Zanetti

commit05549316c2d897c6908660a5088b4abd9b1eb98f authorAlbert Astals Cid <albert.astals@canonical.com> dateMon 11 May 2015, 08:29 (11 years ago) parent82841c4d3152c5
5 files changed+107−55
plugins/Dash/CardCreator.js+18−5 qml/Dash/GenericScopeView.qml+6−6 tests/plugins/Dash/cardcreator/1.res+21−8 tests/plugins/Dash/cardcreator/3.res+31−18 tests/plugins/Dash/cardcreator/5.res+31−18
plugins/Dash/CardCreator.js+18−5
@@ -64,11 +64,26 @@ var kArtShapeHolderCode = 'Item { \n\
6464 active: cardData && cardData["art"] || false; \n\
6565 asynchronous: root.asynchronous; \n\
6666 visible: status == Loader.Ready; \n\
67− sourceComponent: UbuntuShape { \n\
67+ sourceComponent: Item { \n\
6868 id: artShape; \n\
6969 objectName: "artShape"; \n\
70− radius: "medium"; \n\
70+ property bool doShapeItem: components["art"]["conciergeMode"] !== true; \n\
7171 visible: image.status == Image.Ready; \n\
72+ readonly property alias image: artImage.image; \n\
73+ ShaderEffectSource { \n\
74+ id: artShapeSource; \n\
75+ sourceItem: artImage; \n\
76+ anchors.centerIn: parent; \n\
77+ width: 1; \n\
78+ height: 1; \n\
79+ hideSource: doShapeItem; \n\
80+ } \n\
81+ Shape { \n\
82+ image: artShapeSource; \n\
83+ anchors.fill: parent; \n\
84+ visible: doShapeItem; \n\
85+ radius: "medium"; \n\
86+ } \n\
7287 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
7388 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
7489 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } \n\
@@ -87,11 +102,9 @@ var kArtShapeHolderCode = 'Item { \n\
87102 objectName: "artImage"; \n\
88103 source: cardData && cardData["art"] || ""; \n\
89104 asynchronous: root.asynchronous; \n\
90− visible: false; \n\
91105 width: %2; \n\
92106 height: %3; \n\
93107 } \n\
94− image: artImage.image; \n\
95108 } \n\
96109 } \n\
97110 }\n';
@@ -322,7 +335,7 @@ function cardString(template, components) {
322335
323336 var hasArt = components["art"] && components["art"]["field"] || false;
324337 var hasSummary = components["summary"] || false;
325− var artAndSummary = hasArt && hasSummary;
338+ var artAndSummary = hasArt && hasSummary && components["art"]["conciergeMode"] !== true;
326339 var isHorizontal = template["card-layout"] === "horizontal";
327340 var hasBackground = (!isHorizontal && (template["card-background"] || components["background"] || artAndSummary)) ||
328341 (hasSummary && (template["card-background"] || components["background"]));
qml/Dash/GenericScopeView.qml+6−6
@@ -67,8 +67,8 @@ FocusScope {
6767 subPageLoader.closeSubPage()
6868 }
6969
70− function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) {
71− if (itemModel.uri.indexOf("scope://") === 0 || scope.id === "clickscope") {
70+ function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
71+ if (itemModel.uri.indexOf("scope://") === 0 || scope.id === "clickscope" || (scope.id === "videoaggregator" && categoryId === "myvideos-getstarted")) {
7272 // TODO Technically it is possible that calling activate() will make the scope emit
7373 // previewRequested so that we show a preview but there's no scope that does that yet
7474 // so it's not implemented
@@ -80,8 +80,8 @@ FocusScope {
8080 }
8181 }
8282
83− function itemPressedAndHeld(index, result, itemModel, resultsModel, limitedCategoryItemCount) {
84− if (itemModel.uri.indexOf("scope://") !== 0) {
83+ function itemPressedAndHeld(index, result, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
84+ if (itemModel.uri.indexOf("scope://") !== 0 && !(scope.id === "videoaggregator" && categoryId === "myvideos-getstarted")) {
8585 if (scope.preview(result)) {
8686 openPreview(index, resultsModel, limitedCategoryItemCount);
8787 }
@@ -346,11 +346,11 @@ FocusScope {
346346 Connections {
347347 target: rendererLoader.item
348348 onClicked: {
349− scopeView.itemClicked(index, result, item, itemModel, target.model, categoryItemCount());
349+ scopeView.itemClicked(index, result, item, itemModel, target.model, categoryItemCount(), baseItem.category);
350350 }
351351
352352 onPressAndHold: {
353− scopeView.itemPressedAndHeld(index, result, itemModel, target.model, categoryItemCount());
353+ scopeView.itemPressedAndHeld(index, result, itemModel, target.model, categoryItemCount(), baseItem.category);
354354 }
355355
356356 function categoryItemCount() {
tests/plugins/Dash/cardcreator/1.res+21−8
@@ -28,12 +28,27 @@ Item {
2828 active: cardData && cardData["art"] || false;
2929 asynchronous: root.asynchronous;
3030 visible: status == Loader.Ready;
31− sourceComponent: UbuntuShape {
32− id: artShape;
33− objectName: "artShape";
34− radius: "medium";
35− visible: image.status == Image.Ready;
36− readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
31+ sourceComponent: Item {
32+ id: artShape;
33+ objectName: "artShape";
34+ property bool doShapeItem: components["art"]["conciergeMode"] !== true;
35+ visible: image.status == Image.Ready;
36+ readonly property alias image: artImage.image;
37+ ShaderEffectSource {
38+ id: artShapeSource;
39+ sourceItem: artImage;
40+ anchors.centerIn: parent;
41+ width: 1;
42+ height: 1;
43+ hideSource: doShapeItem;
44+ }
45+ Shape {
46+ image: artShapeSource;
47+ anchors.fill: parent;
48+ visible: doShapeItem;
49+ radius: "medium";
50+ }
51+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
3752 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
3853 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
3954 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
@@ -51,11 +66,9 @@ Item {
5166 objectName: "artImage";
5267 source: cardData && cardData["art"] || "";
5368 asynchronous: root.asynchronous;
54− visible: false;
5569 width: root.width;
5670 height: width / artShape.aspect;
5771 }
58− image: artImage.image;
5972 }
6073 }
6174 }
tests/plugins/Dash/cardcreator/3.res+31−18
@@ -28,34 +28,47 @@ Item {
2828 active: cardData && cardData["art"] || false;
2929 asynchronous: root.asynchronous;
3030 visible: status == Loader.Ready;
31− sourceComponent: UbuntuShape {
32− id: artShape;
33− objectName: "artShape";
34− radius: "medium";
35− visible: image.status == Image.Ready;
36− readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
37− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
38− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
39− Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40− function updateWidthHeightBindings() {
41− if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42− width = root.fixedArtShapeSize.width;
43− height = root.fixedArtShapeSize.height;
44− } else {
31+ sourceComponent: Item {
32+ id: artShape;
33+ objectName: "artShape";
34+ property bool doShapeItem: components["art"]["conciergeMode"] !== true;
35+ visible: image.status == Image.Ready;
36+ readonly property alias image: artImage.image;
37+ ShaderEffectSource {
38+ id: artShapeSource;
39+ sourceItem: artImage;
40+ anchors.centerIn: parent;
41+ width: 1;
42+ height: 1;
43+ hideSource: doShapeItem;
44+ }
45+ Shape {
46+ image: artShapeSource;
47+ anchors.fill: parent;
48+ visible: doShapeItem;
49+ radius: "medium";
50+ }
51+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
52+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
53+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
54+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
55+ function updateWidthHeightBindings() {
56+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
57+ width = root.fixedArtShapeSize.width;
58+ height = root.fixedArtShapeSize.height;
59+ } else {
4560 width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
4661 height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
4762 }
48− }
63+ }
4964 CroppedImageMinimumSourceSize {
5065 id: artImage;
5166 objectName: "artImage";
52− source: cardData && cardData["art"] || "";
67+ source: cardData && cardData["art"] || "";
5368 asynchronous: root.asynchronous;
54− visible: false;
5569 width: root.width;
5670 height: width / artShape.aspect;
5771 }
58− image: artImage.image;
5972 }
6073 }
6174 }
tests/plugins/Dash/cardcreator/5.res+31−18
@@ -28,34 +28,47 @@ Item {
2828 active: cardData && cardData["art"] || false;
2929 asynchronous: root.asynchronous;
3030 visible: status == Loader.Ready;
31− sourceComponent: UbuntuShape {
32− id: artShape;
33− objectName: "artShape";
34− radius: "medium";
35− visible: image.status == Image.Ready;
36− readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
37− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
38− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
39− Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40− function updateWidthHeightBindings() {
41− if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42− width = root.fixedArtShapeSize.width;
43− height = root.fixedArtShapeSize.height;
44− } else {
31+ sourceComponent: Item {
32+ id: artShape;
33+ objectName: "artShape";
34+ property bool doShapeItem: components["art"]["conciergeMode"] !== true;
35+ visible: image.status == Image.Ready;
36+ readonly property alias image: artImage.image;
37+ ShaderEffectSource {
38+ id: artShapeSource;
39+ sourceItem: artImage;
40+ anchors.centerIn: parent;
41+ width: 1;
42+ height: 1;
43+ hideSource: doShapeItem;
44+ }
45+ Shape {
46+ image: artShapeSource;
47+ anchors.fill: parent;
48+ visible: doShapeItem;
49+ radius: "medium";
50+ }
51+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
52+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
53+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
54+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
55+ function updateWidthHeightBindings() {
56+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
57+ width = root.fixedArtShapeSize.width;
58+ height = root.fixedArtShapeSize.height;
59+ } else {
4560 width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
4661 height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
4762 }
48− }
63+ }
4964 CroppedImageMinimumSourceSize {
5065 id: artImage;
5166 objectName: "artImage";
52− source: cardData && cardData["art"] || "";
67+ source: cardData && cardData["art"] || "";
5368 asynchronous: root.asynchronous;
54− visible: false;
5569 width: root.width;
5670 height: width / artShape.aspect;
5771 }
58− image: artImage.image;
5972 }
6073 }
6174 }