Settings dialog infrastructure
[quicknewsreader] / qml / QuickNewsReader / main.qml
1 import QtQuick 1.0
2 import "content/view"
3 import "content/modelimpl"
4 import "content/modelitf"
5
6 Rectangle {
7     id: window
8     width: 800; height: 480
9
10     property int currentSourceIndex: 0
11
12     property list<SourceModel> listSourceModel: [
13         LeMondeSourceModel{},
14         FavoriteFeedsSourceModel{},
15         YahooSourceModel{}
16     ]
17
18     ListModel {
19         id: viewsModel
20
21         ListElement { component: "content/view/Sources.qml"; componentId: "sourcesRect"; componentDepth: 0 }
22     }
23
24     property variant currentSource: listSourceModel[currentSourceIndex]
25     property bool loading: currentSource.loading
26     property ListModel windowViewsModel: viewsModel
27     property ListView windowViewsList: viewsList
28
29     ListView {
30         id: viewsList
31
32         anchors.fill: window
33         orientation: ListView.Horizontal
34         snapMode: ListView.SnapOneItem
35         flickDeceleration: 500
36
37         model: viewsModel
38         delegate: Loader {
39             id: componentId
40             source: component
41         }
42     }
43
44     function showConfigDialog(settingsComponent) {
45         configDialog.configViewComponent = settingsComponent
46         configDialog.state = "showSourceConfig"
47     }
48
49     SourceConfigDialog {
50         id:configDialog
51     }
52
53 /*
54 */
55
56     Component {
57         id: quitButtonDelegate
58         Item {
59             width: parent.width; height: 60
60             Text {
61                 text: "Quit"
62                 font { family: "Helvetica"; pixelSize: 16; bold: true }
63                 anchors {
64                     left: parent.left; leftMargin: 15
65                     verticalCenter: parent.verticalCenter
66                 }
67             }
68             MouseArea {
69                 anchors.fill: parent
70                 onClicked: Qt.quit()
71             }
72         }
73     }
74 }