on xenial help sign in
Only set the source of the images once it is visible

Saves data

commitc2a54491d01d8fc93a69b5ba5ecab6069fa00eb4 authorAlbert Astals <albert.astals@canonical.com> dateTue 26 Aug 2014, 17:19 (12 years ago) parentb5ed3a4
7 files changed+16−8
plugins/Dash/CardCreator.js+4−2 tests/plugins/Dash/cardcreator/1.res+2−1 tests/plugins/Dash/cardcreator/2.res+2−1 tests/plugins/Dash/cardcreator/3.res+2−1 tests/plugins/Dash/cardcreator/4.res+2−1 tests/plugins/Dash/cardcreator/5.res+2−1 tests/plugins/Dash/cardcreator/7.res+2−1
plugins/Dash/CardCreator.js+4−2
@@ -84,7 +84,8 @@ var kArtShapeHolderCode = 'Item { \n\
8484 } \n\
8585 image: Image { \n\
8686 objectName: "artImage"; \n\
87− source: cardData && cardData["art"] || ""; \n\
87+ property bool everShown: false; \n\
88+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["art"] || ""; } \n\
8889 cache: true; \n\
8990 asynchronous: root.asynchronous; \n\
9091 fillMode: Image.PreserveAspectCrop; \n\
@@ -195,7 +196,8 @@ var kMascotImageCode = 'Image { \n\
195196 objectName: "mascotImage"; \n\
196197 anchors { %1 } \n\
197198 readonly property int maxSize: Math.max(width, height) * 4; \n\
198− source: cardData && cardData["mascot"] || ""; \n\
199+ property bool everShown: false; \n\
200+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["mascot"] || ""; } \n\
199201 width: units.gu(6); \n\
200202 height: units.gu(5.625); \n\
201203 sourceSize { width: maxSize; height: maxSize } \n\
tests/plugins/Dash/cardcreator/1.res+2−1
@@ -46,7 +46,8 @@ Item {
4646 }
4747 image: Image {
4848 objectName: "artImage";
49− source: cardData && cardData["art"] || "";
49+ property bool everShown: false;
50+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["art"] || ""; }
5051 cache: true;
5152 asynchronous: root.asynchronous;
5253 fillMode: Image.PreserveAspectCrop;
tests/plugins/Dash/cardcreator/2.res+2−1
@@ -67,7 +67,8 @@ Image {
6767 objectName: "mascotImage";
6868 anchors { verticalCenter: parent.verticalCenter; }
6969 readonly property int maxSize: Math.max(width, height) * 4;
70− source: cardData && cardData["mascot"] || "";
70+ property bool everShown: false;
71+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["mascot"] || ""; }
7172 width: units.gu(6);
7273 height: units.gu(5.625);
7374 sourceSize { width: maxSize; height: maxSize }
tests/plugins/Dash/cardcreator/3.res+2−1
@@ -46,7 +46,8 @@ Item {
4646 }
4747 image: Image {
4848 objectName: "artImage";
49− source: cardData && cardData["art"] || "";
49+ property bool everShown: false;
50+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["art"] || ""; }
5051 cache: true;
5152 asynchronous: root.asynchronous;
5253 fillMode: Image.PreserveAspectCrop;
tests/plugins/Dash/cardcreator/4.res+2−1
@@ -46,7 +46,8 @@ Loader {
4646 objectName: "mascotImage";
4747 anchors { verticalCenter: parent.verticalCenter; }
4848 readonly property int maxSize: Math.max(width, height) * 4;
49− source: cardData && cardData["mascot"] || "";
49+ property bool everShown: false;
50+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["mascot"] || ""; }
5051 width: units.gu(6);
5152 height: units.gu(5.625);
5253 sourceSize { width: maxSize; height: maxSize }
tests/plugins/Dash/cardcreator/5.res+2−1
@@ -46,7 +46,8 @@ Item {
4646 }
4747 image: Image {
4848 objectName: "artImage";
49− source: cardData && cardData["art"] || "";
49+ property bool everShown: false;
50+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["art"] || ""; }
5051 cache: true;
5152 asynchronous: root.asynchronous;
5253 fillMode: Image.PreserveAspectCrop;
tests/plugins/Dash/cardcreator/7.res+2−1
@@ -67,7 +67,8 @@ Image {
6767 objectName: "mascotImage";
6868 anchors { verticalCenter: parent.verticalCenter; }
6969 readonly property int maxSize: Math.max(width, height) * 4;
70− source: cardData && cardData["mascot"] || "";
70+ property bool everShown: false;
71+ source: { if (root.visible) everShown = true; return everShown && cardData && cardData["mascot"] || ""; }
7172 width: units.gu(6);
7273 height: units.gu(5.625);
7374 sourceSize { width: maxSize; height: maxSize }