X-Git-Url: http://git.maemo.org/git/?p=quicknewsreader;a=blobdiff_plain;f=qml%2FQuickNewsReader%2Fmain.qml;h=7000a2ccd48470000b9138e58e7f9d1d9b418d3d;hp=ebee529e6783da0f2d3feedad50aadaf74bf6b23;hb=310ac8e6b3fadd9b43c528e6e8ae050e66844c7c;hpb=f60fe85fee497f7865a28a43797d6867c8cc401e diff --git a/qml/QuickNewsReader/main.qml b/qml/QuickNewsReader/main.qml index ebee529..7000a2c 100644 --- a/qml/QuickNewsReader/main.qml +++ b/qml/QuickNewsReader/main.qml @@ -5,25 +5,30 @@ 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"; componentId: "sourcesRect"; componentDepth: 0 } + ListElement { component: "content/view/Sources.qml"; componentDepth: 0 } } - property variant currentSource: listSourceModel[currentSourceIndex] - property bool loading: currentSource.loading - property ListModel windowViewsModel: viewsModel ListView { id: viewsList @@ -32,14 +37,40 @@ Rectangle { 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: componentId + 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 {