From dd9617e4cdf05319f272804e293d870a00aa0b66 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 23 Apr 2010 15:37:32 +1000 Subject: Replace usage of print() with console.log(). --- demos/declarative/samegame/SamegameCore/samegame.js | 9 ++++----- demos/declarative/snake/content/snake.js | 8 ++++---- doc/src/declarative/javascriptblocks.qdoc | 14 ++++++++------ examples/declarative/dynamic/qml/itemCreation.js | 6 +++--- .../declarative/tutorials/samegame/samegame2/samegame.js | 8 ++++---- .../declarative/tutorials/samegame/samegame3/samegame.js | 8 ++++---- .../tutorials/samegame/samegame4/content/samegame.js | 8 ++++---- examples/declarative/workerscript/workerscript.qml | 6 +++--- 8 files changed, 34 insertions(+), 33 deletions(-) diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js index aafbfdf..bf99ca3 100755 --- a/demos/declarative/samegame/SamegameCore/samegame.js +++ b/demos/declarative/samegame/SamegameCore/samegame.js @@ -5,7 +5,6 @@ var maxRow = 15; var maxIndex = maxColumn*maxRow; var board = new Array(maxIndex); var blockSrc = "SamegameCore/BoomBlock.qml"; -var scoresURL = "http://qtfx-nokia.trolltech.com.au/samegame/scores.php"; var scoresURL = ""; var gameDuration; var component = Qt.createComponent(blockSrc); @@ -179,8 +178,8 @@ function createBlock(column,row){ if(component.isReady){ var dynamicObject = component.createObject(); if(dynamicObject == null){ - print("error creating block"); - print(component.errorsString()); + console.log("error creating block"); + console.log(component.errorsString()); return false; } dynamicObject.type = Math.floor(Math.random() * 3); @@ -193,8 +192,8 @@ function createBlock(column,row){ dynamicObject.spawned = true; board[index(column,row)] = dynamicObject; }else{ - print("error loading block component"); - print(component.errorsString()); + console.log("error loading block component"); + console.log(component.errorsString()); return false; } return true; diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js index 2457fbd..02f9757 100644 --- a/demos/declarative/snake/content/snake.js +++ b/demos/declarative/snake/content/snake.js @@ -54,9 +54,9 @@ function startNewGame() } else { if(linkComponent.isReady == false){ if(linkComponent.isError == true) - print(linkComponent.errorsString()); + console.log(linkComponent.errorsString()); else - print("Still loading linkComponent"); + console.log("Still loading linkComponent"); continue;//TODO: Better error handling? } var link = linkComponent.createObject(); @@ -295,9 +295,9 @@ function createCookie(value) { if(cookieComponent.isReady == false){ if(cookieComponent.isError == true) - print(cookieComponent.errorsString()); + console.log(cookieComponent.errorsString()); else - print("Still loading cookieComponent"); + console.log("Still loading cookieComponent"); return;//TODO: Better error handling? } cookie = cookieComponent.createObject(); diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc index d9a2ba5..2db7e8e 100644 --- a/doc/src/declarative/javascriptblocks.qdoc +++ b/doc/src/declarative/javascriptblocks.qdoc @@ -75,7 +75,7 @@ Item { MouseArea { anchors.fill: parent - onClicked: print(factorial(10)) + onClicked: console.log(factorial(10)) } } \endcode @@ -99,7 +99,7 @@ import "factorial.js" as MathFunctions Item { MouseArea { anchors.fill: parent - onClicked: print(MathFunctions.factorial(10)) + onClicked: console.log(MathFunctions.factorial(10)) } } \endcode @@ -207,16 +207,18 @@ is illegal in QML. \code // Illegal modification of undeclared variable a = 1; -for (var ii = 1; ii < 10; ++ii) a = a * ii; - console.log("Result: " + a); +for (var ii = 1; ii < 10; ++ii) + a = a * ii; +console.log("Result: " + a); \endcode It can be trivially modified to this legal code. \code var a = 1; -for (var ii = 1; ii < 10; ++ii) a = a * ii; - console.log("Result: " + a); +for (var ii = 1; ii < 10; ++ii) + a = a * ii; +console.log("Result: " + a); \endcode Any attempt to modify the global object - either implicitly or explicitly - will diff --git a/examples/declarative/dynamic/qml/itemCreation.js b/examples/declarative/dynamic/qml/itemCreation.js index 4fa0d9f..98d48a8 100644 --- a/examples/declarative/dynamic/qml/itemCreation.js +++ b/examples/declarative/dynamic/qml/itemCreation.js @@ -32,7 +32,7 @@ function loadComponent() { createItem(); itemComponent = Qt.createComponent(itemButton.file); - //print(itemButton.file) + //console.log(itemButton.file) if(itemComponent.isLoading){ component.statusChanged.connect(finishCreation); }else{//Depending on the content, it can be ready or error immediately @@ -51,8 +51,8 @@ function createItem() { draggedItem.z = 4;//On top } else if (itemComponent.isError) { draggedItem = null; - print("error creating component"); - print(component.errorsString()); + console.log("error creating component"); + console.log(component.errorsString()); } } diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/declarative/tutorials/samegame/samegame2/samegame.js index 81da31b..e5c790d 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.js @@ -43,8 +43,8 @@ function createBlock(column, row) { if (component.isReady) { var dynamicObject = component.createObject(); if (dynamicObject == null) { - print("error creating block"); - print(component.errorsString()); + console.log("error creating block"); + console.log(component.errorsString()); return false; } dynamicObject.parent = background; @@ -54,8 +54,8 @@ function createBlock(column, row) { dynamicObject.height = blockSize; board[index(column, row)] = dynamicObject; } else { - print("error loading block component"); - print(component.errorsString()); + console.log("error loading block component"); + console.log(component.errorsString()); return false; } return true; diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.js b/examples/declarative/tutorials/samegame/samegame3/samegame.js index eaf47d9..da0f76e 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.js @@ -40,8 +40,8 @@ function createBlock(column, row) { if (component.isReady) { var dynamicObject = component.createObject(); if (dynamicObject == null) { - print("error creating block"); - print(component.errorsString()); + console.log("error creating block"); + console.log(component.errorsString()); return false; } dynamicObject.type = Math.floor(Math.random() * 3); @@ -52,8 +52,8 @@ function createBlock(column, row) { dynamicObject.height = gameCanvas.blockSize; board[index(column, row)] = dynamicObject; } else { - print("error loading block component"); - print(component.errorsString()); + console.log("error loading block component"); + console.log(component.errorsString()); return false; } return true; diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index c527f66..1454f0b 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -51,8 +51,8 @@ function createBlock(column, row) { if (component.isReady) { var dynamicObject = component.createObject(); if (dynamicObject == null) { - print("error creating block"); - print(component.errorsString()); + console.log("error creating block"); + console.log(component.errorsString()); return false; } dynamicObject.type = Math.floor(Math.random() * 3); @@ -65,8 +65,8 @@ function createBlock(column, row) { dynamicObject.spawned = true; board[index(column, row)] = dynamicObject; } else { - print("error loading block component"); - print(component.errorsString()); + console.log("error loading block component"); + console.log(component.errorsString()); return false; } return true; diff --git a/examples/declarative/workerscript/workerscript.qml b/examples/declarative/workerscript/workerscript.qml index 6c6253b..2294a81 100644 --- a/examples/declarative/workerscript/workerscript.qml +++ b/examples/declarative/workerscript/workerscript.qml @@ -8,9 +8,9 @@ Rectangle { source: "workerscript.js" onMessage: { - print("Moved " + messageObject.xmove + " along the X axis."); - print("Moved " + messageObject.ymove + " along the Y axis."); - print("Moved " + messageObject.move + " pixels."); + console.log("Moved " + messageObject.xmove + " along the X axis."); + console.log("Moved " + messageObject.ymove + " along the Y axis."); + console.log("Moved " + messageObject.move + " pixels."); } } -- cgit v0.12