Big changes all around. Basic download works.
[mussorgsky] / ui / Alternatives.qml
1 import QtQuick 1.1
2 import com.meego 1.0
3
4 Page {
5     id: coversAlternativesPage
6
7     tools: ToolBarLayout {
8              ToolIcon {
9                id: backButton
10                iconId: "toolbar-back" 
11                onClicked: { missionControl.stop_pending_jobs(); pageStack.pop () }
12              }
13     }
14
15     GridView { 
16         id: coversView
17         model: coversModel
18         anchors.fill : coversAlternativesPage
19         cellWidth: 160
20         cellHeight: 160
21
22         delegate: Component {
23           Rectangle {
24               id: coverPaintArea
25               width: coversView.cellWidth
26               height: coversView.cellHeight
27               border.color: "red"
28               
29               Image {
30                  id: cover
31                  source: model.cover.url
32                  width: parent.width
33                  height: parent.height
34                  cache: false
35                  anchors.centerIn: parent
36               }              
37               
38               Text {
39                  id: t
40                  text: "xxx"
41                  visible: (model.cover.url == null)
42               }
43
44               MouseArea {
45                    anchors.fill: coverPaintArea
46                    onClicked: {
47                       console.log ("wohooo")
48                       missionControl.save_option_for (coversModel, index)
49                       backButton.clicked ()       
50                    }
51               }
52
53         }
54       }
55     }
56
57 }
58
59
60 /*
61 Row {
62        id: coversAlternatives
63
64        // This are set on construction
65        property alias altmodel: imagesLoop.model
66        property variant albumListModel
67        property variant mc
68
69        // Pass this when an image is clicked
70        property int indexInAlbumList
71        
72        signal done
73
74        anchors.horizontalCenter : parent.horizontalCenter
75        anchors.verticalCenter: parent.verticalCenter
76
77        spacing: parent.width / 16
78
79        Repeater {
80            id: imagesLoop
81            delegate: Component {
82                 ClickeableImage {
83                   source: model.cover.url
84                   width: 120
85                   height: 120
86                   onClicked: { 
87                      console.log (model.cover.url) 
88                      mc.coverSelected (model.cover, albumListModel, indexInAlbumList)
89                      coversAlternatives.done ()
90                   }
91                }
92            }
93        }
94 }
95
96 */