uonedb-qt team mailing list archive
-
uonedb-qt team
-
Mailing list archive
-
Message #00319
[Merge] lp:~uonedb-qt/u1db-qt/advanced-game into lp:u1db-qt
Christian Dywan has proposed merging lp:~uonedb-qt/u1db-qt/advanced-game into lp:u1db-qt.
Commit message:
Add new advanced-game example
Requested reviews:
Christian Dywan (kalikiana)
Nekhelesh Ramananthan (nik90)
For more details, see:
https://code.launchpad.net/~uonedb-qt/u1db-qt/advanced-game/+merge/209920
--
https://code.launchpad.net/~uonedb-qt/u1db-qt/advanced-game/+merge/209920
Your team U1DB Qt developers is subscribed to branch lp:~uonedb-qt/u1db-qt/advanced-game.
=== added directory 'examples/advanced-game'
=== added file 'examples/advanced-game/AdvancedGame.desktop'
--- examples/advanced-game/AdvancedGame.desktop 1970-01-01 00:00:00 +0000
+++ examples/advanced-game/AdvancedGame.desktop 2014-08-25 09:53:24 +0000
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=AdvancedGame
+Exec=/usr/bin/qmlscene $@ /usr/share/AdvancedGame/AdvancedGame.qml
+Icon=qmlscene
+Terminal=false
+Type=Application
+X-Ubuntu-Touch=true
=== added file 'examples/advanced-game/AdvancedGame.json'
--- examples/advanced-game/AdvancedGame.json 1970-01-01 00:00:00 +0000
+++ examples/advanced-game/AdvancedGame.json 2014-08-25 09:53:24 +0000
@@ -0,0 +1,6 @@
+{
+ "policy_groups": [
+ "networking"
+ ],
+ "policy_version": 1.2
+}
\ No newline at end of file
=== added file 'examples/advanced-game/AdvancedGame.qml'
--- examples/advanced-game/AdvancedGame.qml 1970-01-01 00:00:00 +0000
+++ examples/advanced-game/AdvancedGame.qml 2014-08-25 09:53:24 +0000
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2014 Canonical, Ltd.
+ *
+ * Authors:
+ * Nekhelesh Ramananthan <nik90@xxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.2
+import Ubuntu.Components 1.1
+
+// Import U1db to access its functions
+import U1db 1.0 as U1db
+
+MainView {
+ id: mainView
+
+ objectName: "mainView"
+ applicationName: "com.ubuntu.developer.nik90.AdvancedGame"
+
+ width: units.gu(50)
+ height: units.gu(75)
+
+ useDeprecatedToolbar: false
+
+ // U1db database to store player profiles
+ U1db.Database {
+ id: appDb
+ path: "playerDatabase"
+ }
+
+ // Common Action available to all pages
+ Action {
+ id: addPlayerAction
+ text: i18n.tr("Add Player")
+ iconName: "add"
+ onTriggered: pagestack.push(Qt.resolvedUrl("CreatePlayerPage.qml"))
+ }
+
+ PageStack {
+ id: pagestack
+
+ Component.onCompleted: push(homePage)
+
+ Page {
+ id: homePage
+ title: i18n.tr("Advanced Game")
+
+ head.actions: [
+ addPlayerAction
+ ]
+
+ Column {
+ anchors.fill: parent
+ anchors.margins: units.gu(5)
+ spacing: units.gu(2)
+
+ Button {
+ width: parent.width
+ text: i18n.tr("List Players")
+ onClicked: pagestack.push(Qt.resolvedUrl("ListPlayers.qml"))
+ }
+
+ Button {
+ width: parent.width
+ text: i18n.tr("Filter Players")
+ onClicked: pagestack.push(Qt.resolvedUrl("FilterPlayers.qml"))
+ }
+ }
+ }
+ }
+}
=== added file 'examples/advanced-game/AdvancedGame.qmlproject'
--- examples/advanced-game/AdvancedGame.qmlproject 1970-01-01 00:00:00 +0000
+++ examples/advanced-game/AdvancedGame.qmlproject 2014-08-25 09:53:24 +0000
@@ -0,0 +1,53 @@
+/* File generated by Qt Creator (with Ubuntu Plugin), version 2.8.1 */
+
+import QmlProject 1.1
+
+Project {
+ mainFile: "AdvancedGame.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ Files {
+ filter: "*.desktop"
+ }
+ Files {
+ filter: "www/*.html"
+ }
+ Files {
+ filter: "Makefile"
+ }
+ Files {
+ directory: "www"
+ filter: "*"
+ }
+ Files {
+ directory: "www/img/"
+ filter: "*"
+ }
+ Files {
+ directory: "www/css/"
+ filter: "*"
+ }
+ Files {
+ directory: "www/js/"
+ filter: "*"
+ }
+ Files {
+ directory: "tests/"
+ filter: "*"
+ }
+ Files {
+ directory: "debian"
+ filter: "*"
+ }
+ /* List of plugin directories passed to QML runtime */
+ importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml" ]
+}
=== added file 'examples/advanced-game/CreatePlayerPage.qml'
--- examples/advanced-game/CreatePlayerPage.qml 1970-01-01 00:00:00 +0000
+++ examples/advanced-game/CreatePlayerPage.qml 2014-08-25 09:53:24 +0000
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2014 Canonical, Ltd.
+ *
+ * Authors:
+ * Nekhelesh Ramananthan <nik90@xxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.2
+import Ubuntu.Components 1.1
+import U1db 1.0 as U1db
+
+Page {
+ id: createUserPage
+
+ visible: false
+ title: i18n.tr("Create Player")
+
+ head.actions: [
+ Action {
+ id: savePlayerAction
+ text: i18n.tr("Save Player")
+ iconName: "save"
+ onTriggered: {
+ appDb.putDoc({ "username": userName.text, "userlevel": userlevel.text, "userclass": userClass.selectedIndex})
+ pageStack.pop()
+ }
+ }
+ ]
+
+ Column {
+ spacing: units.gu(3)
+ anchors.fill: parent
+ anchors.margins: units.gu(2)
+
+ Column {
+ width: parent.width
+ spacing: units.gu(1)
+ Label { text: i18n.tr("Username") }
+ TextField {
+ id: userName
+ placeholderText: "Username"
+ width: parent.width
+ }
+ }
+
+ Column {
+ width: parent.width
+ spacing: units.gu(1)
+ Label { text: i18n.tr("User Level") }
+ TextField {
+ id: userlevel
+ placeholderText: "User Level"
+ width: parent.width
+ }
+ }
+
+ OptionSelector {
+ id: userClass
+ model: ["Foot Soldier", "Archer", "Giant", "Wizard", "Demolisher"]
+ }
+ }
+}
=== added file 'examples/advanced-game/FilterPlayers.qml'
--- examples/advanced-game/FilterPlayers.qml 1970-01-01 00:00:00 +0000
+++ examples/advanced-game/FilterPlayers.qml 2014-08-25 09:53:24 +0000
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2014 Canonical, Ltd.
+ *
+ * Authors:
+ * Nekhelesh Ramananthan <nik90@xxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.2
+import Ubuntu.Components 1.1
+import Ubuntu.Components.ListItems 1.0 as ListItem
+import U1db 1.0 as U1db
+
+Page {
+ id: filterPlayers
+
+ visible: false
+ title: "Filter Players"
+
+ U1db.Index {
+ database: appDb
+ id: by_player
+ expression: ["username", "userlevel", "userclass"]
+ }
+
+ U1db.Query {
+ id: playerQuery
+ index: by_player
+ query: [{username:'*'}, {userlevel:'*'},{userclass:userClass.selectedIndex.toString()}]
+ }
+
+ Column {
+ spacing: units.gu(3)
+ anchors.fill: parent
+ anchors.margins: units.gu(2)
+
+ Label { text: "Filter by user class" }
+
+ OptionSelector {
+ id: userClass
+ model: ["Foot Soldier", "Archer", "Giant", "Wizard", "Demolisher"]
+ }
+
+ ListView {
+ id: players
+
+ width: parent.width
+ height: units.gu(20)
+
+ clip: true
+ model: playerQuery
+
+ delegate: ListItem.Subtitled {
+ text: '%1 Lvl %2'.arg(model.contents.username).arg(model.contents.userlevel)
+ subText: userClass.model[model.contents.userclass]
+ removable: true
+ confirmRemoval: true
+ onItemRemoved: appDb.deleteDoc(model.docId)
+ }
+ }
+ }
+}
=== added file 'examples/advanced-game/ListPlayers.qml'
--- examples/advanced-game/ListPlayers.qml 1970-01-01 00:00:00 +0000
+++ examples/advanced-game/ListPlayers.qml 2014-08-25 09:53:24 +0000
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2014 Canonical, Ltd.
+ *
+ * Authors:
+ * Nekhelesh Ramananthan <nik90@xxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.2
+import Ubuntu.Components 1.1
+import Ubuntu.Components.ListItems 1.0 as ListItem
+import U1db 1.0 as U1db
+
+Page {
+ id: homePage
+
+ visible: false
+ title: i18n.tr("List Players")
+
+ head.actions: [
+ addPlayerAction
+ ]
+
+ U1db.Index {
+ database: appDb
+ id: by_player
+ expression: ["username", "userlevel", "userclass"]
+ }
+
+ U1db.Query {
+ id: playerQuery
+ index: by_player
+ query: ["*", "*", "*"]
+ }
+
+ Label {
+ anchors.centerIn: parent
+ visible: players.count === 0
+ text: "No players? Add some!"
+ }
+
+ ListView {
+ id: players
+ anchors.fill: parent
+ clip: true
+ model: playerQuery
+
+ delegate: ListItem.Subtitled {
+ text: model.contents.username
+ subText: "User Level: " + model.contents.userlevel
+ removable: true
+ confirmRemoval: true
+ onItemRemoved: appDb.deleteDoc(model.docId)
+ }
+ }
+}
=== added file 'examples/advanced-game/manifest.json'
--- examples/advanced-game/manifest.json 1970-01-01 00:00:00 +0000
+++ examples/advanced-game/manifest.json 2014-08-25 09:53:24 +0000
@@ -0,0 +1,15 @@
+{
+ "architecture": "all",
+ "description": "description of AdvancedGame",
+ "framework": "ubuntu-sdk-14.10-qml-dev3",
+ "hooks": {
+ "AdvancedGame": {
+ "apparmor": "AdvancedGame.json",
+ "desktop": "AdvancedGame.desktop"
+ }
+ },
+ "maintainer": "Nekhelesh Ramananthan <krnekhelesh@xxxxxxxxx>",
+ "name": "com.ubuntu.developer.nik90.advancedgame",
+ "title": "AdvancedGame",
+ "version": "0.1"
+}
Follow ups