123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- import QtQuick 1.0
- import com.nokia.symbian 1.1
- ApplicationWindow {
- id: theAPP
- Component.onCompleted:{
- pageStack.push(mainPage);
- //deferred initialization for performance reason
- catalogModel.readDRMCatalog();
- }
- Page{
- id: mainPage
- tools: ToolBarLayout {
- ToolButton {
- iconSource: "toolbar-back"
- onClicked: Qt.quit()
- }
- ToolButton {
- id: buttonRestore
- iconSource: "toolbar-refresh"
- enabled: !catalogModel.isApplicationBusy
- ToolTip {
- id: toolTipRestore
- text: "Restore purchase sessions"
- target: buttonRestore
- visible: false
- }
- onPlatformPressAndHold: toolTipRestore.visible = true
- onPlatformReleased: toolTipRestore.visible = false
- }
- ToolButton {
- id: buttonDelete
- iconSource: "toolbar-delete"
- enabled: !catalogModel.isApplicationBusy
- ToolTip {
- id: toolTipDelete
- text: "Reset purchase sessions"
- target: buttonDelete
- visible: false
- }
- onPlatformPressAndHold: toolTipDelete.visible = true
- onPlatformReleased: toolTipDelete.visible = false
- onClicked: {
- catalogModel.resetPurchases();
- }
- }
- ToolButton {
- iconSource: "gfx/icon_info.png"
- onClicked: theAPP.pageStack.push(infoPage)
- }
- }
- Flickable {
- anchors.fill: parent
- contentWidth: parent.width
- contentHeight: content.height
- Column{
- id: content
- spacing: 10
- ListView {
- interactive: false
- model: itemsToBuyModel
- delegate: listToBuyDelegate
- header: ListHeading {
- ListItemText {
- anchors.centerIn: parent
- role: "SelectionSubTitle"
- text: "Items to buy"
- }
- }
- width: mainPage.width
- // NOTE: incrementing items count is for accounting header
- height: (mainPage.tools.implicitHeight + spacing) * (count + 1)
- z:count // to overlap "Items you have" header if the list is empty
- }
- ListView {
- interactive: false
- model: itemsBoughtModel
- delegate: listYouHaveDelegate
- header: ListHeading {
- ListItemText {
- anchors.centerIn: parent
- role: "SelectionSubTitle"
- text: "Items you have"
- }
- }
- width: mainPage.width
- height: (mainPage.tools.implicitHeight + spacing) * (count + 1)
- }
- }
- }
- BusyIndicator {
- anchors.centerIn: parent
- visible: catalogModel.isApplicationBusy
- running: true
- width: 60
- height: 60
- }
- Component {
- id: listToBuyDelegate
- ListItem {
- subItemIndicator: true
- Column {
- anchors.fill: parent.paddingItem
- ListItemText {
- role: "Title"
- text: iap_productid // Title text from model
- width: parent.width
- color: iap_isBusy ? "darkred" : "darkgreen"
- }
- }
- onClicked:{
- catalogModel.buy(index);
- }
- }
- }
- Component {
- id: listYouHaveDelegate
- ListItem {
- Column {
- anchors.fill: parent.paddingItem
- ListItemText {
- role: "Title"
- text: iap_productid // Title text from model
- width: parent.width
- }
- }
- }
- }
- Page{
- id: infoPage
- TextArea{
- id: info
- anchors.margins: 30
- anchors.fill: parent
- readOnly: true
- property string link: "http://projects.developer.nokia.com/iap_sample_drm_case"
- text: "This is a mock game application project that demonstrates use " +
- "of In-application Purchase API with Nokia DRM protected resources. " +
- "You can use that application as skeleton for your project.<br/><br/>" +
- "For more details please see the application project page : " +
- "<p style=\"color: darkblue\">TryAndBuyExample</p>"
- }
- MouseArea{
- anchors.fill: info
- onClicked: Qt.openUrlExternally(info.link)
- }
- tools: ToolBarLayout {
- ToolButton {
- iconSource: "toolbar-back"
- onClicked: theAPP.pageStack.pop()
- }
- }
- }
- }
- }
|