From 1d55c88b66013f86be9c7ef069f0f8cdb598d1e2 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 26 Nov 2009 11:34:44 +0100 Subject: rename .qs files to .js QtScript _is_ JavaScript, there's no need to use a custom extension. Most of the other examples were already using .js, but there were two files that still had the .qs extension. Agreed with Simon. Reviewed-by: TrustMe --- doc/src/examples/helloscript.qdoc | 6 +++--- examples/script/helloscript/helloscript.js | 5 +++++ examples/script/helloscript/helloscript.qrc | 2 +- examples/script/helloscript/helloscript.qs | 5 ----- examples/script/helloscript/main.cpp | 2 +- examples/script/qsdbg/example.js | 17 +++++++++++++++++ examples/script/qsdbg/example.qs | 17 ----------------- examples/script/qsdbg/main.cpp | 2 +- 8 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 examples/script/helloscript/helloscript.js delete mode 100644 examples/script/helloscript/helloscript.qs create mode 100644 examples/script/qsdbg/example.js delete mode 100644 examples/script/qsdbg/example.qs diff --git a/doc/src/examples/helloscript.qdoc b/doc/src/examples/helloscript.qdoc index 7142d8b..243b10f 100644 --- a/doc/src/examples/helloscript.qdoc +++ b/doc/src/examples/helloscript.qdoc @@ -69,7 +69,7 @@ The contents of the script file are read. - \snippet examples/script/helloscript/helloscript.qs 0 + \snippet examples/script/helloscript/helloscript.js 0 The script sets the \c text (note that the qTr() function is used to allow for translation) and \c styleSheet properties of the button, and calls the @@ -105,7 +105,7 @@ To generate the translation file, run \c lupdate as follows: \code - lupdate helloscript.qs -ts helloscript_la.ts + lupdate helloscript.js -ts helloscript_la.ts \endcode You should now have a file \c helloscript_la.ts in the current @@ -115,7 +115,7 @@ linguist helloscript_la.ts \endcode - You should now see the text "helloscript.qs" in the top left pane. + You should now see the text "helloscript.js" in the top left pane. Double-click it, then click on "Hello world!" and enter "Orbis, te saluto!" in the \gui Translation pane (the middle right of the window). Don't forget the exclamation mark! diff --git a/examples/script/helloscript/helloscript.js b/examples/script/helloscript/helloscript.js new file mode 100644 index 0000000..6d8e87c --- /dev/null +++ b/examples/script/helloscript/helloscript.js @@ -0,0 +1,5 @@ +//! [0] +button.text = qsTr('Hello World!'); +button.styleSheet = 'font-style: italic'; +button.show(); +//! [0] diff --git a/examples/script/helloscript/helloscript.qrc b/examples/script/helloscript/helloscript.qrc index dc93461..c52fa15 100644 --- a/examples/script/helloscript/helloscript.qrc +++ b/examples/script/helloscript/helloscript.qrc @@ -1,5 +1,5 @@ - helloscript.qs + helloscript.js diff --git a/examples/script/helloscript/helloscript.qs b/examples/script/helloscript/helloscript.qs deleted file mode 100644 index 6d8e87c..0000000 --- a/examples/script/helloscript/helloscript.qs +++ /dev/null @@ -1,5 +0,0 @@ -//! [0] -button.text = qsTr('Hello World!'); -button.styleSheet = 'font-style: italic'; -button.show(); -//! [0] diff --git a/examples/script/helloscript/main.cpp b/examples/script/helloscript/main.cpp index bc9a65e..55d63bf 100644 --- a/examples/script/helloscript/main.cpp +++ b/examples/script/helloscript/main.cpp @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) //! [2] //! [3] - QString fileName(":/helloscript.qs"); + QString fileName(":/helloscript.js"); QFile scriptFile(fileName); scriptFile.open(QIODevice::ReadOnly); QTextStream stream(&scriptFile); diff --git a/examples/script/qsdbg/example.js b/examples/script/qsdbg/example.js new file mode 100644 index 0000000..47c1363 --- /dev/null +++ b/examples/script/qsdbg/example.js @@ -0,0 +1,17 @@ +function bar() { + var x = 1; + var y = 2; + return x + y; +} + +function foo(a, b, c) { + var i = a + bar(); + var j = b - bar(); + var k = c * bar(); + return Math.cos(i) + Math.sin(j) - Math.atan(k); +} + +var first = foo(1, 2, 3); +var second = foo(4, 5, 6); +print("first was:", first, ", and second was:", second); + diff --git a/examples/script/qsdbg/example.qs b/examples/script/qsdbg/example.qs deleted file mode 100644 index 47c1363..0000000 --- a/examples/script/qsdbg/example.qs +++ /dev/null @@ -1,17 +0,0 @@ -function bar() { - var x = 1; - var y = 2; - return x + y; -} - -function foo(a, b, c) { - var i = a + bar(); - var j = b - bar(); - var k = c * bar(); - return Math.cos(i) + Math.sin(j) - Math.atan(k); -} - -var first = foo(1, 2, 3); -var second = foo(4, 5, 6); -print("first was:", first, ", and second was:", second); - diff --git a/examples/script/qsdbg/main.cpp b/examples/script/qsdbg/main.cpp index 526de0c..fdcc7cb 100644 --- a/examples/script/qsdbg/main.cpp +++ b/examples/script/qsdbg/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char **argv) { if (argc < 2) { - fprintf(stderr, "*** you must specify a script file to evaluate (try example.qs)\n"); + fprintf(stderr, "*** you must specify a script file to evaluate (try example.js)\n"); return(-1); } -- cgit v0.12