on xenial help sign in
Workarounds for concierge mode.
0554931Albert Astals Cid
plugins/Dash/CardCreator.js+18−5
@@ -64,11 +64,26 @@ var kArtShapeHolderCode = 'Item { \n\
64 active: cardData && cardData["art"] || false; \n\
64 active: cardData && cardData["art"] || false; \n\
65 asynchronous: root.asynchronous; \n\
65 asynchronous: root.asynchronous; \n\
66 visible: status == Loader.Ready; \n\
66 visible: status == Loader.Ready; \n\
67− sourceComponent: UbuntuShape { \n\
67+ sourceComponent: Item { \n\
68 id: artShape; \n\
68 id: artShape; \n\
69 objectName: "artShape"; \n\
69 objectName: "artShape"; \n\
70− radius: "medium"; \n\
70+ property bool doShapeItem: components["art"]["conciergeMode"] !== true; \n\
71 visible: image.status == Image.Ready; \n\
71 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\
72 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
87 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
73 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
88 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
74 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } \n\
89 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } \n\
@@ -87,11 +102,9 @@ var kArtShapeHolderCode = 'Item { \n\
87 objectName: "artImage"; \n\
102 objectName: "artImage"; \n\
88 source: cardData && cardData["art"] || ""; \n\
103 source: cardData && cardData["art"] || ""; \n\
89 asynchronous: root.asynchronous; \n\
104 asynchronous: root.asynchronous; \n\
90− visible: false; \n\
91 width: %2; \n\
105 width: %2; \n\
92 height: %3; \n\
106 height: %3; \n\
93 } \n\
107 } \n\
94− image: artImage.image; \n\
95 } \n\
108 } \n\
96 } \n\
109 } \n\
97 }\n';
110 }\n';
@@ -322,7 +335,7 @@ function cardString(template, components) {
322
335
323 var hasArt = components["art"] && components["art"]["field"] || false;
336 var hasArt = components["art"] && components["art"]["field"] || false;
324 var hasSummary = components["summary"] || false;
337 var hasSummary = components["summary"] || false;
325− var artAndSummary = hasArt && hasSummary;
338+ var artAndSummary = hasArt && hasSummary && components["art"]["conciergeMode"] !== true;
326 var isHorizontal = template["card-layout"] === "horizontal";
339 var isHorizontal = template["card-layout"] === "horizontal";
327 var hasBackground = (!isHorizontal && (template["card-background"] || components["background"] || artAndSummary)) ||
340 var hasBackground = (!isHorizontal && (template["card-background"] || components["background"] || artAndSummary)) ||
328 (hasSummary && (template["card-background"] || components["background"]));
341 (hasSummary && (template["card-background"] || components["background"]));
qml/Dash/GenericScopeView.qml+6−6
@@ -67,8 +67,8 @@ FocusScope {
67 subPageLoader.closeSubPage()
67 subPageLoader.closeSubPage()
68 }
68 }
69
69
70− function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) {
70+ function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
71− if (itemModel.uri.indexOf("scope://") === 0 || scope.id === "clickscope") {
71+ if (itemModel.uri.indexOf("scope://") === 0 || scope.id === "clickscope" || (scope.id === "videoaggregator" && categoryId === "myvideos-getstarted")) {
72 // TODO Technically it is possible that calling activate() will make the scope emit
72 // TODO Technically it is possible that calling activate() will make the scope emit
73 // previewRequested so that we show a preview but there's no scope that does that yet
73 // previewRequested so that we show a preview but there's no scope that does that yet
74 // so it's not implemented
74 // so it's not implemented
@@ -80,8 +80,8 @@ FocusScope {
80 }
80 }
81 }
81 }
82
82
83− function itemPressedAndHeld(index, result, itemModel, resultsModel, limitedCategoryItemCount) {
83+ function itemPressedAndHeld(index, result, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
84− if (itemModel.uri.indexOf("scope://") !== 0) {
84+ if (itemModel.uri.indexOf("scope://") !== 0 && !(scope.id === "videoaggregator" && categoryId === "myvideos-getstarted")) {
85 if (scope.preview(result)) {
85 if (scope.preview(result)) {
86 openPreview(index, resultsModel, limitedCategoryItemCount);
86 openPreview(index, resultsModel, limitedCategoryItemCount);
87 }
87 }
@@ -346,11 +346,11 @@ FocusScope {
346 Connections {
346 Connections {
347 target: rendererLoader.item
347 target: rendererLoader.item
348 onClicked: {
348 onClicked: {
349− scopeView.itemClicked(index, result, item, itemModel, target.model, categoryItemCount());
349+ scopeView.itemClicked(index, result, item, itemModel, target.model, categoryItemCount(), baseItem.category);
350 }
350 }
351
351
352 onPressAndHold: {
352 onPressAndHold: {
353− scopeView.itemPressedAndHeld(index, result, itemModel, target.model, categoryItemCount());
353+ scopeView.itemPressedAndHeld(index, result, itemModel, target.model, categoryItemCount(), baseItem.category);
354 }
354 }
355
355
356 function categoryItemCount() {
356 function categoryItemCount() {
tests/plugins/Dash/cardcreator/1.res+21−8
@@ -28,12 +28,27 @@ Item {
28 active: cardData && cardData["art"] || false;
28 active: cardData && cardData["art"] || false;
29 asynchronous: root.asynchronous;
29 asynchronous: root.asynchronous;
30 visible: status == Loader.Ready;
30 visible: status == Loader.Ready;
31− sourceComponent: UbuntuShape {
31+ sourceComponent: Item {
32− id: artShape;
32+ id: artShape;
33− objectName: "artShape";
33+ objectName: "artShape";
34− radius: "medium";
34+ property bool doShapeItem: components["art"]["conciergeMode"] !== true;
35− visible: image.status == Image.Ready;
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+ }
36− readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
51+ 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;
52 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
38 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
53 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
39 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
54 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
@@ -51,11 +66,9 @@ Item {
51 objectName: "artImage";
66 objectName: "artImage";
52 source: cardData && cardData["art"] || "";
67 source: cardData && cardData["art"] || "";
53 asynchronous: root.asynchronous;
68 asynchronous: root.asynchronous;
54− visible: false;
55 width: root.width;
69 width: root.width;
56 height: width / artShape.aspect;
70 height: width / artShape.aspect;
57 }
71 }
58− image: artImage.image;
59 }
72 }
60 }
73 }
61 }
74 }
tests/plugins/Dash/cardcreator/3.res+31−18
@@ -28,34 +28,47 @@ Item {
28 active: cardData && cardData["art"] || false;
28 active: cardData && cardData["art"] || false;
29 asynchronous: root.asynchronous;
29 asynchronous: root.asynchronous;
30 visible: status == Loader.Ready;
30 visible: status == Loader.Ready;
31− sourceComponent: UbuntuShape {
31+ sourceComponent: Item {
32− id: artShape;
32+ id: artShape;
33− objectName: "artShape";
33+ objectName: "artShape";
34− radius: "medium";
34+ property bool doShapeItem: components["art"]["conciergeMode"] !== true;
35− visible: image.status == Image.Ready;
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+ }
36− readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
51+ 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;
52+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
38− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
53+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
39− Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
54+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40− function updateWidthHeightBindings() {
55+ function updateWidthHeightBindings() {
41− if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
56+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42− width = root.fixedArtShapeSize.width;
57+ width = root.fixedArtShapeSize.width;
43− height = root.fixedArtShapeSize.height;
58+ height = root.fixedArtShapeSize.height;
44− } else {
59+ } else {
45 width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
60 width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
46 height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
61 height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
47 }
62 }
48− }
63+ }
49 CroppedImageMinimumSourceSize {
64 CroppedImageMinimumSourceSize {
50 id: artImage;
65 id: artImage;
51 objectName: "artImage";
66 objectName: "artImage";
52− source: cardData && cardData["art"] || "";
67+ source: cardData && cardData["art"] || "";
53 asynchronous: root.asynchronous;
68 asynchronous: root.asynchronous;
54− visible: false;
55 width: root.width;
69 width: root.width;
56 height: width / artShape.aspect;
70 height: width / artShape.aspect;
57 }
71 }
58− image: artImage.image;
59 }
72 }
60 }
73 }
61 }
74 }
tests/plugins/Dash/cardcreator/5.res+31−18
@@ -28,34 +28,47 @@ Item {
28 active: cardData && cardData["art"] || false;
28 active: cardData && cardData["art"] || false;
29 asynchronous: root.asynchronous;
29 asynchronous: root.asynchronous;
30 visible: status == Loader.Ready;
30 visible: status == Loader.Ready;
31− sourceComponent: UbuntuShape {
31+ sourceComponent: Item {
32− id: artShape;
32+ id: artShape;
33− objectName: "artShape";
33+ objectName: "artShape";
34− radius: "medium";
34+ property bool doShapeItem: components["art"]["conciergeMode"] !== true;
35− visible: image.status == Image.Ready;
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+ }
36− readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
51+ 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;
52+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
38− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
53+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
39− Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
54+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40− function updateWidthHeightBindings() {
55+ function updateWidthHeightBindings() {
41− if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
56+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42− width = root.fixedArtShapeSize.width;
57+ width = root.fixedArtShapeSize.width;
43− height = root.fixedArtShapeSize.height;
58+ height = root.fixedArtShapeSize.height;
44− } else {
59+ } else {
45 width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
60 width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
46 height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
61 height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
47 }
62 }
48− }
63+ }
49 CroppedImageMinimumSourceSize {
64 CroppedImageMinimumSourceSize {
50 id: artImage;
65 id: artImage;
51 objectName: "artImage";
66 objectName: "artImage";
52− source: cardData && cardData["art"] || "";
67+ source: cardData && cardData["art"] || "";
53 asynchronous: root.asynchronous;
68 asynchronous: root.asynchronous;
54− visible: false;
55 width: root.width;
69 width: root.width;
56 height: width / artShape.aspect;
70 height: width / artShape.aspect;
57 }
71 }
58− image: artImage.image;
59 }
72 }
60 }
73 }
61 }
74 }