import QtQuick 1.0 import "content/view" import "content/modelimpl" import "content/modelitf" Rectangle { id: window //anchors.fill: parent // use this little trick to always adapt itself to the screen width: 800; height: 480 property int currentSourceIndex: 0 property list listSourceModel: [ LeMondeSourceModel{}, GoogleReaderSourceModel{}, FavoriteFeedsSourceModel{}, YahooSourceModel{} ] property variant currentSource: listSourceModel[currentSourceIndex] property bool loading: currentSource.loading property alias windowViewsModel: viewsModel property alias windowViewsList: viewsList property alias currentContentX: viewsList.contentX ListModel { id: viewsModel ListElement { component: "content/view/Sources.qml"; componentDepth: 0 } } ListView { id: viewsList anchors.fill: window orientation: ListView.Horizontal snapMode: ListView.SnapOneItem flickDeceleration: 500 cacheBuffer: 1600 // so that the next delegate gets actually loaded... preferredHighlightBegin: window.x preferredHighlightEnd: window.width highlightRangeMode: ListView.StrictlyEnforceRange boundsBehavior: Flickable.StopAtBounds Behavior on contentX { NumberAnimation { duration: 500; easing.type: Easing.InOutCubic } } model: viewsModel delegate: Loader { id: modelLoader source: component ListView.onAdd: { viewsList.contentX = componentDepth*window.width //viewsList.currentIndex = componentDepth // doesn't work well with Qt 4.7.3 on Maemo... } } } function showConfigDialog(index) { configDialog.configModel = listSourceModel[index] configDialog.state = "showSourceConfig" } SourceConfigDialog { id:configDialog } /* */ Component { id: quitButtonDelegate Item { width: parent.width; height: 60 Text { text: "Quit" font { family: "Helvetica"; pixelSize: 16; bold: true } anchors { left: parent.left; leftMargin: 15 verticalCenter: parent.verticalCenter } } MouseArea { anchors.fill: parent onClicked: Qt.quit() } } } }