aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2012-01-24 16:07:24 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-25 06:32:34 +0100
commitb2869013fdfb76d60ce8750e24614111f78fef5c (patch)
treec57ec9c0cfc1226c1ac9d66735ddd267b20cffca /examples/declarative
parent149f6afe321ce59aebe4ce2f9dddd1881d0ac22b (diff)
Move sqldatabase into a module API plugin
Change-Id: Icd0bbfe16804abf1bbadbabddf3a30b5b18df30c Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'examples/declarative')
-rwxr-xr-xexamples/declarative/samegame/content/samegame.js5
-rw-r--r--examples/declarative/snake/content/HighScoreModel.qml3
-rw-r--r--examples/declarative/sqllocalstorage/hello.qml3
-rwxr-xr-xexamples/declarative/tutorials/samegame/samegame4/content/samegame.js5
4 files changed, 10 insertions, 6 deletions
diff --git a/examples/declarative/samegame/content/samegame.js b/examples/declarative/samegame/content/samegame.js
index 8c15af763a..611767584b 100755
--- a/examples/declarative/samegame/content/samegame.js
+++ b/examples/declarative/samegame/content/samegame.js
@@ -1,5 +1,6 @@
/* This script file handles the game logic */
.pragma library
+.import QtQuick.LocalStorage 2.0 as Sql
var maxColumn = 10;
var maxRow = 15;
@@ -229,7 +230,7 @@ function createBlock(column,row)
function initHighScoreBar()
{
- var db = openDatabaseSync(
+ var db = Sql.openDatabaseSync(
"SameGameScores",
"1.0",
"Local SameGame High Scores",
@@ -254,7 +255,7 @@ function saveHighScore(name)
if (scoresURL != "")
sendHighScore(name);
// Offline storage
- var db = openDatabaseSync(
+ var db = Sql.openDatabaseSync(
"SameGameScores",
"1.0",
"Local SameGame High Scores",
diff --git a/examples/declarative/snake/content/HighScoreModel.qml b/examples/declarative/snake/content/HighScoreModel.qml
index 0a30d7343e..d6ac762859 100644
--- a/examples/declarative/snake/content/HighScoreModel.qml
+++ b/examples/declarative/snake/content/HighScoreModel.qml
@@ -40,6 +40,7 @@
****************************************************************************/
import QtQuick 2.0
+import QtQuick.LocalStorage 2.0 as Sql
// Models a high score table.
//
@@ -84,7 +85,7 @@ ListModel {
function __db()
{
- return openDatabaseSync("HighScoreModel", "1.0", "Generic High Score Functionality for QML", 1000000);
+ return Sql.openDatabaseSync("HighScoreModel", "1.0", "Generic High Score Functionality for QML", 1000000);
}
function __ensureTables(tx)
{
diff --git a/examples/declarative/sqllocalstorage/hello.qml b/examples/declarative/sqllocalstorage/hello.qml
index 5290f9c38b..8312e8cabe 100644
--- a/examples/declarative/sqllocalstorage/hello.qml
+++ b/examples/declarative/sqllocalstorage/hello.qml
@@ -39,6 +39,7 @@
****************************************************************************/
//![0]
import QtQuick 2.0
+import QtQuick.LocalStorage 2.0 as LS
Rectangle {
color: "white"
@@ -49,7 +50,7 @@ Rectangle {
text: "?"
anchors.horizontalCenter: parent.horizontalCenter
function findGreetings() {
- var db = openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000);
+ var db = LS.openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000);
db.transaction(
function(tx) {
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
index ccc3f9dae2..7bb7243914 100755
--- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
+++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
@@ -1,4 +1,6 @@
/* This script file handles the game logic */
+.import QtQuick.LocalStorage 2.0 as Sql
+
var maxColumn = 10;
var maxRow = 15;
var maxIndex = maxColumn * maxRow;
@@ -191,7 +193,7 @@ function saveHighScore(name) {
if (scoresURL != "")
sendHighScore(name);
- var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores", 100);
+ var db = Sql.openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores", 100);
var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)";
var data = [name, gameCanvas.score, maxColumn + "x" + maxRow, Math.floor(gameDuration / 1000)];
db.transaction(function(tx) {
@@ -222,4 +224,3 @@ function sendHighScore(name) {
postman.send(postData);
}
//![1]
-