QuiaMiniFlickr.qml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. import Qt 4.7
  2. Rectangle {
  3. width: 516
  4. height: 134
  5. color: "#a2a0a0"
  6. property string flickrUrl
  7. property string ownerId
  8. property string setId
  9. ListView {
  10. id: imageListView
  11. /*width: 516
  12. height: 134*/
  13. anchors.fill: parent
  14. z: 2
  15. orientation: ListView.Horizontal
  16. model: flickrRssModel//flickrRssModel
  17. delegate: QuiaMiniFlickrDelegate {
  18. imageSource: {
  19. //now we have to parse html content
  20. //to find link to the thumbnail
  21. //and not to the original sized HUGE image
  22. return content.slice(content.indexOf(".static.flickr.com")-12, content.indexOf("_m.jpg")+6);
  23. }
  24. MouseArea {
  25. anchors.fill: parent
  26. onClicked: {
  27. imageListView.currentIndex = index;
  28. changeStateToPhotoView();
  29. bigImageRectangle.opacity = 1;
  30. bigImage.opacity = 1;
  31. loadingIndicator.opacity=1;
  32. loadingIndicatorDark.opacity=1;
  33. loadingIndicatorDark.width=0;
  34. bigImage.source = flickrRssModel.get(imageListView.currentIndex).hq;
  35. //testText.text = bigImage.source
  36. var content = flickrRssModel.get(imageListView.currentIndex).content;
  37. biggerThumb.source = content.slice(content.indexOf(".static.flickr.com")-12, content.indexOf("_m.jpg")+6);
  38. biggerThumb.visible = true;
  39. biggerThumb.scale = 0.6;
  40. }
  41. }
  42. }
  43. Image {
  44. id: filmStripOverlay
  45. anchors.fill: parent
  46. source: "images/filmstrip_overlay.png"
  47. }
  48. /*Image {
  49. width: 140
  50. height: 120
  51. source: {
  52. //now we have to parse html content
  53. //to find link to the thumbnail
  54. //and not to the original sized HUGE image
  55. return content.slice(content.indexOf(".static.flickr.com")-12, content.indexOf("_m.jpg")+6);
  56. }
  57. }*/
  58. }
  59. RssModel {
  60. id: flickrRssModel
  61. ownerId: ownerId
  62. setId: setId
  63. onStatusChanged: {
  64. if(flickrRssModel.status == XmlListModel.Loading) {
  65. //text1.text = "loading";
  66. loadingImage.visible = true;
  67. //loadingImage.opacity = 1-flickrRssModel.progress;
  68. }
  69. else if(flickrRssModel.status == XmlListModel.Ready) {
  70. //text1.text = "ready";
  71. loadingImage.visible = false;
  72. loadingImage.opacity = 1;
  73. }
  74. else if(flickrRssModel.status == XmlListModel.Error) {
  75. //text1.text = flickrRssModel.errorString();
  76. }
  77. //else {text1.text = "don't know";}
  78. }
  79. }
  80. Image {
  81. id: loadingImage
  82. anchors.horizontalCenter: parent.horizontalCenter
  83. anchors.verticalCenter: parent.verticalCenter
  84. width: 50
  85. height: 50
  86. z: 11
  87. opacity: 1
  88. source: "images/loading.png"
  89. smooth: true
  90. visible: false
  91. SequentialAnimation on rotation {
  92. loops: Animation.Infinite
  93. NumberAnimation {
  94. from: 0
  95. to: 360
  96. //easing.type: Easing.InOutBounce
  97. duration: 1000
  98. }
  99. //PauseAnimation { duration: 3000 }
  100. }
  101. }
  102. Text {
  103. id: text1
  104. x: 37
  105. y: 61
  106. width: 400
  107. height: 40
  108. text: ""
  109. wrapMode: Text.WrapAnywhere
  110. z: 3
  111. }
  112. function reloadFlickrModel() {
  113. flickrRssModel.setId = setId;
  114. flickrRssModel.ownerId = ownerId;
  115. flickrRssModel.source = "http://api.flickr.com/services/feeds/photoset.gne?set="+setId+"&nsid="+ownerId;
  116. flickrRssModel.reload();
  117. }
  118. Rectangle {
  119. id: bigImageRectangle
  120. width: 800
  121. height: 480
  122. anchors.fill: screen
  123. opacity: 0
  124. color: "darkgrey"
  125. z: 10
  126. property string imageSource: ""
  127. MouseArea {
  128. anchors.fill: parent
  129. onClicked: { changeStateToBasicView();
  130. bigImageRectangle.opacity = 0;
  131. bigImage.opacity= 0;
  132. bigImage.source="";
  133. //width 516
  134. //height: 134
  135. //flickrRssModel.reload()
  136. }
  137. }
  138. Image {
  139. id: bigImage
  140. width: 800
  141. height: 480
  142. //anchors.verticalCenter: parent.verticalCenter
  143. fillMode: Image.PreserveAspectFit
  144. //source: parent.imageSource
  145. onProgressChanged:
  146. {
  147. //loadingImage.opacity = 1-bigImage.progress;
  148. loadingIndicatorDark.width = bigImage.progress*400;
  149. var mydelta = 0.1 * bigImage.progress;
  150. biggerThumb.scale = biggerThumb.scale+mydelta;
  151. if(bigImage.progress==1) {
  152. loadingIndicator.opacity=0;
  153. loadingIndicatorDark.opacity=0;
  154. //biggerThumb.opacity =0;
  155. biggerThumb.visible=false;
  156. biggerThumb.scale = 0.6;
  157. }
  158. }
  159. z: 25;
  160. }
  161. Image {
  162. id: biggerThumb
  163. width: 600
  164. height: 300
  165. fillMode: Image.PreserveAspectFit
  166. anchors.horizontalCenter: parent.horizontalCenter
  167. anchors.verticalCenter: parent.verticalCenter
  168. opacity: 0.4
  169. z: 14
  170. /*SequentialAnimation on scale {
  171. loops: Animation.Infinite
  172. NumberAnimation {
  173. from: 0.7
  174. to: 1.2
  175. easing.type: Easing.InOutBounce
  176. duration: 10000
  177. }
  178. PauseAnimation { duration: 3000 }
  179. }*/
  180. }
  181. Rectangle {
  182. id: loadingIndicator
  183. width: 410
  184. height: 100
  185. radius: 12
  186. color: "lightgray"
  187. anchors.verticalCenter: parent.verticalCenter
  188. anchors.horizontalCenter: parent.horizontalCenter
  189. z: 11
  190. }
  191. Rectangle {
  192. id: loadingIndicatorDark
  193. width: 0
  194. height: 90
  195. radius: 12
  196. gradient: Gradient {
  197. GradientStop {
  198. position: 0.00;
  199. color: "#181717";
  200. }
  201. GradientStop {
  202. position: 0.52;
  203. color: "#455dd5";
  204. }
  205. GradientStop {
  206. position: 1.00;
  207. color: "#1c3bd7";
  208. }
  209. }
  210. color: "#443f3f"
  211. anchors.verticalCenter: parent.verticalCenter
  212. anchors.horizontalCenter: parent.horizontalCenter
  213. z: 12
  214. }
  215. /*Text {
  216. id: testText
  217. anchors.horizontalCenter: parent.horizontalCenter
  218. anchors.verticalCenter: parent.verticalCenter
  219. color: "white"
  220. font.pointSize: 12
  221. z: 20
  222. }*/
  223. }
  224. }