diff options
Diffstat (limited to 'demos/declarative/flickr/common')
-rw-r--r-- | demos/declarative/flickr/common/ImageDetails.qml | 120 | ||||
-rw-r--r-- | demos/declarative/flickr/common/LikeOMeter.qml | 22 | ||||
-rw-r--r-- | demos/declarative/flickr/common/Loading.qml | 4 | ||||
-rw-r--r-- | demos/declarative/flickr/common/MediaButton.qml | 22 | ||||
-rw-r--r-- | demos/declarative/flickr/common/MediaLineEdit.qml | 62 | ||||
-rw-r--r-- | demos/declarative/flickr/common/Progress.qml | 5 | ||||
-rw-r--r-- | demos/declarative/flickr/common/ScrollBar.qml | 10 | ||||
-rw-r--r-- | demos/declarative/flickr/common/Slider.qml | 16 | ||||
-rw-r--r-- | demos/declarative/flickr/common/Star.qml | 13 |
9 files changed, 135 insertions, 139 deletions
diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml index 6b42910..b8b7d29 100644 --- a/demos/declarative/flickr/common/ImageDetails.qml +++ b/demos/declarative/flickr/common/ImageDetails.qml @@ -1,9 +1,9 @@ import Qt 4.6 Flipable { - id: Container + id: container - property var frontContainer: ContainerFront + property var frontContainer: containerFront property string photoTitle: "" property string photoDescription: "" property string photoTags: "" @@ -19,13 +19,13 @@ Flipable { signal closed transform: Rotation { - id: DetailsRotation - origin.x: Container.width / 2; + id: detailsRotation + origin.x: container.width / 2; axis.y: 1; axis.z: 0 } front: Item { - id: ContainerFront; anchors.fill: Container + id: containerFront; anchors.fill: container Rectangle { anchors.fill: parent @@ -34,74 +34,74 @@ Flipable { } MediaButton { - id: BackButton; x: 630; y: 370; text: "Back" - onClicked: { Container.closed() } + id: backButton; x: 630; y: 370; text: "Back" + onClicked: { container.closed() } } MediaButton { - id: MoreButton; x: 530; y: 370; text: "View..." - onClicked: { Container.state='Back' } + id: moreButton; x: 530; y: 370; text: "View..." + onClicked: { container.state='Back' } } - Text { id: TitleText; style: "Raised"; styleColor: "black"; color: "white"; elide: "ElideRight" - x: 220; y: 30; width: parent.width - 240; text: Container.photoTitle; font.pointSize: 22 } + Text { id: titleText; style: "Raised"; styleColor: "black"; color: "white"; elide: "ElideRight" + x: 220; y: 30; width: parent.width - 240; text: container.photoTitle; font.pointSize: 22 } - LikeOMeter { x: 40; y: 250; rating: Container.rating } + LikeOMeter { x: 40; y: 250; rating: container.rating } - Flickable { id: FlickSurface; x: 220; width: 480; height: 210; y: 130; clip: true - viewportWidth: 480; viewportHeight: DescriptionText.height + Flickable { id: flickable; x: 220; width: 480; height: 210; y: 130; clip: true + viewportWidth: 480; viewportHeight: descriptionText.height - WebView { id: DescriptionText; width: parent.width - html: "<style TYPE=\"text/css\">body {color: white;} a:link {color: cyan; text-decoration: underline; }</style>" + Container.photoDescription } + WebView { id: descriptionText; width: parent.width + html: "<style TYPE=\"text/css\">body {color: white;} a:link {color: cyan; text-decoration: underline; }</style>" + container.photoDescription } } - Text { id: Size; color: "white"; width: 300; x: 40; y: 300 - text: "<b>Size:</b> " + Container.photoWidth + 'x' + Container.photoHeight } - Text { id: Type; color: "white"; width: 300; x: 40; anchors.top: Size.bottom - text: "<b>Type:</b> " + Container.photoType } - - Text { id: Author; color: "white"; width: 300; x: 220; y: 80 - text: "<b>Author:</b> " + Container.photoAuthor } - Text { id: Date; color: "white"; width: 300; x: 220; anchors.top: Author.bottom - text: "<b>Published:</b> " + Container.photoDate } - Text { id: TagsLabel; color: "white"; x: 220; anchors.top: Date.bottom; - text: Container.photoTags == "" ? "" : "<b>Tags:</b> " } - Text { id: Tags; color: "white"; width: parent.width-x-20; - anchors.left: TagsLabel.right; anchors.top: Date.bottom; - elide: "ElideRight"; text: Container.photoTags } - - ScrollBar { id: ScrollBar; x: 720; y: FlickSurface.y; width: 7; height: FlickSurface.height; opacity: 0; - flickableArea: FlickSurface; clip: true } + Text { id: size; color: "white"; width: 300; x: 40; y: 300 + text: "<b>Size:</b> " + container.photoWidth + 'x' + container.photoHeight } + Text { id: type; color: "white"; width: 300; x: 40; anchors.top: size.bottom + text: "<b>Type:</b> " + container.photoType } + + Text { id: author; color: "white"; width: 300; x: 220; y: 80 + text: "<b>Author:</b> " + container.photoAuthor } + Text { id: date; color: "white"; width: 300; x: 220; anchors.top: author.bottom + text: "<b>Published:</b> " + container.photoDate } + Text { id: tagsLabel; color: "white"; x: 220; anchors.top: date.bottom; + text: container.photoTags == "" ? "" : "<b>Tags:</b> " } + Text { id: tags; color: "white"; width: parent.width-x-20; + anchors.left: tagsLabel.right; anchors.top: date.bottom; + elide: "ElideRight"; text: container.photoTags } + + ScrollBar { id: scrollBar; x: 720; y: flickable.y; width: 7; height: flickable.height; opacity: 0; + flickableArea: flickable; clip: true } } back: Item { - anchors.fill: Container + anchors.fill: container Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4; border.color: "white"; border.width: 2 } - Progress { anchors.centerIn: parent; width: 200; height: 18; progress: BigImage.progress; visible: BigImage.status!=1 } + Progress { anchors.centerIn: parent; width: 200; height: 18; progress: bigImage.progress; visible: bigImage.status!=1 } Flickable { - id: Flick; width: Container.width - 10; height: Container.height - 10 + id: flick; width: container.width - 10; height: container.height - 10 x: 5; y: 5; clip: true; - viewportWidth: ImageContainer.width; viewportHeight: ImageContainer.height + viewportWidth: imageContainer.width; viewportHeight: imageContainer.height Item { - id: ImageContainer - width: Math.max(BigImage.width * BigImage.scale, Flick.width); - height: Math.max(BigImage.height * BigImage.scale, Flick.height); + id: imageContainer + width: Math.max(bigImage.width * bigImage.scale, flick.width); + height: Math.max(bigImage.height * bigImage.scale, flick.height); Image { - id: BigImage; source: Container.photoUrl; scale: Slider.value + id: bigImage; source: container.photoUrl; scale: slider.value // Center image if it is smaller than the flickable area. - x: ImageContainer.width > width*scale ? (ImageContainer.width - width*scale) / 2 : 0 - y: ImageContainer.height > height*scale ? (ImageContainer.height - height*scale) / 2 : 0 - smooth: !Flick.moving + x: imageContainer.width > width*scale ? (imageContainer.width - width*scale) / 2 : 0 + y: imageContainer.height > height*scale ? (imageContainer.height - height*scale) / 2 : 0 + smooth: !flick.moving onStatusChanged : { // Default scale shows the entire image. if (status == 1 && width != 0) { - Slider.minimum = Math.min(Flick.width / width, Flick.height / height); - prevScale = Math.min(Slider.minimum, 1); - Slider.value = prevScale; + slider.minimum = Math.min(flick.width / width, flick.height / height); + prevScale = Math.min(slider.minimum, 1); + slider.value = prevScale; } } } @@ -109,24 +109,24 @@ Flipable { } MediaButton { - id: BackButton2; x: 630; y: 370; text: "Back"; onClicked: { Container.state = '' } + id: backButton2; x: 630; y: 370; text: "Back"; onClicked: { container.state = '' } } Text { text: "Image Unavailable" - visible: BigImage.status == 'Error' + visible: bigImage.status == 'Error' anchors.centerIn: parent; color: "white"; font.bold: true } Slider { - id: Slider; x: 25; y: 374; visible: { BigImage.status == 1 && maximum > minimum } + id: slider; x: 25; y: 374; visible: { bigImage.status == 1 && maximum > minimum } onValueChanged: { - if (BigImage.width * value > Flick.width) { - var xoff = (Flick.width/2 + Flick.viewportX) * value / prevScale; - Flick.viewportX = xoff - Flick.width/2; + if (bigImage.width * value > flick.width) { + var xoff = (flick.width/2 + flick.viewportX) * value / prevScale; + flick.viewportX = xoff - flick.width/2; } - if (BigImage.height * value > Flick.height) { - var yoff = (Flick.height/2 + Flick.viewportY) * value / prevScale; - Flick.viewportY = yoff - Flick.height/2; + if (bigImage.height * value > flick.height) { + var yoff = (flick.height/2 + flick.viewportY) * value / prevScale; + flick.viewportY = yoff - flick.height/2; } prevScale = value; } @@ -136,7 +136,7 @@ Flipable { states: [ State { name: "Back" - PropertyChanges { target: DetailsRotation; angle: 180 } + PropertyChanges { target: detailsRotation; angle: 180 } } ] @@ -144,15 +144,15 @@ Flipable { Transition { SequentialAnimation { PropertyAction { - target: BigImage + target: bigImage property: "smooth" value: false } NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 500 } PropertyAction { - target: BigImage + target: bigImage property: "smooth" - value: !Flick.moving + value: !flick.moving } } } diff --git a/demos/declarative/flickr/common/LikeOMeter.qml b/demos/declarative/flickr/common/LikeOMeter.qml index 754dbb1..5ee048b 100644 --- a/demos/declarative/flickr/common/LikeOMeter.qml +++ b/demos/declarative/flickr/common/LikeOMeter.qml @@ -1,35 +1,35 @@ import Qt 4.6 Item { - id: Container + id: container property int rating: 2 Row { Star { rating: 0 - onClicked: { Container.rating = rating } - on: Container.rating >= 0 + onClicked: { container.rating = rating } + on: container.rating >= 0 } Star { rating: 1 - onClicked: { Container.rating = rating } - on: Container.rating >= 1 + onClicked: { container.rating = rating } + on: container.rating >= 1 } Star { rating: 2 - onClicked: { Container.rating = rating } - on: Container.rating >= 2 + onClicked: { container.rating = rating } + on: container.rating >= 2 } Star { rating: 3 - onClicked: { Container.rating = rating } - on: Container.rating >= 3 + onClicked: { container.rating = rating } + on: container.rating >= 3 } Star { rating: 4 - onClicked: { Container.rating = rating } - on: Container.rating >= 4 + onClicked: { container.rating = rating } + on: container.rating >= 4 } } } diff --git a/demos/declarative/flickr/common/Loading.qml b/demos/declarative/flickr/common/Loading.qml index ff2c829..64a04c4 100644 --- a/demos/declarative/flickr/common/Loading.qml +++ b/demos/declarative/flickr/common/Loading.qml @@ -1,8 +1,8 @@ import Qt 4.6 Image { - id: Loading; source: "pics/loading.png"; transformOrigin: "Center" + id: loading; source: "pics/loading.png"; transformOrigin: "Center" rotation: NumberAnimation { - id: "RotationAnimation"; from: 0; to: 360; running: Loading.visible == true; repeat: true; duration: 900 + id: "RotationAnimation"; from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 } } diff --git a/demos/declarative/flickr/common/MediaButton.qml b/demos/declarative/flickr/common/MediaButton.qml index e1e09e8..c12b642 100644 --- a/demos/declarative/flickr/common/MediaButton.qml +++ b/demos/declarative/flickr/common/MediaButton.qml @@ -1,39 +1,39 @@ import Qt 4.6 Item { - id: Container + id: container signal clicked property string text Image { - id: ButtonImage + id: buttonImage source: "pics/button.png" } Image { - id: Pressed + id: pressed source: "pics/button-pressed.png" opacity: 0 } MouseRegion { - id: MyMouseRegion - anchors.fill: ButtonImage - onClicked: { Container.clicked(); } + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.clicked(); } } Text { font.bold: true color: "white" - anchors.centerIn: ButtonImage - text: Container.text + anchors.centerIn: buttonImage + text: container.text } - width: ButtonImage.width + width: buttonImage.width states: [ State { name: "Pressed" - when: MyMouseRegion.pressed == true + when: mouseRegion.pressed == true PropertyChanges { - target: Pressed + target: pressed opacity: 1 } } diff --git a/demos/declarative/flickr/common/MediaLineEdit.qml b/demos/declarative/flickr/common/MediaLineEdit.qml index 7599ce6a05..4b21f66 100644 --- a/demos/declarative/flickr/common/MediaLineEdit.qml +++ b/demos/declarative/flickr/common/MediaLineEdit.qml @@ -1,42 +1,42 @@ import Qt 4.6 Item { - id: Container + id: container property string label property string text - width: Math.max(94,Label.width + Editor.width + 20) - height: ButtonImage.height + width: Math.max(94,label.width + editor.width + 20) + height: buttonImage.height states: [ State { name: "Edit" PropertyChanges { - target: Label - text: Container.label + ": " + target: label + text: container.label + ": " } PropertyChanges { - target: Label + target: label x: 10 } PropertyChanges { - target: Editor + target: editor cursorVisible: true width: 100 } PropertyChanges { - target: Container + target: container focus: true } StateChangeScript { - script:"Editor.selectAll()" + script:"editor.selectAll()" } }, State { // When returning to default state, typed text is propagated StateChangeScript { - script: "Container.text = Editor.text" + script: "container.text = editor.text" } } ] @@ -48,29 +48,29 @@ Item { BorderImage { - id: ButtonImage + id: buttonImage source: "pics/button.sci" - anchors.left: Container.left - anchors.right: Container.right + anchors.left: container.left + anchors.right: container.right } BorderImage { - id: Pressed + id: pressed source: "pics/button-pressed.sci" opacity: 0 - anchors.left: Container.left - anchors.right: Container.right + anchors.left: container.left + anchors.right: container.right } MouseRegion { - id: MyMouseRegion - anchors.fill: ButtonImage - onClicked: { Container.state = Container.state=="Edit" ? "" : "Edit" } + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.state = container.state=="Edit" ? "" : "Edit" } states: [ State { - when: MyMouseRegion.pressed == true + when: mouseRegion.pressed == true PropertyChanges { - target: Pressed + target: pressed opacity: 1 } } @@ -78,27 +78,27 @@ Item { } Text { - id: Label + id: label font.bold: true color: "white" - anchors.verticalCenter: Container.verticalCenter - x: (Container.width - width)/2 - text: Container.label + "..." + anchors.verticalCenter: container.verticalCenter + x: (container.width - width)/2 + text: container.label + "..." } TextInput { - id: Editor + id: editor font.bold: true color: "white" selectionColor: "green" width: 0 clip: true - anchors.left: Label.right - anchors.verticalCenter: Container.verticalCenter + anchors.left: label.right + anchors.verticalCenter: container.verticalCenter } - Keys.forwardTo: [(ReturnKey), (Editor)] + Keys.forwardTo: [(returnKey), (editor)] Item { - id: ReturnKey - Keys.onReturnPressed: "Container.state = ''" + id: returnKey + Keys.onReturnPressed: "container.state = ''" } } diff --git a/demos/declarative/flickr/common/Progress.qml b/demos/declarative/flickr/common/Progress.qml index 00ef901..fd9be10 100644 --- a/demos/declarative/flickr/common/Progress.qml +++ b/demos/declarative/flickr/common/Progress.qml @@ -1,12 +1,10 @@ import Qt 4.6 Item { - id: Progress; - property var progress: 0 Rectangle { - id: Container; anchors.fill: parent; smooth: true + anchors.fill: parent; smooth: true border.color: "white"; border.width: 0; radius: height/2 - 2 gradient: Gradient { GradientStop { position: 0; color: "#66343434" } @@ -15,7 +13,6 @@ Item { } Rectangle { - id: Fill y: 2; height: parent.height-4; x: 2; width: Math.max(parent.width * progress - 4, 0); opacity: width < 1 ? 0 : 1; smooth: true diff --git a/demos/declarative/flickr/common/ScrollBar.qml b/demos/declarative/flickr/common/ScrollBar.qml index d31c57c..feebcb0 100644 --- a/demos/declarative/flickr/common/ScrollBar.qml +++ b/demos/declarative/flickr/common/ScrollBar.qml @@ -1,7 +1,7 @@ import Qt 4.6 Item { - id: Container + id: container property var flickableArea @@ -12,16 +12,16 @@ Item { border.color: "white" border.width: 2 x: 0 - y: flickableArea.visibleArea.yPosition * Container.height + y: flickableArea.visibleArea.yPosition * container.height width: parent.width - height: flickableArea.visibleArea.heightRatio * Container.height + height: flickableArea.visibleArea.heightRatio * container.height } states: [ State { name: "show" when: flickableArea.moving PropertyChanges { - target: Container + target: container opacity: 1 } } @@ -31,7 +31,7 @@ Item { from: "*" to: "*" NumberAnimation { - target: Container + target: container properties: "opacity" duration: 400 } diff --git a/demos/declarative/flickr/common/Slider.qml b/demos/declarative/flickr/common/Slider.qml index b88636d..fa1645c 100644 --- a/demos/declarative/flickr/common/Slider.qml +++ b/demos/declarative/flickr/common/Slider.qml @@ -1,17 +1,17 @@ import Qt 4.6 Item { - id: Slider; width: 400; height: 16 + id: slider; width: 400; height: 16 // value is read/write. property real value - onValueChanged: { Handle.x = 2 + (value - minimum) * Slider.xMax / (maximum - minimum); } + onValueChanged: { handle.x = 2 + (value - minimum) * slider.xMax / (maximum - minimum); } property real maximum: 1 property real minimum: 1 - property int xMax: Slider.width - Handle.width - 4 + property int xMax: slider.width - handle.width - 4 Rectangle { - id: Container; anchors.fill: parent + anchors.fill: parent border.color: "white"; border.width: 0; radius: 8 gradient: Gradient { GradientStop { position: 0.0; color: "#66343434" } @@ -20,8 +20,8 @@ Item { } Rectangle { - id: Handle; smooth: true - x: Slider.width / 2 - Handle.width / 2; y: 2; width: 30; height: Slider.height-4; radius: 6 + id: handle; smooth: true + x: slider.width / 2 - handle.width / 2; y: 2; width: 30; height: slider.height-4; radius: 6 gradient: Gradient { GradientStop { position: 0.0; color: "lightgray" } GradientStop { position: 1.0; color: "gray" } @@ -29,8 +29,8 @@ Item { MouseRegion { anchors.fill: parent; drag.target: parent - drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: Slider.xMax+2 - onPositionChanged: { value = (maximum - minimum) * (Handle.x-2) / Slider.xMax + minimum; } + drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: slider.xMax+2 + onPositionChanged: { value = (maximum - minimum) * (handle.x-2) / slider.xMax + minimum; } } } } diff --git a/demos/declarative/flickr/common/Star.qml b/demos/declarative/flickr/common/Star.qml index c4d1bec..173021b 100644 --- a/demos/declarative/flickr/common/Star.qml +++ b/demos/declarative/flickr/common/Star.qml @@ -1,17 +1,16 @@ import Qt 4.6 Item { - id: Container + id: container width: 24 height: 24 property int rating property bool on - signal clicked Image { - id: StarImage + id: starImage source: "pics/ghns_star.png" x: 6 y: 7 @@ -19,15 +18,15 @@ Item { scale: 0.5 } MouseRegion { - anchors.fill: Container - onClicked: { Container.clicked() } + anchors.fill: container + onClicked: { container.clicked() } } states: [ State { name: "on" - when: Container.on == true + when: container.on == true PropertyChanges { - target: StarImage + target: starImage opacity: 1 scale: 1 x: 1 |