From 04cb8ef1ee919f071540ccb5cae10bb47f37fb3e Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 5 Dec 2012 11:42:20 +0100 Subject: centralize and fixup example sources install targets follow respective change in qtbase Change-Id: I15346e16cd1d6f30cf32a77284b5f19b1dd2a7a9 Reviewed-by: Oswald Buddenhagen Reviewed-by: hjk --- examples/declarative/animation/animation.pro | 6 +- .../basics/color-animation/color-animation.pro | 4 +- .../property-animation/property-animation.pro | 4 +- .../behavior-example/behavior-example.pro | 4 +- .../animation/behaviors/wigglytext/wigglytext.pro | 4 +- examples/declarative/animation/easing/easing.pro | 4 +- examples/declarative/animation/states/states.pro | 4 +- examples/declarative/calculator/calculator.desktop | 11 + examples/declarative/calculator/calculator.pro | 24 ++ .../declarative/calculator/calculator.qmlproject | 16 ++ examples/declarative/calculator/calculator.svg | 93 ++++++ examples/declarative/calculator/calculator64.png | Bin 0 -> 3400 bytes examples/declarative/calculator/calculator80.png | Bin 0 -> 4945 bytes .../calculator/calculator_harmattan.desktop | 11 + examples/declarative/calculator/main.cpp | 61 ++++ .../qml/calculator/CalculatorCore/Button.qml | 80 ++++++ .../qml/calculator/CalculatorCore/Display.qml | 68 +++++ .../qml/calculator/CalculatorCore/calculator.js | 91 ++++++ .../calculator/CalculatorCore/images/button-.png | Bin 0 -> 1288 bytes .../CalculatorCore/images/button-blue.png | Bin 0 -> 1565 bytes .../CalculatorCore/images/button-green.png | Bin 0 -> 1543 bytes .../CalculatorCore/images/button-purple.png | Bin 0 -> 1566 bytes .../CalculatorCore/images/button-red.png | Bin 0 -> 1586 bytes .../calculator/CalculatorCore/images/display.png | Bin 0 -> 998 bytes .../qml/calculator/CalculatorCore/qmldir | 2 + .../calculator/qml/calculator/calculator.qml | 162 +++++++++++ .../declarative/cppextensions/cppextensions.pro | 5 - .../cppextensions/imageprovider/imageprovider.pro | 17 +- .../networkaccessmanagerfactory.pro | 4 +- .../declarative/cppextensions/plugins/plugins.pro | 12 +- .../qgraphicsgridlayout/qgraphicsgridlayout.pro | 4 +- .../qgraphicslinearlayout.pro | 4 +- .../cppextensions/qwidgets/qwidgets.pro | 11 +- .../referenceexamples/adding/adding.pro | 6 +- .../referenceexamples/attached/attached.pro | 6 +- .../referenceexamples/binding/binding.pro | 6 +- .../referenceexamples/coercion/coercion.pro | 6 +- .../referenceexamples/default/default.pro | 6 +- .../referenceexamples/extended/extended.pro | 6 +- .../referenceexamples/grouped/grouped.pro | 6 +- .../referenceexamples/methods/methods.pro | 6 +- .../referenceexamples/properties/properties.pro | 6 +- .../referenceexamples/signal/signal.pro | 6 +- .../referenceexamples/valuesource/valuesource.pro | 6 +- examples/declarative/declarative.pro | 49 ++-- examples/declarative/flickr/flickr.desktop | 11 + examples/declarative/flickr/flickr.pro | 24 ++ examples/declarative/flickr/flickr.qmlproject | 16 ++ examples/declarative/flickr/flickr.svg | 93 ++++++ examples/declarative/flickr/flickr64.png | Bin 0 -> 3400 bytes examples/declarative/flickr/flickr80.png | Bin 0 -> 4945 bytes .../declarative/flickr/flickr_harmattan.desktop | 11 + examples/declarative/flickr/main.cpp | 55 ++++ .../flickr/qml/flickr/common/Progress.qml | 73 +++++ .../flickr/qml/flickr/common/RssModel.qml | 66 +++++ .../flickr/qml/flickr/common/ScrollBar.qml | 81 ++++++ .../flickr/qml/flickr/common/Slider.qml | 91 ++++++ .../declarative/flickr/qml/flickr/common/qmldir | 10 + .../declarative/flickr/qml/flickr/flickr-90.qml | 52 ++++ examples/declarative/flickr/qml/flickr/flickr.qml | 125 ++++++++ .../flickr/qml/flickr/mobile/Button.qml | 79 ++++++ .../flickr/qml/flickr/mobile/GridDelegate.qml | 111 ++++++++ .../flickr/qml/flickr/mobile/ImageDetails.qml | 186 ++++++++++++ .../flickr/qml/flickr/mobile/ListDelegate.qml | 64 +++++ .../flickr/qml/flickr/mobile/TitleBar.qml | 128 +++++++++ .../flickr/qml/flickr/mobile/ToolBar.qml | 69 +++++ .../flickr/qml/flickr/mobile/images/gloss.png | Bin 0 -> 1236 bytes .../flickr/qml/flickr/mobile/images/lineedit.png | Bin 0 -> 1415 bytes .../flickr/qml/flickr/mobile/images/lineedit.sci | 5 + .../flickr/qml/flickr/mobile/images/quit.png | Bin 0 -> 2369 bytes .../flickr/qml/flickr/mobile/images/stripes.png | Bin 0 -> 257 bytes .../flickr/qml/flickr/mobile/images/titlebar.png | Bin 0 -> 1436 bytes .../flickr/qml/flickr/mobile/images/titlebar.sci | 5 + .../flickr/qml/flickr/mobile/images/toolbutton.png | Bin 0 -> 2550 bytes .../flickr/qml/flickr/mobile/images/toolbutton.sci | 5 + examples/declarative/helper/deployment.pri | 133 +++++++++ .../qmlapplicationviewer/qmlapplicationviewer.cpp | 177 ++++++++++++ .../qmlapplicationviewer/qmlapplicationviewer.h | 76 +++++ .../qmlapplicationviewer/qmlapplicationviewer.pri | 24 ++ examples/declarative/i18n/i18n.pro | 4 +- .../imageelements/borderimage/borderimage.pro | 4 +- examples/declarative/imageelements/image/image.pro | 4 +- .../declarative/imageelements/imageelements.pro | 5 - .../declarative/imageelements/shadows/shadows.pro | 4 +- .../declarative/keyinteraction/focus/focus.pro | 4 +- examples/declarative/minehunt/README | 6 + examples/declarative/minehunt/main.cpp | 62 ++++ examples/declarative/minehunt/minehunt.cpp | 221 ++++++++++++++ examples/declarative/minehunt/minehunt.h | 129 +++++++++ examples/declarative/minehunt/minehunt.pro | 25 ++ examples/declarative/minehunt/minehunt.qmlproject | 16 ++ examples/declarative/minehunt/minehunt.qrc | 19 ++ .../qml/minehunt/MinehuntCore/Explosion.qml | 65 +++++ .../minehunt/qml/minehunt/MinehuntCore/Tile.qml | 128 +++++++++ .../qml/minehunt/MinehuntCore/pics/back.png | Bin 0 -> 558 bytes .../qml/minehunt/MinehuntCore/pics/background.png | Bin 0 -> 313930 bytes .../qml/minehunt/MinehuntCore/pics/bomb-color.png | Bin 0 -> 284 bytes .../qml/minehunt/MinehuntCore/pics/bomb.png | Bin 0 -> 535 bytes .../qml/minehunt/MinehuntCore/pics/face-sad.png | Bin 0 -> 14844 bytes .../minehunt/MinehuntCore/pics/face-smile-big.png | Bin 0 -> 13810 bytes .../qml/minehunt/MinehuntCore/pics/face-smile.png | Bin 0 -> 15408 bytes .../qml/minehunt/MinehuntCore/pics/flag-color.png | Bin 0 -> 219 bytes .../qml/minehunt/MinehuntCore/pics/flag.png | Bin 0 -> 196 bytes .../qml/minehunt/MinehuntCore/pics/front.png | Bin 0 -> 580 bytes .../qml/minehunt/MinehuntCore/pics/quit.png | Bin 0 -> 583 bytes .../qml/minehunt/MinehuntCore/pics/star.png | Bin 0 -> 2677 bytes .../declarative/minehunt/qml/minehunt/minehunt.qml | 112 ++++++++ .../abstractitemmodel/abstractitemmodel.pro | 4 +- .../declarative/modelviews/gridview/gridview.pro | 4 +- .../listview/dynamiclist/dynamiclist.pro | 4 +- .../expandingdelegates/expandingdelegates.pro | 4 +- .../modelviews/listview/highlight/highlight.pro | 4 +- .../listview/highlightranges/highlightranges.pro | 4 +- .../declarative/modelviews/listview/listview.pro | 5 - .../modelviews/listview/sections/sections.pro | 4 +- examples/declarative/modelviews/modelviews.pro | 5 - .../modelviews/objectlistmodel/objectlistmodel.pro | 4 +- .../declarative/modelviews/package/package.pro | 4 +- .../declarative/modelviews/parallax/parallax.pro | 4 +- .../declarative/modelviews/pathview/pathview.pro | 4 +- .../modelviews/stringlistmodel/stringlistmodel.pro | 4 +- .../modelviews/visualitemmodel/visualitemmodel.pro | 4 +- examples/declarative/photoviewer/main.cpp | 55 ++++ .../declarative/photoviewer/photoviewer.desktop | 11 + examples/declarative/photoviewer/photoviewer.pro | 24 ++ .../declarative/photoviewer/photoviewer.qmlproject | 16 ++ examples/declarative/photoviewer/photoviewer.svg | 93 ++++++ examples/declarative/photoviewer/photoviewer64.png | Bin 0 -> 3400 bytes examples/declarative/photoviewer/photoviewer80.png | Bin 0 -> 4945 bytes .../photoviewer/photoviewer_harmattan.desktop | 11 + .../photoviewer/PhotoViewerCore/AlbumDelegate.qml | 146 ++++++++++ .../photoviewer/PhotoViewerCore/BusyIndicator.qml | 50 ++++ .../qml/photoviewer/PhotoViewerCore/Button.qml | 72 +++++ .../photoviewer/PhotoViewerCore/EditableButton.qml | 86 ++++++ .../photoviewer/PhotoViewerCore/PhotoDelegate.qml | 188 ++++++++++++ .../photoviewer/PhotoViewerCore/ProgressBar.qml | 57 ++++ .../qml/photoviewer/PhotoViewerCore/RssModel.qml | 54 ++++ .../qml/photoviewer/PhotoViewerCore/Tag.qml | 91 ++++++ .../PhotoViewerCore/images/box-shadow.png | Bin 0 -> 588 bytes .../photoviewer/PhotoViewerCore/images/busy.png | Bin 0 -> 2629 bytes .../PhotoViewerCore/images/cardboard.png | Bin 0 -> 8844 bytes .../qml/photoviewer/PhotoViewerCore/qmldir | 8 + .../photoviewer/PhotoViewerCore/script/script.js | 27 ++ .../photoviewer/qml/photoviewer/i18n/base.ts | 30 ++ .../photoviewer/qml/photoviewer/i18n/qml_fr.qm | Bin 0 -> 268 bytes .../photoviewer/qml/photoviewer/i18n/qml_fr.ts | 30 ++ .../photoviewer/qml/photoviewer/photoviewer.qml | 110 +++++++ examples/declarative/positioners/positioners.pro | 4 +- .../layoutdirection/layoutdirection.pro | 4 +- .../layoutmirroring/layoutmirroring.pro | 4 +- examples/declarative/righttoleft/righttoleft.pro | 6 + .../righttoleft/textalignment/textalignment.pro | 4 +- examples/declarative/rssnews/main.cpp | 55 ++++ .../rssnews/qml/rssnews/content/BusyIndicator.qml | 53 ++++ .../qml/rssnews/content/CategoryDelegate.qml | 82 ++++++ .../rssnews/qml/rssnews/content/NewsDelegate.qml | 71 +++++ .../rssnews/qml/rssnews/content/RssFeeds.qml | 59 ++++ .../rssnews/qml/rssnews/content/ScrollBar.qml | 107 +++++++ .../rssnews/qml/rssnews/content/images/busy.png | Bin 0 -> 2629 bytes .../qml/rssnews/content/images/scrollbar.png | Bin 0 -> 161 bytes .../declarative/rssnews/qml/rssnews/rssnews.qml | 111 ++++++++ examples/declarative/rssnews/rssnews.desktop | 11 + examples/declarative/rssnews/rssnews.pro | 24 ++ examples/declarative/rssnews/rssnews.qmlproject | 16 ++ examples/declarative/rssnews/rssnews.svg | 93 ++++++ examples/declarative/rssnews/rssnews64.png | Bin 0 -> 3400 bytes examples/declarative/rssnews/rssnews80.png | Bin 0 -> 4945 bytes .../declarative/rssnews/rssnews_harmattan.desktop | 11 + examples/declarative/samegame/main.cpp | 55 ++++ .../qml/samegame/SamegameCore/BoomBlock.qml | 109 +++++++ .../samegame/qml/samegame/SamegameCore/Button.qml | 75 +++++ .../samegame/qml/samegame/SamegameCore/Dialog.qml | 77 +++++ .../qml/samegame/SamegameCore/pics/background.png | Bin 0 -> 313930 bytes .../qml/samegame/SamegameCore/pics/blueStar.png | Bin 0 -> 278 bytes .../qml/samegame/SamegameCore/pics/blueStone.png | Bin 0 -> 3054 bytes .../qml/samegame/SamegameCore/pics/greenStar.png | Bin 0 -> 273 bytes .../qml/samegame/SamegameCore/pics/greenStone.png | Bin 0 -> 2932 bytes .../qml/samegame/SamegameCore/pics/redStar.png | Bin 0 -> 274 bytes .../qml/samegame/SamegameCore/pics/redStone.png | Bin 0 -> 2902 bytes .../qml/samegame/SamegameCore/pics/star.png | Bin 0 -> 262 bytes .../qml/samegame/SamegameCore/pics/yellowStone.png | Bin 0 -> 3056 bytes .../samegame/qml/samegame/SamegameCore/qmldir | 3 + .../samegame/qml/samegame/SamegameCore/samegame.js | 288 +++++++++++++++++++ .../samegame/qml/samegame/highscores/README | 1 + .../qml/samegame/highscores/score_data.xml | 2 + .../qml/samegame/highscores/score_style.xsl | 28 ++ .../samegame/qml/samegame/highscores/scores.php | 34 +++ .../declarative/samegame/qml/samegame/samegame.qml | 161 +++++++++++ examples/declarative/samegame/samegame.desktop | 11 + examples/declarative/samegame/samegame.pro | 24 ++ examples/declarative/samegame/samegame.qmlproject | 16 ++ examples/declarative/samegame/samegame.svg | 93 ++++++ examples/declarative/samegame/samegame64.png | Bin 0 -> 3400 bytes examples/declarative/samegame/samegame80.png | Bin 0 -> 4945 bytes .../samegame/samegame_harmattan.desktop | 11 + .../declarative/shadereffects/shadereffects.pro | 4 +- examples/declarative/snake/main.cpp | 55 ++++ .../declarative/snake/qml/snake/content/Button.qml | 66 +++++ .../declarative/snake/qml/snake/content/Cookie.qml | 93 ++++++ .../snake/qml/snake/content/HighScoreModel.qml | 139 +++++++++ .../declarative/snake/qml/snake/content/Link.qml | 128 +++++++++ .../declarative/snake/qml/snake/content/Skull.qml | 62 ++++ .../snake/qml/snake/content/pics/README | 1 + .../snake/qml/snake/content/pics/background.png | Bin 0 -> 144508 bytes .../snake/qml/snake/content/pics/blueStar.png | Bin 0 -> 272 bytes .../snake/qml/snake/content/pics/blueStone.png | Bin 0 -> 3139 bytes .../snake/qml/snake/content/pics/cookie.png | Bin 0 -> 2729 bytes .../snake/qml/snake/content/pics/eyes.svg | 118 ++++++++ .../snake/qml/snake/content/pics/head.png | Bin 0 -> 3473 bytes .../snake/qml/snake/content/pics/head.svg | 134 +++++++++ .../snake/qml/snake/content/pics/pause.png | Bin 0 -> 4327 bytes .../snake/qml/snake/content/pics/redStar.png | Bin 0 -> 273 bytes .../snake/qml/snake/content/pics/redStone.png | Bin 0 -> 3456 bytes .../snake/qml/snake/content/pics/skull.png | Bin 0 -> 2543 bytes .../snake/qml/snake/content/pics/snake.jpg | Bin 0 -> 663901 bytes .../snake/qml/snake/content/pics/star.png | Bin 0 -> 262 bytes .../snake/qml/snake/content/pics/stoneShadow.png | Bin 0 -> 1699 bytes .../snake/qml/snake/content/pics/yellowStar.png | Bin 0 -> 276 bytes .../snake/qml/snake/content/pics/yellowStone.png | Bin 0 -> 2667 bytes .../declarative/snake/qml/snake/content/snake.js | 316 +++++++++++++++++++++ examples/declarative/snake/qml/snake/snake.qml | 272 ++++++++++++++++++ examples/declarative/snake/snake.desktop | 11 + examples/declarative/snake/snake.pro | 24 ++ examples/declarative/snake/snake.qmlproject | 16 ++ examples/declarative/snake/snake.svg | 93 ++++++ examples/declarative/snake/snake64.png | Bin 0 -> 3400 bytes examples/declarative/snake/snake80.png | Bin 0 -> 4945 bytes examples/declarative/snake/snake_harmattan.desktop | 11 + .../sqllocalstorage/sqllocalstorage.pro | 4 +- .../text/fonts/availableFonts/availableFonts.pro | 4 +- examples/declarative/text/fonts/banner/banner.pro | 4 +- examples/declarative/text/fonts/fonts.pro | 5 - examples/declarative/text/fonts/fonts/fonts.pro | 4 +- examples/declarative/text/fonts/hello/hello.pro | 4 +- examples/declarative/text/text.pro | 5 - .../text/textselection/textselection.pro | 4 +- .../threadedlistmodel/threadedlistmodel.pro | 4 +- examples/declarative/threading/threading.pro | 5 - .../threading/workerscript/workerscript.pro | 4 +- .../experimental-gestures.pro | 29 ++ .../experimental-gestures/experimentalgestures.pro | 29 -- .../mousearea-example/mousearea-example.pro | 29 ++ .../mousearea-example/mouseareaexample.pro | 29 -- .../touchinteraction/pincharea/pincharea.pro | 4 +- .../touchinteraction/touchinteraction.pro | 9 +- examples/declarative/toys/clocks/clocks.pro | 4 +- .../declarative/toys/corkboards/corkboards.pro | 4 +- .../declarative/toys/dynamicscene/dynamicscene.pro | 4 +- .../declarative/toys/tic-tac-toe/tic-tac-toe.pro | 29 ++ .../declarative/toys/tic-tac-toe/tictactoe.pro | 30 -- examples/declarative/toys/toys.pro | 7 +- examples/declarative/toys/tvtennis/tvtennis.pro | 4 +- .../extending/chapter1-basics/chapter1-basics.pro | 9 +- .../chapter2-methods/chapter2-methods.pro | 9 +- .../chapter3-bindings/chapter3-bindings.pro | 9 +- .../chapter4-customPropertyTypes.pro | 9 +- .../chapter5-listproperties.pro | 9 +- .../chapter6-plugins/chapter6-plugins.pro | 11 +- .../declarative/tutorials/extending/extending.pro | 6 - .../gettingStarted/filedialog/dialogPlugin.cpp | 51 ++++ .../gettingStarted/filedialog/dialogPlugin.h | 58 ++++ .../gettingStarted/filedialog/directory.cpp | 224 +++++++++++++++ .../gettingStarted/filedialog/directory.h | 107 +++++++ .../tutorials/gettingStarted/filedialog/file.cpp | 57 ++++ .../tutorials/gettingStarted/filedialog/file.h | 67 +++++ .../gettingStarted/filedialog/filedialog.json | 1 + .../gettingStarted/filedialog/filedialog.pro | 22 ++ .../tutorials/gettingStarted/filedialog/qmldir | 1 + .../tutorials/gettingStarted/gettingStarted.pro | 11 + .../tutorials/gettingStarted/gettingStarted.qml | 132 +++++++++ .../tutorials/gettingStarted/gsQml/core/button.qml | 108 +++++++ .../gettingStarted/gsQml/core/editMenu.qml | 105 +++++++ .../gettingStarted/gsQml/core/fileDialog.qml | 163 +++++++++++ .../gettingStarted/gsQml/core/fileMenu.qml | 232 +++++++++++++++ .../gettingStarted/gsQml/core/menuBar.qml | 147 ++++++++++ .../tutorials/gettingStarted/gsQml/core/qmldir | 9 + .../gettingStarted/gsQml/core/textArea.qml | 87 ++++++ .../gsQml/filedialog/dialogPlugin.cpp | 51 ++++ .../gettingStarted/gsQml/filedialog/dialogPlugin.h | 58 ++++ .../gettingStarted/gsQml/filedialog/directory.cpp | 224 +++++++++++++++ .../gettingStarted/gsQml/filedialog/directory.h | 107 +++++++ .../gettingStarted/gsQml/filedialog/file.cpp | 57 ++++ .../gettingStarted/gsQml/filedialog/file.h | 67 +++++ .../gsQml/filedialog/filedialog.json | 1 + .../gettingStarted/gsQml/filedialog/filedialog.pro | 17 ++ .../gettingStarted/gsQml/filedialog/qmldir | 1 + .../gettingStarted/gsQml/images/arrow.png | Bin 0 -> 583 bytes .../gettingStarted/gsQml/parts/part0/Button.qml | 55 ++++ .../gettingStarted/gsQml/parts/part1/Button.qml | 97 +++++++ .../gettingStarted/gsQml/parts/part1/EditMenu.qml | 76 +++++ .../gettingStarted/gsQml/parts/part1/FileMenu.qml | 91 ++++++ .../gsQml/parts/part1/SimpleButton.qml | 73 +++++ .../parts/part1/pics/qml-texteditor1_button.png | Bin 0 -> 1670 bytes .../parts/part1/pics/qml-texteditor1_editmenu.png | Bin 0 -> 6177 bytes .../parts/part1/pics/qml-texteditor1_filemenu.png | Bin 0 -> 6062 bytes .../part1/pics/qml-texteditor1_simplebutton.png | Bin 0 -> 1055 bytes .../gsQml/parts/part1/qml-texteditor.qmlproject | 16 ++ .../gettingStarted/gsQml/parts/part2/Button.qml | 99 +++++++ .../gettingStarted/gsQml/parts/part2/EditMenu.qml | 77 +++++ .../gettingStarted/gsQml/parts/part2/FileMenu.qml | 92 ++++++ .../gettingStarted/gsQml/parts/part2/MenuBar.qml | 140 +++++++++ .../parts/part2/pics/qml-texteditor2_menubar.png | Bin 0 -> 6079 bytes .../gsQml/parts/part2/qml-texteditor2.qmlproject | 16 ++ .../gettingStarted/gsQml/parts/part3/Button.qml | 99 +++++++ .../gettingStarted/gsQml/parts/part3/EditMenu.qml | 77 +++++ .../gettingStarted/gsQml/parts/part3/FileMenu.qml | 92 ++++++ .../gettingStarted/gsQml/parts/part3/MenuBar.qml | 140 +++++++++ .../gettingStarted/gsQml/parts/part3/TextArea.qml | 80 ++++++ .../gsQml/parts/part3/TextEditor.qml | 68 +++++ .../gsQml/parts/part3/images/arrow.png | Bin 0 -> 583 bytes .../part3/pics/qml-texteditor3_texteditor.png | Bin 0 -> 59345 bytes .../gsQml/parts/part3/qml-texteditor3.qmlproject | 16 ++ .../gettingStarted/gsQml/parts/part4/Button.qml | 109 +++++++ .../gettingStarted/gsQml/parts/part4/EditMenu.qml | 81 ++++++ .../gettingStarted/gsQml/parts/part4/FileMenu.qml | 96 +++++++ .../gettingStarted/gsQml/parts/part4/MenuBar.qml | 146 ++++++++++ .../gsQml/parts/part4/SimpleButton.qml | 59 ++++ .../gettingStarted/gsQml/parts/part4/TextArea.qml | 80 ++++++ .../gsQml/parts/part4/TextEditor.qml | 146 ++++++++++ .../gsQml/parts/part4/images/arrow.png | Bin 0 -> 583 bytes .../part4/pics/qml-texteditor4_texteditor.png | Bin 0 -> 63629 bytes .../gsQml/parts/part4/qml-texteditor4.qmlproject | 16 ++ .../gsQml/parts/part5/TextEditor.qml | 127 +++++++++ .../gsQml/parts/part5/core/Button.qml | 109 +++++++ .../gsQml/parts/part5/core/EditMenu.qml | 110 +++++++ .../gsQml/parts/part5/core/FileDialog.qml | 170 +++++++++++ .../gsQml/parts/part5/core/FileMenu.qml | 232 +++++++++++++++ .../gsQml/parts/part5/core/MenuBar.qml | 148 ++++++++++ .../gsQml/parts/part5/core/TextArea.qml | 86 ++++++ .../gettingStarted/gsQml/parts/part5/core/qmldir | 13 + .../gsQml/parts/part5/filedialog/dialogPlugin.cpp | 54 ++++ .../gsQml/parts/part5/filedialog/dialogPlugin.h | 58 ++++ .../gsQml/parts/part5/filedialog/directory.cpp | 219 ++++++++++++++ .../gsQml/parts/part5/filedialog/directory.h | 108 +++++++ .../gsQml/parts/part5/filedialog/file.cpp | 56 ++++ .../gsQml/parts/part5/filedialog/file.h | 67 +++++ .../gsQml/parts/part5/filedialog/filedialog.json | 1 + .../gsQml/parts/part5/filedialog/filedialog.pro | 17 ++ .../gsQml/parts/part5/filedialog/qmldir | 1 + .../gsQml/parts/part5/images/arrow.png | Bin 0 -> 583 bytes .../parts/part5/pics/qml-texteditor5_editmenu.png | Bin 0 -> 65123 bytes .../parts/part5/pics/qml-texteditor5_filemenu.png | Bin 0 -> 21367 bytes .../parts/part5/pics/qml-texteditor5_newfile.png | Bin 0 -> 76693 bytes .../gsQml/parts/part5/qml-texteditor5.qmlproject | 18 ++ .../gsQml/pics/qml-texteditor5_editmenu.png | Bin 0 -> 65123 bytes .../gsQml/pics/qml-texteditor5_filemenu.png | Bin 0 -> 21367 bytes .../gsQml/pics/qml-texteditor5_newfile.png | Bin 0 -> 76693 bytes .../tutorials/gettingStarted/gsQml/texteditor.pro | 4 + .../tutorials/gettingStarted/gsQml/texteditor.qml | 132 +++++++++ .../tutorials/gettingStarted/images/arrow.png | Bin 0 -> 583 bytes .../gettingStarted/parts/part0/Button.qml | 55 ++++ .../gettingStarted/parts/part1/Button.qml | 97 +++++++ .../gettingStarted/parts/part1/EditMenu.qml | 76 +++++ .../gettingStarted/parts/part1/FileMenu.qml | 91 ++++++ .../gettingStarted/parts/part1/SimpleButton.qml | 73 +++++ .../parts/part1/pics/qml-texteditor1_button.png | Bin 0 -> 1670 bytes .../parts/part1/pics/qml-texteditor1_editmenu.png | Bin 0 -> 6177 bytes .../parts/part1/pics/qml-texteditor1_filemenu.png | Bin 0 -> 6062 bytes .../part1/pics/qml-texteditor1_simplebutton.png | Bin 0 -> 1055 bytes .../parts/part1/qml-texteditor.qmlproject | 16 ++ .../gettingStarted/parts/part2/Button.qml | 99 +++++++ .../gettingStarted/parts/part2/EditMenu.qml | 77 +++++ .../gettingStarted/parts/part2/FileMenu.qml | 92 ++++++ .../gettingStarted/parts/part2/MenuBar.qml | 140 +++++++++ .../parts/part2/pics/qml-texteditor2_menubar.png | Bin 0 -> 6079 bytes .../parts/part2/qml-texteditor2.qmlproject | 16 ++ .../gettingStarted/parts/part3/Button.qml | 99 +++++++ .../gettingStarted/parts/part3/EditMenu.qml | 77 +++++ .../gettingStarted/parts/part3/FileMenu.qml | 92 ++++++ .../gettingStarted/parts/part3/MenuBar.qml | 140 +++++++++ .../gettingStarted/parts/part3/TextArea.qml | 80 ++++++ .../gettingStarted/parts/part3/TextEditor.qml | 68 +++++ .../gettingStarted/parts/part3/images/arrow.png | Bin 0 -> 583 bytes .../part3/pics/qml-texteditor3_texteditor.png | Bin 0 -> 59345 bytes .../parts/part3/qml-texteditor3.qmlproject | 16 ++ .../gettingStarted/parts/part4/Button.qml | 109 +++++++ .../gettingStarted/parts/part4/EditMenu.qml | 81 ++++++ .../gettingStarted/parts/part4/FileMenu.qml | 96 +++++++ .../gettingStarted/parts/part4/MenuBar.qml | 146 ++++++++++ .../gettingStarted/parts/part4/SimpleButton.qml | 59 ++++ .../gettingStarted/parts/part4/TextArea.qml | 80 ++++++ .../gettingStarted/parts/part4/TextEditor.qml | 146 ++++++++++ .../gettingStarted/parts/part4/images/arrow.png | Bin 0 -> 583 bytes .../part4/pics/qml-texteditor4_texteditor.png | Bin 0 -> 63629 bytes .../parts/part4/qml-texteditor4.qmlproject | 16 ++ .../gettingStarted/parts/part5/TextEditor.qml | 127 +++++++++ .../parts/part5/filedialog/dialogPlugin.cpp | 54 ++++ .../parts/part5/filedialog/dialogPlugin.h | 58 ++++ .../parts/part5/filedialog/directory.cpp | 219 ++++++++++++++ .../parts/part5/filedialog/directory.h | 108 +++++++ .../gettingStarted/parts/part5/filedialog/file.cpp | 56 ++++ .../gettingStarted/parts/part5/filedialog/file.h | 67 +++++ .../parts/part5/filedialog/filedialog.json | 1 + .../parts/part5/filedialog/filedialog.pro | 17 ++ .../gettingStarted/parts/part5/filedialog/qmldir | 1 + .../gettingStarted/parts/part5/images/arrow.png | Bin 0 -> 583 bytes .../parts/part5/pics/qml-texteditor5_editmenu.png | Bin 0 -> 65123 bytes .../parts/part5/pics/qml-texteditor5_filemenu.png | Bin 0 -> 21367 bytes .../parts/part5/pics/qml-texteditor5_newfile.png | Bin 0 -> 76693 bytes .../parts/part5/qml-texteditor5.qmlproject | 18 ++ .../pics/qml-texteditor5_editmenu.png | Bin 0 -> 65123 bytes .../pics/qml-texteditor5_filemenu.png | Bin 0 -> 21367 bytes .../pics/qml-texteditor5_newfile.png | Bin 0 -> 76693 bytes examples/declarative/tutorials/tutorials.pro | 10 +- examples/declarative/twitter/main.cpp | 55 ++++ .../twitter/qml/twitter/TwitterCore/Button.qml | 90 ++++++ .../qml/twitter/TwitterCore/FatDelegate.qml | 105 +++++++ .../twitter/qml/twitter/TwitterCore/Input.qml | 65 +++++ .../twitter/qml/twitter/TwitterCore/Loading.qml | 49 ++++ .../qml/twitter/TwitterCore/MultiTitleBar.qml | 60 ++++ .../twitter/qml/twitter/TwitterCore/RssModel.qml | 76 +++++ .../twitter/qml/twitter/TwitterCore/SearchView.qml | 124 ++++++++ .../twitter/qml/twitter/TwitterCore/TitleBar.qml | 130 +++++++++ .../twitter/qml/twitter/TwitterCore/ToolBar.qml | 64 +++++ .../twitter/qml/twitter/TwitterCore/UserModel.qml | 65 +++++ .../qml/twitter/TwitterCore/images/gloss.png | Bin 0 -> 1236 bytes .../qml/twitter/TwitterCore/images/lineedit.png | Bin 0 -> 1415 bytes .../qml/twitter/TwitterCore/images/lineedit.sci | 5 + .../qml/twitter/TwitterCore/images/loading.png | Bin 0 -> 813 bytes .../qml/twitter/TwitterCore/images/quit.png | Bin 0 -> 2369 bytes .../qml/twitter/TwitterCore/images/stripes.png | Bin 0 -> 257 bytes .../qml/twitter/TwitterCore/images/titlebar.png | Bin 0 -> 1436 bytes .../qml/twitter/TwitterCore/images/titlebar.sci | 5 + .../qml/twitter/TwitterCore/images/toolbutton.png | Bin 0 -> 2550 bytes .../qml/twitter/TwitterCore/images/toolbutton.sci | 5 + .../twitter/qml/twitter/TwitterCore/qmldir | 10 + .../declarative/twitter/qml/twitter/twitter.qml | 134 +++++++++ examples/declarative/twitter/twitter.desktop | 11 + examples/declarative/twitter/twitter.pro | 24 ++ examples/declarative/twitter/twitter.qmlproject | 16 ++ examples/declarative/twitter/twitter.svg | 93 ++++++ examples/declarative/twitter/twitter64.png | Bin 0 -> 3400 bytes examples/declarative/twitter/twitter80.png | Bin 0 -> 4945 bytes .../declarative/twitter/twitter_harmattan.desktop | 11 + .../ui-components/dialcontrol/dialcontrol.pro | 4 +- .../ui-components/flipable/flipable.pro | 4 +- examples/declarative/ui-components/main/main.pro | 4 +- .../ui-components/progressbar/progressbar.pro | 4 +- .../ui-components/scrollbar/scrollbar.pro | 4 +- .../ui-components/searchbox/searchbox.pro | 4 +- .../ui-components/slideswitch/slideswitch.pro | 4 +- .../declarative/ui-components/spinner/spinner.pro | 4 +- .../ui-components/tabwidget/tabwidget.pro | 4 +- .../declarative/ui-components/ui-components.pro | 5 - .../xmlhttprequestexample.pro | 4 +- examples/demos/calculator/calculator.desktop | 11 - examples/demos/calculator/calculator.pro | 24 -- examples/demos/calculator/calculator.qmlproject | 16 -- examples/demos/calculator/calculator.svg | 93 ------ examples/demos/calculator/calculator64.png | Bin 3400 -> 0 bytes examples/demos/calculator/calculator80.png | Bin 4945 -> 0 bytes .../demos/calculator/calculator_harmattan.desktop | 11 - examples/demos/calculator/main.cpp | 61 ---- .../qml/calculator/CalculatorCore/Button.qml | 80 ------ .../qml/calculator/CalculatorCore/Display.qml | 68 ----- .../qml/calculator/CalculatorCore/calculator.js | 91 ------ .../calculator/CalculatorCore/images/button-.png | Bin 1288 -> 0 bytes .../CalculatorCore/images/button-blue.png | Bin 1565 -> 0 bytes .../CalculatorCore/images/button-green.png | Bin 1543 -> 0 bytes .../CalculatorCore/images/button-purple.png | Bin 1566 -> 0 bytes .../CalculatorCore/images/button-red.png | Bin 1586 -> 0 bytes .../calculator/CalculatorCore/images/display.png | Bin 998 -> 0 bytes .../qml/calculator/CalculatorCore/qmldir | 2 - .../demos/calculator/qml/calculator/calculator.qml | 162 ----------- examples/demos/demos.pro | 17 -- examples/demos/flickr/flickr.desktop | 11 - examples/demos/flickr/flickr.pro | 24 -- examples/demos/flickr/flickr.qmlproject | 16 -- examples/demos/flickr/flickr.svg | 93 ------ examples/demos/flickr/flickr64.png | Bin 3400 -> 0 bytes examples/demos/flickr/flickr80.png | Bin 4945 -> 0 bytes examples/demos/flickr/flickr_harmattan.desktop | 11 - examples/demos/flickr/main.cpp | 55 ---- .../demos/flickr/qml/flickr/common/Progress.qml | 73 ----- .../demos/flickr/qml/flickr/common/RssModel.qml | 66 ----- .../demos/flickr/qml/flickr/common/ScrollBar.qml | 81 ------ examples/demos/flickr/qml/flickr/common/Slider.qml | 91 ------ examples/demos/flickr/qml/flickr/common/qmldir | 10 - examples/demos/flickr/qml/flickr/flickr-90.qml | 52 ---- examples/demos/flickr/qml/flickr/flickr.qml | 125 -------- examples/demos/flickr/qml/flickr/mobile/Button.qml | 79 ------ .../flickr/qml/flickr/mobile/GridDelegate.qml | 111 -------- .../flickr/qml/flickr/mobile/ImageDetails.qml | 186 ------------ .../flickr/qml/flickr/mobile/ListDelegate.qml | 64 ----- .../demos/flickr/qml/flickr/mobile/TitleBar.qml | 128 --------- .../demos/flickr/qml/flickr/mobile/ToolBar.qml | 69 ----- .../flickr/qml/flickr/mobile/images/gloss.png | Bin 1236 -> 0 bytes .../flickr/qml/flickr/mobile/images/lineedit.png | Bin 1415 -> 0 bytes .../flickr/qml/flickr/mobile/images/lineedit.sci | 5 - .../demos/flickr/qml/flickr/mobile/images/quit.png | Bin 2369 -> 0 bytes .../flickr/qml/flickr/mobile/images/stripes.png | Bin 257 -> 0 bytes .../flickr/qml/flickr/mobile/images/titlebar.png | Bin 1436 -> 0 bytes .../flickr/qml/flickr/mobile/images/titlebar.sci | 5 - .../flickr/qml/flickr/mobile/images/toolbutton.png | Bin 2550 -> 0 bytes .../flickr/qml/flickr/mobile/images/toolbutton.sci | 5 - examples/demos/minehunt/README | 6 - examples/demos/minehunt/main.cpp | 62 ---- examples/demos/minehunt/minehunt.cpp | 221 -------------- examples/demos/minehunt/minehunt.h | 129 --------- examples/demos/minehunt/minehunt.pro | 25 -- examples/demos/minehunt/minehunt.qmlproject | 16 -- examples/demos/minehunt/minehunt.qrc | 19 -- .../qml/minehunt/MinehuntCore/Explosion.qml | 65 ----- .../minehunt/qml/minehunt/MinehuntCore/Tile.qml | 128 --------- .../qml/minehunt/MinehuntCore/pics/back.png | Bin 558 -> 0 bytes .../qml/minehunt/MinehuntCore/pics/background.png | Bin 313930 -> 0 bytes .../qml/minehunt/MinehuntCore/pics/bomb-color.png | Bin 284 -> 0 bytes .../qml/minehunt/MinehuntCore/pics/bomb.png | Bin 535 -> 0 bytes .../qml/minehunt/MinehuntCore/pics/face-sad.png | Bin 14844 -> 0 bytes .../minehunt/MinehuntCore/pics/face-smile-big.png | Bin 13810 -> 0 bytes .../qml/minehunt/MinehuntCore/pics/face-smile.png | Bin 15408 -> 0 bytes .../qml/minehunt/MinehuntCore/pics/flag-color.png | Bin 219 -> 0 bytes .../qml/minehunt/MinehuntCore/pics/flag.png | Bin 196 -> 0 bytes .../qml/minehunt/MinehuntCore/pics/front.png | Bin 580 -> 0 bytes .../qml/minehunt/MinehuntCore/pics/quit.png | Bin 583 -> 0 bytes .../qml/minehunt/MinehuntCore/pics/star.png | Bin 2677 -> 0 bytes examples/demos/minehunt/qml/minehunt/minehunt.qml | 112 -------- examples/demos/photoviewer/main.cpp | 55 ---- examples/demos/photoviewer/photoviewer.desktop | 11 - examples/demos/photoviewer/photoviewer.pro | 24 -- examples/demos/photoviewer/photoviewer.qmlproject | 16 -- examples/demos/photoviewer/photoviewer.svg | 93 ------ examples/demos/photoviewer/photoviewer64.png | Bin 3400 -> 0 bytes examples/demos/photoviewer/photoviewer80.png | Bin 4945 -> 0 bytes .../photoviewer/photoviewer_harmattan.desktop | 11 - .../photoviewer/PhotoViewerCore/AlbumDelegate.qml | 146 ---------- .../photoviewer/PhotoViewerCore/BusyIndicator.qml | 50 ---- .../qml/photoviewer/PhotoViewerCore/Button.qml | 72 ----- .../photoviewer/PhotoViewerCore/EditableButton.qml | 86 ------ .../photoviewer/PhotoViewerCore/PhotoDelegate.qml | 188 ------------ .../photoviewer/PhotoViewerCore/ProgressBar.qml | 57 ---- .../qml/photoviewer/PhotoViewerCore/RssModel.qml | 54 ---- .../qml/photoviewer/PhotoViewerCore/Tag.qml | 91 ------ .../PhotoViewerCore/images/box-shadow.png | Bin 588 -> 0 bytes .../photoviewer/PhotoViewerCore/images/busy.png | Bin 2629 -> 0 bytes .../PhotoViewerCore/images/cardboard.png | Bin 8844 -> 0 bytes .../qml/photoviewer/PhotoViewerCore/qmldir | 8 - .../photoviewer/PhotoViewerCore/script/script.js | 27 -- .../demos/photoviewer/qml/photoviewer/i18n/base.ts | 30 -- .../photoviewer/qml/photoviewer/i18n/qml_fr.qm | Bin 268 -> 0 bytes .../photoviewer/qml/photoviewer/i18n/qml_fr.ts | 30 -- .../photoviewer/qml/photoviewer/photoviewer.qml | 110 ------- examples/demos/rssnews/main.cpp | 55 ---- .../rssnews/qml/rssnews/content/BusyIndicator.qml | 53 ---- .../qml/rssnews/content/CategoryDelegate.qml | 82 ------ .../rssnews/qml/rssnews/content/NewsDelegate.qml | 71 ----- .../demos/rssnews/qml/rssnews/content/RssFeeds.qml | 59 ---- .../rssnews/qml/rssnews/content/ScrollBar.qml | 107 ------- .../rssnews/qml/rssnews/content/images/busy.png | Bin 2629 -> 0 bytes .../qml/rssnews/content/images/scrollbar.png | Bin 161 -> 0 bytes examples/demos/rssnews/qml/rssnews/rssnews.qml | 111 -------- examples/demos/rssnews/rssnews.desktop | 11 - examples/demos/rssnews/rssnews.pro | 24 -- examples/demos/rssnews/rssnews.qmlproject | 16 -- examples/demos/rssnews/rssnews.svg | 93 ------ examples/demos/rssnews/rssnews64.png | Bin 3400 -> 0 bytes examples/demos/rssnews/rssnews80.png | Bin 4945 -> 0 bytes examples/demos/rssnews/rssnews_harmattan.desktop | 11 - examples/demos/samegame/main.cpp | 55 ---- .../qml/samegame/SamegameCore/BoomBlock.qml | 109 ------- .../samegame/qml/samegame/SamegameCore/Button.qml | 75 ----- .../samegame/qml/samegame/SamegameCore/Dialog.qml | 77 ----- .../qml/samegame/SamegameCore/pics/background.png | Bin 313930 -> 0 bytes .../qml/samegame/SamegameCore/pics/blueStar.png | Bin 278 -> 0 bytes .../qml/samegame/SamegameCore/pics/blueStone.png | Bin 3054 -> 0 bytes .../qml/samegame/SamegameCore/pics/greenStar.png | Bin 273 -> 0 bytes .../qml/samegame/SamegameCore/pics/greenStone.png | Bin 2932 -> 0 bytes .../qml/samegame/SamegameCore/pics/redStar.png | Bin 274 -> 0 bytes .../qml/samegame/SamegameCore/pics/redStone.png | Bin 2902 -> 0 bytes .../qml/samegame/SamegameCore/pics/star.png | Bin 262 -> 0 bytes .../qml/samegame/SamegameCore/pics/yellowStone.png | Bin 3056 -> 0 bytes .../samegame/qml/samegame/SamegameCore/qmldir | 3 - .../samegame/qml/samegame/SamegameCore/samegame.js | 288 ------------------- .../demos/samegame/qml/samegame/highscores/README | 1 - .../qml/samegame/highscores/score_data.xml | 2 - .../qml/samegame/highscores/score_style.xsl | 28 -- .../samegame/qml/samegame/highscores/scores.php | 34 --- examples/demos/samegame/qml/samegame/samegame.qml | 161 ----------- examples/demos/samegame/samegame.desktop | 11 - examples/demos/samegame/samegame.pro | 24 -- examples/demos/samegame/samegame.qmlproject | 16 -- examples/demos/samegame/samegame.svg | 93 ------ examples/demos/samegame/samegame64.png | Bin 3400 -> 0 bytes examples/demos/samegame/samegame80.png | Bin 4945 -> 0 bytes examples/demos/samegame/samegame_harmattan.desktop | 11 - examples/demos/snake/main.cpp | 55 ---- examples/demos/snake/qml/snake/content/Button.qml | 66 ----- examples/demos/snake/qml/snake/content/Cookie.qml | 93 ------ .../snake/qml/snake/content/HighScoreModel.qml | 139 --------- examples/demos/snake/qml/snake/content/Link.qml | 128 --------- examples/demos/snake/qml/snake/content/Skull.qml | 62 ---- examples/demos/snake/qml/snake/content/pics/README | 1 - .../snake/qml/snake/content/pics/background.png | Bin 144508 -> 0 bytes .../snake/qml/snake/content/pics/blueStar.png | Bin 272 -> 0 bytes .../snake/qml/snake/content/pics/blueStone.png | Bin 3139 -> 0 bytes .../demos/snake/qml/snake/content/pics/cookie.png | Bin 2729 -> 0 bytes .../demos/snake/qml/snake/content/pics/eyes.svg | 118 -------- .../demos/snake/qml/snake/content/pics/head.png | Bin 3473 -> 0 bytes .../demos/snake/qml/snake/content/pics/head.svg | 134 --------- .../demos/snake/qml/snake/content/pics/pause.png | Bin 4327 -> 0 bytes .../demos/snake/qml/snake/content/pics/redStar.png | Bin 273 -> 0 bytes .../snake/qml/snake/content/pics/redStone.png | Bin 3456 -> 0 bytes .../demos/snake/qml/snake/content/pics/skull.png | Bin 2543 -> 0 bytes .../demos/snake/qml/snake/content/pics/snake.jpg | Bin 663901 -> 0 bytes .../demos/snake/qml/snake/content/pics/star.png | Bin 262 -> 0 bytes .../snake/qml/snake/content/pics/stoneShadow.png | Bin 1699 -> 0 bytes .../snake/qml/snake/content/pics/yellowStar.png | Bin 276 -> 0 bytes .../snake/qml/snake/content/pics/yellowStone.png | Bin 2667 -> 0 bytes examples/demos/snake/qml/snake/content/snake.js | 316 --------------------- examples/demos/snake/qml/snake/snake.qml | 272 ------------------ examples/demos/snake/snake.desktop | 11 - examples/demos/snake/snake.pro | 24 -- examples/demos/snake/snake.qmlproject | 16 -- examples/demos/snake/snake.svg | 93 ------ examples/demos/snake/snake64.png | Bin 3400 -> 0 bytes examples/demos/snake/snake80.png | Bin 4945 -> 0 bytes examples/demos/snake/snake_harmattan.desktop | 11 - examples/demos/twitter/main.cpp | 55 ---- .../twitter/qml/twitter/TwitterCore/Button.qml | 90 ------ .../qml/twitter/TwitterCore/FatDelegate.qml | 105 ------- .../twitter/qml/twitter/TwitterCore/Input.qml | 65 ----- .../twitter/qml/twitter/TwitterCore/Loading.qml | 49 ---- .../qml/twitter/TwitterCore/MultiTitleBar.qml | 60 ---- .../twitter/qml/twitter/TwitterCore/RssModel.qml | 76 ----- .../twitter/qml/twitter/TwitterCore/SearchView.qml | 124 -------- .../twitter/qml/twitter/TwitterCore/TitleBar.qml | 130 --------- .../twitter/qml/twitter/TwitterCore/ToolBar.qml | 64 ----- .../twitter/qml/twitter/TwitterCore/UserModel.qml | 65 ----- .../qml/twitter/TwitterCore/images/gloss.png | Bin 1236 -> 0 bytes .../qml/twitter/TwitterCore/images/lineedit.png | Bin 1415 -> 0 bytes .../qml/twitter/TwitterCore/images/lineedit.sci | 5 - .../qml/twitter/TwitterCore/images/loading.png | Bin 813 -> 0 bytes .../qml/twitter/TwitterCore/images/quit.png | Bin 2369 -> 0 bytes .../qml/twitter/TwitterCore/images/stripes.png | Bin 257 -> 0 bytes .../qml/twitter/TwitterCore/images/titlebar.png | Bin 1436 -> 0 bytes .../qml/twitter/TwitterCore/images/titlebar.sci | 5 - .../qml/twitter/TwitterCore/images/toolbutton.png | Bin 2550 -> 0 bytes .../qml/twitter/TwitterCore/images/toolbutton.sci | 5 - .../demos/twitter/qml/twitter/TwitterCore/qmldir | 10 - examples/demos/twitter/qml/twitter/twitter.qml | 134 --------- examples/demos/twitter/twitter.desktop | 11 - examples/demos/twitter/twitter.pro | 24 -- examples/demos/twitter/twitter.qmlproject | 16 -- examples/demos/twitter/twitter.svg | 93 ------ examples/demos/twitter/twitter64.png | Bin 3400 -> 0 bytes examples/demos/twitter/twitter80.png | Bin 4945 -> 0 bytes examples/demos/twitter/twitter_harmattan.desktop | 11 - examples/examples.pro | 4 +- examples/helper/deployment.pri | 133 --------- examples/helper/helper.pro | 9 - .../qmlapplicationviewer/qmlapplicationviewer.cpp | 177 ------------ .../qmlapplicationviewer/qmlapplicationviewer.h | 76 ----- .../qmlapplicationviewer/qmlapplicationviewer.pri | 24 -- .../tutorials/gettingStarted/gsQml/core/button.qml | 108 ------- .../gettingStarted/gsQml/core/editMenu.qml | 105 ------- .../gettingStarted/gsQml/core/fileDialog.qml | 163 ----------- .../gettingStarted/gsQml/core/fileMenu.qml | 232 --------------- .../gettingStarted/gsQml/core/menuBar.qml | 147 ---------- .../tutorials/gettingStarted/gsQml/core/qmldir | 9 - .../gettingStarted/gsQml/core/textArea.qml | 87 ------ .../gsQml/filedialog/dialogPlugin.cpp | 51 ---- .../gettingStarted/gsQml/filedialog/dialogPlugin.h | 58 ---- .../gettingStarted/gsQml/filedialog/directory.cpp | 224 --------------- .../gettingStarted/gsQml/filedialog/directory.h | 107 ------- .../gettingStarted/gsQml/filedialog/file.cpp | 57 ---- .../gettingStarted/gsQml/filedialog/file.h | 67 ----- .../gsQml/filedialog/filedialog.json | 1 - .../gettingStarted/gsQml/filedialog/filedialog.pro | 17 -- .../gettingStarted/gsQml/filedialog/qmldir | 1 - .../gettingStarted/gsQml/images/arrow.png | Bin 583 -> 0 bytes .../gettingStarted/gsQml/parts/part0/Button.qml | 55 ---- .../gettingStarted/gsQml/parts/part1/Button.qml | 97 ------- .../gettingStarted/gsQml/parts/part1/EditMenu.qml | 76 ----- .../gettingStarted/gsQml/parts/part1/FileMenu.qml | 91 ------ .../gsQml/parts/part1/SimpleButton.qml | 73 ----- .../parts/part1/pics/qml-texteditor1_button.png | Bin 1670 -> 0 bytes .../parts/part1/pics/qml-texteditor1_editmenu.png | Bin 6177 -> 0 bytes .../parts/part1/pics/qml-texteditor1_filemenu.png | Bin 6062 -> 0 bytes .../part1/pics/qml-texteditor1_simplebutton.png | Bin 1055 -> 0 bytes .../gsQml/parts/part1/qml-texteditor.qmlproject | 16 -- .../gettingStarted/gsQml/parts/part2/Button.qml | 99 ------- .../gettingStarted/gsQml/parts/part2/EditMenu.qml | 77 ----- .../gettingStarted/gsQml/parts/part2/FileMenu.qml | 92 ------ .../gettingStarted/gsQml/parts/part2/MenuBar.qml | 140 --------- .../parts/part2/pics/qml-texteditor2_menubar.png | Bin 6079 -> 0 bytes .../gsQml/parts/part2/qml-texteditor2.qmlproject | 16 -- .../gettingStarted/gsQml/parts/part3/Button.qml | 99 ------- .../gettingStarted/gsQml/parts/part3/EditMenu.qml | 77 ----- .../gettingStarted/gsQml/parts/part3/FileMenu.qml | 92 ------ .../gettingStarted/gsQml/parts/part3/MenuBar.qml | 140 --------- .../gettingStarted/gsQml/parts/part3/TextArea.qml | 80 ------ .../gsQml/parts/part3/TextEditor.qml | 68 ----- .../gsQml/parts/part3/images/arrow.png | Bin 583 -> 0 bytes .../part3/pics/qml-texteditor3_texteditor.png | Bin 59345 -> 0 bytes .../gsQml/parts/part3/qml-texteditor3.qmlproject | 16 -- .../gettingStarted/gsQml/parts/part4/Button.qml | 109 ------- .../gettingStarted/gsQml/parts/part4/EditMenu.qml | 81 ------ .../gettingStarted/gsQml/parts/part4/FileMenu.qml | 96 ------- .../gettingStarted/gsQml/parts/part4/MenuBar.qml | 146 ---------- .../gsQml/parts/part4/SimpleButton.qml | 59 ---- .../gettingStarted/gsQml/parts/part4/TextArea.qml | 80 ------ .../gsQml/parts/part4/TextEditor.qml | 146 ---------- .../gsQml/parts/part4/images/arrow.png | Bin 583 -> 0 bytes .../part4/pics/qml-texteditor4_texteditor.png | Bin 63629 -> 0 bytes .../gsQml/parts/part4/qml-texteditor4.qmlproject | 16 -- .../gsQml/parts/part5/TextEditor.qml | 127 --------- .../gsQml/parts/part5/core/Button.qml | 109 ------- .../gsQml/parts/part5/core/EditMenu.qml | 110 ------- .../gsQml/parts/part5/core/FileDialog.qml | 170 ----------- .../gsQml/parts/part5/core/FileMenu.qml | 232 --------------- .../gsQml/parts/part5/core/MenuBar.qml | 148 ---------- .../gsQml/parts/part5/core/TextArea.qml | 86 ------ .../gettingStarted/gsQml/parts/part5/core/qmldir | 13 - .../gsQml/parts/part5/filedialog/dialogPlugin.cpp | 54 ---- .../gsQml/parts/part5/filedialog/dialogPlugin.h | 58 ---- .../gsQml/parts/part5/filedialog/directory.cpp | 219 -------------- .../gsQml/parts/part5/filedialog/directory.h | 108 ------- .../gsQml/parts/part5/filedialog/file.cpp | 56 ---- .../gsQml/parts/part5/filedialog/file.h | 67 ----- .../gsQml/parts/part5/filedialog/filedialog.json | 1 - .../gsQml/parts/part5/filedialog/filedialog.pro | 17 -- .../gsQml/parts/part5/filedialog/qmldir | 1 - .../gsQml/parts/part5/images/arrow.png | Bin 583 -> 0 bytes .../parts/part5/pics/qml-texteditor5_editmenu.png | Bin 65123 -> 0 bytes .../parts/part5/pics/qml-texteditor5_filemenu.png | Bin 21367 -> 0 bytes .../parts/part5/pics/qml-texteditor5_newfile.png | Bin 76693 -> 0 bytes .../gsQml/parts/part5/qml-texteditor5.qmlproject | 18 -- .../gsQml/pics/qml-texteditor5_editmenu.png | Bin 65123 -> 0 bytes .../gsQml/pics/qml-texteditor5_filemenu.png | Bin 21367 -> 0 bytes .../gsQml/pics/qml-texteditor5_newfile.png | Bin 76693 -> 0 bytes .../tutorials/gettingStarted/gsQml/texteditor.pro | 4 - .../tutorials/gettingStarted/gsQml/texteditor.qml | 132 --------- 732 files changed, 17947 insertions(+), 14465 deletions(-) create mode 100644 examples/declarative/calculator/calculator.desktop create mode 100644 examples/declarative/calculator/calculator.pro create mode 100644 examples/declarative/calculator/calculator.qmlproject create mode 100644 examples/declarative/calculator/calculator.svg create mode 100644 examples/declarative/calculator/calculator64.png create mode 100644 examples/declarative/calculator/calculator80.png create mode 100644 examples/declarative/calculator/calculator_harmattan.desktop create mode 100644 examples/declarative/calculator/main.cpp create mode 100644 examples/declarative/calculator/qml/calculator/CalculatorCore/Button.qml create mode 100644 examples/declarative/calculator/qml/calculator/CalculatorCore/Display.qml create mode 100644 examples/declarative/calculator/qml/calculator/CalculatorCore/calculator.js create mode 100644 examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-.png create mode 100644 examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-blue.png create mode 100644 examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-green.png create mode 100644 examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-purple.png create mode 100644 examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-red.png create mode 100644 examples/declarative/calculator/qml/calculator/CalculatorCore/images/display.png create mode 100644 examples/declarative/calculator/qml/calculator/CalculatorCore/qmldir create mode 100644 examples/declarative/calculator/qml/calculator/calculator.qml create mode 100644 examples/declarative/flickr/flickr.desktop create mode 100644 examples/declarative/flickr/flickr.pro create mode 100644 examples/declarative/flickr/flickr.qmlproject create mode 100644 examples/declarative/flickr/flickr.svg create mode 100644 examples/declarative/flickr/flickr64.png create mode 100644 examples/declarative/flickr/flickr80.png create mode 100644 examples/declarative/flickr/flickr_harmattan.desktop create mode 100644 examples/declarative/flickr/main.cpp create mode 100644 examples/declarative/flickr/qml/flickr/common/Progress.qml create mode 100644 examples/declarative/flickr/qml/flickr/common/RssModel.qml create mode 100644 examples/declarative/flickr/qml/flickr/common/ScrollBar.qml create mode 100644 examples/declarative/flickr/qml/flickr/common/Slider.qml create mode 100644 examples/declarative/flickr/qml/flickr/common/qmldir create mode 100644 examples/declarative/flickr/qml/flickr/flickr-90.qml create mode 100644 examples/declarative/flickr/qml/flickr/flickr.qml create mode 100644 examples/declarative/flickr/qml/flickr/mobile/Button.qml create mode 100644 examples/declarative/flickr/qml/flickr/mobile/GridDelegate.qml create mode 100644 examples/declarative/flickr/qml/flickr/mobile/ImageDetails.qml create mode 100644 examples/declarative/flickr/qml/flickr/mobile/ListDelegate.qml create mode 100644 examples/declarative/flickr/qml/flickr/mobile/TitleBar.qml create mode 100644 examples/declarative/flickr/qml/flickr/mobile/ToolBar.qml create mode 100644 examples/declarative/flickr/qml/flickr/mobile/images/gloss.png create mode 100644 examples/declarative/flickr/qml/flickr/mobile/images/lineedit.png create mode 100644 examples/declarative/flickr/qml/flickr/mobile/images/lineedit.sci create mode 100644 examples/declarative/flickr/qml/flickr/mobile/images/quit.png create mode 100644 examples/declarative/flickr/qml/flickr/mobile/images/stripes.png create mode 100644 examples/declarative/flickr/qml/flickr/mobile/images/titlebar.png create mode 100644 examples/declarative/flickr/qml/flickr/mobile/images/titlebar.sci create mode 100644 examples/declarative/flickr/qml/flickr/mobile/images/toolbutton.png create mode 100644 examples/declarative/flickr/qml/flickr/mobile/images/toolbutton.sci create mode 100644 examples/declarative/helper/deployment.pri create mode 100644 examples/declarative/helper/qmlapplicationviewer/qmlapplicationviewer.cpp create mode 100644 examples/declarative/helper/qmlapplicationviewer/qmlapplicationviewer.h create mode 100644 examples/declarative/helper/qmlapplicationviewer/qmlapplicationviewer.pri create mode 100644 examples/declarative/minehunt/README create mode 100644 examples/declarative/minehunt/main.cpp create mode 100644 examples/declarative/minehunt/minehunt.cpp create mode 100644 examples/declarative/minehunt/minehunt.h create mode 100644 examples/declarative/minehunt/minehunt.pro create mode 100644 examples/declarative/minehunt/minehunt.qmlproject create mode 100644 examples/declarative/minehunt/minehunt.qrc create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/Explosion.qml create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/Tile.qml create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/back.png create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/background.png create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/bomb-color.png create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/bomb.png create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/face-sad.png create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/face-smile-big.png create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/face-smile.png create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/flag-color.png create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/flag.png create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/front.png create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/quit.png create mode 100644 examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/star.png create mode 100644 examples/declarative/minehunt/qml/minehunt/minehunt.qml create mode 100644 examples/declarative/photoviewer/main.cpp create mode 100644 examples/declarative/photoviewer/photoviewer.desktop create mode 100644 examples/declarative/photoviewer/photoviewer.pro create mode 100644 examples/declarative/photoviewer/photoviewer.qmlproject create mode 100644 examples/declarative/photoviewer/photoviewer.svg create mode 100644 examples/declarative/photoviewer/photoviewer64.png create mode 100644 examples/declarative/photoviewer/photoviewer80.png create mode 100644 examples/declarative/photoviewer/photoviewer_harmattan.desktop create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/AlbumDelegate.qml create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/BusyIndicator.qml create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/Button.qml create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/EditableButton.qml create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/PhotoDelegate.qml create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/ProgressBar.qml create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/RssModel.qml create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/Tag.qml create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/images/box-shadow.png create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/images/busy.png create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/images/cardboard.png create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/qmldir create mode 100644 examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/script/script.js create mode 100644 examples/declarative/photoviewer/qml/photoviewer/i18n/base.ts create mode 100644 examples/declarative/photoviewer/qml/photoviewer/i18n/qml_fr.qm create mode 100644 examples/declarative/photoviewer/qml/photoviewer/i18n/qml_fr.ts create mode 100644 examples/declarative/photoviewer/qml/photoviewer/photoviewer.qml create mode 100644 examples/declarative/righttoleft/righttoleft.pro create mode 100644 examples/declarative/rssnews/main.cpp create mode 100644 examples/declarative/rssnews/qml/rssnews/content/BusyIndicator.qml create mode 100644 examples/declarative/rssnews/qml/rssnews/content/CategoryDelegate.qml create mode 100644 examples/declarative/rssnews/qml/rssnews/content/NewsDelegate.qml create mode 100644 examples/declarative/rssnews/qml/rssnews/content/RssFeeds.qml create mode 100644 examples/declarative/rssnews/qml/rssnews/content/ScrollBar.qml create mode 100644 examples/declarative/rssnews/qml/rssnews/content/images/busy.png create mode 100644 examples/declarative/rssnews/qml/rssnews/content/images/scrollbar.png create mode 100644 examples/declarative/rssnews/qml/rssnews/rssnews.qml create mode 100644 examples/declarative/rssnews/rssnews.desktop create mode 100644 examples/declarative/rssnews/rssnews.pro create mode 100644 examples/declarative/rssnews/rssnews.qmlproject create mode 100644 examples/declarative/rssnews/rssnews.svg create mode 100644 examples/declarative/rssnews/rssnews64.png create mode 100644 examples/declarative/rssnews/rssnews80.png create mode 100644 examples/declarative/rssnews/rssnews_harmattan.desktop create mode 100644 examples/declarative/samegame/main.cpp create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/BoomBlock.qml create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/Button.qml create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/Dialog.qml create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/pics/background.png create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/pics/blueStar.png create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/pics/blueStone.png create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/pics/greenStar.png create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/pics/greenStone.png create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/pics/redStar.png create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/pics/redStone.png create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/pics/star.png create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/pics/yellowStone.png create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/qmldir create mode 100644 examples/declarative/samegame/qml/samegame/SamegameCore/samegame.js create mode 100644 examples/declarative/samegame/qml/samegame/highscores/README create mode 100644 examples/declarative/samegame/qml/samegame/highscores/score_data.xml create mode 100644 examples/declarative/samegame/qml/samegame/highscores/score_style.xsl create mode 100644 examples/declarative/samegame/qml/samegame/highscores/scores.php create mode 100644 examples/declarative/samegame/qml/samegame/samegame.qml create mode 100644 examples/declarative/samegame/samegame.desktop create mode 100644 examples/declarative/samegame/samegame.pro create mode 100644 examples/declarative/samegame/samegame.qmlproject create mode 100644 examples/declarative/samegame/samegame.svg create mode 100644 examples/declarative/samegame/samegame64.png create mode 100644 examples/declarative/samegame/samegame80.png create mode 100644 examples/declarative/samegame/samegame_harmattan.desktop create mode 100644 examples/declarative/snake/main.cpp create mode 100644 examples/declarative/snake/qml/snake/content/Button.qml create mode 100644 examples/declarative/snake/qml/snake/content/Cookie.qml create mode 100644 examples/declarative/snake/qml/snake/content/HighScoreModel.qml create mode 100644 examples/declarative/snake/qml/snake/content/Link.qml create mode 100644 examples/declarative/snake/qml/snake/content/Skull.qml create mode 100644 examples/declarative/snake/qml/snake/content/pics/README create mode 100644 examples/declarative/snake/qml/snake/content/pics/background.png create mode 100644 examples/declarative/snake/qml/snake/content/pics/blueStar.png create mode 100644 examples/declarative/snake/qml/snake/content/pics/blueStone.png create mode 100644 examples/declarative/snake/qml/snake/content/pics/cookie.png create mode 100644 examples/declarative/snake/qml/snake/content/pics/eyes.svg create mode 100644 examples/declarative/snake/qml/snake/content/pics/head.png create mode 100644 examples/declarative/snake/qml/snake/content/pics/head.svg create mode 100644 examples/declarative/snake/qml/snake/content/pics/pause.png create mode 100644 examples/declarative/snake/qml/snake/content/pics/redStar.png create mode 100644 examples/declarative/snake/qml/snake/content/pics/redStone.png create mode 100644 examples/declarative/snake/qml/snake/content/pics/skull.png create mode 100644 examples/declarative/snake/qml/snake/content/pics/snake.jpg create mode 100644 examples/declarative/snake/qml/snake/content/pics/star.png create mode 100644 examples/declarative/snake/qml/snake/content/pics/stoneShadow.png create mode 100644 examples/declarative/snake/qml/snake/content/pics/yellowStar.png create mode 100644 examples/declarative/snake/qml/snake/content/pics/yellowStone.png create mode 100644 examples/declarative/snake/qml/snake/content/snake.js create mode 100644 examples/declarative/snake/qml/snake/snake.qml create mode 100644 examples/declarative/snake/snake.desktop create mode 100644 examples/declarative/snake/snake.pro create mode 100644 examples/declarative/snake/snake.qmlproject create mode 100644 examples/declarative/snake/snake.svg create mode 100644 examples/declarative/snake/snake64.png create mode 100644 examples/declarative/snake/snake80.png create mode 100644 examples/declarative/snake/snake_harmattan.desktop create mode 100644 examples/declarative/touchinteraction/gestures/experimental-gestures/experimental-gestures.pro delete mode 100644 examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.pro create mode 100644 examples/declarative/touchinteraction/mousearea/mousearea-example/mousearea-example.pro delete mode 100644 examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.pro create mode 100644 examples/declarative/toys/tic-tac-toe/tic-tac-toe.pro delete mode 100644 examples/declarative/toys/tic-tac-toe/tictactoe.pro create mode 100644 examples/declarative/tutorials/gettingStarted/filedialog/dialogPlugin.cpp create mode 100644 examples/declarative/tutorials/gettingStarted/filedialog/dialogPlugin.h create mode 100644 examples/declarative/tutorials/gettingStarted/filedialog/directory.cpp create mode 100644 examples/declarative/tutorials/gettingStarted/filedialog/directory.h create mode 100644 examples/declarative/tutorials/gettingStarted/filedialog/file.cpp create mode 100644 examples/declarative/tutorials/gettingStarted/filedialog/file.h create mode 100644 examples/declarative/tutorials/gettingStarted/filedialog/filedialog.json create mode 100644 examples/declarative/tutorials/gettingStarted/filedialog/filedialog.pro create mode 100644 examples/declarative/tutorials/gettingStarted/filedialog/qmldir create mode 100644 examples/declarative/tutorials/gettingStarted/gettingStarted.pro create mode 100644 examples/declarative/tutorials/gettingStarted/gettingStarted.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/core/button.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/core/editMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/core/fileDialog.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/core/fileMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/core/menuBar.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/core/qmldir create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/core/textArea.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/filedialog/directory.cpp create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/filedialog/directory.h create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/filedialog/file.cpp create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/filedialog/file.h create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/filedialog/filedialog.json create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/filedialog/filedialog.pro create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/filedialog/qmldir create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/images/arrow.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part0/Button.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/Button.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/Button.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/Button.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/Button.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.json create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_editmenu.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_filemenu.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_newfile.png create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/texteditor.pro create mode 100644 examples/declarative/tutorials/gettingStarted/gsQml/texteditor.qml create mode 100644 examples/declarative/tutorials/gettingStarted/images/arrow.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part0/Button.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part1/Button.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part1/EditMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part1/FileMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part1/SimpleButton.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_button.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_editmenu.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_filemenu.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_simplebutton.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part1/qml-texteditor.qmlproject create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part2/Button.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part2/EditMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part2/FileMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part2/MenuBar.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part2/pics/qml-texteditor2_menubar.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part2/qml-texteditor2.qmlproject create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part3/Button.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part3/EditMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part3/FileMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part3/MenuBar.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part3/TextArea.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part3/TextEditor.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part3/images/arrow.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part3/pics/qml-texteditor3_texteditor.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part3/qml-texteditor3.qmlproject create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part4/Button.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part4/EditMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part4/FileMenu.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part4/MenuBar.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part4/SimpleButton.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part4/TextArea.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part4/TextEditor.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part4/images/arrow.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part4/pics/qml-texteditor4_texteditor.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part4/qml-texteditor4.qmlproject create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.cpp create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.json create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/qmldir create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/images/arrow.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/pics/qml-texteditor5_editmenu.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/pics/qml-texteditor5_filemenu.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/pics/qml-texteditor5_newfile.png create mode 100644 examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject create mode 100644 examples/declarative/tutorials/gettingStarted/pics/qml-texteditor5_editmenu.png create mode 100644 examples/declarative/tutorials/gettingStarted/pics/qml-texteditor5_filemenu.png create mode 100644 examples/declarative/tutorials/gettingStarted/pics/qml-texteditor5_newfile.png create mode 100644 examples/declarative/twitter/main.cpp create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/Button.qml create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/FatDelegate.qml create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/Input.qml create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/Loading.qml create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/MultiTitleBar.qml create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/RssModel.qml create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/SearchView.qml create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/TitleBar.qml create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/ToolBar.qml create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/UserModel.qml create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/images/gloss.png create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/images/lineedit.png create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/images/lineedit.sci create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/images/loading.png create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/images/quit.png create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/images/stripes.png create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/images/titlebar.png create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/images/titlebar.sci create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/images/toolbutton.png create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/images/toolbutton.sci create mode 100644 examples/declarative/twitter/qml/twitter/TwitterCore/qmldir create mode 100644 examples/declarative/twitter/qml/twitter/twitter.qml create mode 100644 examples/declarative/twitter/twitter.desktop create mode 100644 examples/declarative/twitter/twitter.pro create mode 100644 examples/declarative/twitter/twitter.qmlproject create mode 100644 examples/declarative/twitter/twitter.svg create mode 100644 examples/declarative/twitter/twitter64.png create mode 100644 examples/declarative/twitter/twitter80.png create mode 100644 examples/declarative/twitter/twitter_harmattan.desktop delete mode 100644 examples/demos/calculator/calculator.desktop delete mode 100644 examples/demos/calculator/calculator.pro delete mode 100644 examples/demos/calculator/calculator.qmlproject delete mode 100644 examples/demos/calculator/calculator.svg delete mode 100644 examples/demos/calculator/calculator64.png delete mode 100644 examples/demos/calculator/calculator80.png delete mode 100644 examples/demos/calculator/calculator_harmattan.desktop delete mode 100644 examples/demos/calculator/main.cpp delete mode 100644 examples/demos/calculator/qml/calculator/CalculatorCore/Button.qml delete mode 100644 examples/demos/calculator/qml/calculator/CalculatorCore/Display.qml delete mode 100644 examples/demos/calculator/qml/calculator/CalculatorCore/calculator.js delete mode 100644 examples/demos/calculator/qml/calculator/CalculatorCore/images/button-.png delete mode 100644 examples/demos/calculator/qml/calculator/CalculatorCore/images/button-blue.png delete mode 100644 examples/demos/calculator/qml/calculator/CalculatorCore/images/button-green.png delete mode 100644 examples/demos/calculator/qml/calculator/CalculatorCore/images/button-purple.png delete mode 100644 examples/demos/calculator/qml/calculator/CalculatorCore/images/button-red.png delete mode 100644 examples/demos/calculator/qml/calculator/CalculatorCore/images/display.png delete mode 100644 examples/demos/calculator/qml/calculator/CalculatorCore/qmldir delete mode 100644 examples/demos/calculator/qml/calculator/calculator.qml delete mode 100644 examples/demos/demos.pro delete mode 100644 examples/demos/flickr/flickr.desktop delete mode 100644 examples/demos/flickr/flickr.pro delete mode 100644 examples/demos/flickr/flickr.qmlproject delete mode 100644 examples/demos/flickr/flickr.svg delete mode 100644 examples/demos/flickr/flickr64.png delete mode 100644 examples/demos/flickr/flickr80.png delete mode 100644 examples/demos/flickr/flickr_harmattan.desktop delete mode 100644 examples/demos/flickr/main.cpp delete mode 100644 examples/demos/flickr/qml/flickr/common/Progress.qml delete mode 100644 examples/demos/flickr/qml/flickr/common/RssModel.qml delete mode 100644 examples/demos/flickr/qml/flickr/common/ScrollBar.qml delete mode 100644 examples/demos/flickr/qml/flickr/common/Slider.qml delete mode 100644 examples/demos/flickr/qml/flickr/common/qmldir delete mode 100644 examples/demos/flickr/qml/flickr/flickr-90.qml delete mode 100644 examples/demos/flickr/qml/flickr/flickr.qml delete mode 100644 examples/demos/flickr/qml/flickr/mobile/Button.qml delete mode 100644 examples/demos/flickr/qml/flickr/mobile/GridDelegate.qml delete mode 100644 examples/demos/flickr/qml/flickr/mobile/ImageDetails.qml delete mode 100644 examples/demos/flickr/qml/flickr/mobile/ListDelegate.qml delete mode 100644 examples/demos/flickr/qml/flickr/mobile/TitleBar.qml delete mode 100644 examples/demos/flickr/qml/flickr/mobile/ToolBar.qml delete mode 100644 examples/demos/flickr/qml/flickr/mobile/images/gloss.png delete mode 100644 examples/demos/flickr/qml/flickr/mobile/images/lineedit.png delete mode 100644 examples/demos/flickr/qml/flickr/mobile/images/lineedit.sci delete mode 100644 examples/demos/flickr/qml/flickr/mobile/images/quit.png delete mode 100644 examples/demos/flickr/qml/flickr/mobile/images/stripes.png delete mode 100644 examples/demos/flickr/qml/flickr/mobile/images/titlebar.png delete mode 100644 examples/demos/flickr/qml/flickr/mobile/images/titlebar.sci delete mode 100644 examples/demos/flickr/qml/flickr/mobile/images/toolbutton.png delete mode 100644 examples/demos/flickr/qml/flickr/mobile/images/toolbutton.sci delete mode 100644 examples/demos/minehunt/README delete mode 100644 examples/demos/minehunt/main.cpp delete mode 100644 examples/demos/minehunt/minehunt.cpp delete mode 100644 examples/demos/minehunt/minehunt.h delete mode 100644 examples/demos/minehunt/minehunt.pro delete mode 100644 examples/demos/minehunt/minehunt.qmlproject delete mode 100644 examples/demos/minehunt/minehunt.qrc delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/Explosion.qml delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/Tile.qml delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/back.png delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/background.png delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/bomb-color.png delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/bomb.png delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/face-sad.png delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/face-smile-big.png delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/face-smile.png delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/flag-color.png delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/flag.png delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/front.png delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/quit.png delete mode 100644 examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/star.png delete mode 100644 examples/demos/minehunt/qml/minehunt/minehunt.qml delete mode 100644 examples/demos/photoviewer/main.cpp delete mode 100644 examples/demos/photoviewer/photoviewer.desktop delete mode 100644 examples/demos/photoviewer/photoviewer.pro delete mode 100644 examples/demos/photoviewer/photoviewer.qmlproject delete mode 100644 examples/demos/photoviewer/photoviewer.svg delete mode 100644 examples/demos/photoviewer/photoviewer64.png delete mode 100644 examples/demos/photoviewer/photoviewer80.png delete mode 100644 examples/demos/photoviewer/photoviewer_harmattan.desktop delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/AlbumDelegate.qml delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/BusyIndicator.qml delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/Button.qml delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/EditableButton.qml delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/PhotoDelegate.qml delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/ProgressBar.qml delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/RssModel.qml delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/Tag.qml delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/images/box-shadow.png delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/images/busy.png delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/images/cardboard.png delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/qmldir delete mode 100644 examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/script/script.js delete mode 100644 examples/demos/photoviewer/qml/photoviewer/i18n/base.ts delete mode 100644 examples/demos/photoviewer/qml/photoviewer/i18n/qml_fr.qm delete mode 100644 examples/demos/photoviewer/qml/photoviewer/i18n/qml_fr.ts delete mode 100644 examples/demos/photoviewer/qml/photoviewer/photoviewer.qml delete mode 100644 examples/demos/rssnews/main.cpp delete mode 100644 examples/demos/rssnews/qml/rssnews/content/BusyIndicator.qml delete mode 100644 examples/demos/rssnews/qml/rssnews/content/CategoryDelegate.qml delete mode 100644 examples/demos/rssnews/qml/rssnews/content/NewsDelegate.qml delete mode 100644 examples/demos/rssnews/qml/rssnews/content/RssFeeds.qml delete mode 100644 examples/demos/rssnews/qml/rssnews/content/ScrollBar.qml delete mode 100644 examples/demos/rssnews/qml/rssnews/content/images/busy.png delete mode 100644 examples/demos/rssnews/qml/rssnews/content/images/scrollbar.png delete mode 100644 examples/demos/rssnews/qml/rssnews/rssnews.qml delete mode 100644 examples/demos/rssnews/rssnews.desktop delete mode 100644 examples/demos/rssnews/rssnews.pro delete mode 100644 examples/demos/rssnews/rssnews.qmlproject delete mode 100644 examples/demos/rssnews/rssnews.svg delete mode 100644 examples/demos/rssnews/rssnews64.png delete mode 100644 examples/demos/rssnews/rssnews80.png delete mode 100644 examples/demos/rssnews/rssnews_harmattan.desktop delete mode 100644 examples/demos/samegame/main.cpp delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/BoomBlock.qml delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/Button.qml delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/Dialog.qml delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/pics/background.png delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/pics/blueStar.png delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/pics/blueStone.png delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/pics/greenStar.png delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/pics/greenStone.png delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/pics/redStar.png delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/pics/redStone.png delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/pics/star.png delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/pics/yellowStone.png delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/qmldir delete mode 100644 examples/demos/samegame/qml/samegame/SamegameCore/samegame.js delete mode 100644 examples/demos/samegame/qml/samegame/highscores/README delete mode 100644 examples/demos/samegame/qml/samegame/highscores/score_data.xml delete mode 100644 examples/demos/samegame/qml/samegame/highscores/score_style.xsl delete mode 100644 examples/demos/samegame/qml/samegame/highscores/scores.php delete mode 100644 examples/demos/samegame/qml/samegame/samegame.qml delete mode 100644 examples/demos/samegame/samegame.desktop delete mode 100644 examples/demos/samegame/samegame.pro delete mode 100644 examples/demos/samegame/samegame.qmlproject delete mode 100644 examples/demos/samegame/samegame.svg delete mode 100644 examples/demos/samegame/samegame64.png delete mode 100644 examples/demos/samegame/samegame80.png delete mode 100644 examples/demos/samegame/samegame_harmattan.desktop delete mode 100644 examples/demos/snake/main.cpp delete mode 100644 examples/demos/snake/qml/snake/content/Button.qml delete mode 100644 examples/demos/snake/qml/snake/content/Cookie.qml delete mode 100644 examples/demos/snake/qml/snake/content/HighScoreModel.qml delete mode 100644 examples/demos/snake/qml/snake/content/Link.qml delete mode 100644 examples/demos/snake/qml/snake/content/Skull.qml delete mode 100644 examples/demos/snake/qml/snake/content/pics/README delete mode 100644 examples/demos/snake/qml/snake/content/pics/background.png delete mode 100644 examples/demos/snake/qml/snake/content/pics/blueStar.png delete mode 100644 examples/demos/snake/qml/snake/content/pics/blueStone.png delete mode 100644 examples/demos/snake/qml/snake/content/pics/cookie.png delete mode 100644 examples/demos/snake/qml/snake/content/pics/eyes.svg delete mode 100644 examples/demos/snake/qml/snake/content/pics/head.png delete mode 100644 examples/demos/snake/qml/snake/content/pics/head.svg delete mode 100644 examples/demos/snake/qml/snake/content/pics/pause.png delete mode 100644 examples/demos/snake/qml/snake/content/pics/redStar.png delete mode 100644 examples/demos/snake/qml/snake/content/pics/redStone.png delete mode 100644 examples/demos/snake/qml/snake/content/pics/skull.png delete mode 100644 examples/demos/snake/qml/snake/content/pics/snake.jpg delete mode 100644 examples/demos/snake/qml/snake/content/pics/star.png delete mode 100644 examples/demos/snake/qml/snake/content/pics/stoneShadow.png delete mode 100644 examples/demos/snake/qml/snake/content/pics/yellowStar.png delete mode 100644 examples/demos/snake/qml/snake/content/pics/yellowStone.png delete mode 100644 examples/demos/snake/qml/snake/content/snake.js delete mode 100644 examples/demos/snake/qml/snake/snake.qml delete mode 100644 examples/demos/snake/snake.desktop delete mode 100644 examples/demos/snake/snake.pro delete mode 100644 examples/demos/snake/snake.qmlproject delete mode 100644 examples/demos/snake/snake.svg delete mode 100644 examples/demos/snake/snake64.png delete mode 100644 examples/demos/snake/snake80.png delete mode 100644 examples/demos/snake/snake_harmattan.desktop delete mode 100644 examples/demos/twitter/main.cpp delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/Button.qml delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/FatDelegate.qml delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/Input.qml delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/Loading.qml delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/MultiTitleBar.qml delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/RssModel.qml delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/SearchView.qml delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/TitleBar.qml delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/ToolBar.qml delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/UserModel.qml delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/images/gloss.png delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/images/lineedit.png delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/images/lineedit.sci delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/images/loading.png delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/images/quit.png delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/images/stripes.png delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/images/titlebar.png delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/images/titlebar.sci delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/images/toolbutton.png delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/images/toolbutton.sci delete mode 100644 examples/demos/twitter/qml/twitter/TwitterCore/qmldir delete mode 100644 examples/demos/twitter/qml/twitter/twitter.qml delete mode 100644 examples/demos/twitter/twitter.desktop delete mode 100644 examples/demos/twitter/twitter.pro delete mode 100644 examples/demos/twitter/twitter.qmlproject delete mode 100644 examples/demos/twitter/twitter.svg delete mode 100644 examples/demos/twitter/twitter64.png delete mode 100644 examples/demos/twitter/twitter80.png delete mode 100644 examples/demos/twitter/twitter_harmattan.desktop delete mode 100644 examples/helper/deployment.pri delete mode 100644 examples/helper/helper.pro delete mode 100644 examples/helper/qmlapplicationviewer/qmlapplicationviewer.cpp delete mode 100644 examples/helper/qmlapplicationviewer/qmlapplicationviewer.h delete mode 100644 examples/helper/qmlapplicationviewer/qmlapplicationviewer.pri delete mode 100644 examples/tutorials/gettingStarted/gsQml/core/button.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/core/editMenu.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/core/fileDialog.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/core/fileMenu.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/core/menuBar.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/core/qmldir delete mode 100644 examples/tutorials/gettingStarted/gsQml/core/textArea.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp delete mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h delete mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp delete mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/directory.h delete mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp delete mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/file.h delete mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/filedialog.json delete mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/filedialog.pro delete mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/qmldir delete mode 100644 examples/tutorials/gettingStarted/gsQml/images/arrow.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/Button.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/Button.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/Button.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/Button.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.json delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject delete mode 100644 examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_editmenu.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_filemenu.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_newfile.png delete mode 100644 examples/tutorials/gettingStarted/gsQml/texteditor.pro delete mode 100644 examples/tutorials/gettingStarted/gsQml/texteditor.qml (limited to 'examples') diff --git a/examples/declarative/animation/animation.pro b/examples/declarative/animation/animation.pro index 6ac1b645..c9dca1de 100644 --- a/examples/declarative/animation/animation.pro +++ b/examples/declarative/animation/animation.pro @@ -5,9 +5,5 @@ SUBDIRS += \ basics/color-animation \ easing \ behaviors/behavior-example \ + behaviors/wigglytext \ states - -# install -sources.files = animation.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/animation -INSTALLS += sources diff --git a/examples/declarative/animation/basics/color-animation/color-animation.pro b/examples/declarative/animation/basics/color-animation/color-animation.pro index 11dd9d13..f0e805e5 100644 --- a/examples/declarative/animation/basics/color-animation/color-animation.pro +++ b/examples/declarative/animation/basics/color-animation/color-animation.pro @@ -23,9 +23,9 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/animation/basics/color-animation +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/animation/basics/color-animation exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() OTHER_FILES += \ diff --git a/examples/declarative/animation/basics/property-animation/property-animation.pro b/examples/declarative/animation/basics/property-animation/property-animation.pro index 28e7ebc3..0c2dcdb1 100644 --- a/examples/declarative/animation/basics/property-animation/property-animation.pro +++ b/examples/declarative/animation/basics/property-animation/property-animation.pro @@ -23,7 +23,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/animation/basics/property-animation +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/animation/basics/property-animation exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/animation/behaviors/behavior-example/behavior-example.pro b/examples/declarative/animation/behaviors/behavior-example/behavior-example.pro index b1b3cd6b..7430b0fc 100644 --- a/examples/declarative/animation/behaviors/behavior-example/behavior-example.pro +++ b/examples/declarative/animation/behaviors/behavior-example/behavior-example.pro @@ -23,7 +23,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/animation/behaviors/behavior-example +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/animation/behaviors/behavior-example exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/animation/behaviors/wigglytext/wigglytext.pro b/examples/declarative/animation/behaviors/wigglytext/wigglytext.pro index e110924e..f8c2b129 100644 --- a/examples/declarative/animation/behaviors/wigglytext/wigglytext.pro +++ b/examples/declarative/animation/behaviors/wigglytext/wigglytext.pro @@ -26,7 +26,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/animation/wigglytext/wigglytext +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/animation/wigglytext/wigglytext exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/animation/easing/easing.pro b/examples/declarative/animation/easing/easing.pro index ac80ef7a..63769634 100644 --- a/examples/declarative/animation/easing/easing.pro +++ b/examples/declarative/animation/easing/easing.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/animation/easing +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/animation/easing exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/animation/states/states.pro b/examples/declarative/animation/states/states.pro index 9a469a68..7e9f48d3 100644 --- a/examples/declarative/animation/states/states.pro +++ b/examples/declarative/animation/states/states.pro @@ -23,7 +23,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/animation/states +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/animation/states exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/calculator/calculator.desktop b/examples/declarative/calculator/calculator.desktop new file mode 100644 index 00000000..854120f2 --- /dev/null +++ b/examples/declarative/calculator/calculator.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=calculator +Exec=/opt/calculator/bin/calculator +Icon=calculator64 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/calculator/calculator.pro b/examples/declarative/calculator/calculator.pro new file mode 100644 index 00000000..3591af05 --- /dev/null +++ b/examples/declarative/calculator/calculator.pro @@ -0,0 +1,24 @@ +# Add more folders to ship with the application, here +folder_01.source = qml/calculator +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# If your application uses the Qt Mobility libraries, uncomment the following +# lines and add the respective components to the MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# Speed up launching on MeeGo/Harmattan when using applauncherd daemon +# CONFIG += qdeclarative-boostable + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/calculator +exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/calculator/calculator.qmlproject b/examples/declarative/calculator/calculator.qmlproject new file mode 100644 index 00000000..88ca3caa --- /dev/null +++ b/examples/declarative/calculator/calculator.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "qml/calculator" + } + JavaScriptFiles { + directory: "qml/calculator" + } + ImageFiles { + directory: "qml/calculator" + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/calculator/calculator.svg b/examples/declarative/calculator/calculator.svg new file mode 100644 index 00000000..566acfad --- /dev/null +++ b/examples/declarative/calculator/calculator.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/examples/declarative/calculator/calculator64.png b/examples/declarative/calculator/calculator64.png new file mode 100644 index 00000000..707d5c4e Binary files /dev/null and b/examples/declarative/calculator/calculator64.png differ diff --git a/examples/declarative/calculator/calculator80.png b/examples/declarative/calculator/calculator80.png new file mode 100644 index 00000000..6ad8096c Binary files /dev/null and b/examples/declarative/calculator/calculator80.png differ diff --git a/examples/declarative/calculator/calculator_harmattan.desktop b/examples/declarative/calculator/calculator_harmattan.desktop new file mode 100644 index 00000000..574521d8 --- /dev/null +++ b/examples/declarative/calculator/calculator_harmattan.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=calculator +Exec=/usr/bin/single-instance /opt/calculator/bin/calculator +Icon=/usr/share/icons/hicolor/80x80/apps/calculator80.png +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/calculator/main.cpp b/examples/declarative/calculator/main.cpp new file mode 100644 index 00000000..9d2d4168 --- /dev/null +++ b/examples/declarative/calculator/main.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlapplicationviewer.h" +#include +#include + +Q_DECL_EXPORT int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + qDebug() << "NOTE: The runtime property and the Orientation enum are only available" + << "through qmlviewer and are not available in the complied version.\n" + << "Run 'qmlviewer calculator.qmlproject' or load 'calculator.qmlproject'" + << "in Qt Creator and run the project."; + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/calculator/calculator.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/calculator/qml/calculator/CalculatorCore/Button.qml b/examples/declarative/calculator/qml/calculator/CalculatorCore/Button.qml new file mode 100644 index 00000000..a6126b00 --- /dev/null +++ b/examples/declarative/calculator/qml/calculator/CalculatorCore/Button.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +BorderImage { + id: button + + property alias operation: buttonText.text + property string color: "" + + signal clicked + + source: "images/button-" + color + ".png"; clip: true + border { left: 10; top: 10; right: 10; bottom: 10 } + + Rectangle { + id: shade + anchors.fill: button; radius: 10; color: "black"; opacity: 0 + } + + Text { + id: buttonText + anchors.centerIn: parent; anchors.verticalCenterOffset: -1 + font.pixelSize: parent.width > parent.height ? parent.height * .5 : parent.width * .5 + style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true + } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { + doOp(operation) + button.clicked() + } + } + + states: State { + name: "pressed"; when: mouseArea.pressed == true + PropertyChanges { target: shade; opacity: .4 } + } +} diff --git a/examples/declarative/calculator/qml/calculator/CalculatorCore/Display.qml b/examples/declarative/calculator/qml/calculator/CalculatorCore/Display.qml new file mode 100644 index 00000000..9e7653fd --- /dev/null +++ b/examples/declarative/calculator/qml/calculator/CalculatorCore/Display.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +BorderImage { + id: image + + property alias text : displayText.text + property alias currentOperation : operationText + + source: "images/display.png" + border { left: 10; top: 10; right: 10; bottom: 10 } + + Text { + id: displayText + anchors { + right: parent.right; verticalCenter: parent.verticalCenter; verticalCenterOffset: -1 + rightMargin: 6; left: operationText.right + } + font.pixelSize: parent.height * .6; text: "0"; horizontalAlignment: Text.AlignRight; elide: Text.ElideRight + color: "#343434"; smooth: true; font.bold: true + } + Text { + id: operationText + font.bold: true; font.pixelSize: parent.height * .7 + color: "#343434"; smooth: true + anchors { left: parent.left; leftMargin: 6; verticalCenterOffset: -3; verticalCenter: parent.verticalCenter } + } +} diff --git a/examples/declarative/calculator/qml/calculator/CalculatorCore/calculator.js b/examples/declarative/calculator/qml/calculator/CalculatorCore/calculator.js new file mode 100644 index 00000000..7c363c7f --- /dev/null +++ b/examples/declarative/calculator/qml/calculator/CalculatorCore/calculator.js @@ -0,0 +1,91 @@ + +var curVal = 0 +var memory = 0 +var lastOp = "" +var timer = 0 + +function disabled(op) { + if (op == "." && display.text.toString().search(/\./) != -1) { + return true + } else if (op == squareRoot && display.text.toString().search(/-/) != -1) { + return true + } else { + return false + } +} + +function doOperation(op) { + if (disabled(op)) { + return + } + + if (op.toString().length==1 && ((op >= "0" && op <= "9") || op==".") ) { + if (display.text.toString().length >= 14) + return; // No arbitrary length numbers + if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp == ".") ) { + display.text = display.text + op.toString() + } else { + display.text = op + } + lastOp = op + return + } + lastOp = op + + if (display.currentOperation.text == "+") { + display.text = Number(display.text.valueOf()) + Number(curVal.valueOf()) + } else if (display.currentOperation.text == "-") { + display.text = Number(curVal) - Number(display.text.valueOf()) + } else if (display.currentOperation.text == multiplication) { + display.text = Number(curVal) * Number(display.text.valueOf()) + } else if (display.currentOperation.text == division) { + display.text = Number(Number(curVal) / Number(display.text.valueOf())).toString() + } else if (display.currentOperation.text == "=") { + } + + if (op == "+" || op == "-" || op == multiplication || op == division) { + display.currentOperation.text = op + curVal = display.text.valueOf() + return + } + + curVal = 0 + display.currentOperation.text = "" + + if (op == "1/x") { + display.text = (1 / display.text.valueOf()).toString() + } else if (op == "x^2") { + display.text = (display.text.valueOf() * display.text.valueOf()).toString() + } else if (op == "Abs") { + display.text = (Math.abs(display.text.valueOf())).toString() + } else if (op == "Int") { + display.text = (Math.floor(display.text.valueOf())).toString() + } else if (op == plusminus) { + display.text = (display.text.valueOf() * -1).toString() + } else if (op == squareRoot) { + display.text = (Math.sqrt(display.text.valueOf())).toString() + } else if (op == "mc") { + memory = 0; + } else if (op == "m+") { + memory += display.text.valueOf() + } else if (op == "mr") { + display.text = memory.toString() + } else if (op == "m-") { + memory = display.text.valueOf() + } else if (op == leftArrow) { + display.text = display.text.toString().slice(0, -1) + if (display.text.length == 0) { + display.text = "0" + } + } else if (op == "Off") { + Qt.quit(); + } else if (op == "C") { + display.text = "0" + } else if (op == "AC") { + curVal = 0 + memory = 0 + lastOp = "" + display.text ="0" + } +} + diff --git a/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-.png b/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-.png new file mode 100644 index 00000000..544e5145 Binary files /dev/null and b/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-.png differ diff --git a/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-blue.png b/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-blue.png new file mode 100644 index 00000000..5f92de32 Binary files /dev/null and b/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-blue.png differ diff --git a/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-green.png b/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-green.png new file mode 100644 index 00000000..36c93914 Binary files /dev/null and b/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-green.png differ diff --git a/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-purple.png b/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-purple.png new file mode 100644 index 00000000..347cbbea Binary files /dev/null and b/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-purple.png differ diff --git a/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-red.png b/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-red.png new file mode 100644 index 00000000..3b335891 Binary files /dev/null and b/examples/declarative/calculator/qml/calculator/CalculatorCore/images/button-red.png differ diff --git a/examples/declarative/calculator/qml/calculator/CalculatorCore/images/display.png b/examples/declarative/calculator/qml/calculator/CalculatorCore/images/display.png new file mode 100644 index 00000000..9507f438 Binary files /dev/null and b/examples/declarative/calculator/qml/calculator/CalculatorCore/images/display.png differ diff --git a/examples/declarative/calculator/qml/calculator/CalculatorCore/qmldir b/examples/declarative/calculator/qml/calculator/CalculatorCore/qmldir new file mode 100644 index 00000000..a926b93f --- /dev/null +++ b/examples/declarative/calculator/qml/calculator/CalculatorCore/qmldir @@ -0,0 +1,2 @@ +Button Button.qml +Display Display.qml diff --git a/examples/declarative/calculator/qml/calculator/calculator.qml b/examples/declarative/calculator/qml/calculator/calculator.qml new file mode 100644 index 00000000..5c7c5e5d --- /dev/null +++ b/examples/declarative/calculator/qml/calculator/calculator.qml @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "CalculatorCore" +import "CalculatorCore/calculator.js" as CalcEngine + +Rectangle { + id: window + + width: 360; height: 480 + color: "#282828" + + property string rotateLeft: "\u2939" + property string rotateRight: "\u2935" + property string leftArrow: "\u2190" + property string division : "\u00f7" + property string multiplication : "\u00d7" + property string squareRoot : "\u221a" + property string plusminus : "\u00b1" + + function doOp(operation) { CalcEngine.doOperation(operation) } + + Item { + id: main + state: "orientation " + runtime.orientation + + property bool landscapeWindow: window.width > window.height + property real baseWidth: landscapeWindow ? window.height : window.width + property real baseHeight: landscapeWindow ? window.width : window.height + property real rotationDelta: landscapeWindow ? -90 : 0 + + rotation: rotationDelta + width: main.baseWidth + height: main.baseHeight + anchors.centerIn: parent + + Column { + id: box; spacing: 8 + + anchors { fill: parent; topMargin: 6; bottomMargin: 6; leftMargin: 6; rightMargin: 6 } + + Display { + id: display + width: box.width-3 + height: 64 + } + + Column { + id: column; spacing: 6 + + property real h: ((box.height - 72) / 6) - ((spacing * (6 - 1)) / 6) + property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) + + Row { + spacing: 6 + Button { width: column.w; height: column.h; color: 'purple'; operation: "Off" } + Button { width: column.w; height: column.h; color: 'purple'; operation: leftArrow } + Button { width: column.w; height: column.h; color: 'purple'; operation: "C" } + Button { width: column.w; height: column.h; color: 'purple'; operation: "AC" } + } + + Row { + spacing: 6 + property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) + + Button { width: column.w; height: column.h; color: 'green'; operation: "mc" } + Button { width: column.w; height: column.h; color: 'green'; operation: "m+" } + Button { width: column.w; height: column.h; color: 'green'; operation: "m-" } + Button { width: column.w; height: column.h; color: 'green'; operation: "mr" } + } + + Grid { + id: grid; rows: 5; columns: 5; spacing: 6 + + property real w: (box.width / columns) - ((spacing * (columns - 1)) / columns) + + Button { width: grid.w; height: column.h; operation: "7"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "8"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "9"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: division } + Button { width: grid.w; height: column.h; operation: squareRoot } + Button { width: grid.w; height: column.h; operation: "4"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "5"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "6"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: multiplication } + Button { width: grid.w; height: column.h; operation: "x^2" } + Button { width: grid.w; height: column.h; operation: "1"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "2"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "3"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "-" } + Button { width: grid.w; height: column.h; operation: "1/x" } + Button { width: grid.w; height: column.h; operation: "0"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "." } + Button { width: grid.w; height: column.h; operation: plusminus } + Button { width: grid.w; height: column.h; operation: "+" } + Button { width: grid.w; height: column.h; operation: "="; color: 'red' } + } + } + } + + states: [ + State { + name: "orientation " + Orientation.Landscape + PropertyChanges { target: main; rotation: 90 + rotationDelta; width: main.baseHeight; height: main.baseWidth } + }, + State { + name: "orientation " + Orientation.PortraitInverted + PropertyChanges { target: main; rotation: 180 + rotationDelta; } + }, + State { + name: "orientation " + Orientation.LandscapeInverted + PropertyChanges { target: main; rotation: 270 + rotationDelta; width: main.baseHeight; height: main.baseWidth } + } + ] + + transitions: Transition { + SequentialAnimation { + RotationAnimation { direction: RotationAnimation.Shortest; duration: 300; easing.type: Easing.InOutQuint } + NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint } + } + } + } +} diff --git a/examples/declarative/cppextensions/cppextensions.pro b/examples/declarative/cppextensions/cppextensions.pro index 96550307..c81eb13f 100644 --- a/examples/declarative/cppextensions/cppextensions.pro +++ b/examples/declarative/cppextensions/cppextensions.pro @@ -7,8 +7,3 @@ SUBDIRS += \ qwidgets \ qgraphicslayouts \ referenceexamples - -# install -sources.files = cppextensions.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions -INSTALLS += sources diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.pro b/examples/declarative/cppextensions/imageprovider/imageprovider.pro index 9e698d88..9c305212 100644 --- a/examples/declarative/cppextensions/imageprovider/imageprovider.pro +++ b/examples/declarative/cppextensions/imageprovider/imageprovider.pro @@ -7,16 +7,11 @@ TARGET = qmlimageproviderplugin SOURCES += imageprovider.cpp -OTHER_FILES += imageprovider.json +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/imageprovider/ImageProviderCore +qml.files = imageprovider-example.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/imageprovider +qml2.files = ImageProviderCore/qmldir +qml2.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/imageprovider/ImageProviderCore -sources.files = $$SOURCES imageprovider.qml imageprovider.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/imageprovider - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/imageprovider/ImageProviderCore - -ImageProviderCore_sources.files = \ - ImageProviderCore/qmldir -ImageProviderCore_sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/imageprovider/ImageProviderCore - -INSTALLS = sources ImageProviderCore_sources target +INSTALLS = qml qml2 target diff --git a/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro b/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro index 4048dfd9..0f3e4e43 100644 --- a/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro +++ b/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro @@ -21,7 +21,7 @@ SOURCES += main.cpp RESOURCES += networkaccessmanagerfactory.qrc # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/networkaccessmanagerfactory +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/networkaccessmanagerfactory exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/cppextensions/plugins/plugins.pro b/examples/declarative/cppextensions/plugins/plugins.pro index 053e6c44..93318e40 100644 --- a/examples/declarative/cppextensions/plugins/plugins.pro +++ b/examples/declarative/cppextensions/plugins/plugins.pro @@ -7,7 +7,7 @@ TARGET = qmlqtimeexampleplugin SOURCES += plugin.cpp -OTHER_FILES += "plugin.json" +target.path += $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/plugins/com/nokia/TimeExample qdeclarativesources.files += \ com/nokia/TimeExample/qmldir \ @@ -16,12 +16,10 @@ qdeclarativesources.files += \ com/nokia/TimeExample/Clock.qml \ com/nokia/TimeExample/hour.png \ com/nokia/TimeExample/minute.png +qdeclarativesources.path += $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/plugins/com/nokia/TimeExample -qdeclarativesources.path += $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/plugins/com/nokia/TimeExample +qml.files += plugins.qml +qml.path += $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/plugins -sources.files += plugins.pro plugin.cpp plugins.qml README -sources.path += $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/plugins -target.path += $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/plugins/com/nokia/TimeExample - -INSTALLS += qdeclarativesources sources target +INSTALLS += target qdeclarativesources qml diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.pro b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.pro index 794979c4..e60ef3cc 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.pro +++ b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.pro @@ -28,8 +28,8 @@ RESOURCES += \ gridlayout.qrc # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.pro b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.pro index da9b9939..49dbc405 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.pro +++ b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.pro @@ -28,7 +28,7 @@ RESOURCES += \ linearlayout.qrc # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/cppextensions/qwidgets/qwidgets.pro b/examples/declarative/cppextensions/qwidgets/qwidgets.pro index 3c0c865a..ea61235e 100644 --- a/examples/declarative/cppextensions/qwidgets/qwidgets.pro +++ b/examples/declarative/cppextensions/qwidgets/qwidgets.pro @@ -7,11 +7,12 @@ TARGET = qmlqwidgetsplugin SOURCES += qwidgets.cpp -OTHER_FILES += qwidgets.json +qml.files = qwidgets.qml +qml.path += $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/qwidgets +qml2.files = QWidgets/qmldir +qml2.path += $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/plugins/QWidgets -sources.files += qwidgets.pro qwidgets.cpp qwidgets.qml -sources.path += $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/plugins -target.path += $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/plugins +target.path += $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/plugins -INSTALLS += sources target +INSTALLS += target qml qml2 diff --git a/examples/declarative/cppextensions/referenceexamples/adding/adding.pro b/examples/declarative/cppextensions/referenceexamples/adding/adding.pro index 57179384..bc17d41c 100644 --- a/examples/declarative/cppextensions/referenceexamples/adding/adding.pro +++ b/examples/declarative/cppextensions/referenceexamples/adding/adding.pro @@ -5,7 +5,5 @@ SOURCES += main.cpp \ HEADERS += person.h RESOURCES += adding.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/adding -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS adding.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/adding -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/referenceexamples/adding +INSTALLS += target diff --git a/examples/declarative/cppextensions/referenceexamples/attached/attached.pro b/examples/declarative/cppextensions/referenceexamples/attached/attached.pro index 2c24fcbd..32f01468 100644 --- a/examples/declarative/cppextensions/referenceexamples/attached/attached.pro +++ b/examples/declarative/cppextensions/referenceexamples/attached/attached.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += attached.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/attached -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS attached.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/attached -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/referenceexamples/attached +INSTALLS += target diff --git a/examples/declarative/cppextensions/referenceexamples/binding/binding.pro b/examples/declarative/cppextensions/referenceexamples/binding/binding.pro index 7b269491..64bcd0ef 100644 --- a/examples/declarative/cppextensions/referenceexamples/binding/binding.pro +++ b/examples/declarative/cppextensions/referenceexamples/binding/binding.pro @@ -9,7 +9,5 @@ HEADERS += person.h \ happybirthdaysong.h RESOURCES += binding.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/binding -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS binding.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/binding -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/referenceexamples/binding +INSTALLS += target diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/coercion.pro b/examples/declarative/cppextensions/referenceexamples/coercion/coercion.pro index 29b905ca..17f67be4 100644 --- a/examples/declarative/cppextensions/referenceexamples/coercion/coercion.pro +++ b/examples/declarative/cppextensions/referenceexamples/coercion/coercion.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += coercion.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/coercion -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS coercion.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/coercion -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/referenceexamples/coercion +INSTALLS += target diff --git a/examples/declarative/cppextensions/referenceexamples/default/default.pro b/examples/declarative/cppextensions/referenceexamples/default/default.pro index 235aa317..b045061d 100644 --- a/examples/declarative/cppextensions/referenceexamples/default/default.pro +++ b/examples/declarative/cppextensions/referenceexamples/default/default.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += default.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/default -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS default.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/default -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/referenceexamples/default +INSTALLS += target diff --git a/examples/declarative/cppextensions/referenceexamples/extended/extended.pro b/examples/declarative/cppextensions/referenceexamples/extended/extended.pro index 8acc21de..3956f7ab 100644 --- a/examples/declarative/cppextensions/referenceexamples/extended/extended.pro +++ b/examples/declarative/cppextensions/referenceexamples/extended/extended.pro @@ -5,7 +5,5 @@ SOURCES += main.cpp \ HEADERS += lineedit.h RESOURCES += extended.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/extended -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS extended.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/extended -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/referenceexamples/extended +INSTALLS += target diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/grouped.pro b/examples/declarative/cppextensions/referenceexamples/grouped/grouped.pro index 3d98260a..3a3830fb 100644 --- a/examples/declarative/cppextensions/referenceexamples/grouped/grouped.pro +++ b/examples/declarative/cppextensions/referenceexamples/grouped/grouped.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += grouped.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/grouped -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS grouped.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/grouped -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/referenceexamples/grouped +INSTALLS += target diff --git a/examples/declarative/cppextensions/referenceexamples/methods/methods.pro b/examples/declarative/cppextensions/referenceexamples/methods/methods.pro index 105007a0..1d42fcac 100644 --- a/examples/declarative/cppextensions/referenceexamples/methods/methods.pro +++ b/examples/declarative/cppextensions/referenceexamples/methods/methods.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += methods.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/methods -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS methods.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/methods -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/referenceexamples/methods +INSTALLS += target diff --git a/examples/declarative/cppextensions/referenceexamples/properties/properties.pro b/examples/declarative/cppextensions/referenceexamples/properties/properties.pro index d6c547a2..509bf3b6 100644 --- a/examples/declarative/cppextensions/referenceexamples/properties/properties.pro +++ b/examples/declarative/cppextensions/referenceexamples/properties/properties.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += properties.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/properties -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS properties.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/properties -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/referenceexamples/properties +INSTALLS += target diff --git a/examples/declarative/cppextensions/referenceexamples/signal/signal.pro b/examples/declarative/cppextensions/referenceexamples/signal/signal.pro index d62fb200..11465c38 100644 --- a/examples/declarative/cppextensions/referenceexamples/signal/signal.pro +++ b/examples/declarative/cppextensions/referenceexamples/signal/signal.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += signal.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/signal -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS signal.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/signal -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/referenceexamples/signal +INSTALLS += target diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/valuesource.pro b/examples/declarative/cppextensions/referenceexamples/valuesource/valuesource.pro index 1af33152..ada2ad76 100644 --- a/examples/declarative/cppextensions/referenceexamples/valuesource/valuesource.pro +++ b/examples/declarative/cppextensions/referenceexamples/valuesource/valuesource.pro @@ -9,7 +9,5 @@ HEADERS += person.h \ happybirthdaysong.h RESOURCES += valuesource.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/valuesource -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS valuesource.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/cppextensions/referenceexamples/valuesource -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/cppextensions/referenceexamples/valuesource +INSTALLS += target diff --git a/examples/declarative/declarative.pro b/examples/declarative/declarative.pro index c2e93d55..4079afc2 100644 --- a/examples/declarative/declarative.pro +++ b/examples/declarative/declarative.pro @@ -2,29 +2,36 @@ TEMPLATE = subdirs # These examples contain some C++ and need to be built SUBDIRS = \ - animation \ - cppextensions \ - modelviews \ - i18n \ - imageelements \ - keyinteraction/focus \ - positioners \ - sqllocalstorage \ - text \ - threading \ - tutorials \ - touchinteraction \ - toys \ - ui-components + animation \ + calculator \ + cppextensions \ + flickr \ + i18n \ + imageelements \ + keyinteraction/focus \ + minehunt \ + modelviews \ + photoviewer \ + positioners \ + righttoleft \ + rssnews \ + samegame \ + shadereffects \ + snake \ + sqllocalstorage \ + text \ + threading \ + touchinteraction \ + toys \ + tutorials \ + twitter \ + ui-components # OpenGL shader examples requires opengl and they contain some C++ and need to be built contains(QT_CONFIG, opengl): SUBDIRS += shadereffects # These examples contain no C++ and can simply be copied -sources.files = \ - cppextensions \ - xml \ - declarative.pro - -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative -INSTALLS += sources +EXAMPLE_FILES = \ + helper \ + screenorientation \ + xml diff --git a/examples/declarative/flickr/flickr.desktop b/examples/declarative/flickr/flickr.desktop new file mode 100644 index 00000000..8467f39b --- /dev/null +++ b/examples/declarative/flickr/flickr.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=flickr +Exec=/opt/flickr/bin/flickr +Icon=flickr64 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/flickr/flickr.pro b/examples/declarative/flickr/flickr.pro new file mode 100644 index 00000000..cfc3afc5 --- /dev/null +++ b/examples/declarative/flickr/flickr.pro @@ -0,0 +1,24 @@ +# Add more folders to ship with the application, here +folder_01.source = qml/flickr +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# If your application uses the Qt Mobility libraries, uncomment the following +# lines and add the respective components to the MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# Speed up launching on MeeGo/Harmattan when using applauncherd daemon +# CONFIG += qdeclarative-boostable + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/flickr +exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/flickr/flickr.qmlproject b/examples/declarative/flickr/flickr.qmlproject new file mode 100644 index 00000000..3a6d8210 --- /dev/null +++ b/examples/declarative/flickr/flickr.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "qml/flickr" + } + JavaScriptFiles { + directory: "qml/flickr" + } + ImageFiles { + directory: "qml/flickr" + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/flickr/flickr.svg b/examples/declarative/flickr/flickr.svg new file mode 100644 index 00000000..566acfad --- /dev/null +++ b/examples/declarative/flickr/flickr.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/examples/declarative/flickr/flickr64.png b/examples/declarative/flickr/flickr64.png new file mode 100644 index 00000000..707d5c4e Binary files /dev/null and b/examples/declarative/flickr/flickr64.png differ diff --git a/examples/declarative/flickr/flickr80.png b/examples/declarative/flickr/flickr80.png new file mode 100644 index 00000000..6ad8096c Binary files /dev/null and b/examples/declarative/flickr/flickr80.png differ diff --git a/examples/declarative/flickr/flickr_harmattan.desktop b/examples/declarative/flickr/flickr_harmattan.desktop new file mode 100644 index 00000000..19cf6264 --- /dev/null +++ b/examples/declarative/flickr/flickr_harmattan.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=flickr +Exec=/usr/bin/single-instance /opt/flickr/bin/flickr +Icon=/usr/share/icons/hicolor/80x80/apps/flickr80.png +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/flickr/main.cpp b/examples/declarative/flickr/main.cpp new file mode 100644 index 00000000..62e3246e --- /dev/null +++ b/examples/declarative/flickr/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlapplicationviewer.h" +#include + +Q_DECL_EXPORT int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/flickr/flickr.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/flickr/qml/flickr/common/Progress.qml b/examples/declarative/flickr/qml/flickr/common/Progress.qml new file mode 100644 index 00000000..1781497f --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/common/Progress.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + property variant progress: 0 + + Rectangle { + anchors.fill: parent; smooth: true + border.color: "white"; border.width: 0; radius: height/2 - 2 + gradient: Gradient { + GradientStop { position: 0; color: "#66343434" } + GradientStop { position: 1.0; color: "#66000000" } + } + } + + Rectangle { + y: 2; height: parent.height-4; + x: 2; width: Math.max(parent.width * progress - 4, 0); + opacity: width < 1 ? 0 : 1; smooth: true + gradient: Gradient { + GradientStop { position: 0; color: "lightsteelblue" } + GradientStop { position: 1.0; color: "steelblue" } + } + radius: height/2 - 2 + } + + Text { + text: Math.round(progress * 100) + "%" + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + color: "white"; font.bold: true; font.pixelSize: 15 + } +} diff --git a/examples/declarative/flickr/qml/flickr/common/RssModel.qml b/examples/declarative/flickr/qml/flickr/common/RssModel.qml new file mode 100644 index 00000000..f7070f43 --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/common/RssModel.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +XmlListModel { + property string tags : "" + + function commasep(x) + { + return x.replace(' ',','); + } + + source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+commasep(tags)+"&" : "")+"format=rss2" + query: "/rss/channel/item" + namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";" + + XmlRole { name: "title"; query: "title/string()" } + XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" } + XmlRole { name: "url"; query: "media:content/@url/string()" } + XmlRole { name: "description"; query: "description/string()" } + XmlRole { name: "tags"; query: "media:category/string()" } + XmlRole { name: "photoWidth"; query: "media:content/@width/string()" } + XmlRole { name: "photoHeight"; query: "media:content/@height/string()" } + XmlRole { name: "photoType"; query: "media:content/@type/string()" } + XmlRole { name: "photoAuthor"; query: "author/string()" } + XmlRole { name: "photoDate"; query: "pubDate/string()" } +} diff --git a/examples/declarative/flickr/qml/flickr/common/ScrollBar.qml b/examples/declarative/flickr/qml/flickr/common/ScrollBar.qml new file mode 100644 index 00000000..409cfb7e --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/common/ScrollBar.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property variant flickableArea + + Rectangle { + radius: 5 + color: "black" + opacity: 0.3 + border.color: "white" + border.width: 2 + x: 0 + y: flickableArea.visibleArea.yPosition * container.height + width: parent.width + height: flickableArea.visibleArea.heightRatio * container.height + } + states: [ + State { + name: "show" + when: flickableArea.movingVertically + PropertyChanges { + target: container + opacity: 1 + } + } + ] + transitions: [ + Transition { + from: "*" + to: "*" + NumberAnimation { + target: container + properties: "opacity" + duration: 400 + } + } + ] +} diff --git a/examples/declarative/flickr/qml/flickr/common/Slider.qml b/examples/declarative/flickr/qml/flickr/common/Slider.qml new file mode 100644 index 00000000..dfb4ac11 --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/common/Slider.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: slider; width: 400; height: 16 + + // value is read/write. + property real value: 1 + onValueChanged: updatePos(); + property real maximum: 1 + property real minimum: 1 + property int xMax: width - handle.width - 4 + onXMaxChanged: updatePos(); + onMinimumChanged: updatePos(); + + function updatePos() { + if (maximum > minimum) { + var pos = 2 + (value - minimum) * slider.xMax / (maximum - minimum); + pos = Math.min(pos, width - handle.width - 2); + pos = Math.max(pos, 2); + handle.x = pos; + } else { + handle.x = 2; + } + } + + Rectangle { + anchors.fill: parent + border.color: "white"; border.width: 0; radius: 8 + gradient: Gradient { + GradientStop { position: 0.0; color: "#66343434" } + GradientStop { position: 1.0; color: "#66000000" } + } + } + + Rectangle { + id: handle; smooth: true + y: 2; width: 30; height: slider.height-4; radius: 6 + gradient: Gradient { + GradientStop { position: 0.0; color: "lightgray" } + GradientStop { position: 1.0; color: "gray" } + } + + MouseArea { + id: mouse + anchors.fill: parent; drag.target: parent + drag.axis: Drag.XAxis; drag.minimumX: 2; drag.maximumX: slider.xMax+2 + onPositionChanged: { value = (maximum - minimum) * (handle.x-2) / slider.xMax + minimum; } + } + } +} diff --git a/examples/declarative/flickr/qml/flickr/common/qmldir b/examples/declarative/flickr/qml/flickr/common/qmldir new file mode 100644 index 00000000..adc2479b --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/common/qmldir @@ -0,0 +1,10 @@ +ImageDetails ImageDetails.qml +LikeOMeter LikeOMeter.qml +Loading Loading.qml +MediaButton MediaButton.qml +MediaLineEdit MediaLineEdit.qml +Progress Progress.qml +RssModel RssModel.qml +ScrollBar ScrollBar.qml +Slider Slider.qml +Star Star.qml diff --git a/examples/declarative/flickr/qml/flickr/flickr-90.qml b/examples/declarative/flickr/qml/flickr/flickr-90.qml new file mode 100644 index 00000000..6acc92cb --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/flickr-90.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + width: 480; height: 320 + + Loader { + y: 320; rotation: -90 + transformOrigin: Item.TopLeft + source: "flickr.qml" + } +} diff --git a/examples/declarative/flickr/qml/flickr/flickr.qml b/examples/declarative/flickr/qml/flickr/flickr.qml new file mode 100644 index 00000000..fa303e76 --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/flickr.qml @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "common" as Common +import "mobile" as Mobile + +Item { + id: screen; width: 320; height: 480 + property bool inListView : false + + Rectangle { + id: background + anchors.fill: parent; color: "#343434"; + + Image { source: "mobile/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } + + Common.RssModel { id: rssModel } + + Item { + id: views + width: parent.width + anchors.top: titleBar.bottom; anchors.bottom: toolBar.top + + GridView { + id: photoGridView; model: rssModel; delegate: Mobile.GridDelegate {} + cacheBuffer: 1000 + cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height + } + + ListView { + id: photoListView; model: rssModel; delegate: Mobile.ListDelegate { } + width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100; + } + + states: State { + name: "ListView"; when: screen.inListView == true + PropertyChanges { target: photoListView; x: 0 } + PropertyChanges { target: photoGridView; x: -(parent.width * 1.5) } + } + + transitions: Transition { + NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad } + } + + Mobile.ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height } + + Item { id: foreground; anchors.fill: parent } + } + + Mobile.TitleBar { id: titleBar; width: parent.width; height: 40; opacity: 0.9 } + + Mobile.ToolBar { + id: toolBar + height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9 + button1Label: "Update"; button2Label: "View mode" + onButton1Clicked: rssModel.reload() + onButton2Clicked: if (screen.inListView == true) screen.inListView = false; else screen.inListView = true + } + + Connections { + target: imageDetails + onClosed: { + if (background.state == "DetailedView") { + background.state = ''; + imageDetails.photoUrl = ""; + } + } + } + + states: State { + name: "DetailedView" + PropertyChanges { target: views; x: -parent.width } + PropertyChanges { target: toolBar; button1Label: "View..." } + PropertyChanges { + target: toolBar + onButton1Clicked: if (imageDetails.state=='') imageDetails.state='Back'; else imageDetails.state='' + } + PropertyChanges { target: toolBar; button2Label: "Back" } + PropertyChanges { target: toolBar; onButton2Clicked: imageDetails.closed() } + } + + transitions: Transition { + NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad } + } + } +} diff --git a/examples/declarative/flickr/qml/flickr/mobile/Button.qml b/examples/declarative/flickr/qml/flickr/mobile/Button.qml new file mode 100644 index 00000000..a993d7d9 --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/mobile/Button.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + signal clicked + + property string text + + BorderImage { + id: buttonImage + source: "images/toolbutton.sci" + width: container.width; height: container.height + } + BorderImage { + id: pressed + opacity: 0 + source: "images/toolbutton.sci" + width: container.width; height: container.height + } + MouseArea { + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.clicked(); } + } + Text { + color: "white" + anchors.centerIn: buttonImage; font.bold: true; font.pixelSize: 15 + text: container.text; style: Text.Raised; styleColor: "black" + } + states: [ + State { + name: "Pressed" + when: mouseRegion.pressed == true + PropertyChanges { target: pressed; opacity: 1 } + } + ] +} diff --git a/examples/declarative/flickr/qml/flickr/mobile/GridDelegate.qml b/examples/declarative/flickr/qml/flickr/mobile/GridDelegate.qml new file mode 100644 index 00000000..d6df1d0c --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/mobile/GridDelegate.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: wrapper; width: GridView.view.cellWidth; height: GridView.view.cellHeight + + function photoClicked() { + imageDetails.photoTitle = title; + imageDetails.photoTags = tags; + imageDetails.photoWidth = photoWidth; + imageDetails.photoHeight = photoHeight; + imageDetails.photoType = photoType; + imageDetails.photoAuthor = photoAuthor; + imageDetails.photoDate = photoDate; + imageDetails.photoUrl = url; + imageDetails.rating = 0; + scaleMe.state = "Details"; + } + + Item { + anchors.centerIn: parent + scale: 0.0 + Behavior on scale { NumberAnimation { easing.type: Easing.InOutQuad} } + id: scaleMe + + Item { + width: 77; height: 77; anchors.centerIn: parent + Rectangle { + id: whiteRect; width: 77; height: 77; color: "#dddddd"; smooth: true + Image { id: thumb; source: imagePath; x: 1; y: 1; smooth: true } + Image { source: "images/gloss.png" } + } + } + + Connections { + target: toolBar + onButton2Clicked: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show' + } + + states: [ + State { + name: "Show"; when: thumb.status == Image.Ready + PropertyChanges { target: scaleMe; scale: 1 } + }, + State { + name: "Details" + PropertyChanges { target: scaleMe; scale: 1 } + ParentChange { target: whiteRect; x: 10; y: 20; parent: imageDetails.frontContainer } + PropertyChanges { target: background; state: "DetailedView" } + } + ] + transitions: [ + Transition { + from: "Show"; to: "Details" + ParentAnimation { + via: foreground + NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } + } + }, + Transition { + from: "Details"; to: "Show" + ParentAnimation { + via: foreground + NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } + } + } + ] + } + MouseArea { anchors.fill: wrapper; onClicked: photoClicked() } +} + diff --git a/examples/declarative/flickr/qml/flickr/mobile/ImageDetails.qml b/examples/declarative/flickr/qml/flickr/mobile/ImageDetails.qml new file mode 100644 index 00000000..27a8f44c --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/mobile/ImageDetails.qml @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "../common" as Common + +Flipable { + id: container + + property alias frontContainer: containerFront + property string photoTitle: "" + property string photoTags: "" + property int photoWidth + property int photoHeight + property string photoType + property string photoAuthor + property string photoDate + property string photoUrl + property int rating: 2 + property variant prevScale: 1.0 + + signal closed + + transform: Rotation { + id: itemRotation + origin.x: container.width / 2; + axis.y: 1; axis.z: 0 + } + + front: Item { + id: containerFront; anchors.fill: container + + Rectangle { + anchors.fill: parent + color: "black"; opacity: 0.4 + } + + Column { + spacing: 10 + anchors { + left: parent.left; leftMargin: 10 + right: parent.right; rightMargin: 10 + top: parent.top; topMargin: 120 + } + Text { font.bold: true; color: "white"; elide: Text.ElideRight; text: container.photoTitle; width: parent.width } + Text { color: "white"; elide: Text.ElideRight; text: "Size: " + container.photoWidth + 'x' + container.photoHeight; width: parent.width } + Text { color: "white"; elide: Text.ElideRight; text: "Type: " + container.photoType; width: parent.width } + Text { color: "white"; elide: Text.ElideRight; text: "Author: " + container.photoAuthor; width: parent.width } + Text { color: "white"; elide: Text.ElideRight; text: "Published: " + container.photoDate; width: parent.width } + Text { color: "white"; elide: Text.ElideRight; text: container.photoTags == "" ? "" : "Tags: "; width: parent.width } + Text { color: "white"; elide: Text.ElideRight; text: container.photoTags; width: parent.width } + } + } + + back: Item { + anchors.fill: container + + Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4 } + + Common.Progress { + anchors.centerIn: parent; width: 200; height: 22 + progress: bigImage.progress; visible: bigImage.status != Image.Ready + } + + Flickable { + id: flickable; anchors.fill: parent; clip: true + contentWidth: imageContainer.width; contentHeight: imageContainer.height + + function updateMinimumScale() { + if (bigImage.status == Image.Ready && bigImage.width != 0) { + slider.minimum = Math.min(flickable.width / bigImage.width, flickable.height / bigImage.height); + if (bigImage.width * slider.value > flickable.width) { + var xoff = (flickable.width/2 + flickable.contentX) * slider.value / prevScale; + flickable.contentX = xoff - flickable.width/2; + } + if (bigImage.height * slider.value > flickable.height) { + var yoff = (flickable.height/2 + flickable.contentY) * slider.value / prevScale; + flickable.contentY = yoff - flickable.height/2; + } + prevScale = slider.value; + } + } + + onWidthChanged: updateMinimumScale() + onHeightChanged: updateMinimumScale() + + Item { + id: imageContainer + width: Math.max(bigImage.width * bigImage.scale, flickable.width); + height: Math.max(bigImage.height * bigImage.scale, flickable.height); + + Image { + id: bigImage; source: container.photoUrl; scale: slider.value + anchors.centerIn: parent; smooth: !flickable.movingVertically + onStatusChanged : { + // Default scale shows the entire image. + if (bigImage.status == Image.Ready && bigImage.width != 0) { + slider.minimum = Math.min(flickable.width / bigImage.width, flickable.height / bigImage.height); + prevScale = Math.min(slider.minimum, 1); + slider.value = prevScale; + } + } + } + } + } + + Text { + text: "Image Unavailable" + visible: bigImage.status == Image.Error + anchors.centerIn: parent; color: "white"; font.bold: true + } + + Common.Slider { + id: slider; visible: { bigImage.status == Image.Ready && maximum > minimum } + anchors { + bottom: parent.bottom; bottomMargin: 65 + left: parent.left; leftMargin: 25 + right: parent.right; rightMargin: 25 + } + onValueChanged: { + if (bigImage.width * value > flickable.width) { + var xoff = (flickable.width/2 + flickable.contentX) * value / prevScale; + flickable.contentX = xoff - flickable.width/2; + } + if (bigImage.height * value > flickable.height) { + var yoff = (flickable.height/2 + flickable.contentY) * value / prevScale; + flickable.contentY = yoff - flickable.height/2; + } + prevScale = value; + } + } + } + + states: State { + name: "Back" + PropertyChanges { target: itemRotation; angle: 180 } + PropertyChanges { target: toolBar; button2Visible: false } + PropertyChanges { target: toolBar; button1Label: "Back" } + } + + transitions: Transition { + SequentialAnimation { + PropertyAction { target: bigImage; property: "smooth"; value: false } + NumberAnimation { easing.type: Easing.InOutQuad; properties: "angle"; duration: 500 } + PropertyAction { target: bigImage; property: "smooth"; value: !flickable.movingVertically } + } + } +} diff --git a/examples/declarative/flickr/qml/flickr/mobile/ListDelegate.qml b/examples/declarative/flickr/qml/flickr/mobile/ListDelegate.qml new file mode 100644 index 00000000..0165ffb0 --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/mobile/ListDelegate.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Component { + Item { + id: wrapper; width: wrapper.ListView.view.width; height: 86 + Item { + id: moveMe + Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 } + Rectangle { + x: 6; y: 4; width: 77; height: 77; color: "white"; smooth: true + + Image { source: imagePath; x: 1; y: 1 } + Image { source: "images/gloss.png" } + } + Column { + x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2 + Text { text: title; color: "white"; width: parent.width; font.pixelSize: 14; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" } + Text { text: photoAuthor; width: parent.width; font.pixelSize: 14; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } + Text { text: photoDate; width: parent.width; font.pixelSize: 14; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" } + } + } + } +} diff --git a/examples/declarative/flickr/qml/flickr/mobile/TitleBar.qml b/examples/declarative/flickr/qml/flickr/mobile/TitleBar.qml new file mode 100644 index 00000000..82370212 --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/mobile/TitleBar.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: titleBar + property string untaggedString: "Uploads from everyone" + property string taggedString: "Recent uploads tagged " + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + + Item { + id: container + width: (parent.width * 2) - 55 ; height: parent.height + + function accept() { + imageDetails.closed() + titleBar.state = "" + background.state = "" + rssModel.tags = editor.text + } + + Image { + id: quitButton + anchors.left: parent.left//; anchors.leftMargin: 0 + anchors.verticalCenter: parent.verticalCenter + source: "images/quit.png" + MouseArea { + anchors.fill: parent + onClicked: Qt.quit() + } + } + + Text { + id: categoryText + anchors { + left: quitButton.right; right: tagButton.left; leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + elide: Text.ElideLeft + text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags) + font.bold: true; font.pixelSize: 15; color: "White"; style: Text.Raised; styleColor: "Black" + } + + Button { + id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..." + onClicked: if (titleBar.state == "Tags") container.accept(); else titleBar.state = "Tags" + anchors.verticalCenter: parent.verticalCenter + } + + Item { + id: lineEdit + y: 4; height: parent.height - 9 + anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 } + + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } + + TextInput { + id: editor + anchors { + left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + cursorVisible: true; font.bold: true + color: "#151515"; selectionColor: "Green" + } + + Keys.forwardTo: [ (returnKey), (editor)] + + Item { + id: returnKey + Keys.onReturnPressed: container.accept() + Keys.onEnterPressed: container.accept() + Keys.onEscapePressed: titleBar.state = "" + } + } + } + + states: State { + name: "Tags" + PropertyChanges { target: container; x: -tagButton.x + 5 } + PropertyChanges { target: tagButton; text: "OK" } + PropertyChanges { target: editor; focus: true } + } + + transitions: Transition { + NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad } + } +} diff --git a/examples/declarative/flickr/qml/flickr/mobile/ToolBar.qml b/examples/declarative/flickr/qml/flickr/mobile/ToolBar.qml new file mode 100644 index 00000000..7e268303 --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/mobile/ToolBar.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: toolbar + + property alias button1Label: button1.text + property alias button2Label: button2.text + property alias button2Visible: button2.visible + + signal button1Clicked + signal button2Clicked + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + + Row { + anchors.right: parent.right; anchors.rightMargin: 5; y: 3; height: 32; spacing: 30 + Button { + id: button1 + width: 140; height: 32 + onClicked: toolbar.button1Clicked() + } + + Button { + id: button2; width: 140; height: 32 + onClicked: toolbar.button2Clicked() + } + } +} diff --git a/examples/declarative/flickr/qml/flickr/mobile/images/gloss.png b/examples/declarative/flickr/qml/flickr/mobile/images/gloss.png new file mode 100644 index 00000000..5d370cd9 Binary files /dev/null and b/examples/declarative/flickr/qml/flickr/mobile/images/gloss.png differ diff --git a/examples/declarative/flickr/qml/flickr/mobile/images/lineedit.png b/examples/declarative/flickr/qml/flickr/mobile/images/lineedit.png new file mode 100644 index 00000000..2cc38dc3 Binary files /dev/null and b/examples/declarative/flickr/qml/flickr/mobile/images/lineedit.png differ diff --git a/examples/declarative/flickr/qml/flickr/mobile/images/lineedit.sci b/examples/declarative/flickr/qml/flickr/mobile/images/lineedit.sci new file mode 100644 index 00000000..054bff78 --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/mobile/images/lineedit.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 10 +border.bottom: 10 +border.right: 10 +source: lineedit.png diff --git a/examples/declarative/flickr/qml/flickr/mobile/images/quit.png b/examples/declarative/flickr/qml/flickr/mobile/images/quit.png new file mode 100644 index 00000000..5bda1b6e Binary files /dev/null and b/examples/declarative/flickr/qml/flickr/mobile/images/quit.png differ diff --git a/examples/declarative/flickr/qml/flickr/mobile/images/stripes.png b/examples/declarative/flickr/qml/flickr/mobile/images/stripes.png new file mode 100644 index 00000000..9f36727e Binary files /dev/null and b/examples/declarative/flickr/qml/flickr/mobile/images/stripes.png differ diff --git a/examples/declarative/flickr/qml/flickr/mobile/images/titlebar.png b/examples/declarative/flickr/qml/flickr/mobile/images/titlebar.png new file mode 100644 index 00000000..51c90082 Binary files /dev/null and b/examples/declarative/flickr/qml/flickr/mobile/images/titlebar.png differ diff --git a/examples/declarative/flickr/qml/flickr/mobile/images/titlebar.sci b/examples/declarative/flickr/qml/flickr/mobile/images/titlebar.sci new file mode 100644 index 00000000..0418d94c --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/mobile/images/titlebar.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 12 +border.bottom: 12 +border.right: 10 +source: titlebar.png diff --git a/examples/declarative/flickr/qml/flickr/mobile/images/toolbutton.png b/examples/declarative/flickr/qml/flickr/mobile/images/toolbutton.png new file mode 100644 index 00000000..11310013 Binary files /dev/null and b/examples/declarative/flickr/qml/flickr/mobile/images/toolbutton.png differ diff --git a/examples/declarative/flickr/qml/flickr/mobile/images/toolbutton.sci b/examples/declarative/flickr/qml/flickr/mobile/images/toolbutton.sci new file mode 100644 index 00000000..9e4f9653 --- /dev/null +++ b/examples/declarative/flickr/qml/flickr/mobile/images/toolbutton.sci @@ -0,0 +1,5 @@ +border.left: 15 +border.top: 4 +border.bottom: 4 +border.right: 15 +source: toolbutton.png diff --git a/examples/declarative/helper/deployment.pri b/examples/declarative/helper/deployment.pri new file mode 100644 index 00000000..8dba8025 --- /dev/null +++ b/examples/declarative/helper/deployment.pri @@ -0,0 +1,133 @@ +# The code below handles deployment to Android and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + greaterThan(QT_MAJOR_VERSION, 4) { + itemsources = $${item}.files + } else { + itemsources = $${item}.sources + } + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$_PRO_FILE_PWD_ + +android { + installPrefix = /assets + x86 { + target.path = /libs/x86 + } else: armeabi-v7a { + target.path = /libs/armeabi-v7a + } else { + target.path = /libs/armeabi + } +} else:maemo5 { + installPrefix = /opt/$${TARGET} + target.path = $${installPrefix}/bin + desktopfile.files = $${TARGET}.desktop + desktopfile.path = /usr/share/applications/hildon + icon.files = $${TARGET}64.png + icon.path = /usr/share/icons/hicolor/64x64/apps +} else:!isEmpty(MEEGO_VERSION_MAJOR) { + installPrefix = /opt/$${TARGET} + target.path = $${installPrefix}/bin + desktopfile.files = $${TARGET}_harmattan.desktop + desktopfile.path = /usr/share/applications + icon.files = $${TARGET}80.png + icon.path = /usr/share/icons/hicolor/80x80/apps +} else { # Assumed to be a Desktop Unix, Windows, or Mac + installPrefix = $$desktopInstallPrefix + target.path = $${installPrefix} + sources.files = *.cpp *.h *.desktop *.png *.pro *.qml *.qmlproject *.svg *.qrc + sources.path = $$desktopInstallPrefix + export(sources.files) + export(sources.path) + INSTALLS += sources + copyCommand = + win32 { + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, /, \\) + sourcePathSegments = $$split(source, \\) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments) + target = $$replace(target, /, \\) + target ~= s,\\\\\\.?\\\\,\\, + !isEqual(source,$$target) { + !isEmpty(copyCommand):copyCommand += && + isEqual(QMAKE_DIR_SEP, \\) { + copyCommand += $(COPY_DIR) \"$$source\" \"$$target\" + } else { + source = $$replace(source, \\\\, /) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + target = $$replace(target, \\\\, /) + copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\" + } + } + } + } else { + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, \\\\, /) + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + target = $$replace(target, \\\\, /) + sourcePathSegments = $$split(source, /) + targetFullPath = $$target/$$last(sourcePathSegments) + targetFullPath ~= s,/\\.?/,/, + !isEqual(source,$$targetFullPath) { + !isEmpty(copyCommand):copyCommand += && + copyCommand += $(MKDIR) \"$$target\" + copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\" + } + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} + +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item +} + +!isEmpty(desktopfile.path) { + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + INSTALLS += icon desktopfile +} + +export(target.path) +INSTALLS += target + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/helper/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/helper/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 00000000..05d481be --- /dev/null +++ b/examples/declarative/helper/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlapplicationviewer.h" + +#include +#include +#include +#include +#include +#include + +#include // MEEGO_EDITION_HARMATTAN + +#ifdef HARMATTAN_BOOSTER +#include +#endif + +#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 + +#include + +#if !defined(NO_JSDEBUGGER) +#include +#endif +#if !defined(NO_QMLOBSERVER) +#include +#endif + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QString::fromLatin1("%1/../Resources/%2") + .arg(QCoreApplication::applicationDirPath(), path); +#elif defined(Q_OS_QNX) + if (!QDir::isAbsolutePath(path)) + return QString::fromLatin1("app/native/%1").arg(path); +#elif !defined(Q_OS_ANDROID) + QString pathInInstallDir = + QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); + if (QFileInfo(pathInInstallDir).exists()) + return pathInInstallDir; + pathInInstallDir = + QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); + if (QFileInfo(pathInInstallDir).exists()) + return pathInInstallDir; +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) + : QDeclarativeView(parent) + , d(new QmlApplicationViewerPrivate()) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); + + // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in +#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 +#if !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, this); +#endif +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete d; +} + +QmlApplicationViewer *QmlApplicationViewer::create() +{ + return new QmlApplicationViewer(); +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); +#ifdef Q_OS_ANDROID + setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); +#else + setSource(QUrl::fromLocalFile(d->mainQmlFile)); +#endif +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ + // TODO: Needs a Qt5 implementation + Q_UNUSED(orientation) +} + +void QmlApplicationViewer::showExpanded() +{ +#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) + showMaximized(); +#else + show(); +#endif +} + +QApplication *createApplication(int &argc, char **argv) +{ +#ifdef HARMATTAN_BOOSTER + return MDeclarativeCache::qApplication(argc, argv); +#else + return new QApplication(argc, argv); +#endif +} diff --git a/examples/declarative/helper/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/helper/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 00000000..be12f6a8 --- /dev/null +++ b/examples/declarative/helper/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + static QmlApplicationViewer *create(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + + // Note that this will only have an effect on Fremantle. + void setOrientation(ScreenOrientation orientation); + + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *d; +}; + +QApplication *createApplication(int &argc, char **argv); + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/helper/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/helper/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 00000000..3218a12d --- /dev/null +++ b/examples/declarative/helper/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,24 @@ +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +# Include JS debugger library if QMLJSDEBUGGER_PATH is set +!isEmpty(QMLJSDEBUGGER_PATH) { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) +} else { + DEFINES -= QMLJSDEBUGGER +} + +contains(CONFIG,qdeclarative-boostable):contains(MEEGO_EDITION,harmattan) { + DEFINES += HARMATTAN_BOOSTER +} + +include(../deployment.pri) diff --git a/examples/declarative/i18n/i18n.pro b/examples/declarative/i18n/i18n.pro index abae210e..bfb628a8 100644 --- a/examples/declarative/i18n/i18n.pro +++ b/examples/declarative/i18n/i18n.pro @@ -23,8 +23,8 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/i18n +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/i18n exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) else:exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/imageelements/borderimage/borderimage.pro b/examples/declarative/imageelements/borderimage/borderimage.pro index 5cfc2e5b..72ca4bb5 100644 --- a/examples/declarative/imageelements/borderimage/borderimage.pro +++ b/examples/declarative/imageelements/borderimage/borderimage.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/imageelements/borderimage +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/imageelements/borderimage exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/imageelements/image/image.pro b/examples/declarative/imageelements/image/image.pro index d19b6fde..0eba8390 100644 --- a/examples/declarative/imageelements/image/image.pro +++ b/examples/declarative/imageelements/image/image.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/imageelements/image +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/imageelements/image exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/imageelements/imageelements.pro b/examples/declarative/imageelements/imageelements.pro index 7c1d576a..8aa99203 100644 --- a/examples/declarative/imageelements/imageelements.pro +++ b/examples/declarative/imageelements/imageelements.pro @@ -4,8 +4,3 @@ SUBDIRS += \ borderimage \ image \ shadows - -# install -sources.files = imageelements.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/imageelements -INSTALLS += sources diff --git a/examples/declarative/imageelements/shadows/shadows.pro b/examples/declarative/imageelements/shadows/shadows.pro index 035a06a6..4f5d91fa 100644 --- a/examples/declarative/imageelements/shadows/shadows.pro +++ b/examples/declarative/imageelements/shadows/shadows.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/imageelements/shadows +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/imageelements/shadows exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/keyinteraction/focus/focus.pro b/examples/declarative/keyinteraction/focus/focus.pro index 584a80bf..e18ffa8e 100644 --- a/examples/declarative/keyinteraction/focus/focus.pro +++ b/examples/declarative/keyinteraction/focus/focus.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/keyinteraction/focus +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/keyinteraction/focus exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/minehunt/README b/examples/declarative/minehunt/README new file mode 100644 index 00000000..3849ca5f --- /dev/null +++ b/examples/declarative/minehunt/README @@ -0,0 +1,6 @@ +Minehunt has to be compiled to run. + +To compile the C++ part, do 'qmake && make'. +To run, simply run the executable. +To deploy on a device, do 'make sis'. + diff --git a/examples/declarative/minehunt/main.cpp b/examples/declarative/minehunt/main.cpp new file mode 100644 index 00000000..cfe36f0b --- /dev/null +++ b/examples/declarative/minehunt/main.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlapplicationviewer.h" +#include "minehunt.h" +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + QmlApplicationViewer viewer; + + qmlRegisterType(); + MinehuntGame* game = new MinehuntGame(); + + viewer.engine()->rootContext()->setContextObject(game); + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/minehunt/minehunt.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/minehunt/minehunt.cpp b/examples/declarative/minehunt/minehunt.cpp new file mode 100644 index 00000000..3527cc17 --- /dev/null +++ b/examples/declarative/minehunt/minehunt.cpp @@ -0,0 +1,221 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +#include "minehunt.h" + +void tilesPropAppend(QDeclarativeListProperty* prop, TileData* value) +{ + Q_UNUSED(prop); + Q_UNUSED(value); + return; //Append not supported +} + +int tilesPropCount(QDeclarativeListProperty* prop) +{ + return static_cast*>(prop->data)->count(); +} + +TileData* tilesPropAt(QDeclarativeListProperty* prop, int index) +{ + return static_cast*>(prop->data)->at(index); +} + +QDeclarativeListProperty MinehuntGame::tiles(){ + return QDeclarativeListProperty(this, &_tiles, &tilesPropAppend, + &tilesPropCount, &tilesPropAt, 0); +} + +MinehuntGame::MinehuntGame() +: numCols(9), numRows(9), playing(true), won(false) +{ + setObjectName("mainObject"); + srand(QTime(0,0,0).secsTo(QTime::currentTime())); + + //initialize array + for(int ii = 0; ii < numRows * numCols; ++ii) { + _tiles << new TileData; + } + reset(); + +} + +void MinehuntGame::setBoard() +{ + foreach(TileData* t, _tiles){ + t->setHasMine(false); + t->setHint(-1); + } + //place mines + int mines = nMines; + remaining = numRows*numCols-mines; + while ( mines ) { + int col = int((double(rand()) / double(RAND_MAX)) * numCols); + int row = int((double(rand()) / double(RAND_MAX)) * numRows); + + TileData* t = tile( row, col ); + + if (t && !t->hasMine()) { + t->setHasMine( true ); + mines--; + } + } + + //set hints + for (int r = 0; r < numRows; r++) + for (int c = 0; c < numCols; c++) { + TileData* t = tile(r, c); + if (t && !t->hasMine()) { + int hint = getHint(r,c); + t->setHint(hint); + } + } + + setPlaying(true); +} + +void MinehuntGame::reset() +{ + foreach(TileData* t, _tiles){ + t->unflip(); + t->setHasFlag(false); + } + nMines = 12; + nFlags = 0; + emit numMinesChanged(); + emit numFlagsChanged(); + setPlaying(false); + QTimer::singleShot(600,this, SLOT(setBoard())); +} + +int MinehuntGame::getHint(int row, int col) +{ + int hint = 0; + for (int c = col-1; c <= col+1; c++) + for (int r = row-1; r <= row+1; r++) { + TileData* t = tile(r, c); + if (t && t->hasMine()) + hint++; + } + return hint; +} + +bool MinehuntGame::flip(int row, int col) +{ + if(!playing) + return false; + + TileData *t = tile(row, col); + if (!t || t->hasFlag()) + return false; + + if(t->flipped()){ + int flags = 0; + for (int c = col-1; c <= col+1; c++) + for (int r = row-1; r <= row+1; r++) { + TileData *nearT = tile(r, c); + if(!nearT || nearT == t) + continue; + if(nearT->hasFlag()) + flags++; + } + if(!t->hint() || t->hint() != flags) + return false; + for (int c = col-1; c <= col+1; c++) + for (int r = row-1; r <= row+1; r++) { + TileData *nearT = tile(r, c); + if (nearT && !nearT->flipped() && !nearT->hasFlag()) { + flip( r, c ); + } + } + return true; + } + + t->flip(); + + if (t->hint() == 0) { + for (int c = col-1; c <= col+1; c++) + for (int r = row-1; r <= row+1; r++) { + TileData* t = tile(r, c); + if (t && !t->flipped()) { + flip( r, c ); + } + } + } + + if(t->hasMine()){ + for (int r = 0; r < numRows; r++)//Flip all other mines + for (int c = 0; c < numCols; c++) { + TileData* t = tile(r, c); + if (t && t->hasMine()) { + flip(r, c); + } + } + won = false; + hasWonChanged(); + setPlaying(false); + return true; + } + + remaining--; + if(!remaining){ + won = true; + hasWonChanged(); + setPlaying(false); + return true; + } + return true; +} + +bool MinehuntGame::flag(int row, int col) +{ + TileData *t = tile(row, col); + if(!t || !playing || t->flipped()) + return false; + + t->setHasFlag(!t->hasFlag()); + nFlags += (t->hasFlag()?1:-1); + emit numFlagsChanged(); + return true; +} diff --git a/examples/declarative/minehunt/minehunt.h b/examples/declarative/minehunt/minehunt.h new file mode 100644 index 00000000..f949ffd7 --- /dev/null +++ b/examples/declarative/minehunt/minehunt.h @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include + +class TileData : public QObject +{ + Q_OBJECT +public: + TileData() : _hasFlag(false), _hasMine(false), _hint(-1), _flipped(false) {} + + Q_PROPERTY(bool hasFlag READ hasFlag WRITE setHasFlag NOTIFY hasFlagChanged) + bool hasFlag() const { return _hasFlag; } + + Q_PROPERTY(bool hasMine READ hasMine NOTIFY hasMineChanged) + bool hasMine() const { return _hasMine; } + + Q_PROPERTY(int hint READ hint NOTIFY hintChanged) + int hint() const { return _hint; } + + Q_PROPERTY(bool flipped READ flipped NOTIFY flippedChanged()) + bool flipped() const { return _flipped; } + + void setHasFlag(bool flag) {if(flag==_hasFlag) return; _hasFlag = flag; emit hasFlagChanged();} + void setHasMine(bool mine) {if(mine==_hasMine) return; _hasMine = mine; emit hasMineChanged();} + void setHint(int hint) { if(hint == _hint) return; _hint = hint; emit hintChanged(); } + void flip() { if (_flipped) return; _flipped = true; emit flippedChanged(); } + void unflip() { if(!_flipped) return; _flipped = false; emit flippedChanged(); } + +signals: + void flippedChanged(); + void hasFlagChanged(); + void hintChanged(); + void hasMineChanged(); + +private: + bool _hasFlag; + bool _hasMine; + int _hint; + bool _flipped; +}; + +class MinehuntGame : public QObject +{ + Q_OBJECT +public: + MinehuntGame(); + + Q_PROPERTY(QDeclarativeListProperty tiles READ tiles CONSTANT) + QDeclarativeListProperty tiles(); + + Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged) + bool isPlaying() {return playing;} + + Q_PROPERTY(bool hasWon READ hasWon NOTIFY hasWonChanged) + bool hasWon() {return won;} + + Q_PROPERTY(int numMines READ numMines NOTIFY numMinesChanged) + int numMines() const{return nMines;} + + Q_PROPERTY(int numFlags READ numFlags NOTIFY numFlagsChanged) + int numFlags() const{return nFlags;} + +public slots: + Q_INVOKABLE bool flip(int row, int col); + Q_INVOKABLE bool flag(int row, int col); + void setBoard(); + void reset(); + +signals: + void isPlayingChanged(); + void hasWonChanged(); + void numMinesChanged(); + void numFlagsChanged(); + +private: + bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; } + TileData *tile( int row, int col ) { return onBoard(row, col) ? _tiles[col+numRows*row] : 0; } + int getHint(int row, int col); + void setPlaying(bool b){if(b==playing) return; playing=b; emit isPlayingChanged();} + + QList _tiles; + int numCols; + int numRows; + bool playing; + bool won; + int remaining; + int nMines; + int nFlags; +}; diff --git a/examples/declarative/minehunt/minehunt.pro b/examples/declarative/minehunt/minehunt.pro new file mode 100644 index 00000000..6a630a1f --- /dev/null +++ b/examples/declarative/minehunt/minehunt.pro @@ -0,0 +1,25 @@ +# Add more folders to ship with the application, here +folder_01.source = qml/minehunt +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# If your application uses the Qt Mobility libraries, uncomment the following +# lines and add the respective components to the MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# Speed up launching on MeeGo/Harmattan when using applauncherd daemon +# CONFIG += qdeclarative-boostable + +HEADERS += minehunt.h +SOURCES += main.cpp minehunt.cpp +RESOURCES = minehunt.qrc + +# Please do not modify the following two lines. Required for deployment. +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/minehunt +exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/minehunt/minehunt.qmlproject b/examples/declarative/minehunt/minehunt.qmlproject new file mode 100644 index 00000000..1f8b659f --- /dev/null +++ b/examples/declarative/minehunt/minehunt.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "qml/minehunt" + } + JavaScriptFiles { + directory: "qml/minehunt" + } + ImageFiles { + directory: "qml/minehunt" + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/minehunt/minehunt.qrc b/examples/declarative/minehunt/minehunt.qrc new file mode 100644 index 00000000..4694beb1 --- /dev/null +++ b/examples/declarative/minehunt/minehunt.qrc @@ -0,0 +1,19 @@ + + + qml/minehunt/minehunt.qml + qml/minehunt/MinehuntCore/Explosion.qml + qml/minehunt/MinehuntCore/Tile.qml + qml/minehunt/MinehuntCore/pics/background.png + qml/minehunt/MinehuntCore/pics/back.png + qml/minehunt/MinehuntCore/pics/bomb-color.png + qml/minehunt/MinehuntCore/pics/bomb.png + qml/minehunt/MinehuntCore/pics/face-sad.png + qml/minehunt/MinehuntCore/pics/face-smile-big.png + qml/minehunt/MinehuntCore/pics/face-smile.png + qml/minehunt/MinehuntCore/pics/flag-color.png + qml/minehunt/MinehuntCore/pics/flag.png + qml/minehunt/MinehuntCore/pics/front.png + qml/minehunt/MinehuntCore/pics/quit.png + qml/minehunt/MinehuntCore/pics/star.png + + diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/Explosion.qml b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/Explosion.qml new file mode 100644 index 00000000..f096c26c --- /dev/null +++ b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/Explosion.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import Qt.labs.particles 1.0 + +Item { + property bool explode : false + + Particles { + id: particles + width: 40 + height: 40 + lifeSpan: 1000 + lifeSpanDeviation: 0 + source: "pics/star.png" + count: 0 + angle: 270 + angleDeviation: 360 + velocity: 100 + velocityDeviation: 20 + z: 100 + } + states: State { name: "exploding"; when: explode + StateChangeScript {script: particles.burst(200); } + } +} diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/Tile.qml b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/Tile.qml new file mode 100644 index 00000000..15b8f871 --- /dev/null +++ b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/Tile.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Flipable { + id: flipable + property int angle: 0 + + width: 40; height: 40 + transform: Rotation { origin.x: 20; origin.y: 20; axis.x: 1; axis.z: 0; angle: flipable.angle } + + front: Image { + source: "pics/front.png"; width: 40; height: 40 + + Image { + anchors.centerIn: parent + source: "pics/flag.png"; opacity: modelData.hasFlag + + Behavior on opacity { NumberAnimation {} } + } + } + + back: Image { + source: "pics/back.png" + width: 40; height: 40 + + Text { + anchors.centerIn: parent + text: modelData.hint; color: "white"; font.bold: true + opacity: !modelData.hasMine && modelData.hint > 0 + } + + Image { + anchors.centerIn: parent + source: "pics/bomb.png"; opacity: modelData.hasMine + } + + Explosion { id: expl } + } + + states: State { + name: "back"; when: modelData.flipped + PropertyChanges { target: flipable; angle: 180 } + } + + property real pauseDur: 250 + transitions: Transition { + SequentialAnimation { + ScriptAction { + script: { + var ret = Math.abs(flipable.x - field.clickx) + + Math.abs(flipable.y - field.clicky); + if (modelData.hasMine && modelData.flipped) + pauseDur = ret * 3 + else + pauseDur = ret + } + } + PauseAnimation { + duration: pauseDur + } + RotationAnimation { easing.type: Easing.InOutQuad } + ScriptAction { script: if (modelData.hasMine && modelData.flipped) { expl.explode = true } } + } + } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + field.clickx = flipable.x + field.clicky = flipable.y + var row = Math.floor(index / 9) + var col = index - (Math.floor(index / 9) * 9) + if (mouse.button == undefined || mouse.button == Qt.RightButton) { + flag(row, col) + } else { + flip(row, col) + } + } + onPressAndHold: { + field.clickx = flipable.x + field.clicky = flipable.y + var row = Math.floor(index / 9) + var col = index - (Math.floor(index / 9) * 9) + flag(row, col) + } + } +} diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/back.png b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/back.png new file mode 100644 index 00000000..f6b3f0b4 Binary files /dev/null and b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/back.png differ diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/background.png b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/background.png new file mode 100644 index 00000000..3734a277 Binary files /dev/null and b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/background.png differ diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/bomb-color.png b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/bomb-color.png new file mode 100644 index 00000000..61ad0a92 Binary files /dev/null and b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/bomb-color.png differ diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/bomb.png b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/bomb.png new file mode 100644 index 00000000..a9925755 Binary files /dev/null and b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/bomb.png differ diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/face-sad.png b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/face-sad.png new file mode 100644 index 00000000..cf00aafe Binary files /dev/null and b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/face-sad.png differ diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/face-smile-big.png b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/face-smile-big.png new file mode 100644 index 00000000..f9c2335d Binary files /dev/null and b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/face-smile-big.png differ diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/face-smile.png b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/face-smile.png new file mode 100644 index 00000000..3d66d725 Binary files /dev/null and b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/face-smile.png differ diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/flag-color.png b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/flag-color.png new file mode 100644 index 00000000..aadad0f1 Binary files /dev/null and b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/flag-color.png differ diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/flag.png b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/flag.png new file mode 100644 index 00000000..39cde4df Binary files /dev/null and b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/flag.png differ diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/front.png b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/front.png new file mode 100644 index 00000000..834331bd Binary files /dev/null and b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/front.png differ diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/quit.png b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/quit.png new file mode 100644 index 00000000..b822057d Binary files /dev/null and b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/quit.png differ diff --git a/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/star.png b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/star.png new file mode 100644 index 00000000..37723591 Binary files /dev/null and b/examples/declarative/minehunt/qml/minehunt/MinehuntCore/pics/star.png differ diff --git a/examples/declarative/minehunt/qml/minehunt/minehunt.qml b/examples/declarative/minehunt/qml/minehunt/minehunt.qml new file mode 100644 index 00000000..2c0911a2 --- /dev/null +++ b/examples/declarative/minehunt/qml/minehunt/minehunt.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "MinehuntCore" + +Item { + id: field + property int clickx: 0 + property int clicky: 0 + + width: 450; height: 450 + + Image { source: "MinehuntCore/pics/background.png"; anchors.fill: parent; fillMode: Image.Tile } + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + columns: 9; spacing: 1 + + Repeater { + id: repeater + model: tiles + delegate: Tile {} + } + } + + Row { + id: gamedata + x: 20; spacing: 20 + anchors.bottom: field.bottom; anchors.bottomMargin: 15 + + Image { + source: "MinehuntCore/pics/quit.png" + scale: quitMouse.pressed ? 0.8 : 1.0 + smooth: quitMouse.pressed + y: 10 + MouseArea { + id: quitMouse + anchors.fill: parent + anchors.margins: -20 + onClicked: Qt.quit() + } + } + Column { + spacing: 2 + Image { source: "MinehuntCore/pics/bomb-color.png" } + Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numMines } + } + + Column { + spacing: 2 + Image { source: "MinehuntCore/pics/flag-color.png" } + Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numFlags } + } + } + + Image { + anchors.bottom: field.bottom; anchors.bottomMargin: 15 + anchors.right: field.right; anchors.rightMargin: 20 + source: isPlaying ? 'MinehuntCore/pics/face-smile.png' : + hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png' + + MouseArea { anchors.fill: parent; onPressed: reset() } + } + Text { + anchors.centerIn: parent; width: parent.width - 20 + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + text: "Minehunt demo has to be compiled to run.\n\nPlease see README." + color: "white"; font.bold: true; font.pixelSize: 14 + visible: tiles == undefined + } + +} diff --git a/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro b/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro index 7ba55ba6..8bf11423 100644 --- a/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro +++ b/examples/declarative/modelviews/abstractitemmodel/abstractitemmodel.pro @@ -21,7 +21,7 @@ SOURCES = main.cpp model.cpp HEADERS = model.h # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/abstractitemmodel +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/abstractitemmodel exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/modelviews/gridview/gridview.pro b/examples/declarative/modelviews/gridview/gridview.pro index 6d7ffc37..f83458da 100644 --- a/examples/declarative/modelviews/gridview/gridview.pro +++ b/examples/declarative/modelviews/gridview/gridview.pro @@ -23,7 +23,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/gridview +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/gridview exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.pro b/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.pro index c37afe45..243d9ace 100644 --- a/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.pro +++ b/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.pro @@ -23,7 +23,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/listview/dynamiclist +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/listview/dynamiclist exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.pro b/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.pro index 1ddbb46f..e3d3cd01 100644 --- a/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.pro +++ b/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.pro @@ -23,7 +23,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/listview/expandingdelegates +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/listview/expandingdelegates exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/modelviews/listview/highlight/highlight.pro b/examples/declarative/modelviews/listview/highlight/highlight.pro index 062de0a7..2ef2c0fb 100644 --- a/examples/declarative/modelviews/listview/highlight/highlight.pro +++ b/examples/declarative/modelviews/listview/highlight/highlight.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/listview/highlight +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/listview/highlight exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/modelviews/listview/highlightranges/highlightranges.pro b/examples/declarative/modelviews/listview/highlightranges/highlightranges.pro index b27e2c06..1cb417d1 100644 --- a/examples/declarative/modelviews/listview/highlightranges/highlightranges.pro +++ b/examples/declarative/modelviews/listview/highlightranges/highlightranges.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/listview/highlightranges +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/listview/highlightranges exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/modelviews/listview/listview.pro b/examples/declarative/modelviews/listview/listview.pro index fa7def33..877eb7cd 100644 --- a/examples/declarative/modelviews/listview/listview.pro +++ b/examples/declarative/modelviews/listview/listview.pro @@ -6,8 +6,3 @@ SUBDIRS += \ highlight \ highlightranges \ sections - -# install -sources.files = listview.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/listview -INSTALLS += sources diff --git a/examples/declarative/modelviews/listview/sections/sections.pro b/examples/declarative/modelviews/listview/sections/sections.pro index edad3e58..5f08fb97 100644 --- a/examples/declarative/modelviews/listview/sections/sections.pro +++ b/examples/declarative/modelviews/listview/sections/sections.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/listview/sections +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/listview/sections exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/modelviews/modelviews.pro b/examples/declarative/modelviews/modelviews.pro index ee05704c..c50dd742 100644 --- a/examples/declarative/modelviews/modelviews.pro +++ b/examples/declarative/modelviews/modelviews.pro @@ -10,8 +10,3 @@ SUBDIRS += \ pathview \ stringlistmodel \ visualitemmodel - -# install -sources.files = modelviews.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews -INSTALLS += sources diff --git a/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro b/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro index d37bd87b..fb401bd0 100644 --- a/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro +++ b/examples/declarative/modelviews/objectlistmodel/objectlistmodel.pro @@ -22,7 +22,7 @@ SOURCES += main.cpp \ HEADERS += dataobject.h # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/objectlistmodel +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/objectlistmodel exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/modelviews/package/package.pro b/examples/declarative/modelviews/package/package.pro index d68cdcc8..fbb0408a 100644 --- a/examples/declarative/modelviews/package/package.pro +++ b/examples/declarative/modelviews/package/package.pro @@ -18,7 +18,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/package +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/package exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/modelviews/parallax/parallax.pro b/examples/declarative/modelviews/parallax/parallax.pro index cf21b699..6b1d258b 100644 --- a/examples/declarative/modelviews/parallax/parallax.pro +++ b/examples/declarative/modelviews/parallax/parallax.pro @@ -18,7 +18,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/parallax +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/parallax exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/modelviews/pathview/pathview.pro b/examples/declarative/modelviews/pathview/pathview.pro index e88bbc67..2e4138e4 100644 --- a/examples/declarative/modelviews/pathview/pathview.pro +++ b/examples/declarative/modelviews/pathview/pathview.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/pathview +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/pathview exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/modelviews/stringlistmodel/stringlistmodel.pro b/examples/declarative/modelviews/stringlistmodel/stringlistmodel.pro index 8d326922..da3b9608 100644 --- a/examples/declarative/modelviews/stringlistmodel/stringlistmodel.pro +++ b/examples/declarative/modelviews/stringlistmodel/stringlistmodel.pro @@ -20,7 +20,7 @@ QT += widgets SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/stringlistmodel +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/stringlistmodel exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/modelviews/visualitemmodel/visualitemmodel.pro b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.pro index 7309eea1..07a33b3d 100644 --- a/examples/declarative/modelviews/visualitemmodel/visualitemmodel.pro +++ b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.pro @@ -23,7 +23,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/modelviews/visualitemmodel +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/modelviews/visualitemmodel exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/photoviewer/main.cpp b/examples/declarative/photoviewer/main.cpp new file mode 100644 index 00000000..ba976b2d --- /dev/null +++ b/examples/declarative/photoviewer/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlapplicationviewer.h" +#include + +Q_DECL_EXPORT int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/photoviewer/photoviewer.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/photoviewer/photoviewer.desktop b/examples/declarative/photoviewer/photoviewer.desktop new file mode 100644 index 00000000..4246b9f3 --- /dev/null +++ b/examples/declarative/photoviewer/photoviewer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=photoviewer +Exec=/opt/photoviewer/bin/photoviewer +Icon=photoviewer64 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/photoviewer/photoviewer.pro b/examples/declarative/photoviewer/photoviewer.pro new file mode 100644 index 00000000..5e7849f9 --- /dev/null +++ b/examples/declarative/photoviewer/photoviewer.pro @@ -0,0 +1,24 @@ +# Add more folders to ship with the application, here +folder_01.source = qml/photoviewer +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# If your application uses the Qt Mobility libraries, uncomment the following +# lines and add the respective components to the MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# Speed up launching on MeeGo/Harmattan when using applauncherd daemon +# CONFIG += qdeclarative-boostable + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/photoviewer +exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/photoviewer/photoviewer.qmlproject b/examples/declarative/photoviewer/photoviewer.qmlproject new file mode 100644 index 00000000..025a3a8f --- /dev/null +++ b/examples/declarative/photoviewer/photoviewer.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "qml/photoviewer" + } + JavaScriptFiles { + directory: "qml/photoviewer" + } + ImageFiles { + directory: "qml/photoviewer" + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/photoviewer/photoviewer.svg b/examples/declarative/photoviewer/photoviewer.svg new file mode 100644 index 00000000..566acfad --- /dev/null +++ b/examples/declarative/photoviewer/photoviewer.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/examples/declarative/photoviewer/photoviewer64.png b/examples/declarative/photoviewer/photoviewer64.png new file mode 100644 index 00000000..707d5c4e Binary files /dev/null and b/examples/declarative/photoviewer/photoviewer64.png differ diff --git a/examples/declarative/photoviewer/photoviewer80.png b/examples/declarative/photoviewer/photoviewer80.png new file mode 100644 index 00000000..6ad8096c Binary files /dev/null and b/examples/declarative/photoviewer/photoviewer80.png differ diff --git a/examples/declarative/photoviewer/photoviewer_harmattan.desktop b/examples/declarative/photoviewer/photoviewer_harmattan.desktop new file mode 100644 index 00000000..2dced148 --- /dev/null +++ b/examples/declarative/photoviewer/photoviewer_harmattan.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=photoviewer +Exec=/usr/bin/single-instance /opt/photoviewer/bin/photoviewer +Icon=/usr/share/icons/hicolor/80x80/apps/photoviewer80.png +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/AlbumDelegate.qml new file mode 100644 index 00000000..1b6e522b --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/AlbumDelegate.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Component { + id: albumDelegate + Package { + + Item { + Package.name: 'browser' + GridView { + id: photosGridView; model: visualModel.parts.grid; width: mainWindow.width; height: mainWindow.height - 21 + x: 0; y: 21; cellWidth: 160; cellHeight: 153; interactive: false + onCurrentIndexChanged: photosListView.positionViewAtIndex(currentIndex, ListView.Contain) + } + } + + Item { + Package.name: 'fullscreen' + ListView { + id: photosListView; model: visualModel.parts.list; orientation: Qt.Horizontal + width: mainWindow.width; height: mainWindow.height; interactive: false + onCurrentIndexChanged: photosGridView.positionViewAtIndex(currentIndex, GridView.Contain) + highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem + } + } + + Item { + Package.name: 'album' + id: albumWrapper; width: 210; height: 220 + + VisualDataModel { + id: visualModel; delegate: PhotoDelegate { } + model: RssModel { id: rssModel; tags: tag } + } + + BusyIndicator { + id: busyIndicator + anchors { centerIn: parent; verticalCenterOffset: -20 } + on: rssModel.status != XmlListModel.Ready + } + + PathView { + id: photosPathView; model: visualModel.parts.stack; pathItemCount: 5 + visible: !busyIndicator.visible + anchors.centerIn: parent; anchors.verticalCenterOffset: -30 + path: Path { + PathAttribute { name: 'z'; value: 9999.0 } + PathLine { x: 1; y: 1 } + PathAttribute { name: 'z'; value: 0.0 } + } + } + + MouseArea { + anchors.fill: parent + onClicked: mainWindow.editMode ? photosModel.remove(index) : albumWrapper.state = 'inGrid' + } + + Tag { + anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 10 } + frontLabel: tag; backLabel: qsTr("Remove"); flipped: mainWindow.editMode + onTagChanged: rssModel.tags = tag + onBackClicked: if (mainWindow.editMode) photosModel.remove(index); + } + + states: [ + State { + name: 'inGrid' + PropertyChanges { target: photosGridView; interactive: true } + PropertyChanges { target: albumsShade; opacity: 1 } + PropertyChanges { target: backButton; onClicked: albumWrapper.state = ''; y: 6 } + }, + State { + name: 'fullscreen'; extend: 'inGrid' + PropertyChanges { target: photosGridView; interactive: false } + PropertyChanges { target: photosListView; interactive: true } + PropertyChanges { target: photosShade; opacity: 1 } + PropertyChanges { target: backButton; y: -backButton.height - 8 } + } + ] + + GridView.onAdd: NumberAnimation { + target: albumWrapper; properties: "scale"; from: 0.0; to: 1.0; easing.type: Easing.OutQuad + } + GridView.onRemove: SequentialAnimation { + PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: true } + NumberAnimation { target: albumWrapper; property: "scale"; from: 1.0; to: 0.0; easing.type: Easing.OutQuad } + PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: false } + } + + transitions: [ + Transition { + from: '*'; to: 'inGrid' + SequentialAnimation { + NumberAnimation { properties: 'opacity'; duration: 250 } + PauseAnimation { duration: 350 } + NumberAnimation { target: backButton; properties: "y"; duration: 200; easing.type: Easing.OutQuad } + } + }, + Transition { + from: 'inGrid'; to: '*' + NumberAnimation { properties: "y,opacity"; easing.type: Easing.OutQuad; duration: 300 } + } + ] + } + } +} diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/BusyIndicator.qml b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/BusyIndicator.qml new file mode 100644 index 00000000..3cfeaf83 --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/BusyIndicator.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: container + property bool on: false + + source: "images/busy.png"; visible: container.on + NumberAnimation on rotation { running: container.on; from: 0; to: 360; loops: Animation.Infinite; duration: 1200 } +} diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/Button.qml b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/Button.qml new file mode 100644 index 00000000..29635d5a --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/Button.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property alias label: labelText.text + property color tint: "transparent" + signal clicked + + width: labelText.width + 70 ; height: labelText.height + 18 + + BorderImage { + anchors { fill: container; leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } + source: 'images/box-shadow.png'; smooth: true + border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 + } + + Image { anchors.fill: parent; source: "images/cardboard.png"; smooth: true } + + Rectangle { + anchors.fill: container; color: container.tint; visible: container.tint != "" + opacity: 0.25; smooth: true + } + + Text { id: labelText; font.pixelSize: 15; anchors.centerIn: parent; smooth: true } + + MouseArea { + anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } + onClicked: container.clicked() + } +} diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/EditableButton.qml b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/EditableButton.qml new file mode 100644 index 00000000..de98a515 --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/EditableButton.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property string label + signal clicked + signal labelChanged(string label) + + width: textInput.width + 70 ; height: textInput.height + 18 + + BorderImage { + anchors { fill: container; leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } + source: 'images/box-shadow.png'; smooth: true + border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 + } + + Image { anchors.fill: parent; source: "images/cardboard.png"; smooth: true } + + TextInput { + id: textInput; text: label; font.pixelSize: 15; anchors.centerIn: parent; smooth: true + Keys.onReturnPressed: { + container.labelChanged(textInput.text) + container.focus = true + } + Keys.onEnterPressed: { + container.labelChanged(textInput.text) + container.focus = true + } + Keys.onEscapePressed: { + textInput.text = container.label + container.focus = true + } + } + + Rectangle { + anchors.fill: container; border.color: "steelblue"; border.width: 4 + color: "transparent"; visible: textInput.focus; smooth: true + } + + MouseArea { + anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } + onClicked: { textInput.forceActiveFocus(); textInput.openSoftwareInputPanel(); } + } +} diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/PhotoDelegate.qml new file mode 100644 index 00000000..bf7d92ee --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/PhotoDelegate.qml @@ -0,0 +1,188 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import "script/script.js" as Script + +Package { + Item { id: stackItem; Package.name: 'stack'; width: 160; height: 153; z: stackItem.PathView.z } + Item { id: listItem; Package.name: 'list'; width: mainWindow.width + 40; height: 153 } + Item { id: gridItem; Package.name: 'grid'; width: 160; height: 153 } + + Item { + width: 160; height: 153 + + Item { + id: photoWrapper + + property double randomAngle: Math.random() * (2 * 6 + 1) - 6 + property double randomAngle2: Math.random() * (2 * 6 + 1) - 6 + + x: 0; y: 0; width: 140; height: 133 + z: stackItem.PathView.z; rotation: photoWrapper.randomAngle + + BorderImage { + anchors { + fill: originalImage.status == Image.Ready ? border : placeHolder + leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 + } + source: 'images/box-shadow.png'; smooth: true + border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 + } + Rectangle { + id: placeHolder + + property int w: Script.getWidth(content) + property int h: Script.getHeight(content) + property double s: Script.calculateScale(w, h, photoWrapper.width) + + color: 'white'; anchors.centerIn: parent; smooth: true + width: w * s; height: h * s; visible: originalImage.status != Image.Ready + Rectangle { + color: "#878787"; smooth: true + anchors { fill: parent; topMargin: 3; bottomMargin: 3; leftMargin: 3; rightMargin: 3 } + } + } + Rectangle { + id: border; color: 'white'; anchors.centerIn: parent; smooth: true + width: originalImage.paintedWidth + 6; height: originalImage.paintedHeight + 6 + visible: !placeHolder.visible + } + BusyIndicator { anchors.centerIn: parent; on: originalImage.status != Image.Ready } + Image { + id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content); cache: false + fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height + } + Image { + id: hqImage; smooth: true; source: ""; visible: false; cache: false + fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height + } + Binding { + target: mainWindow; property: "downloadProgress"; value: hqImage.progress + when: listItem.ListView.isCurrentItem + } + Binding { + target: mainWindow; property: "imageLoading" + value: (hqImage.status == Image.Loading) ? 1 : 0; when: listItem.ListView.isCurrentItem + } + MouseArea { + width: originalImage.paintedWidth; height: originalImage.paintedHeight; anchors.centerIn: originalImage + onClicked: { + if (albumWrapper.state == 'inGrid') { + gridItem.GridView.view.currentIndex = index; + albumWrapper.state = 'fullscreen' + } else { + gridItem.GridView.view.currentIndex = index; + albumWrapper.state = 'inGrid' + } + } + } + + states: [ + State { + name: 'stacked'; when: albumWrapper.state == '' + ParentChange { target: photoWrapper; parent: stackItem; x: 10; y: 10 } + PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 } + }, + State { + name: 'inGrid'; when: albumWrapper.state == 'inGrid' + ParentChange { target: photoWrapper; parent: gridItem; x: 10; y: 10; rotation: photoWrapper.randomAngle2 } + }, + State { + name: 'fullscreen'; when: albumWrapper.state == 'fullscreen' + ParentChange { + target: photoWrapper; parent: listItem; x: 0; y: 0; rotation: 0 + width: mainWindow.width; height: mainWindow.height + } + PropertyChanges { target: border; opacity: 0 } + PropertyChanges { target: hqImage; source: listItem.ListView.isCurrentItem ? hq : ""; visible: true } + } + ] + + transitions: [ + Transition { + from: 'stacked'; to: 'inGrid' + SequentialAnimation { + PauseAnimation { duration: 10 * index } + ParentAnimation { + target: photoWrapper; via: foreground + NumberAnimation { + target: photoWrapper; properties: 'x,y,rotation,opacity'; duration: 600; easing.type: 'OutQuart' + } + } + } + }, + Transition { + from: 'inGrid'; to: 'stacked' + ParentAnimation { + target: photoWrapper; via: foreground + NumberAnimation { properties: 'x,y,rotation,opacity'; duration: 600; easing.type: 'OutQuart' } + } + }, + Transition { + from: 'inGrid'; to: 'fullscreen' + SequentialAnimation { + PauseAnimation { duration: gridItem.GridView.isCurrentItem ? 0 : 600 } + ParentAnimation { + target: photoWrapper; via: foreground + NumberAnimation { + targets: [ photoWrapper, border ] + properties: 'x,y,width,height,opacity,rotation' + duration: gridItem.GridView.isCurrentItem ? 600 : 1; easing.type: 'OutQuart' + } + } + } + }, + Transition { + from: 'fullscreen'; to: 'inGrid' + ParentAnimation { + target: photoWrapper; via: foreground + NumberAnimation { + targets: [ photoWrapper, border ] + properties: 'x,y,width,height,rotation,opacity' + duration: gridItem.GridView.isCurrentItem ? 600 : 1; easing.type: 'OutQuart' + } + } + } + ] + } + } +} diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/ProgressBar.qml b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/ProgressBar.qml new file mode 100644 index 00000000..2e3e2fa8 --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/ProgressBar.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property real progress: 0 + + Behavior on opacity { NumberAnimation { duration: 600 } } + + Rectangle { anchors.fill: parent; color: "black"; opacity: 0.5 } + + Rectangle { + id: fill; color: "white"; height: container.height + width: container.width * container.progress + } +} diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/RssModel.qml b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/RssModel.qml new file mode 100644 index 00000000..3bbcb5ab --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/RssModel.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +XmlListModel { + property string tags : "" + + source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+tags+"&" : "") + query: "/feed/entry" + namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';" + + XmlRole { name: "title"; query: "title/string()" } + XmlRole { name: "content"; query: "content/string()" } + XmlRole { name: "hq"; query: "link[@rel='enclosure']/@href/string()" } +} diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/Tag.qml b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/Tag.qml new file mode 100644 index 00000000..8f783d40 --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/Tag.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Flipable { + id: flipable + + property alias frontLabel: frontButton.label + property alias backLabel: backButton.label + + property int angle: 0 + property int randomAngle: Math.random() * (2 * 6 + 1) - 6 + property bool flipped: false + + signal frontClicked + signal backClicked + signal tagChanged(string tag) + + front: EditableButton { + id: frontButton; rotation: flipable.randomAngle + anchors { centerIn: parent; verticalCenterOffset: -20 } + onClicked: flipable.frontClicked() + onLabelChanged: flipable.tagChanged(label) + } + + back: Button { + id: backButton; tint: "red"; rotation: flipable.randomAngle + anchors { centerIn: parent; verticalCenterOffset: -20 } + onClicked: flipable.backClicked() + } + + transform: Rotation { + origin.x: flipable.width / 2; origin.y: flipable.height / 2 + axis.x: 0; axis.y: 1; axis.z: 0 + angle: flipable.angle + } + + states: State { + name: "back"; when: flipable.flipped + PropertyChanges { target: flipable; angle: 180 } + } + + transitions: Transition { + ParallelAnimation { + NumberAnimation { properties: "angle"; duration: 400 } + SequentialAnimation { + NumberAnimation { target: flipable; property: "scale"; to: 0.8; duration: 200 } + NumberAnimation { target: flipable; property: "scale"; to: 1.0; duration: 200 } + } + } + } +} diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/images/box-shadow.png b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/images/box-shadow.png new file mode 100644 index 00000000..431af854 Binary files /dev/null and b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/images/box-shadow.png differ diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/images/busy.png b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/images/busy.png new file mode 100644 index 00000000..664c2b14 Binary files /dev/null and b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/images/busy.png differ diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/images/cardboard.png b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/images/cardboard.png new file mode 100644 index 00000000..1847ab52 Binary files /dev/null and b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/images/cardboard.png differ diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/qmldir b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/qmldir new file mode 100644 index 00000000..d3c247f2 --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/qmldir @@ -0,0 +1,8 @@ +AlbumDelegate AlbumDelegate.qml +PhotoDelegate PhotoDelegate.qml +ProgressBar ProgressBar.qml +RssModel RssModel.qml +BusyIndicator BusyIndicator.qml +EditableButton EditableButton.qml +Button Button.qml +Tag Tag.qml diff --git a/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/script/script.js b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/script/script.js new file mode 100644 index 00000000..e8ef93a8 --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/PhotoViewerCore/script/script.js @@ -0,0 +1,27 @@ +.pragma library + +function getWidth(string) { + return (string.match(/width=\"([0-9]+)\"/))[1] +} + +function getHeight(string) { + return (string.match(/height=\"([0-9]+)\"/))[1] +} + +function getImagePath(string) { + var pattern = /src=\"http:\/\/(\S+)\"/ + return (string.match(pattern))[1] +} + +function calculateScale(width, height, cellSize) { + var widthScale = (cellSize * 1.0) / width + var heightScale = (cellSize * 1.0) / height + var scale = 0 + + if (widthScale <= heightScale) { + scale = widthScale; + } else if (heightScale < widthScale) { + scale = heightScale; + } + return scale; +} diff --git a/examples/declarative/photoviewer/qml/photoviewer/i18n/base.ts b/examples/declarative/photoviewer/qml/photoviewer/i18n/base.ts new file mode 100644 index 00000000..1accfd2f --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/i18n/base.ts @@ -0,0 +1,30 @@ + + + + + AlbumDelegate + + + Remove + + + + + photoviewer + + + Add + + + + + Edit + + + + + Back + + + + diff --git a/examples/declarative/photoviewer/qml/photoviewer/i18n/qml_fr.qm b/examples/declarative/photoviewer/qml/photoviewer/i18n/qml_fr.qm new file mode 100644 index 00000000..c24fcbc4 Binary files /dev/null and b/examples/declarative/photoviewer/qml/photoviewer/i18n/qml_fr.qm differ diff --git a/examples/declarative/photoviewer/qml/photoviewer/i18n/qml_fr.ts b/examples/declarative/photoviewer/qml/photoviewer/i18n/qml_fr.ts new file mode 100644 index 00000000..9f892db6 --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/i18n/qml_fr.ts @@ -0,0 +1,30 @@ + + + + + AlbumDelegate + + + Remove + Supprimer + + + + photoviewer + + + Add + Ajouter + + + + Edit + Éditer + + + + Back + Retour + + + diff --git a/examples/declarative/photoviewer/qml/photoviewer/photoviewer.qml b/examples/declarative/photoviewer/qml/photoviewer/photoviewer.qml new file mode 100644 index 00000000..9c07e3ce --- /dev/null +++ b/examples/declarative/photoviewer/qml/photoviewer/photoviewer.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "PhotoViewerCore" + +Rectangle { + id: mainWindow + + property real downloadProgress: 0 + property bool imageLoading: false + property bool editMode: false + + width: 800; height: 480; color: "#d5d6d8" + + ListModel { + id: photosModel + ListElement { tag: "Flowers" } + ListElement { tag: "Wildlife" } + ListElement { tag: "Prague" } + } + + VisualDataModel { id: albumVisualModel; model: photosModel; delegate: AlbumDelegate {} } + + GridView { + id: albumView; width: parent.width; height: parent.height; cellWidth: 210; cellHeight: 220 + model: albumVisualModel.parts.album; visible: albumsShade.opacity != 1.0 + } + + Column { + spacing: 20; anchors { bottom: parent.bottom; right: parent.right; rightMargin: 20; bottomMargin: 20 } + Button { + id: newButton; label: qsTr("Add"); rotation: 3 + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + mainWindow.editMode = false + photosModel.append( { tag: "" } ) + albumView.positionViewAtIndex(albumView.count - 1, GridView.Contain) + } + } + Button { + id: deleteButton; label: qsTr("Edit"); rotation: -2; + onClicked: mainWindow.editMode = !mainWindow.editMode + anchors.horizontalCenter: parent.horizontalCenter + } + Button { + id: quitButton; label: qsTr("Quit"); rotation: -2; + onClicked: Qt.quit() + anchors.horizontalCenter: parent.horizontalCenter + } + } + + Rectangle { + id: albumsShade; color: mainWindow.color + width: parent.width; height: parent.height; opacity: 0.0 + } + + ListView { anchors.fill: parent; model: albumVisualModel.parts.browser; interactive: false } + + Button { id: backButton; label: qsTr("Back"); rotation: 3; x: parent.width - backButton.width - 6; y: -backButton.height - 8 } + + Rectangle { id: photosShade; color: 'black'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 } + + ListView { anchors.fill: parent; model: albumVisualModel.parts.fullscreen; interactive: false } + + Item { id: foreground; anchors.fill: parent } + + ProgressBar { + progress: mainWindow.downloadProgress; width: parent.width; height: 4 + anchors.bottom: parent.bottom; opacity: mainWindow.imageLoading; visible: opacity != 0.0 + } +} diff --git a/examples/declarative/positioners/positioners.pro b/examples/declarative/positioners/positioners.pro index 1991997a..39732285 100644 --- a/examples/declarative/positioners/positioners.pro +++ b/examples/declarative/positioners/positioners.pro @@ -23,8 +23,8 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/positioners +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/positioners exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) else:exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/righttoleft/layoutdirection/layoutdirection.pro b/examples/declarative/righttoleft/layoutdirection/layoutdirection.pro index 520ad6d8..901a05e7 100644 --- a/examples/declarative/righttoleft/layoutdirection/layoutdirection.pro +++ b/examples/declarative/righttoleft/layoutdirection/layoutdirection.pro @@ -21,7 +21,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/righttoleft/layoutdirection +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/righttoleft/layoutdirection exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.pro b/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.pro index ffcc4d0c..83d1641b 100644 --- a/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.pro +++ b/examples/declarative/righttoleft/layoutmirroring/layoutmirroring.pro @@ -21,7 +21,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/righttoleft/layoutmirroring +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/righttoleft/layoutmirroring exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/righttoleft/righttoleft.pro b/examples/declarative/righttoleft/righttoleft.pro new file mode 100644 index 00000000..fc5b82fd --- /dev/null +++ b/examples/declarative/righttoleft/righttoleft.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs + +SUBDIRS = \ + layoutdirection \ + layoutmirroring \ + textalignment diff --git a/examples/declarative/righttoleft/textalignment/textalignment.pro b/examples/declarative/righttoleft/textalignment/textalignment.pro index afc8df88..a66ca6c5 100644 --- a/examples/declarative/righttoleft/textalignment/textalignment.pro +++ b/examples/declarative/righttoleft/textalignment/textalignment.pro @@ -21,7 +21,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/righttoleft/textalignment +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/righttoleft/textalignment exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/rssnews/main.cpp b/examples/declarative/rssnews/main.cpp new file mode 100644 index 00000000..fb6cd05e --- /dev/null +++ b/examples/declarative/rssnews/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlapplicationviewer.h" +#include + +Q_DECL_EXPORT int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/rssnews/rssnews.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/rssnews/qml/rssnews/content/BusyIndicator.qml b/examples/declarative/rssnews/qml/rssnews/content/BusyIndicator.qml new file mode 100644 index 00000000..e3671cf8 --- /dev/null +++ b/examples/declarative/rssnews/qml/rssnews/content/BusyIndicator.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: container + property bool on: false + + source: "images/busy.png"; visible: container.on + + NumberAnimation on rotation { + running: container.on; from: 0; to: 360; loops: Animation.Infinite; duration: 1200 + } +} diff --git a/examples/declarative/rssnews/qml/rssnews/content/CategoryDelegate.qml b/examples/declarative/rssnews/qml/rssnews/content/CategoryDelegate.qml new file mode 100644 index 00000000..fff34953 --- /dev/null +++ b/examples/declarative/rssnews/qml/rssnews/content/CategoryDelegate.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: delegate + + width: delegate.ListView.view.width; height: 60 + + Text { + text: name + color: delegate.ListView.isCurrentItem ? "white" : "black" + font { family: "Helvetica"; pixelSize: 16; bold: true } + anchors { + left: parent.left; leftMargin: 15 + verticalCenter: parent.verticalCenter + } + } + + BusyIndicator { + scale: 0.6 + on: delegate.ListView.isCurrentItem && window.loading + anchors { right: parent.right; rightMargin: 10; verticalCenter: parent.verticalCenter } + } + + Rectangle { + width: delegate.width; height: 1; color: "#cccccc" + anchors.bottom: delegate.bottom + visible: delegate.ListView.isCurrentItem ? false : true + } + Rectangle { + width: delegate.width; height: 1; color: "white" + visible: delegate.ListView.isCurrentItem ? false : true + } + + MouseArea { + anchors.fill: delegate + onClicked: { + delegate.ListView.view.currentIndex = index + window.currentFeed = feed + } + } +} diff --git a/examples/declarative/rssnews/qml/rssnews/content/NewsDelegate.qml b/examples/declarative/rssnews/qml/rssnews/content/NewsDelegate.qml new file mode 100644 index 00000000..030f1d88 --- /dev/null +++ b/examples/declarative/rssnews/qml/rssnews/content/NewsDelegate.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: delegate + height: column.height + 40 + width: delegate.ListView.view.width + + Column { + id: column + x: 20; y: 20 + width: parent.width - 40 + + Text { + id: titleText + text: title; width: parent.width; wrapMode: Text.WordWrap + font { bold: true; family: "Helvetica"; pointSize: 16 } + } + + Text { + id: descriptionText + width: parent.width; text: description + wrapMode: Text.WordWrap; font.family: "Helvetica" + } + } + + Rectangle { + width: parent.width; height: 1; color: "#cccccc" + anchors.bottom: parent.bottom + } +} diff --git a/examples/declarative/rssnews/qml/rssnews/content/RssFeeds.qml b/examples/declarative/rssnews/qml/rssnews/content/RssFeeds.qml new file mode 100644 index 00000000..7aaa5ea8 --- /dev/null +++ b/examples/declarative/rssnews/qml/rssnews/content/RssFeeds.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + id: rssFeeds + + ListElement { name: "Top Stories"; feed: "rss.news.yahoo.com/rss/topstories" } + ListElement { name: "World"; feed: "rss.news.yahoo.com/rss/world" } + ListElement { name: "Europe"; feed: "rss.news.yahoo.com/rss/europe" } + ListElement { name: "Oceania"; feed: "rss.news.yahoo.com/rss/oceania" } + ListElement { name: "U.S. National"; feed: "rss.news.yahoo.com/rss/us" } + ListElement { name: "Politics"; feed: "rss.news.yahoo.com/rss/politics" } + ListElement { name: "Business"; feed: "rss.news.yahoo.com/rss/business" } + ListElement { name: "Technology"; feed: "rss.news.yahoo.com/rss/tech" } + ListElement { name: "Entertainment"; feed: "rss.news.yahoo.com/rss/entertainment" } + ListElement { name: "Health"; feed: "rss.news.yahoo.com/rss/health" } + ListElement { name: "Science"; feed: "rss.news.yahoo.com/rss/science" } + ListElement { name: "Sports"; feed: "rss.news.yahoo.com/rss/sports" } +} diff --git a/examples/declarative/rssnews/qml/rssnews/content/ScrollBar.qml b/examples/declarative/rssnews/qml/rssnews/content/ScrollBar.qml new file mode 100644 index 00000000..0e2275fb --- /dev/null +++ b/examples/declarative/rssnews/qml/rssnews/content/ScrollBar.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property variant scrollArea + property variant orientation: Qt.Vertical + + opacity: 0 + + function position() + { + var ny = 0; + if (container.orientation == Qt.Vertical) + ny = scrollArea.visibleArea.yPosition * container.height; + else + ny = scrollArea.visibleArea.xPosition * container.width; + if (ny > 2) return ny; else return 2; + } + + function size() + { + var nh, ny; + + if (container.orientation == Qt.Vertical) + nh = scrollArea.visibleArea.heightRatio * container.height; + else + nh = scrollArea.visibleArea.widthRatio * container.width; + + if (container.orientation == Qt.Vertical) + ny = scrollArea.visibleArea.yPosition * container.height; + else + ny = scrollArea.visibleArea.xPosition * container.width; + + if (ny > 3) { + var t; + if (container.orientation == Qt.Vertical) + t = Math.ceil(container.height - 3 - ny); + else + t = Math.ceil(container.width - 3 - ny); + if (nh > t) return t; else return nh; + } else return nh + ny; + } + + Rectangle { anchors.fill: parent; color: "Black"; opacity: 0.3 } + + BorderImage { + source: "images/scrollbar.png" + border { left: 1; right: 1; top: 1; bottom: 1 } + x: container.orientation == Qt.Vertical ? 2 : position() + width: container.orientation == Qt.Vertical ? container.width - 4 : size() + y: container.orientation == Qt.Vertical ? position() : 2 + height: container.orientation == Qt.Vertical ? size() : container.height - 4 + } + + states: State { + name: "visible" + when: container.orientation == Qt.Vertical ? scrollArea.movingVertically : scrollArea.movingHorizontally + PropertyChanges { target: container; opacity: 1.0 } + } + + transitions: Transition { + from: "visible"; to: "" + NumberAnimation { properties: "opacity"; duration: 600 } + } +} diff --git a/examples/declarative/rssnews/qml/rssnews/content/images/busy.png b/examples/declarative/rssnews/qml/rssnews/content/images/busy.png new file mode 100644 index 00000000..664c2b14 Binary files /dev/null and b/examples/declarative/rssnews/qml/rssnews/content/images/busy.png differ diff --git a/examples/declarative/rssnews/qml/rssnews/content/images/scrollbar.png b/examples/declarative/rssnews/qml/rssnews/content/images/scrollbar.png new file mode 100644 index 00000000..0228dcf9 Binary files /dev/null and b/examples/declarative/rssnews/qml/rssnews/content/images/scrollbar.png differ diff --git a/examples/declarative/rssnews/qml/rssnews/rssnews.qml b/examples/declarative/rssnews/qml/rssnews/rssnews.qml new file mode 100644 index 00000000..18ea2ed0 --- /dev/null +++ b/examples/declarative/rssnews/qml/rssnews/rssnews.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: window + width: 800; height: 480 + + property string currentFeed: "rss.news.yahoo.com/rss/topstories" + property bool loading: feedModel.status == XmlListModel.Loading + + RssFeeds { id: rssFeeds } + + XmlListModel { + id: feedModel + source: "http://" + window.currentFeed + query: "/rss/channel/item" + + XmlRole { name: "title"; query: "title/string()" } + XmlRole { name: "link"; query: "link/string()" } + XmlRole { name: "description"; query: "description/string()" } + } + + Row { + Rectangle { + width: 220; height: window.height + color: "#efefef" + + ListView { + focus: true + id: categories + anchors.fill: parent + model: rssFeeds + footer: quitButtonDelegate + delegate: CategoryDelegate {} + highlight: Rectangle { color: "steelblue" } + highlightMoveSpeed: 9999999 + } + ScrollBar { + scrollArea: categories; height: categories.height; width: 8 + anchors.right: categories.right + } + } + ListView { + id: list + width: window.width - 220; height: window.height + model: feedModel + delegate: NewsDelegate {} + } + } + Component { + id: quitButtonDelegate + Item { + width: categories.width; height: 60 + Text { + text: "Quit" + font { family: "Helvetica"; pixelSize: 16; bold: true } + anchors { + left: parent.left; leftMargin: 15 + verticalCenter: parent.verticalCenter + } + } + MouseArea { + anchors.fill: parent + onClicked: Qt.quit() + } + } + } + ScrollBar { scrollArea: list; height: list.height; width: 8; anchors.right: window.right } + Rectangle { x: 220; height: window.height; width: 1; color: "#cccccc" } +} diff --git a/examples/declarative/rssnews/rssnews.desktop b/examples/declarative/rssnews/rssnews.desktop new file mode 100644 index 00000000..7d02ed5f --- /dev/null +++ b/examples/declarative/rssnews/rssnews.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=rssnews +Exec=/opt/rssnews/bin/rssnews +Icon=rssnews64 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/rssnews/rssnews.pro b/examples/declarative/rssnews/rssnews.pro new file mode 100644 index 00000000..57b81fe6 --- /dev/null +++ b/examples/declarative/rssnews/rssnews.pro @@ -0,0 +1,24 @@ +# Add more folders to ship with the application, here +folder_01.source = qml/rssnews +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# If your application uses the Qt Mobility libraries, uncomment the following +# lines and add the respective components to the MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# Speed up launching on MeeGo/Harmattan when using applauncherd daemon +# CONFIG += qdeclarative-boostable + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/rssnews +exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/rssnews/rssnews.qmlproject b/examples/declarative/rssnews/rssnews.qmlproject new file mode 100644 index 00000000..608be8d3 --- /dev/null +++ b/examples/declarative/rssnews/rssnews.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "qml/rssnews" + } + JavaScriptFiles { + directory: "qml/rssnews" + } + ImageFiles { + directory: "qml/rssnews" + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/rssnews/rssnews.svg b/examples/declarative/rssnews/rssnews.svg new file mode 100644 index 00000000..566acfad --- /dev/null +++ b/examples/declarative/rssnews/rssnews.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/examples/declarative/rssnews/rssnews64.png b/examples/declarative/rssnews/rssnews64.png new file mode 100644 index 00000000..707d5c4e Binary files /dev/null and b/examples/declarative/rssnews/rssnews64.png differ diff --git a/examples/declarative/rssnews/rssnews80.png b/examples/declarative/rssnews/rssnews80.png new file mode 100644 index 00000000..6ad8096c Binary files /dev/null and b/examples/declarative/rssnews/rssnews80.png differ diff --git a/examples/declarative/rssnews/rssnews_harmattan.desktop b/examples/declarative/rssnews/rssnews_harmattan.desktop new file mode 100644 index 00000000..df6303ff --- /dev/null +++ b/examples/declarative/rssnews/rssnews_harmattan.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=rssnews +Exec=/usr/bin/single-instance /opt/rssnews/bin/rssnews +Icon=/usr/share/icons/hicolor/80x80/apps/rssnews80.png +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/samegame/main.cpp b/examples/declarative/samegame/main.cpp new file mode 100644 index 00000000..f6e2b732 --- /dev/null +++ b/examples/declarative/samegame/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlapplicationviewer.h" +#include + +Q_DECL_EXPORT int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/samegame/samegame.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/BoomBlock.qml b/examples/declarative/samegame/qml/samegame/SamegameCore/BoomBlock.qml new file mode 100644 index 00000000..52cd54db --- /dev/null +++ b/examples/declarative/samegame/qml/samegame/SamegameCore/BoomBlock.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import Qt.labs.particles 1.0 + +Item { + id: block + property bool dying: false + property bool spawned: false + property int type: 0 + + Behavior on x { + enabled: spawned; + SpringAnimation{ spring: 2; damping: 0.2 } + } + Behavior on y { + SpringAnimation{ spring: 2; damping: 0.2 } + } + + Image { + id: img + source: { + if(type == 0){ + "pics/redStone.png"; + } else if(type == 1) { + "pics/blueStone.png"; + } else { + "pics/greenStone.png"; + } + } + opacity: 0 + Behavior on opacity { NumberAnimation { duration: 200 } } + anchors.fill: parent + } + + Particles { + id: particles + + width: 1; height: 1 + anchors.centerIn: parent + + emissionRate: 0 + lifeSpan: 700; lifeSpanDeviation: 600 + angle: 0; angleDeviation: 360; + velocity: 100; velocityDeviation: 30 + source: { + if(type == 0){ + "pics/redStar.png"; + } else if (type == 1) { + "pics/blueStar.png"; + } else { + "pics/greenStar.png"; + } + } + } + + states: [ + State { + name: "AliveState"; when: spawned == true && dying == false + PropertyChanges { target: img; opacity: 1 } + }, + + State { + name: "DeathState"; when: dying == true + StateChangeScript { script: particles.burst(50); } + PropertyChanges { target: img; opacity: 0 } + StateChangeScript { script: block.destroy(1000); } + } + ] +} diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/Button.qml b/examples/declarative/samegame/qml/samegame/SamegameCore/Button.qml new file mode 100644 index 00000000..91247233 --- /dev/null +++ b/examples/declarative/samegame/qml/samegame/SamegameCore/Button.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 + +Rectangle { + id: container + + property string text: "Button" + + signal clicked + + width: buttonLabel.width + 20; height: buttonLabel.height + 20 + smooth: true + border { width: 1; color: Qt.darker(activePalette.button) } + radius: 8 + color: activePalette.button + + gradient: Gradient { + GradientStop { + position: 0.0 + color: { + if (mouseArea.pressed) + return activePalette.dark + else + return activePalette.light + } + } + GradientStop { position: 1.0; color: activePalette.button } + } + + MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } + + Text { + id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText; font.pixelSize: 24 + } +} diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/Dialog.qml b/examples/declarative/samegame/qml/samegame/SamegameCore/Dialog.qml new file mode 100644 index 00000000..ba3e9c60 --- /dev/null +++ b/examples/declarative/samegame/qml/samegame/SamegameCore/Dialog.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 + +Rectangle { + id: page + + property Item text: dialogText + + signal closed + signal opened + function forceClose() { + if(page.opacity == 0) + return; //already closed + page.closed(); + page.opacity = 0; + } + + function show(txt) { + page.opened(); + dialogText.text = txt; + page.opacity = 1; + } + + width: dialogText.width + 20; height: dialogText.height + 20 + color: "white" + border.width: 1 + opacity: 0 + visible: opacity > 0 + Behavior on opacity { + NumberAnimation { duration: 1000 } + } + + Text { id: dialogText; anchors.centerIn: parent; text: "Hello World!" } + + MouseArea { anchors.fill: parent; onClicked: forceClose(); } +} + diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/pics/background.png b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/background.png new file mode 100644 index 00000000..3734a277 Binary files /dev/null and b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/background.png differ diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/pics/blueStar.png b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/blueStar.png new file mode 100644 index 00000000..ff9588f8 Binary files /dev/null and b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/blueStar.png differ diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/pics/blueStone.png b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/blueStone.png new file mode 100644 index 00000000..20e43c75 Binary files /dev/null and b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/blueStone.png differ diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/pics/greenStar.png b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/greenStar.png new file mode 100644 index 00000000..cd068547 Binary files /dev/null and b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/greenStar.png differ diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/pics/greenStone.png b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/greenStone.png new file mode 100644 index 00000000..b568a190 Binary files /dev/null and b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/greenStone.png differ diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/pics/redStar.png b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/redStar.png new file mode 100644 index 00000000..0a4dffe5 Binary files /dev/null and b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/redStar.png differ diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/pics/redStone.png b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/redStone.png new file mode 100644 index 00000000..36b09a26 Binary files /dev/null and b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/redStone.png differ diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/pics/star.png b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/star.png new file mode 100644 index 00000000..defbde53 Binary files /dev/null and b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/star.png differ diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/pics/yellowStone.png b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/yellowStone.png new file mode 100644 index 00000000..b1ce7621 Binary files /dev/null and b/examples/declarative/samegame/qml/samegame/SamegameCore/pics/yellowStone.png differ diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/qmldir b/examples/declarative/samegame/qml/samegame/SamegameCore/qmldir new file mode 100644 index 00000000..e17b1f5d --- /dev/null +++ b/examples/declarative/samegame/qml/samegame/SamegameCore/qmldir @@ -0,0 +1,3 @@ +BoomBlock BoomBlock.qml +Button Button.qml +Dialog Dialog.qml diff --git a/examples/declarative/samegame/qml/samegame/SamegameCore/samegame.js b/examples/declarative/samegame/qml/samegame/SamegameCore/samegame.js new file mode 100644 index 00000000..d7b827a1 --- /dev/null +++ b/examples/declarative/samegame/qml/samegame/SamegameCore/samegame.js @@ -0,0 +1,288 @@ +/* This script file handles the game logic */ + +var maxColumn = 10; +var maxRow = 15; +var maxIndex = maxColumn*maxRow; +var board = new Array(maxIndex); +var blockSrc = "SamegameCore/BoomBlock.qml"; +var scoresURL = ""; +var gameDuration; +var component = Qt.createComponent(blockSrc); +var highScoreBar = 0; + +// Index function used instead of a 2D array +function index(column, row) +{ + return column + row * maxColumn; +} + +function timeStr(msecs) +{ + var secs = Math.floor(msecs/1000); + var m = Math.floor(secs/60); + var ret = "" + m + "m " + (secs%60) + "s"; + return ret; +} + +function startNewGame() +{ + // Delete blocks from previous game + for (var i = 0; i < maxIndex; i++) { + if (board[i] != null) + board[i].destroy(); + } + + // Calculate board size + maxColumn = Math.floor(gameCanvas.width/gameCanvas.blockSize); + maxRow = Math.floor(gameCanvas.height/gameCanvas.blockSize); + maxIndex = maxRow * maxColumn; + + // Close dialogs + nameInputDialog.forceClose(); + dialog.forceClose(); + + // Initialize Board + board = new Array(maxIndex); + gameCanvas.score = 0; + for (var column = 0; column < maxColumn; column++) { + for (var row = 0; row < maxRow; row++) { + board[index(column, row)] = null; + createBlock(column, row); + } + } + gameDuration = new Date(); +} + +var fillFound; // Set after a floodFill call to the number of blocks found +var floodBoard; // Set to 1 if the floodFill reaches off that node + +// NOTE: Be careful with vars named x,y, as the calling object's x,y are still in scope +function handleClick(x,y) +{ + var column = Math.floor(x/gameCanvas.blockSize); + var row = Math.floor(y/gameCanvas.blockSize); + if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) + return; + if (board[index(column, row)] == null) + return; + // If it's a valid block, remove it and all connected (does nothing if it's not connected) + floodFill(column,row, -1); + if (fillFound <= 0) + return; + gameCanvas.score += (fillFound - 1) * (fillFound - 1); + shuffleDown(); + victoryCheck(); +} + +function floodFill(column,row,type) +{ + if (board[index(column, row)] == null) + return; + var first = false; + if (type == -1) { + first = true; + type = board[index(column,row)].type; + + // Flood fill initialization + fillFound = 0; + floodBoard = new Array(maxIndex); + } + if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) + return; + if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type)) + return; + floodBoard[index(column, row)] = 1; + floodFill(column + 1, row, type); + floodFill(column - 1, row, type); + floodFill(column, row + 1, type); + floodFill(column, row - 1, type); + if (first == true && fillFound == 0) + return; // Can't remove single blocks + board[index(column, row)].dying = true; + board[index(column, row)] = null; + fillFound += 1; +} + +function shuffleDown() +{ + // Fall down + for (var column = 0; column < maxColumn; column++) { + var fallDist = 0; + for (var row = maxRow - 1; row >= 0; row--) { + if (board[index(column,row)] == null) { + fallDist += 1; + } else { + if (fallDist > 0) { + var obj = board[index(column, row)]; + obj.y = (row + fallDist) * gameCanvas.blockSize; + board[index(column, row + fallDist)] = obj; + board[index(column, row)] = null; + } + } + } + } + // Fall to the left + fallDist = 0; + for (column = 0; column < maxColumn; column++) { + if (board[index(column, maxRow - 1)] == null) { + fallDist += 1; + } else { + if (fallDist > 0) { + for (row = 0; row < maxRow; row++) { + obj = board[index(column, row)]; + if (obj == null) + continue; + obj.x = (column - fallDist) * gameCanvas.blockSize; + board[index(column - fallDist,row)] = obj; + board[index(column, row)] = null; + } + } + } + } +} + +function victoryCheck() +{ + // Awards bonuses for no blocks left + var deservesBonus = true; + for (var column = maxColumn - 1; column >= 0; column--) + if (board[index(column, maxRow - 1)] != null) + deservesBonus = false; + if (deservesBonus) + gameCanvas.score += 500; + // Checks for game over + if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1))) { + gameDuration = new Date() - gameDuration; + if(gameCanvas.score > highScoreBar){ + nameInputDialog.show("You won! Please enter your name: "); + nameInputDialog.initialWidth = nameInputDialog.text.width + 20; + if (nameInputDialog.name == "") + nameInputDialog.width = nameInputDialog.initialWidth; + nameInputDialog.text.opacity = 0; // Just a spacer + }else{ + dialog.show("You won!"); + } + } +} + +// Only floods up and right, to see if it can find adjacent same-typed blocks +function floodMoveCheck(column, row, type) +{ + if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) + return false; + if (board[index(column, row)] == null) + return false; + var myType = board[index(column, row)].type; + if (type == myType) + return true; + return floodMoveCheck(column + 1, row, myType) || + floodMoveCheck(column, row - 1, board[index(column, row)].type); +} + +function createBlock(column,row) +{ + // Note that we don't wait for the component to become ready. This will + // only work if the block QML is a local file. Otherwise the component will + // not be ready immediately. There is a statusChanged signal on the + // component you could use if you want to wait to load remote files. + if(component.status == Component.Ready){ + var dynamicObject = component.createObject(gameCanvas, + {"type": Math.floor(Math.random() * 3), + "x": column*gameCanvas.blockSize, + "width": gameCanvas.blockSize, + "height": gameCanvas.blockSize}); + if(dynamicObject == null){ + console.log("error creating block"); + console.log(component.errorString()); + return false; + } + dynamicObject.y = row*gameCanvas.blockSize; + dynamicObject.spawned = true; + + board[index(column,row)] = dynamicObject; + }else{ + console.log("error loading block component"); + console.log(component.errorString()); + return false; + } + return true; +} + +function initHighScoreBar() +{ + if(scoresURL != "") + return true;//don't query remote scores + var db = openDatabaseSync( + "SameGameScores", + "1.0", + "Local SameGame High Scores", + 100 + ); + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); + // Only show results for the current grid size + var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "' + + maxColumn + "x" + maxRow + '" ORDER BY score desc LIMIT 10'); + if(rs.rows.length < 10) + highScoreBar = 0; + else + highScoreBar = rs.rows.item(rs.rows.length - 1).score; + } + ); +} + +function saveHighScore(name) +{ + if (scoresURL != "") + sendHighScore(name); + // Offline storage + var db = 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) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); + tx.executeSql(dataStr, data); + + // Only show results for the current grid size + var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "' + + maxColumn + "x" + maxRow + '" ORDER BY score desc LIMIT 10'); + var r = "\nHIGH SCORES for this grid size\n\n" + for (var i = 0; i < rs.rows.length; i++) { + r += (i+1) + ". " + rs.rows.item(i).name + ' got ' + + rs.rows.item(i).score + ' points in ' + + rs.rows.item(i).time + ' seconds.\n'; + } + if(rs.rows.length == 10) + highScoreBar = rs.rows.item(9).score; + dialog.show(r); + } + ); +} + +function sendHighScore(name) +{ + var postman = new XMLHttpRequest() + var postData = "name=" + name + "&score=" + gameCanvas.score + + "&gridSize=" + maxColumn + "x" + maxRow + + "&time=" + Math.floor(gameDuration / 1000); + postman.open("POST", scoresURL, true); + postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + postman.onreadystatechange = function() { + if (postman.readyState == postman.DONE) { + dialog.show("Your score has been uploaded."); + } + } + postman.send(postData); +} diff --git a/examples/declarative/samegame/qml/samegame/highscores/README b/examples/declarative/samegame/qml/samegame/highscores/README new file mode 100644 index 00000000..eaa00fae --- /dev/null +++ b/examples/declarative/samegame/qml/samegame/highscores/README @@ -0,0 +1 @@ +The SameGame example can interface with a simple PHP script to store XML high score data on a remote server. We do not have a publically accessible server available for this use, but if you have access to a PHP capable webserver you can copy the files (score_data.xml, score.php, score_style.xsl) to it and alter the highscore_server variable at the top of the samegame.js file to point to it. diff --git a/examples/declarative/samegame/qml/samegame/highscores/score_data.xml b/examples/declarative/samegame/qml/samegame/highscores/score_data.xml new file mode 100644 index 00000000..c3fd90d9 --- /dev/null +++ b/examples/declarative/samegame/qml/samegame/highscores/score_data.xml @@ -0,0 +1,2 @@ +1000000Alan the Tester0x00 +6213Alan12x1751 diff --git a/examples/declarative/samegame/qml/samegame/highscores/score_style.xsl b/examples/declarative/samegame/qml/samegame/highscores/score_style.xsl new file mode 100644 index 00000000..670354c9 --- /dev/null +++ b/examples/declarative/samegame/qml/samegame/highscores/score_style.xsl @@ -0,0 +1,28 @@ + + + + + SameGame High Scores + +

SameGame High Scores

+ + + + + + + + + + + + + + + + +
NameScoreGrid SizeTime, s
+ + +
+
diff --git a/examples/declarative/samegame/qml/samegame/highscores/scores.php b/examples/declarative/samegame/qml/samegame/highscores/scores.php new file mode 100644 index 00000000..3cceb2d7 --- /dev/null +++ b/examples/declarative/samegame/qml/samegame/highscores/scores.php @@ -0,0 +1,34 @@ +"; + echo "SameGame High Scores"; + if($score > 0){#Sending in a new high score + $name = $_POST["name"]; + $grid = $_POST["gridSize"]; + $time = $_POST["time"]; + if($name == "") + $name = "Anonymous"; + //if($grid != "10x10"){ + //Need a standard, so as to reject others? + //} + $file = fopen("score_data.xml", "a"); #It's XML. Happy? + $ret = fwrite($file, "". $score . "" + . $name . "" . $grid . "" + . $time . "\n"); + echo "Your score has been recorded. Thanks for playing!"; + if($ret == False) + echo "
There was an error though, so don't expect to see that score again."; + }else{#Read high score list + #Now uses XSLT to display. So just print the file. With XML cruft added. + #Note that firefox at least won't apply the XSLT on a php file. So redirecting + $file = fopen("scores.xml", "w"); + $ret = fwrite($file, '' . "\n" + . '' . "\n" + . "\n" . file_get_contents("score_data.xml") . "\n"); + if($ret == False) + echo "There was an internal error. Sorry."; + else + echo ''; + } + echo ""; +?> diff --git a/examples/declarative/samegame/qml/samegame/samegame.qml b/examples/declarative/samegame/qml/samegame/samegame.qml new file mode 100644 index 00000000..5356ab78 --- /dev/null +++ b/examples/declarative/samegame/qml/samegame/samegame.qml @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.1 +import "SamegameCore" +import "SamegameCore/samegame.js" as Logic + +Rectangle { + id: screen + width: 490; height: 720 + property bool inAnotherDemo: false //Samegame often is just plonked straight into other demos + + SystemPalette { id: activePalette } + + Item { + width: parent.width + anchors { top: parent.top; bottom: toolBar.top } + + Image { + id: background + anchors.fill: parent + source: "SamegameCore/pics/background.png" + fillMode: Image.PreserveAspectCrop + } + + Item { + id: gameCanvas + property int score: 0 + property int blockSize: 40 + + z: 20; anchors.centerIn: parent + width: parent.width - (parent.width % blockSize); + height: parent.height - (parent.height % blockSize); + + MouseArea { + anchors.fill: parent; onClicked: Logic.handleClick(mouse.x,mouse.y); + } + } + } + + Dialog { id: dialog; anchors.centerIn: parent; z: 21 } + + Dialog { + id: nameInputDialog + + property int initialWidth: 0 + property alias name: nameInputText.text + + anchors.centerIn: parent + z: 22; + + Behavior on width { + NumberAnimation {} + enabled: nameInputDialog.initialWidth != 0 + } + + onClosed: { + if (nameInputText.text != "") + Logic.saveHighScore(nameInputText.text); + } + Text { + id: dialogText + anchors { left: nameInputDialog.left; leftMargin: 20; verticalCenter: parent.verticalCenter } + text: "You won! Please enter your name: " + } + MouseArea { + anchors.fill: parent + onClicked: { + if (nameInputText.text == "") + nameInputText.openSoftwareInputPanel(); + else + nameInputDialog.forceClose(); + } + } + + TextInput { + id: nameInputText + anchors { verticalCenter: parent.verticalCenter; left: dialogText.right } + focus: visible + autoScroll: false + maximumLength: 24 + onTextChanged: { + var newWidth = nameInputText.width + dialogText.width + 40; + if ( (newWidth > nameInputDialog.width && newWidth < screen.width) + || (nameInputDialog.width > nameInputDialog.initialWidth) ) + nameInputDialog.width = newWidth; + } + onAccepted: { + nameInputDialog.forceClose(); + } + } + } + + Rectangle { + id: toolBar + width: parent.width; height: 58 + color: activePalette.window + anchors.bottom: screen.bottom + + Button { + id: newGameButton + anchors { left: parent.left; leftMargin: 3; verticalCenter: parent.verticalCenter } + text: "New Game" + onClicked: Logic.startNewGame() + } + + Button { + visible: !inAnotherDemo + text: "Quit" + anchors { left: newGameButton.right; leftMargin: 3; verticalCenter: parent.verticalCenter } + onClicked: Qt.quit(); + } + + Text { + id: score + anchors { right: parent.right; rightMargin: 3; verticalCenter: parent.verticalCenter } + text: "Score: " + gameCanvas.score + font.bold: true + font.pixelSize: 24 + color: activePalette.windowText + } + } +} diff --git a/examples/declarative/samegame/samegame.desktop b/examples/declarative/samegame/samegame.desktop new file mode 100644 index 00000000..18ad2d98 --- /dev/null +++ b/examples/declarative/samegame/samegame.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=samegame +Exec=/opt/samegame/bin/samegame +Icon=samegame64 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/samegame/samegame.pro b/examples/declarative/samegame/samegame.pro new file mode 100644 index 00000000..baac5dc1 --- /dev/null +++ b/examples/declarative/samegame/samegame.pro @@ -0,0 +1,24 @@ +# Add more folders to ship with the application, here +folder_01.source = qml/samegame +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# If your application uses the Qt Mobility libraries, uncomment the following +# lines and add the respective components to the MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# Speed up launching on MeeGo/Harmattan when using applauncherd daemon +# CONFIG += qdeclarative-boostable + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/samegame +exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/samegame/samegame.qmlproject b/examples/declarative/samegame/samegame.qmlproject new file mode 100644 index 00000000..c17ee1ee --- /dev/null +++ b/examples/declarative/samegame/samegame.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "qml/samegame" + } + JavaScriptFiles { + directory: "qml/samegame" + } + ImageFiles { + directory: "qml/samegame" + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/samegame/samegame.svg b/examples/declarative/samegame/samegame.svg new file mode 100644 index 00000000..566acfad --- /dev/null +++ b/examples/declarative/samegame/samegame.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/examples/declarative/samegame/samegame64.png b/examples/declarative/samegame/samegame64.png new file mode 100644 index 00000000..707d5c4e Binary files /dev/null and b/examples/declarative/samegame/samegame64.png differ diff --git a/examples/declarative/samegame/samegame80.png b/examples/declarative/samegame/samegame80.png new file mode 100644 index 00000000..6ad8096c Binary files /dev/null and b/examples/declarative/samegame/samegame80.png differ diff --git a/examples/declarative/samegame/samegame_harmattan.desktop b/examples/declarative/samegame/samegame_harmattan.desktop new file mode 100644 index 00000000..1f35b8e3 --- /dev/null +++ b/examples/declarative/samegame/samegame_harmattan.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=samegame +Exec=/usr/bin/single-instance /opt/samegame/bin/samegame +Icon=/usr/share/icons/hicolor/80x80/apps/samegame80.png +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/shadereffects/shadereffects.pro b/examples/declarative/shadereffects/shadereffects.pro index 4911a52b..7a4f1a8b 100644 --- a/examples/declarative/shadereffects/shadereffects.pro +++ b/examples/declarative/shadereffects/shadereffects.pro @@ -20,8 +20,8 @@ QT += declarative opengl SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/shadereffects +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/shadereffects exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) else:exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/snake/main.cpp b/examples/declarative/snake/main.cpp new file mode 100644 index 00000000..7bd252f0 --- /dev/null +++ b/examples/declarative/snake/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlapplicationviewer.h" +#include + +Q_DECL_EXPORT int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/snake/snake.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/snake/qml/snake/content/Button.qml b/examples/declarative/snake/qml/snake/content/Button.qml new file mode 100644 index 00000000..c1e0be5c --- /dev/null +++ b/examples/declarative/snake/qml/snake/content/Button.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: container + + signal clicked + property string text: "Button" + + color: activePalette.button; smooth: true + width: txtItem.width + 20; height: txtItem.height + 6 + border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; + + gradient: Gradient { + GradientStop { + id: topGrad; position: 0.0 + color: if (mr.pressed) { activePalette.dark } else { activePalette.light } } + GradientStop { position: 1.0; color: activePalette.button } + } + + MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } + + Text { + id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText + } +} diff --git a/examples/declarative/snake/qml/snake/content/Cookie.qml b/examples/declarative/snake/qml/snake/content/Cookie.qml new file mode 100644 index 00000000..353bf508 --- /dev/null +++ b/examples/declarative/snake/qml/snake/content/Cookie.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import Qt.labs.particles 1.0 + +Item { + id: root + property bool dying: false + property int row; + property int column; + x: margin + column * gridSize + y: margin + row * gridSize + + width: gridSize + height: gridSize + property int value : 1; + + Image { + id: img + anchors.fill: parent + source: "pics/cookie.png" + opacity: 0 + Text { + font.bold: true + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + text: value + } + } + + Particles { id: particles + width:1; height:1; anchors.centerIn: parent; + emissionRate: 0; + lifeSpan: 700; lifeSpanDeviation: 600; + angle: 0; angleDeviation: 360; + velocity: 100; velocityDeviation:30; + source: "pics/yellowStar.png"; + } + + states: [ + State{ name: "AliveState"; when: dying == false + PropertyChanges { target: img; opacity: 1 } + }, + State{ name: "DeathState"; when: dying == true + StateChangeScript { script: particles.burst(50); } + PropertyChanges { target: img; opacity: 0 } + } + ] + transitions: [ + Transition { + NumberAnimation { target: img; property: "opacity"; duration: 100 } + } + ] +} diff --git a/examples/declarative/snake/qml/snake/content/HighScoreModel.qml b/examples/declarative/snake/qml/snake/content/HighScoreModel.qml new file mode 100644 index 00000000..58695c6e --- /dev/null +++ b/examples/declarative/snake/qml/snake/content/HighScoreModel.qml @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +// Models a high score table. +// +// Use this component like this: +// +// HighScoreModel { +// id: highScores +// game: "MyCoolGame" +// } +// +// Then use either use the top-score properties: +// +// Text { text: "HI: " + highScores.topScore } +// +// or, use the model in a view: +// +// ListView { +// model: highScore +// delegate: Component { +// ... player ... score ... +// } +// } +// +// Add new scores via: +// +// saveScore(newScore) +// +// or: +// +// savePlayerScore(playerName,newScore) +// +// The best maxScore scores added by this method will be retained in an SQL database, +// and presented in the model and in the topScore/topPlayer properties. +// + +ListModel { + id: model + property string game: "" + property int topScore: 0 + property string topPlayer: "" + property int maxScores: 10 + + function __db() + { + return openDatabaseSync("HighScoreModel", "1.0", "Generic High Score Functionality for QML", 1000000); + } + function __ensureTables(tx) + { + tx.executeSql('CREATE TABLE IF NOT EXISTS HighScores(game TEXT, score INT, player TEXT)', []); + } + + function fillModel() { + __db().transaction( + function(tx) { + __ensureTables(tx); + var rs = tx.executeSql("SELECT score,player FROM HighScores WHERE game=? ORDER BY score DESC", [game]); + model.clear(); + if (rs.rows.length > 0) { + topScore = rs.rows.item(0).score + topPlayer = rs.rows.item(0).player + for (var i=0; i maxScores) + tx.executeSql("DELETE FROM HighScores WHERE game=? AND score <= ?", + [game, rs.rows.item(maxScores).score]); + } + } + ) + } + + function savePlayerScore(player,score) { + __db().transaction( + function(tx) { + __ensureTables(tx); + tx.executeSql("INSERT INTO HighScores VALUES(?,?,?)", [game,score,player]); + fillModel(); + } + ) + } + + function saveScore(score) { + savePlayerScore("player",score); + } + + function clearScores() { + __db().transaction( + function(tx) { + tx.executeSql("DELETE FROM HighScores WHERE game=?", [game]); + fillModel(); + } + ) + } + + Component.onCompleted: { fillModel() } +} diff --git a/examples/declarative/snake/qml/snake/content/Link.qml b/examples/declarative/snake/qml/snake/content/Link.qml new file mode 100644 index 00000000..7ace4054 --- /dev/null +++ b/examples/declarative/snake/qml/snake/content/Link.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import Qt.labs.particles 1.0 + +Item { id:link + property bool dying: false + property bool spawned: false + property int type: 0 + property int row: 0 + property int column: 0 + property int rotation; + + width: 40; + height: 40 + + x: margin - 3 + gridSize * column + y: margin - 3 + gridSize * row + Behavior on x { NumberAnimation { duration: spawned ? heartbeatInterval : 0} } + Behavior on y { NumberAnimation { duration: spawned ? heartbeatInterval : 0 } } + + + Item { + id: img + anchors.fill: parent + Image { + source: { + if(type == 1) { + "pics/blueStone.png"; + } else if (type == 2) { + "pics/head.png"; + } else { + "pics/redStone.png"; + } + } + + transform: Rotation { + id: actualImageRotation + origin.x: width/2; origin.y: height/2; + angle: rotation * 90 + Behavior on angle { + RotationAnimation{ + direction: RotationAnimation.Shortest + duration: spawned ? 200 : 0 + } + } + } + } + + Image { + source: "pics/stoneShadow.png" + } + + opacity: 0 + } + + + Particles { id: particles + width:1; height:1; anchors.centerIn: parent; + emissionRate: 0; + lifeSpan: 700; lifeSpanDeviation: 600; + angle: 0; angleDeviation: 360; + velocity: 100; velocityDeviation:30; + source: { + if(type == 1){ + "pics/blueStar.png"; + } else { + "pics/redStar.png"; + } + } + } + + states: [ + State{ name: "AliveState"; when: spawned == true && dying == false + PropertyChanges { target: img; opacity: 1 } + }, + State{ name: "DeathState"; when: dying == true + StateChangeScript { script: particles.burst(50); } + PropertyChanges { target: img; opacity: 0 } + } + ] + + transitions: [ + Transition { + NumberAnimation { target: img; property: "opacity"; duration: 200 } + } + ] + +} diff --git a/examples/declarative/snake/qml/snake/content/Skull.qml b/examples/declarative/snake/qml/snake/content/Skull.qml new file mode 100644 index 00000000..111e87b3 --- /dev/null +++ b/examples/declarative/snake/qml/snake/content/Skull.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + property bool spawned: false + property int row; + property int column; + property int verticalMovement; + property int horizontalMovement; + + x: margin + column * gridSize + 2 + y: margin + row * gridSize - 3 + Behavior on x { NumberAnimation { duration: spawned ? halfbeatInterval : 0} } + Behavior on y { NumberAnimation { duration: spawned ? halfbeatInterval : 0 } } + + opacity: spawned ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: 200 } } + + source: "pics/skull.png" + width: 24 + height: 40 +} diff --git a/examples/declarative/snake/qml/snake/content/pics/README b/examples/declarative/snake/qml/snake/content/pics/README new file mode 100644 index 00000000..0215132c --- /dev/null +++ b/examples/declarative/snake/qml/snake/content/pics/README @@ -0,0 +1 @@ +snake.jpg: This image is based on the picture "Eastern Green Mamba.jpg" from the free media databse Wikimedia Commons and is published under the terms of the GNU Free Documentation License. The original picture was taken by Danleo. diff --git a/examples/declarative/snake/qml/snake/content/pics/background.png b/examples/declarative/snake/qml/snake/content/pics/background.png new file mode 100644 index 00000000..72dffaa8 Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/background.png differ diff --git a/examples/declarative/snake/qml/snake/content/pics/blueStar.png b/examples/declarative/snake/qml/snake/content/pics/blueStar.png new file mode 100644 index 00000000..ba7acabd Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/blueStar.png differ diff --git a/examples/declarative/snake/qml/snake/content/pics/blueStone.png b/examples/declarative/snake/qml/snake/content/pics/blueStone.png new file mode 100644 index 00000000..356affdd Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/blueStone.png differ diff --git a/examples/declarative/snake/qml/snake/content/pics/cookie.png b/examples/declarative/snake/qml/snake/content/pics/cookie.png new file mode 100644 index 00000000..aec2957f Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/cookie.png differ diff --git a/examples/declarative/snake/qml/snake/content/pics/eyes.svg b/examples/declarative/snake/qml/snake/content/pics/eyes.svg new file mode 100644 index 00000000..10786927 --- /dev/null +++ b/examples/declarative/snake/qml/snake/content/pics/eyes.svg @@ -0,0 +1,118 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/examples/declarative/snake/qml/snake/content/pics/head.png b/examples/declarative/snake/qml/snake/content/pics/head.png new file mode 100644 index 00000000..550e0026 Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/head.png differ diff --git a/examples/declarative/snake/qml/snake/content/pics/head.svg b/examples/declarative/snake/qml/snake/content/pics/head.svg new file mode 100644 index 00000000..3bf0bd2f --- /dev/null +++ b/examples/declarative/snake/qml/snake/content/pics/head.svg @@ -0,0 +1,134 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/examples/declarative/snake/qml/snake/content/pics/pause.png b/examples/declarative/snake/qml/snake/content/pics/pause.png new file mode 100644 index 00000000..056d97dd Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/pause.png differ diff --git a/examples/declarative/snake/qml/snake/content/pics/redStar.png b/examples/declarative/snake/qml/snake/content/pics/redStar.png new file mode 100644 index 00000000..cd068547 Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/redStar.png differ diff --git a/examples/declarative/snake/qml/snake/content/pics/redStone.png b/examples/declarative/snake/qml/snake/content/pics/redStone.png new file mode 100644 index 00000000..9bb7fe42 Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/redStone.png differ diff --git a/examples/declarative/snake/qml/snake/content/pics/skull.png b/examples/declarative/snake/qml/snake/content/pics/skull.png new file mode 100644 index 00000000..63186167 Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/skull.png differ diff --git a/examples/declarative/snake/qml/snake/content/pics/snake.jpg b/examples/declarative/snake/qml/snake/content/pics/snake.jpg new file mode 100644 index 00000000..e91a784f Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/snake.jpg differ diff --git a/examples/declarative/snake/qml/snake/content/pics/star.png b/examples/declarative/snake/qml/snake/content/pics/star.png new file mode 100644 index 00000000..defbde53 Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/star.png differ diff --git a/examples/declarative/snake/qml/snake/content/pics/stoneShadow.png b/examples/declarative/snake/qml/snake/content/pics/stoneShadow.png new file mode 100644 index 00000000..1bd56afd Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/stoneShadow.png differ diff --git a/examples/declarative/snake/qml/snake/content/pics/yellowStar.png b/examples/declarative/snake/qml/snake/content/pics/yellowStar.png new file mode 100644 index 00000000..52fb9c4b Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/yellowStar.png differ diff --git a/examples/declarative/snake/qml/snake/content/pics/yellowStone.png b/examples/declarative/snake/qml/snake/content/pics/yellowStone.png new file mode 100644 index 00000000..c56124a8 Binary files /dev/null and b/examples/declarative/snake/qml/snake/content/pics/yellowStone.png differ diff --git a/examples/declarative/snake/qml/snake/content/snake.js b/examples/declarative/snake/qml/snake/content/snake.js new file mode 100644 index 00000000..837b82ad --- /dev/null +++ b/examples/declarative/snake/qml/snake/content/snake.js @@ -0,0 +1,316 @@ + +var snake = new Array; +var board = new Array; +var links = new Array; +var scheduledDirections = new Array; +var numRows = 1; +var numColumns = 1; +var linkComponent = Qt.createComponent("content/Link.qml"); // XXX should resolve relative to script, not component +var cookieComponent = Qt.createComponent("content/Cookie.qml"); +var cookie; +var linksToGrow = 0; +var linksToDie = 0; +var waitForCookie = 0; +var growType = 0; +var skullMovementsBeforeDirectionChange = 0; + + +function rand(n) +{ + return (Math.floor(Math.random() * n)); +} + +function scheduleDirection(dir) +{ + if (state == "starting") { + direction = dir; + headDirection = direction; + head.rotation = headDirection; + } else if (state == "running"){ + direction = dir; + if(scheduledDirections[scheduledDirections.length-1]!=direction) + scheduledDirections.push(direction); + } +} + +function startNewGame() +{ + if (state == "starting") { + return; + } + + if (activeGame) { + endGame(); + startNewGameTimer.running = true; + return; + } + + state = "starting"; + + numRows = numRowsAvailable; + numColumns = numColumnsAvailable; + board = new Array(numRows * numColumns); + snake = new Array; + scheduledDirections = new Array; + growType = 0; + + skull.z = numRows * numColumns + 1; + + for (var i = 0; i < numRows * numColumns; ++i) { + if (i < links.length) { + var link = links[i]; + link.spawned = false; + link.dying = false; + } else { + if(linkComponent.status != Component.Ready) { + if(linkComponent.status == Component.Error) + console.log(linkComponent.errorString()); + else + console.log("Still loading linkComponent"); + continue;//TODO: Better error handling? + } + var link = linkComponent.createObject(playfield); + link.z = numRows * numColumns + 1 - i; + link.type = i == 0 ? 2 : 0; + link.spawned = false; + link.dying = false; + links.push(link); + } + } + + head = links[0]; + snake.push(head); + head.row = numRows/2 -1; + head.column = numColumns/2 -1; + head.spawned = true; + + linksToGrow = 5; + linksToDie = 0; + waitForCookie = 5; + score = 0; + startHeartbeatTimer.running = true; +} + +function endGame() +{ + activeGame = false; + for(var i in snake) + snake[i].dying = true; + if (cookie) { + cookie.dying = true; + cookie = 0; + } + lastScore = score; + highScores.saveScore(lastScore); + state = ""; +} + +function move() { + + if (!head) + return; + + var dir = direction; + + if (scheduledDirections.length) { + dir = scheduledDirections.shift(); + } + + if (state == "starting") { + var turn = (dir - headDirection); + head.rotation += turn == -3 ? 1 : (turn == 3 ? -1 : turn ); + headDirection = dir; + return; + } + + var row = head.row; + var column = head.column; + + if (dir == 0) { + row = row - 1; + } else if (dir == 1) { + column = column + 1 + } else if (dir == 2) { + row = row + 1; + } else if (dir == 3) { + column = column - 1; + } + + //validate the new position + if (row < 0 || row >= numRows + || column < 0 || column >= numColumns + || (row == skull.row && column == skull.column) + || !isFree(row, column)) { + var turn = (dir - headDirection); + head.rotation += turn == -3 ? 1 : (turn == 3 ? -1 : turn ); + headDirection = dir; + endGame(); + return; + } + + var newLink; + if (linksToGrow > 0) { + --linksToGrow; + newLink = links[snake.length]; + newLink.spawned = false; + newLink.rotation = snake[snake.length-1].rotation; + newLink.type = growType; + newLink.dying = false; + snake.push(newLink); + } else { + var lastLink = snake[snake.length-1]; + board[lastLink.row * numColumns + lastLink.column] = undefined; + } + + if (waitForCookie > 0) { + if (--waitForCookie == 0) + createCookie(cookie? (cookie.value+1) : 1); + } + + for (var i = snake.length-1; i > 0; --i) { + snake[i].row = snake[i-1].row; + snake[i].column = snake[i-1].column; + snake[i].rotation = snake[i-1].rotation; + } + + if (newLink) { + newLink.spawned = true; + } + + // move the head + head.row = row; + head.column = column; + board[row * numColumns + column] = head; + + var turn = (dir - headDirection); + head.rotation += turn == -3 ? 1 : (turn == 3 ? -1 : turn ); + headDirection = dir; + + var value = testCookie(row, column); + if (value > 0) { + linksToGrow += value; + score += value; + } +} + +function isFree(row, column) +{ + return board[row * numColumns + column] == undefined; +} + +function isHead(row, column) +{ + return head.column == column && head.row == row; +} + +function testCookie(row, column) +{ + if (cookie && !cookie.dying && cookie.row == row && cookie.column == column) { + var value = cookie.value; + waitForCookie = value; + growType = snake[snake.length-1].type == 1 ? 0 : 1; + cookie.dying = true; + cookie.z = numRows * numColumns + 2; + return value; + } + return 0; +} + +function moveSkull() +{ + + if (linksToDie > 0) { + --linksToDie; + var link = snake.pop(); + link.dying = true; + board[link.row * numColumns + link.column] = undefined; + if (score > 0) + --score; + if (snake.length == 0) { + endGame(); + return; + } + } + + var row = skull.row; + var column = skull.column; + if (isHead(row, column)) { + endGame(); + return; + } + row += skull.verticalMovement; + column += skull.horizontalMovement; + + var attempts = 4; + + while (skullMovementsBeforeDirectionChange == 0 || row < 0 || row >= numRows + || column < 0 || column >= numColumns + || (!isFree(row, column) && !isHead(row, column))) { + var d = rand(8); + skull.verticalMovement = 0; + skull.horizontalMovement = 0; + skullMovementsBeforeDirectionChange = rand(20)+1; + if (d == 0) { + skull.verticalMovement = -1 + } else if (d == 1) { + skull.horizontalMovement = -1; + } else if (d == 2) { + skull.verticalMovement = 1 + } else if (d == 3){ + skull.horizontalMovement = 1; + } else if (cookie) { + var rd = cookie.row - skull.row; + var rc = cookie.column - skull.column; + if (Math.abs(rd) > Math.abs(rc)) { + skull.verticalMovement = rd > 0 ? 1 : -1; + skullMovementsBeforeDirectionChange = Math.abs(rd); + } else { + skull.horizontalMovement= rc > 0 ? 1 : -1; + skullMovementsBeforeDirectionChange = Math.abs(rc); + } + } + row = skull.row + skull.verticalMovement; + column = skull.column + skull.horizontalMovement; + if (--attempts == 0) + return; + } + + skull.row = row; + skull.column = column; + --skullMovementsBeforeDirectionChange; + var value = testCookie(row, column); + if (value > 0) + linksToDie += value/2; + + if (isHead(row, column)) + endGame(); +} + +function createCookie(value) { + if (numRows * numColumns - snake.length < 10) + return; + + var column = rand(numColumns); + var row = rand(numRows); + while (!isFree(row, column)) { + column++; + if (column == numColumns) { + column = 0; + row++; + if (row == numRows) + row = 0; + } + } + + if(cookieComponent.status != Component.Ready) { + if(cookieComponent.status == Component.Error) + console.log(cookieComponent.errorString()); + else + console.log("Still loading cookieComponent"); + return;//TODO: Better error handling? + } + cookie = cookieComponent.createObject(head.parent); + cookie.value = value; + cookie.row = row; + cookie.column = column; +} diff --git a/examples/declarative/snake/qml/snake/snake.qml b/examples/declarative/snake/qml/snake/snake.qml new file mode 100644 index 00000000..47e8501c --- /dev/null +++ b/examples/declarative/snake/qml/snake/snake.qml @@ -0,0 +1,272 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" as Content +import "content/snake.js" as Logic + +Rectangle { + id: screen; + SystemPalette { id: activePalette } + color: activePalette.window + property bool activeGame: false + + property int gridSize : 34 + property int margin: 4 + property int numRowsAvailable: Math.floor((height-32-2*margin)/gridSize) + property int numColumnsAvailable: Math.floor((width-2*margin)/gridSize) + + property int lastScore : 0 + + property int score: 0; + property int heartbeatInterval: 200 + property int halfbeatInterval: 160 + + width: 480 + height: 750 + + property int direction + property int headDirection + + property variant head; + + Content.HighScoreModel { + id: highScores + game: "Snake" + } + + Timer { + id: heartbeat; + interval: heartbeatInterval; + running: activeGame + repeat: true + onTriggered: { Logic.move() } + } + Timer { + id: halfbeat; + interval: halfbeatInterval; + repeat: true + running: heartbeat.running + onTriggered: { Logic.moveSkull() } + } + Timer { + id: startNewGameTimer; + interval: 700; + onTriggered: { Logic.startNewGame(); } + } + + Timer { + id: startHeartbeatTimer; + interval: 1000 ; + onTriggered: { state = "running"; activeGame = true; } + } + + Image{ + id: pauseDialog + z: 1 + source: "content/pics/pause.png" + anchors.centerIn: parent; + //opacity is deliberately not animated + opacity: activeGame && !Qt.application.active + } + + Image { + + Image { + id: title + source: "content/pics/snake.jpg" + fillMode: Image.PreserveAspectCrop + anchors.fill: parent + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + + Column { + spacing: 140 + anchors.verticalCenter: parent.verticalCenter; + anchors.left: parent.left; + anchors.right: parent.right; + + Text { + color: "white" + font.pointSize: 48 + font.italic: true; + font.bold: true; + text: "Snake" + anchors.horizontalCenter: parent.horizontalCenter; + } + + Text { + color: "white" + font.pointSize: 24 + anchors.horizontalCenter: parent.horizontalCenter; + //horizontalAlignment: Text.AlignHCenter + text: "Last Score:\t" + lastScore + "\nHighscore:\t" + highScores.topScore; + } + } + } + + source: "content/pics/background.png" + fillMode: Image.PreserveAspectCrop + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: toolbar.top + + Rectangle { + id: playfield + border.width: 1 + border.color: "white" + color: "transparent" + anchors.horizontalCenter: parent.horizontalCenter + y: (screen.height - 32 - height)/2; + width: numColumnsAvailable * gridSize + 2*margin + height: numRowsAvailable * gridSize + 2*margin + + + Content.Skull { + id: skull + } + + MouseArea { + anchors.fill: parent + onPressed: { + if (screen.state == "") { + Logic.startNewGame(); + return; + } + if (direction == 0 || direction == 2) + Logic.scheduleDirection((mouseX > (head.x + head.width/2)) ? 1 : 3); + else + Logic.scheduleDirection((mouseY > (head.y + head.height/2)) ? 2 : 0); + } + } + } + + } + + Rectangle { + id: progressBar + opacity: 0 + Behavior on opacity { NumberAnimation { duration: 200 } } + color: "transparent" + border.width: 2 + border.color: "#221edd" + x: 50 + y: 50 + width: 200 + height: 30 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: 40 + + Rectangle { + id: progressIndicator + color: "#221edd"; + width: 0; + height: 30; + } + } + + Rectangle { + id: toolbar + color: activePalette.window + height: 32; width: parent.width + anchors.bottom: screen.bottom + + Content.Button { + id: btnA; text: "New Game"; onClicked: Logic.startNewGame(); + anchors.left: parent.left; anchors.leftMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + + Content.Button { + text: "Quit" + anchors { left: btnA.right; leftMargin: 3; verticalCenter: parent.verticalCenter } + onClicked: Qt.quit(); + } + + Text { + color: activePalette.text + text: "Score: " + score; font.bold: true + anchors.right: parent.right; anchors.rightMargin: 3 + anchors.verticalCenter: parent.verticalCenter + } + } + + focus: true + Keys.onSpacePressed: Logic.startNewGame(); + Keys.onLeftPressed: if (state == "starting" || direction != 1) Logic.scheduleDirection(3); + Keys.onRightPressed: if (state == "starting" || direction != 3) Logic.scheduleDirection(1); + Keys.onUpPressed: if (state == "starting" || direction != 2) Logic.scheduleDirection(0); + Keys.onDownPressed: if (state == "starting" || direction != 0) Logic.scheduleDirection(2); + + states: [ + State { + name: "starting" + PropertyChanges {target: progressIndicator; width: 200} + PropertyChanges {target: title; opacity: 0} + PropertyChanges {target: progressBar; opacity: 1} + }, + State { + name: "running" + PropertyChanges {target: progressIndicator; width: 200} + PropertyChanges {target: title; opacity: 0} + PropertyChanges {target: skull; row: 0; column: 0; } + PropertyChanges {target: skull; spawned: 1} + } + ] + + transitions: [ + Transition { + from: "*" + to: "starting" + NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 } + NumberAnimation { property: "opacity"; duration: 200 } + }, + Transition { + to: "starting" + NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 } + NumberAnimation { property: "opacity"; duration: 200 } + } + ] + +} diff --git a/examples/declarative/snake/snake.desktop b/examples/declarative/snake/snake.desktop new file mode 100644 index 00000000..fef60907 --- /dev/null +++ b/examples/declarative/snake/snake.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=snake +Exec=/opt/snake/bin/snake +Icon=snake64 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/snake/snake.pro b/examples/declarative/snake/snake.pro new file mode 100644 index 00000000..ce1e28e3 --- /dev/null +++ b/examples/declarative/snake/snake.pro @@ -0,0 +1,24 @@ +# Add more folders to ship with the application, here +folder_01.source = qml/snake +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# If your application uses the Qt Mobility libraries, uncomment the following +# lines and add the respective components to the MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# Speed up launching on MeeGo/Harmattan when using applauncherd daemon +# CONFIG += qdeclarative-boostable + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/snake +exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/snake/snake.qmlproject b/examples/declarative/snake/snake.qmlproject new file mode 100644 index 00000000..431d2a9e --- /dev/null +++ b/examples/declarative/snake/snake.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "qml/snake" + } + JavaScriptFiles { + directory: "qml/snake" + } + ImageFiles { + directory: "qml/snake" + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/snake/snake.svg b/examples/declarative/snake/snake.svg new file mode 100644 index 00000000..566acfad --- /dev/null +++ b/examples/declarative/snake/snake.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/examples/declarative/snake/snake64.png b/examples/declarative/snake/snake64.png new file mode 100644 index 00000000..707d5c4e Binary files /dev/null and b/examples/declarative/snake/snake64.png differ diff --git a/examples/declarative/snake/snake80.png b/examples/declarative/snake/snake80.png new file mode 100644 index 00000000..6ad8096c Binary files /dev/null and b/examples/declarative/snake/snake80.png differ diff --git a/examples/declarative/snake/snake_harmattan.desktop b/examples/declarative/snake/snake_harmattan.desktop new file mode 100644 index 00000000..10b0f792 --- /dev/null +++ b/examples/declarative/snake/snake_harmattan.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=snake +Exec=/usr/bin/single-instance /opt/snake/bin/snake +Icon=/usr/share/icons/hicolor/80x80/apps/snake80.png +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/sqllocalstorage/sqllocalstorage.pro b/examples/declarative/sqllocalstorage/sqllocalstorage.pro index 631cff40..824f407a 100644 --- a/examples/declarative/sqllocalstorage/sqllocalstorage.pro +++ b/examples/declarative/sqllocalstorage/sqllocalstorage.pro @@ -19,8 +19,8 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/sqllocalstorage +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/sqllocalstorage exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) else:exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/text/fonts/availableFonts/availableFonts.pro b/examples/declarative/text/fonts/availableFonts/availableFonts.pro index a175e3d5..3cd3f973 100644 --- a/examples/declarative/text/fonts/availableFonts/availableFonts.pro +++ b/examples/declarative/text/fonts/availableFonts/availableFonts.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/text/fonts/availableFonts +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/text/fonts/availableFonts exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/text/fonts/banner/banner.pro b/examples/declarative/text/fonts/banner/banner.pro index ab6f3e56..e21ee2e3 100644 --- a/examples/declarative/text/fonts/banner/banner.pro +++ b/examples/declarative/text/fonts/banner/banner.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/text/fonts/banner +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/text/fonts/banner exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/text/fonts/fonts.pro b/examples/declarative/text/fonts/fonts.pro index 33637ef4..2359918e 100644 --- a/examples/declarative/text/fonts/fonts.pro +++ b/examples/declarative/text/fonts/fonts.pro @@ -5,8 +5,3 @@ SUBDIRS += \ banner \ fonts \ hello - -# install -sources.files = fonts.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/text/fonts -INSTALLS += sources diff --git a/examples/declarative/text/fonts/fonts/fonts.pro b/examples/declarative/text/fonts/fonts/fonts.pro index 1e10fc17..4fd22c68 100644 --- a/examples/declarative/text/fonts/fonts/fonts.pro +++ b/examples/declarative/text/fonts/fonts/fonts.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/text/fonts/fonts +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/text/fonts/fonts exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/text/fonts/hello/hello.pro b/examples/declarative/text/fonts/hello/hello.pro index 8a7752a8..db92f145 100644 --- a/examples/declarative/text/fonts/hello/hello.pro +++ b/examples/declarative/text/fonts/hello/hello.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/text/fonts/hello +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/text/fonts/hello exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/text/text.pro b/examples/declarative/text/text.pro index 755e811a..4e86deb3 100644 --- a/examples/declarative/text/text.pro +++ b/examples/declarative/text/text.pro @@ -3,8 +3,3 @@ TEMPLATE = subdirs SUBDIRS += \ fonts \ textselection - -# install -sources.files = text.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/text -INSTALLS += sources diff --git a/examples/declarative/text/textselection/textselection.pro b/examples/declarative/text/textselection/textselection.pro index 327efad9..bd697106 100644 --- a/examples/declarative/text/textselection/textselection.pro +++ b/examples/declarative/text/textselection/textselection.pro @@ -23,7 +23,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/text/textselection +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/text/textselection exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/threading/threadedlistmodel/threadedlistmodel.pro b/examples/declarative/threading/threadedlistmodel/threadedlistmodel.pro index 35f203f1..a669ed41 100644 --- a/examples/declarative/threading/threadedlistmodel/threadedlistmodel.pro +++ b/examples/declarative/threading/threadedlistmodel/threadedlistmodel.pro @@ -18,7 +18,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/threading/threadedlistmodel +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/threading/threadedlistmodel exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/threading/threading.pro b/examples/declarative/threading/threading.pro index d281a764..56508617 100644 --- a/examples/declarative/threading/threading.pro +++ b/examples/declarative/threading/threading.pro @@ -3,8 +3,3 @@ TEMPLATE = subdirs SUBDIRS = \ threadedlistmodel \ workerscript - -# install -sources.files = threading.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/threading -INSTALLS += sources diff --git a/examples/declarative/threading/workerscript/workerscript.pro b/examples/declarative/threading/workerscript/workerscript.pro index b92a2745..afd4d47b 100644 --- a/examples/declarative/threading/workerscript/workerscript.pro +++ b/examples/declarative/threading/workerscript/workerscript.pro @@ -18,7 +18,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/threading/workerscript +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/threading/workerscript exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/touchinteraction/gestures/experimental-gestures/experimental-gestures.pro b/examples/declarative/touchinteraction/gestures/experimental-gestures/experimental-gestures.pro new file mode 100644 index 00000000..396a59d8 --- /dev/null +++ b/examples/declarative/touchinteraction/gestures/experimental-gestures/experimental-gestures.pro @@ -0,0 +1,29 @@ +# Add more folders to ship with the application, here +folder_01.source = qml/experimental-gestures +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/touchinteraction/gestures/experimental-gestures +exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.pro b/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.pro deleted file mode 100644 index db652cc3..00000000 --- a/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.pro +++ /dev/null @@ -1,29 +0,0 @@ -# Add more folders to ship with the application, here -folder_01.source = qml/experimental-gestures -folder_01.target = qml -DEPLOYMENTFOLDERS = folder_01 - -# Additional import path used to resolve QML modules in Creator's code model -QML_IMPORT_PATH = - -# Avoid auto screen rotation -#DEFINES += ORIENTATIONLOCK - -# Define QMLJSDEBUGGER to allow debugging of QML in debug builds -# (This might significantly increase build time) -# DEFINES += QMLJSDEBUGGER - -# If your application uses the Qt Mobility libraries, uncomment -# the following lines and add the respective components to the -# MOBILITY variable. -# CONFIG += mobility -# MOBILITY += - -# The .cpp file which was generated for your project. Feel free to hack it. -SOURCES += main.cpp - -# Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/touchinteraction/gestures/experimental-gestures -exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) -qtcAddDeployment() diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example/mousearea-example.pro b/examples/declarative/touchinteraction/mousearea/mousearea-example/mousearea-example.pro new file mode 100644 index 00000000..9d984146 --- /dev/null +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example/mousearea-example.pro @@ -0,0 +1,29 @@ +# Add more folders to ship with the application, here +folder_01.source = qml/mousearea-example +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/touchinteraction/mousearea/mousearea-example +exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.pro b/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.pro deleted file mode 100644 index c55b883c..00000000 --- a/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.pro +++ /dev/null @@ -1,29 +0,0 @@ -# Add more folders to ship with the application, here -folder_01.source = qml/mousearea-example -folder_01.target = qml -DEPLOYMENTFOLDERS = folder_01 - -# Additional import path used to resolve QML modules in Creator's code model -QML_IMPORT_PATH = - -# Avoid auto screen rotation -DEFINES += ORIENTATIONLOCK - -# Define QMLJSDEBUGGER to allow debugging of QML in debug builds -# (This might significantly increase build time) -# DEFINES += QMLJSDEBUGGER - -# If your application uses the Qt Mobility libraries, uncomment -# the following lines and add the respective components to the -# MOBILITY variable. -# CONFIG += mobility -# MOBILITY += - -# The .cpp file which was generated for your project. Feel free to hack it. -SOURCES += main.cpp - -# Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/touchinteraction/mousearea/mousearea-example -exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) -qtcAddDeployment() diff --git a/examples/declarative/touchinteraction/pincharea/pincharea.pro b/examples/declarative/touchinteraction/pincharea/pincharea.pro index 6a2e9dd3..15bf06be 100644 --- a/examples/declarative/touchinteraction/pincharea/pincharea.pro +++ b/examples/declarative/touchinteraction/pincharea/pincharea.pro @@ -18,7 +18,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/touchinteraction/pincharea +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/touchinteraction/pincharea exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/touchinteraction/touchinteraction.pro b/examples/declarative/touchinteraction/touchinteraction.pro index 1db70571..5ce0abe0 100644 --- a/examples/declarative/touchinteraction/touchinteraction.pro +++ b/examples/declarative/touchinteraction/touchinteraction.pro @@ -1,9 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = gestures/experimental-gestures/experimentalgestures.pro \ - mousearea/mousearea-example/mouseareaexample.pro \ +SUBDIRS = gestures/experimental-gestures \ + mousearea/mousearea-example \ pincharea - -# install -sources.files = touchinteraction.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/touchinteraction -INSTALLS += sources diff --git a/examples/declarative/toys/clocks/clocks.pro b/examples/declarative/toys/clocks/clocks.pro index 483924e1..3fc085ca 100644 --- a/examples/declarative/toys/clocks/clocks.pro +++ b/examples/declarative/toys/clocks/clocks.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/toys/clocks +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/toys/clocks exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/toys/corkboards/corkboards.pro b/examples/declarative/toys/corkboards/corkboards.pro index 61e141fa..dbcfc859 100644 --- a/examples/declarative/toys/corkboards/corkboards.pro +++ b/examples/declarative/toys/corkboards/corkboards.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/toys/corkboards +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/toys/corkboards exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/toys/dynamicscene/dynamicscene.pro b/examples/declarative/toys/dynamicscene/dynamicscene.pro index 5d19757b..c77e7374 100644 --- a/examples/declarative/toys/dynamicscene/dynamicscene.pro +++ b/examples/declarative/toys/dynamicscene/dynamicscene.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/toys/dynamicscene +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/toys/dynamicscene exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/toys/tic-tac-toe/tic-tac-toe.pro b/examples/declarative/toys/tic-tac-toe/tic-tac-toe.pro new file mode 100644 index 00000000..1352bc1c --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/tic-tac-toe.pro @@ -0,0 +1,29 @@ +# Add more folders to ship with the application, here +folder_01.source = qml/tic-tac-toe +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/toys/tic-tac-toe +exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/toys/tic-tac-toe/tictactoe.pro b/examples/declarative/toys/tic-tac-toe/tictactoe.pro deleted file mode 100644 index 4a669f6f..00000000 --- a/examples/declarative/toys/tic-tac-toe/tictactoe.pro +++ /dev/null @@ -1,30 +0,0 @@ -# Add more folders to ship with the application, here -folder_01.source = qml/tic-tac-toe -folder_01.target = qml -DEPLOYMENTFOLDERS = folder_01 - -# Additional import path used to resolve QML modules in Creator's code model -QML_IMPORT_PATH = - -# Avoid auto screen rotation -DEFINES += ORIENTATIONLOCK - -# Define QMLJSDEBUGGER to allow debugging of QML in debug builds -# (This might significantly increase build time) -# DEFINES += QMLJSDEBUGGER - -# If your application uses the Qt Mobility libraries, uncomment -# the following lines and add the respective components to the -# MOBILITY variable. -# CONFIG += mobility -# MOBILITY += - -TARGET = tic-tac-toe -# The .cpp file which was generated for your project. Feel free to hack it. -SOURCES += main.cpp - -# Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/toys/tic-tac-toe -exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) -qtcAddDeployment() diff --git a/examples/declarative/toys/toys.pro b/examples/declarative/toys/toys.pro index 2e35b44a..5c7f70b0 100644 --- a/examples/declarative/toys/toys.pro +++ b/examples/declarative/toys/toys.pro @@ -4,10 +4,5 @@ SUBDIRS += \ clocks \ corkboards \ dynamicscene \ - tic-tac-toe/tictactoe.pro \ + tic-tac-toe \ tvtennis - -# install -sources.files = toys.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/toys -INSTALLS += sources diff --git a/examples/declarative/toys/tvtennis/tvtennis.pro b/examples/declarative/toys/tvtennis/tvtennis.pro index 2b4cc07e..1b934494 100644 --- a/examples/declarative/toys/tvtennis/tvtennis.pro +++ b/examples/declarative/toys/tvtennis/tvtennis.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/toys/tvtennis +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/toys/tvtennis exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro b/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro index 74ef3b66..b3ff1bfb 100644 --- a/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro +++ b/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro @@ -4,8 +4,7 @@ HEADERS += piechart.h SOURCES += piechart.cpp \ main.cpp -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/tutorials/extending/chapter1-basics -sources.files = $$SOURCES $$HEADERS app.qml chapter1-basics.pro -sources.path = $$[QT_INSTALL_EXAMPLES]//qtquick1/declarative/tutorials/extending/chapter1-basics -INSTALLS += target sources +qml.files = app.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/extending/chapter1-basics +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/extending/chapter1-basics +INSTALLS += target qml diff --git a/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro b/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro index 05b8e7dd..b5c8703e 100644 --- a/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro +++ b/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro @@ -4,8 +4,7 @@ HEADERS += piechart.h SOURCES += piechart.cpp \ main.cpp -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/tutorials/extending/chapter2-methods -sources.files = $$SOURCES $$HEADERS app.qml chapter2-methods.pro -sources.path = $$[QT_INSTALL_EXAMPLES]//qtquick1/declarative/tutorials/extending/chapter2-methods -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/extending/chapter2-methods +qml.files = app.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/extending/chapter2-methods +INSTALLS += target qml diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro b/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro index 66a59503..cc37d591 100644 --- a/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro +++ b/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro @@ -4,8 +4,7 @@ HEADERS += piechart.h SOURCES += piechart.cpp \ main.cpp -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/tutorials/extending/chapter3-bindings -sources.files = $$SOURCES $$HEADERS app.qml chapter3-bindings.pro -sources.path = $$[QT_INSTALL_EXAMPLES]//qtquick1/declarative/tutorials/extending/chapter3-bindings -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/extending/chapter3-bindings +qml.files = app.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/extending/chapter3-bindings +INSTALLS += target qml diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro index 50583372..8152fcaf 100644 --- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro +++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro @@ -6,8 +6,7 @@ SOURCES += piechart.cpp \ pieslice.cpp \ main.cpp -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/tutorials/extending/chapter4-customPropertyTypes -sources.files = $$SOURCES $$HEADERS app.qml chapter4-customPropertyTypes.pro -sources.path = $$[QT_INSTALL_EXAMPLES]//qtquick1/declarative/tutorials/extending/chapter4-customPropertyTypes -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/extending/chapter4-customPropertyTypes +qml.files = app.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/extending/chapter4-customPropertyTypes +INSTALLS += target qml diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro b/examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro index e76d3807..ef45c8d3 100644 --- a/examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro +++ b/examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro @@ -6,8 +6,7 @@ SOURCES += piechart.cpp \ pieslice.cpp \ main.cpp -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/tutorials/extending/chapter5-listproperties -sources.files = $$SOURCES $$HEADERS app.qml chapter5-listproperties.pro -sources.path = $$[QT_INSTALL_EXAMPLES]//qtquick1/declarative/tutorials/extending/chapter5-listproperties -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/extending/chapter5-listproperties +qml.files = app.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/extending/chapter5-listproperties +INSTALLS += target qml diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro b/examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro index f8012e66..095312ea 100644 --- a/examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro +++ b/examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro @@ -14,10 +14,7 @@ SOURCES += piechart.cpp \ pieslice.cpp \ chartsplugin.cpp -OTHER_FILES += chartsplugin.json - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/tutorials/extending/chapter6-plugins -sources.files = $$SOURCES $$HEADERS $$OTHER_FILES app.qml chapter6-plugins.pro -sources.path = $$[QT_INSTALL_EXAMPLES]//qtquick1/declarative/tutorials/extending/chapter6-plugins -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/extending/chapter6-plugins +qml.files = app.qml qmldir +qml.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/extending/chapter6-plugins +INSTALLS += target qml diff --git a/examples/declarative/tutorials/extending/extending.pro b/examples/declarative/tutorials/extending/extending.pro index 19bf40b9..fe9a5cc7 100644 --- a/examples/declarative/tutorials/extending/extending.pro +++ b/examples/declarative/tutorials/extending/extending.pro @@ -7,9 +7,3 @@ SUBDIRS += \ chapter4-customPropertyTypes \ chapter5-listproperties \ chapter6-plugins - -# install -sources.files = extending.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/tutorials/extending -INSTALLS += sources - diff --git a/examples/declarative/tutorials/gettingStarted/filedialog/dialogPlugin.cpp b/examples/declarative/tutorials/gettingStarted/filedialog/dialogPlugin.cpp new file mode 100644 index 00000000..bc711932 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/filedialog/dialogPlugin.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "dialogPlugin.h" +#include "directory.h" +#include "file.h" +#include + +void DialogPlugin::registerTypes(const char *uri) +{ + //register the class Directory into QML as a "Directory" element version 1.0 + qmlRegisterType(uri, 1, 0, "Directory"); + qmlRegisterType(uri,1,0,"File"); +} diff --git a/examples/declarative/tutorials/gettingStarted/filedialog/dialogPlugin.h b/examples/declarative/tutorials/gettingStarted/filedialog/dialogPlugin.h new file mode 100644 index 00000000..e87b7e82 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/filedialog/dialogPlugin.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DIALOGPLUGIN_H +#define DIALOGPLUGIN_H + +#include + +class DialogPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "filedialog.json") + + public: + //registerTypes is inherited from QDeclarativeExtensionPlugin + void registerTypes(const char *uri); + +}; + +#endif + diff --git a/examples/declarative/tutorials/gettingStarted/filedialog/directory.cpp b/examples/declarative/tutorials/gettingStarted/filedialog/directory.cpp new file mode 100644 index 00000000..fe5018b1 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/filedialog/directory.cpp @@ -0,0 +1,224 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "directory.h" +#include + +/* +Directory constructor + +Initialize the saves directory and creates the file list +*/ +Directory::Directory(QObject *parent) : QObject(parent) +{ + m_dir.cd( QDir::currentPath() ); + + //go to the saved directory. if not found, create save directory + m_saveDir = "saves"; + if ( m_dir.cd(m_saveDir) == 0 ) { + m_dir.mkdir(m_saveDir); + m_dir.cd(m_saveDir); + } + m_filterList << "*.txt"; + refresh(); +} + +/* +Directory::filesNumber +Return the number of Files +*/ +int Directory::filesCount() const +{ + return m_fileList.size(); +} + +/* +Function called to append data onto list property +*/ +void appendFiles(QDeclarativeListProperty * property, File * file) +{ + Q_UNUSED(property); + Q_UNUSED(file); + //Do nothing. can't add to a directory using this method +} + +/* +Function called to retrieve file in the list using an index +*/ +File* fileAt(QDeclarativeListProperty * property, int index) +{ + return static_cast< QList *>(property->data)->at(index); +} + +/* +Returns the number of files in the list +*/ +int filesSize(QDeclarativeListProperty * property) +{ + return static_cast< QList *>(property->data)->size(); +} + +/* +Function called to empty the list property contents +*/ +void clearFilesPtr(QDeclarativeListProperty *property) +{ + return static_cast< QList *>(property->data)->clear(); +} + +/* +Returns the list of files as a QDeclarativeListProperty. +*/ +QDeclarativeListProperty Directory::files() +{ + refresh(); + return QDeclarativeListProperty( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr ); +} + +/* +Return the name of the currently selected file +*/ +QString Directory::filename() const +{ + return currentFile.name(); +} + +/* +Return the file's content as a string. +*/ +QString Directory::fileContent() const +{ + return m_fileContent; +} + +/* +Set the file name of the current file +*/ +void Directory::setFilename(const QString &str) +{ + if( str != currentFile.name() ) { + currentFile.setName(str); + emit filenameChanged(); + } +} + +/* +Set the content of the file as a string +*/ +void Directory::setFileContent(const QString &str) +{ + if(str != m_fileContent){ + m_fileContent = str; + emit fileContentChanged(); + } +} + +/* +Called from QML to save the file using the filename and file content. +Saving makes sure that the file has a .txt extension. +*/ +void Directory::saveFile() +{ + if(currentFile.name().size() == 0){ + qWarning()<< "Empty filename. no save"; + return; + } + QString extendedName = currentFile.name(); + if(!currentFile.name().endsWith(".txt")){ + extendedName.append(".txt"); + } + QFile file( m_dir.filePath(extendedName) ); + if ( file.open(QFile::WriteOnly | QFile::Truncate) ) { + QTextStream outStream(&file); + outStream << m_fileContent; + } + file.close(); + refresh(); + emit directoryChanged(); +} + +/* +Load the contents of a file. +Only loads files with a .txt extension +*/ +void Directory::loadFile() +{ + m_fileContent.clear(); + QString extendedName = currentFile.name(); + if( !currentFile.name().endsWith(".txt") ) { + extendedName.append(".txt"); + } + + QFile file( m_dir.filePath(extendedName) ); + if ( file.open(QFile::ReadOnly ) ) { + QTextStream inStream(&file); + + QString line; + do { + line = inStream.read(75); + m_fileContent.append(line); + } while ( !line.isNull() ) ; + } + file.close(); +} + +/* +Reloads the content of the files list. This is to ensure that the newly +created files are added onto the list. +*/ +void Directory::refresh() +{ + m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name); + m_fileList.clear(); + + File * file; + for(int i = 0; i < m_dirFiles.size() ; i ++) { + file = new File(); + + if( m_dirFiles.at(i).endsWith(".txt") ) { + QString name = m_dirFiles.at(i); + file->setName( name.remove(".txt",Qt::CaseSensitive) ); + } + else { + file->setName(m_dirFiles.at(i)); + } + m_fileList.append(file); + } +} diff --git a/examples/declarative/tutorials/gettingStarted/filedialog/directory.h b/examples/declarative/tutorials/gettingStarted/filedialog/directory.h new file mode 100644 index 00000000..90e15781 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/filedialog/directory.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DIRECTORY_H +#define DIRECTORY_H + +#include "file.h" + +#include +#include +#include +#include +#include + +class Directory : public QObject { + + Q_OBJECT + + //number of files in the directory + Q_PROPERTY(int filesCount READ filesCount) + + //list property containing file names as QString + Q_PROPERTY(QDeclarativeListProperty files READ files CONSTANT ) + + //file name of the text file to read/write + Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) + + //text content of the file + Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) + + public: + Directory(QObject *parent = 0); + + //properties' read functions + int filesCount() const; + QString filename() const; + QString fileContent() const; + QDeclarativeListProperty files(); + + //properties' write functions + void setFilename(const QString &str); + void setFileContent(const QString &str); + + //accessible from QML + Q_INVOKABLE void saveFile(); + Q_INVOKABLE void loadFile(); + + signals: + void directoryChanged(); + void filenameChanged(); + void fileContentChanged(); + + private: + QDir m_dir; + QStringList m_dirFiles; + File currentFile; + QString m_saveDir; + QStringList m_filterList; + + //contains the file data in QString format + QString m_fileContent; + + //Registered to QML in a plugin. Accessible from QML as a property of Directory + QList m_fileList; + + //refresh content of the directory + void refresh(); +}; + +#endif diff --git a/examples/declarative/tutorials/gettingStarted/filedialog/file.cpp b/examples/declarative/tutorials/gettingStarted/filedialog/file.cpp new file mode 100644 index 00000000..7921489c --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/filedialog/file.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "file.h" + +File::File(QObject *parent) : QObject(parent) +{ + m_name = ""; +} + +QString File::name() const{ + return m_name; +} +void File::setName(const QString &str){ + if(str != m_name){ + m_name = str; + emit nameChanged(); + } +} diff --git a/examples/declarative/tutorials/gettingStarted/filedialog/file.h b/examples/declarative/tutorials/gettingStarted/filedialog/file.h new file mode 100644 index 00000000..ee93aa2e --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/filedialog/file.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FILE_H +#define FILE_H + + +#include +#include + +class File : public QObject{ + + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + + public: + File(QObject *parent = 0); + + QString name() const; + void setName(const QString &str); + + signals: + void nameChanged(); + + private: + QString m_name; +}; + +#endif diff --git a/examples/declarative/tutorials/gettingStarted/filedialog/filedialog.json b/examples/declarative/tutorials/gettingStarted/filedialog/filedialog.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/filedialog/filedialog.json @@ -0,0 +1 @@ +{} diff --git a/examples/declarative/tutorials/gettingStarted/filedialog/filedialog.pro b/examples/declarative/tutorials/gettingStarted/filedialog/filedialog.pro new file mode 100644 index 00000000..0d8dc981 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/filedialog/filedialog.pro @@ -0,0 +1,22 @@ +TEMPLATE = lib +CONFIG += qt plugin +QT += declarative + +DESTDIR += ../plugins +OBJECTS_DIR = tmp +MOC_DIR = tmp + +TARGET = FileDialog + +HEADERS += directory.h \ + file.h \ + dialogPlugin.h + +SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/gettingStarted/filedialog +qml.files = qmldir +qml.path = $$[QT_INSTALL_EXAMPLES]/declarative/tutorials/gettingStarted/filedialog +INSTALLS += target qml diff --git a/examples/declarative/tutorials/gettingStarted/filedialog/qmldir b/examples/declarative/tutorials/gettingStarted/filedialog/qmldir new file mode 100644 index 00000000..c2b27dad --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/filedialog/qmldir @@ -0,0 +1 @@ +plugin FileDialog plugins diff --git a/examples/declarative/tutorials/gettingStarted/gettingStarted.pro b/examples/declarative/tutorials/gettingStarted/gettingStarted.pro new file mode 100644 index 00000000..4fb010b8 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gettingStarted.pro @@ -0,0 +1,11 @@ +TEMPLATE = subdirs +SUBDIRS = \ + filedialog\ + + +EXAMPLE_FILES = \ + gettingStarted.qml \ + core \ + images \ + parts \ + pics diff --git a/examples/declarative/tutorials/gettingStarted/gettingStarted.qml b/examples/declarative/tutorials/gettingStarted/gettingStarted.qml new file mode 100644 index 00000000..84bb0c7d --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gettingStarted.qml @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "core" + +Rectangle { + id: screen + width: 1000; height: 1000 + property int partition: height/3 + border { width: 1; color: "#DCDCCC"} + state: "DRAWER_CLOSED" + + //Item 1: MenuBar on the top portion of the screen + MenuBar { + id:menuBar + height: screen.partition; width: screen.width + z: 1 + } + + //Item 2: The editable text area + TextArea { + id: textArea + y: drawer.height + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2; width:parent.width + } + + //Item 3: The drawer handle + Rectangle { + id: drawer + height: 15; width: parent.width + border { color : "#6A6D6A"; width: 1 } + z: 1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + Image { + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + Behavior{ NumberAnimation { property: "rotation"; easing.type: Easing.OutExpo } } + } + + MouseArea { + id: drawerMouseArea + anchors.fill: parent + hoverEnabled: true + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + onExited: parent.border.color = "#6A6D6A" + onClicked: { + if (screen.state == "DRAWER_CLOSED") { + screen.state = "DRAWER_OPEN" + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + } + } + } + } + +//! [states] + states:[ + State { + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y: 0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State { + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-height; } + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height } + PropertyChanges { target: drawer; y: 0 } + PropertyChanges { target: arrowIcon; rotation: 0 } + } + ] +//! [states] + +//! [transitions] + transitions: [ + Transition { + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100; easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100; easing.type: Easing.OutExpo } + } + ] +//! [transitions] +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/core/button.qml b/examples/declarative/tutorials/gettingStarted/gsQml/core/button.qml new file mode 100644 index 00000000..1c31f661 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/core/button.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +import QtQuick 1.0 + +Rectangle { + //identifier of the item + id: button + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //attaches to the Text element's text content + property string label + property color textColor: buttonLabel.color + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "lightsteelblue" + property color borderColor: "transparent" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + property real labelSize: 14 + + //set appearance properties + radius: 6 + smooth: true + border { width: 2; color: borderColor } + width: buttonWidth; height: buttonHeight + + Text { + id: buttonLabel + anchors.centerIn: parent + text: label //bind the text to the parent's text + color: "#DCDCCC" + font.pointSize: labelSize + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + + //define the clickable area to be the whole rectangle + MouseArea { + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + //animate the color whenever the color property changes + Behavior on color { ColorAnimation{ duration: 55 } } + + //scale the button when pressed + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + //Animate the scale property change + Behavior on scale { NumberAnimation{ duration: 55 } } + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/core/editMenu.qml b/examples/declarative/tutorials/gettingStarted/gsQml/core/editMenu.qml new file mode 100644 index 00000000..8dc7b246 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/core/editMenu.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property color buttonBorderColor: "#7A8182" + property color buttonFillColor: "#61BDCACD" + property string menuName:"Edit" + gradient: Gradient { + GradientStop { position: 0.0; color: "#6A7570" } + GradientStop { position: 1.0; color: Qt.darker("#6A7570") } + } + + Rectangle { + id:actionContainer + color:"transparent" + anchors.centerIn: parent + width: parent.width; height: parent.height / 5 + Row { + anchors.centerIn: parent + spacing: parent.width/9 + Button { + id: loadButton + buttonColor: buttonFillColor + label: "Copy" + labelSize: 16 + borderColor: buttonBorderColor + height: actionContainer.height; width: actionContainer.width/6 + onButtonClick: textArea.copy() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button { + id: saveButton + height: actionContainer.height; width: actionContainer.width/6 + buttonColor: buttonFillColor + label: "Paste" + borderColor: buttonBorderColor + labelSize: 16 + onButtonClick: textArea.paste() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button { + id: exitButton + label: "Select All" + height: actionContainer.height; width: actionContainer.width/6 + labelSize: 16 + buttonColor: buttonFillColor + borderColor:buttonBorderColor + onButtonClick: textArea.selectAll() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/core/fileDialog.qml b/examples/declarative/tutorials/gettingStarted/gsQml/core/fileDialog.qml new file mode 100644 index 00000000..b2f845c3 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/core/fileDialog.qml @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id:dialog + height: 200 * partition; width: 200 + color: "transparent" + + signal selectChanged() + signal notifyRefresh() + onNotifyRefresh:dirView.model = directory.files + + property string selectedFile + property int selectedIndex: 0 + + Rectangle { + id: dirBox + radius: 10 + anchors.centerIn:parent + height: parent.height -15; width: parent.width -30 + + Rectangle { + id:header + height: parent.height*0.1; width: parent.width + radius:3 + z:1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + Text { + height: header.height; anchors.centerIn: header + text: "files:" + color: "lightblue" + font.weight: Font.Light + font.italic: true + } + } + GridView { + id:dirView + width:parent.width; height:parent.height*.9 + anchors.top: header.bottom + cellWidth: 100; cellHeight: 75 + model: directory.files + delegate: dirDelegate + clip: true + highlightMoveDuration: 40 + } + Component { + id: dirDelegate + Rectangle { + id:file + color: "transparent" + width: file.GridView.view.cellWidth; height: file.GridView.view.cellHeight + + Text { + id:fileName + width: parent.width + anchors.centerIn: parent + text: name + color: "#BDCACD" + font.weight: file.GridView.view.currentIndex == index ? Font.DemiBold : Font.Normal + font.pointSize: file.GridView.view.currentIndex == index ? 12 : 10 + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + } + Rectangle { + id: selection + width: parent.width; height: parent.height + anchors.centerIn: parent + radius: 10 + smooth: true + scale: file.GridView.view.currentIndex == index ? 1 : 0.5 + opacity: file.GridView.view.currentIndex == index ? 1 : 0 + Text { + id: overlay + width: parent.width + anchors.centerIn: parent + text: name + color: "#696167" + font.weight: Font.DemiBold + font.pointSize: 12 + smooth: true + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + } + Behavior on opacity { NumberAnimation{ duration: 45 } } + Behavior on scale { NumberAnimation{ duration: 45 } } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter("lightsteelblue",1.25) } + GradientStop { position: 0.67; color: Qt.darker("lightsteelblue",1.3) } + } + border.color: "lightsteelblue" + border.width: 1 + } + MouseArea { + id:fileMouseArea + anchors.fill:parent + hoverEnabled: true + + onClicked: { + file.GridView.view.currentIndex = index + selectedFile = directory.files[index].name + selectChanged() + } + onEntered: { + fileName.color = "lightsteelblue" + fileName.font.weight = Font.DemiBold + } + onExited: { + fileName.font.weight = Font.Normal + fileName.color = "#BDCACD" + } + } + } + } + gradient: Gradient { + GradientStop { position: 0.0; color: "#A5333333" } + GradientStop { position: 1.0; color: "#03333333" } + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/core/fileMenu.qml b/examples/declarative/tutorials/gettingStarted/gsQml/core/fileMenu.qml new file mode 100644 index 00000000..87391893 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/core/fileMenu.qml @@ -0,0 +1,232 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + height: 480; width:1000 + property color buttonBorderColor: "#7F8487" + property color buttonFillColor: "#8FBDCACD" + property string fileContent:directory.fileContent + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //used to divide the screen into parts. + property real partition: 1/3 + + color: "#6C646A" + gradient: Gradient { + GradientStop { position: 0.0; color: "#6C646A" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } + } + + Directory { + id:directory + filename: textInput.text + onDirectoryChanged:fileDialog.notifyRefresh() + } + + Rectangle { + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.left: parent.left + + //the height is a good proportion that creates more space at the top of + //the column of buttons + width: fileMenu.width * partition; height: fileMenu.height + + Column { + anchors.centerIn: parent + spacing: parent.height/32 + Button { + id: saveButton + label: "Save" + borderColor: buttonBorderColor + buttonColor: buttonFillColor + width: actionContainer.width/ 1.3 + height:actionContainer.height / 8 + labelSize:24 + onButtonClick: { + directory.fileContent = textArea.textContent + directory.filename = textInput.text + directory.saveFile() + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button { + id: loadButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + label: "Load" + labelSize:24 + onButtonClick:{ + directory.filename = textInput.text + directory.loadFile() + textArea.textContent = directory.fileContent + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button { + id: newButton + width: actionContainer.width/ 1.3 + height: actionContainer.height/ 8 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + label: "New" + labelSize: 24 + onButtonClick:{ + textArea.textContent = "" + textInput.text = "" + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + + } + Rectangle { + id: space + width: actionContainer.width/ 1.3 + height: actionContainer.height / 16 + color: "transparent" + } + Button { + id: exitButton + width: actionContainer.width/ 1.3 + height: actionContainer.height/ 8 + label: "Exit" + labelSize: 24 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + onButtonClick: Qt.quit() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + } + } + Rectangle { + id:dialogContainer + + width: 2*fileMenu.width * partition; height: fileMenu.height + anchors.right:parent.right + color: "transparent" + + Column { + anchors.centerIn: parent + spacing: parent.height /640 + FileDialog { + id:fileDialog + height: 2*dialogContainer.height * partition + width: dialogContainer.width + onSelectChanged: textInput.text = selectedFile + } + + Rectangle { + id:lowerPartition + height: dialogContainer.height * partition; width: dialogContainer.width + color: "transparent" + + Rectangle { + id: nameField + gradient: Gradient { + GradientStop { position: 0.0; color: "#806F6F6F" } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + radius: 10 + anchors { centerIn:parent; leftMargin: 15; rightMargin: 15; topMargin: 15 } + height: parent.height-15 + width: parent.width -20 + border { color: "#4A4A4A"; width:1 } + + TextInput { + id: textInput + z:2 + anchors { bottom: parent.bottom; topMargin: 10; horizontalCenter: parent.horizontalCenter } + width: parent.width - 10 + height: parent.height -10 + font.pointSize: 40 + color: "lightsteelblue" + focus: true + } + Text { + id: textInstruction + anchors.centerIn: parent + text: "Select file name and press save or load" + font {pointSize: 11; weight: Font.Light; italic: true} + color: "lightblue" + z: 2 + opacity: (textInput.text == "") ? 1 : 0 + } + Text { + id:fieldLabel + anchors { top: parent.top; left: parent.left } + text: " file name: " + font { pointSize: 11; weight: Font.Light; italic: true } + color: "lightblue" + z:2 + } + MouseArea { + anchors.centerIn:parent + width: nameField.width; height: nameField.height + onClicked: { + textInput.text = "" + textInput.focus = true + textInput.forceFocus() + } + } + } + } + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/core/menuBar.qml b/examples/declarative/tutorials/gettingStarted/gsQml/core/menuBar.qml new file mode 100644 index 00000000..8ddb03ae --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/core/menuBar.qml @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000; height:300 + color:"transparent" + property color fileColor: "plum" + property color editColor: "powderblue" + + property real partition: 1/10 + + Column { + anchors.fill: parent + //container for the header and the buttons + z: 1 + Rectangle { + id: labelList + height:menuBar.height*partition + width: menuBar.width + color: "beige" + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + Text { + height: parent.height + anchors { right: labelRow.left ; verticalCenter: parent.bottom } + text: "menu: " + color: "lightblue" + font { weight: Font.Light; italic: true } + smooth: true + } + //row displays its children in a vertical row + Row { + id: labelRow + anchors.centerIn: parent + spacing:40 + Button { + id: fileButton + height: 20; width: 50 + label: "File" + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + labelSize: menuListView.currentIndex == 0? 16:12 + radius: 1 + smooth:true + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: menuListView.currentIndex = 0 + gradient: Gradient { + GradientStop { position: 0.0; color: fileColor } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + } + Button { + id: editButton + height: 20; width: 50 + buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + labelSize: menuListView.currentIndex == 1? 16:12 + smooth:true + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: menuListView.currentIndex = 1 + gradient: Gradient { + GradientStop { position: 0.0; color: editColor } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + } + } + } + + //list view will display a model according to a delegate + ListView { + id: menuListView + width:menuBar.width; height: 9*menuBar.height*partition + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + } + //a list of visual items already have delegates handling their display + VisualItemModel { + id: menuListModel + + FileMenu { + id:fileMenu + width: menuListView.width; height: menuListView.height + color: fileColor + } + EditMenu { + color: editColor + width: menuListView.width; height: menuListView.height + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/core/qmldir b/examples/declarative/tutorials/gettingStarted/gsQml/core/qmldir new file mode 100644 index 00000000..32dc8071 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/core/qmldir @@ -0,0 +1,9 @@ +Button ./button.qml +FileDialog ./fileDialog.qml +TextArea ./textArea.qml +TextEditor ./textEditor.qml +EditMenu ./editMenu.qml +MenuBar ./menuBar.qml +FileMenu ./fileMenu.qml + +plugin FileDialog ../plugins diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/core/textArea.qml b/examples/declarative/tutorials/gettingStarted/gsQml/core/textArea.qml new file mode 100644 index 00000000..6e392ac9 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/core/textArea.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id:textArea + + function paste() { textEdit.paste() } + function copy() { textEdit.copy() } + function selectAll() { textEdit.selectAll() } + + width :400; height:400 + + property color fontColor: "white" + property alias textContent: textEdit.text + Flickable { + id: flickArea + width: parent.width; height: parent.height + anchors.fill:parent + + boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.HorizontalFlick + interactive: true + //Will move the text Edit area to make the area visible when + //scrolled with keyboard strokes + function ensureVisible(r) { + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit { + id: textEdit + anchors.fill:parent + width:parent.width; height:parent.height + color:fontColor + focus: true + wrapMode: TextEdit.Wrap + font.pointSize:10 + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + selectByMouse: true + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp new file mode 100644 index 00000000..bc711932 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "dialogPlugin.h" +#include "directory.h" +#include "file.h" +#include + +void DialogPlugin::registerTypes(const char *uri) +{ + //register the class Directory into QML as a "Directory" element version 1.0 + qmlRegisterType(uri, 1, 0, "Directory"); + qmlRegisterType(uri,1,0,"File"); +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h new file mode 100644 index 00000000..e87b7e82 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DIALOGPLUGIN_H +#define DIALOGPLUGIN_H + +#include + +class DialogPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "filedialog.json") + + public: + //registerTypes is inherited from QDeclarativeExtensionPlugin + void registerTypes(const char *uri); + +}; + +#endif + diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/directory.cpp b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/directory.cpp new file mode 100644 index 00000000..fe5018b1 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/directory.cpp @@ -0,0 +1,224 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "directory.h" +#include + +/* +Directory constructor + +Initialize the saves directory and creates the file list +*/ +Directory::Directory(QObject *parent) : QObject(parent) +{ + m_dir.cd( QDir::currentPath() ); + + //go to the saved directory. if not found, create save directory + m_saveDir = "saves"; + if ( m_dir.cd(m_saveDir) == 0 ) { + m_dir.mkdir(m_saveDir); + m_dir.cd(m_saveDir); + } + m_filterList << "*.txt"; + refresh(); +} + +/* +Directory::filesNumber +Return the number of Files +*/ +int Directory::filesCount() const +{ + return m_fileList.size(); +} + +/* +Function called to append data onto list property +*/ +void appendFiles(QDeclarativeListProperty * property, File * file) +{ + Q_UNUSED(property); + Q_UNUSED(file); + //Do nothing. can't add to a directory using this method +} + +/* +Function called to retrieve file in the list using an index +*/ +File* fileAt(QDeclarativeListProperty * property, int index) +{ + return static_cast< QList *>(property->data)->at(index); +} + +/* +Returns the number of files in the list +*/ +int filesSize(QDeclarativeListProperty * property) +{ + return static_cast< QList *>(property->data)->size(); +} + +/* +Function called to empty the list property contents +*/ +void clearFilesPtr(QDeclarativeListProperty *property) +{ + return static_cast< QList *>(property->data)->clear(); +} + +/* +Returns the list of files as a QDeclarativeListProperty. +*/ +QDeclarativeListProperty Directory::files() +{ + refresh(); + return QDeclarativeListProperty( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr ); +} + +/* +Return the name of the currently selected file +*/ +QString Directory::filename() const +{ + return currentFile.name(); +} + +/* +Return the file's content as a string. +*/ +QString Directory::fileContent() const +{ + return m_fileContent; +} + +/* +Set the file name of the current file +*/ +void Directory::setFilename(const QString &str) +{ + if( str != currentFile.name() ) { + currentFile.setName(str); + emit filenameChanged(); + } +} + +/* +Set the content of the file as a string +*/ +void Directory::setFileContent(const QString &str) +{ + if(str != m_fileContent){ + m_fileContent = str; + emit fileContentChanged(); + } +} + +/* +Called from QML to save the file using the filename and file content. +Saving makes sure that the file has a .txt extension. +*/ +void Directory::saveFile() +{ + if(currentFile.name().size() == 0){ + qWarning()<< "Empty filename. no save"; + return; + } + QString extendedName = currentFile.name(); + if(!currentFile.name().endsWith(".txt")){ + extendedName.append(".txt"); + } + QFile file( m_dir.filePath(extendedName) ); + if ( file.open(QFile::WriteOnly | QFile::Truncate) ) { + QTextStream outStream(&file); + outStream << m_fileContent; + } + file.close(); + refresh(); + emit directoryChanged(); +} + +/* +Load the contents of a file. +Only loads files with a .txt extension +*/ +void Directory::loadFile() +{ + m_fileContent.clear(); + QString extendedName = currentFile.name(); + if( !currentFile.name().endsWith(".txt") ) { + extendedName.append(".txt"); + } + + QFile file( m_dir.filePath(extendedName) ); + if ( file.open(QFile::ReadOnly ) ) { + QTextStream inStream(&file); + + QString line; + do { + line = inStream.read(75); + m_fileContent.append(line); + } while ( !line.isNull() ) ; + } + file.close(); +} + +/* +Reloads the content of the files list. This is to ensure that the newly +created files are added onto the list. +*/ +void Directory::refresh() +{ + m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name); + m_fileList.clear(); + + File * file; + for(int i = 0; i < m_dirFiles.size() ; i ++) { + file = new File(); + + if( m_dirFiles.at(i).endsWith(".txt") ) { + QString name = m_dirFiles.at(i); + file->setName( name.remove(".txt",Qt::CaseSensitive) ); + } + else { + file->setName(m_dirFiles.at(i)); + } + m_fileList.append(file); + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/directory.h b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/directory.h new file mode 100644 index 00000000..90e15781 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/directory.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DIRECTORY_H +#define DIRECTORY_H + +#include "file.h" + +#include +#include +#include +#include +#include + +class Directory : public QObject { + + Q_OBJECT + + //number of files in the directory + Q_PROPERTY(int filesCount READ filesCount) + + //list property containing file names as QString + Q_PROPERTY(QDeclarativeListProperty files READ files CONSTANT ) + + //file name of the text file to read/write + Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) + + //text content of the file + Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) + + public: + Directory(QObject *parent = 0); + + //properties' read functions + int filesCount() const; + QString filename() const; + QString fileContent() const; + QDeclarativeListProperty files(); + + //properties' write functions + void setFilename(const QString &str); + void setFileContent(const QString &str); + + //accessible from QML + Q_INVOKABLE void saveFile(); + Q_INVOKABLE void loadFile(); + + signals: + void directoryChanged(); + void filenameChanged(); + void fileContentChanged(); + + private: + QDir m_dir; + QStringList m_dirFiles; + File currentFile; + QString m_saveDir; + QStringList m_filterList; + + //contains the file data in QString format + QString m_fileContent; + + //Registered to QML in a plugin. Accessible from QML as a property of Directory + QList m_fileList; + + //refresh content of the directory + void refresh(); +}; + +#endif diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/file.cpp b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/file.cpp new file mode 100644 index 00000000..7921489c --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/file.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "file.h" + +File::File(QObject *parent) : QObject(parent) +{ + m_name = ""; +} + +QString File::name() const{ + return m_name; +} +void File::setName(const QString &str){ + if(str != m_name){ + m_name = str; + emit nameChanged(); + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/file.h b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/file.h new file mode 100644 index 00000000..ee93aa2e --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/file.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FILE_H +#define FILE_H + + +#include +#include + +class File : public QObject{ + + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + + public: + File(QObject *parent = 0); + + QString name() const; + void setName(const QString &str); + + signals: + void nameChanged(); + + private: + QString m_name; +}; + +#endif diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/filedialog.json b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/filedialog.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/filedialog.json @@ -0,0 +1 @@ +{} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/filedialog.pro b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/filedialog.pro new file mode 100644 index 00000000..d85787d0 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/filedialog.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG += qt plugin +QT += declarative + +DESTDIR += ../plugins +OBJECTS_DIR = tmp +MOC_DIR = tmp + +TARGET = FileDialog + +HEADERS += directory.h \ + file.h \ + dialogPlugin.h + +SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/qmldir b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/qmldir new file mode 100644 index 00000000..c2b27dad --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/filedialog/qmldir @@ -0,0 +1 @@ +plugin FileDialog plugins diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/images/arrow.png b/examples/declarative/tutorials/gettingStarted/gsQml/images/arrow.png new file mode 100644 index 00000000..14978c2e Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/images/arrow.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part0/Button.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part0/Button.qml new file mode 100644 index 00000000..0794e8a2 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part0/Button.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import QtQuick 1.0 + +Rectangle { + id: simplebutton + color: "grey" + width: 150; height: 75 + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: "button label" + } +} +//! [document] diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/Button.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/Button.qml new file mode 100644 index 00000000..1048711a --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/Button.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius: 10 + smooth: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml new file mode 100644 index 00000000..cf5e481d --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml new file mode 100644 index 00000000..b74ea0e4 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml new file mode 100644 index 00000000..a1512e0b --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: simplebutton + + //the rectangle's fill color + color: "grey" + + //dimensions of the button + width: 150; height: 75 + + //A text element contains functionalities for creating texts + Text { + id: buttonLabel + + //center the text inside the parent + anchors.centerIn: parent + + //text property binds to the label displayed on the button + text: "button label" + } + + //define the clickable area to be the whole rectangle + MouseArea { + id: buttonMouseArea + anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors + + //onClicked handles valid mouse button clicks + onClicked: console.log(buttonLabel.text + " clicked" ) + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png new file mode 100644 index 00000000..aab64bcf Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png new file mode 100644 index 00000000..d3ff66f2 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png new file mode 100644 index 00000000..f2e2b0d9 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png new file mode 100644 index 00000000..21ce5092 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject new file mode 100644 index 00000000..d4909f86 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/Button.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/Button.qml new file mode 100644 index 00000000..744d4bf4 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/Button.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + smooth: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml new file mode 100644 index 00000000..20f88545 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml new file mode 100644 index 00000000..75aac68b --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml new file mode 100644 index 00000000..c53196a4 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000 + height:300 + + property color fileColor: "thistle" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "steelblue" + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png new file mode 100644 index 00000000..da959a34 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject new file mode 100644 index 00000000..d4909f86 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/Button.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/Button.qml new file mode 100644 index 00000000..744d4bf4 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/Button.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + smooth: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml new file mode 100644 index 00000000..20f88545 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml new file mode 100644 index 00000000..75aac68b --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml new file mode 100644 index 00000000..c53196a4 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000 + height:300 + + property color fileColor: "thistle" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "steelblue" + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml new file mode 100644 index 00000000..4b09eff5 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id:textArea + + width :400 + height:400 + color: "white" + + Flickable{ + id: flickArea + + width: parent.width + height: parent.height + anchors.fill:parent + + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit{ + id: textEditor + anchors.fill:parent + width:parent.width; height:parent.height + color:"midnightblue" + focus: true + + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml new file mode 100644 index 00000000..61beb1c6 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + id: screen + width: 1000; height: 1000 + border.color:"black" + //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar + property int partition: height/3 + + MenuBar{ + id:menuBar + height: partition + width:parent.width + z: 1 + } + + + TextArea{ + id:textArea + anchors.bottom:parent.bottom + y: partition + color: "azure" + height: partition*2 + width:parent.width + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png new file mode 100644 index 00000000..14978c2e Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png new file mode 100644 index 00000000..d0623b5a Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject new file mode 100644 index 00000000..d4909f86 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/Button.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/Button.qml new file mode 100644 index 00000000..e0ba7ed7 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/Button.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //attaches to the Text element's text content + property string label + property color textColor: buttonLabel.color + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + smooth: true + border.color: "white" + border.width: 3 + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label //"button label" //bind the text to the parent's text + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + //animate the color whenever the color property changes + Behavior on color { ColorAnimation{ duration: 55} } + + //scale the button when pressed + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + //Animate the scale property change + Behavior on scale { NumberAnimation{ duration: 55} } + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml new file mode 100644 index 00000000..7177ed25 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6A6F70" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D67") } + } + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml new file mode 100644 index 00000000..f897be60 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6C646A" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } + } + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml new file mode 100644 index 00000000..7dbb1c9a --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000 + height:300 + + property color fileColor: "plum" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "beige" + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml new file mode 100644 index 00000000..df28ba3f --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: simplebutton + color: "grey" + width: 150; height: 75 + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: "button label" + } + + MouseArea{ + id: buttonMouseArea + anchors.fill: parent + onClicked: console.log(buttonLabel.text + " clicked" ) + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml new file mode 100644 index 00000000..f83e5d49 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id:textArea + + width :400 + height:400 + property color fontColor: "white" + + Flickable{ + id: flickArea + + width: parent.width + height: parent.height + anchors.fill:parent + + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit{ + id: textEditor + anchors.fill:parent + width:parent.width; height:parent.height + color:fontColor + focus: true + + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml new file mode 100644 index 00000000..35d0e88c --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: screen + width: 1000; height: 1000 + property int partition: height/3 + state: "DRAWER_CLOSED" + + + //Item 1: MenuBar on the top portion of the screen + MenuBar{ + id:menuBar + height: partition + //anchors.top:parent.top + width:parent.width + z:1 + } + + + //Item 2: The editable text area + TextArea{ + id:textArea + y:drawer.height + border.color: Qt.darker(color, 1.4) + border.width: 2 + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2 + width:parent.width + } + + //Item 3: The drawer handle + Rectangle{ + id:drawer + height:15 + width: parent.width + border.color : "#6A6D6A" + border.width: 1 + + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + + Image{ + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + + Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} + } + + MouseArea{ + id: drawerMouseArea + anchors.fill:parent + onClicked:{ + if (screen.state == "DRAWER_CLOSED"){ + screen.state = "DRAWER_OPEN" + console.log("drawer OPEN") + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + console.log("drawer closed") + } + } + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = "#6A6D6A" + } + + } + states:[ + State{ + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y:0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State{ + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-partition} + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} + PropertyChanges { target: drawer; y: 0} + PropertyChanges { target: arrowIcon; rotation: 0} + } + + ] + transitions: [ + Transition{ + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + } + + ] +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png new file mode 100644 index 00000000..14978c2e Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png new file mode 100644 index 00000000..a195fb87 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject new file mode 100644 index 00000000..d4909f86 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml new file mode 100644 index 00000000..84d8d874 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "core" + +Rectangle { + id: screen + width: 1000; height: 1000 + property int partition: height/3 + state: "DRAWER_CLOSED" + + //Item 1: MenuBar on the top portion of the screen + MenuBar{ + id:menuBar + height: screen.partition; width: screen.width + z:1 + } + //Item 2: The editable text area + TextArea{ + id:textArea + y:drawer.height + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2; width:parent.width + } + //Item 3: The drawer handle + Rectangle{ + id:drawer + height:15; width: parent.width + border.color : "#6A6D6A" + border.width: 1 + z:1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + Image{ + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + + Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} + } + + MouseArea{ + id: drawerMouseArea + anchors.fill:parent + hoverEnabled: true + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + onExited: parent.border.color = "#6A6D6A" + onClicked:{ + if (screen.state == "DRAWER_CLOSED"){ + screen.state = "DRAWER_OPEN" + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + } + } + } + } + + states:[ + State{ + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y: 0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State{ + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-height; } + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} + PropertyChanges { target: drawer; y: 0} + PropertyChanges { target: arrowIcon; rotation: 0} + } + ] + + transitions: [ + Transition{ + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + } + ] +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml new file mode 100644 index 00000000..9c15a1aa --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //attaches to the Text element's text content + property string label + property color textColor: buttonLabel.color + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "lightsteelblue" + property color borderColor: "transparent" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + property real labelSize: 14 + //set appearance properties + radius:6 + smooth: true + border.width: 2 + border.color: borderColor + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label //bind the text to the parent's text + color: "#DCDCCC" + font.pointSize: labelSize + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + //animate the color whenever the color property changes + Behavior on color { ColorAnimation{ duration: 55} } + + //scale the button when pressed + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + //Animate the scale property change + Behavior on scale { NumberAnimation{ duration: 55} } + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml new file mode 100644 index 00000000..1677440f --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property color buttonBorderColor: "#7A8182" + property color buttonFillColor: "#61BDCACD" + property string menuName:"Edit" + + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6A7570" } + GradientStop { position: 1.0; color: Qt.darker("#6A7570") } + } + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/9 + Button{ + id: loadButton + buttonColor: buttonFillColor + label: "Copy" + labelSize:16 + borderColor:buttonBorderColor + height: actionContainer.height + width: actionContainer.width/6 + onButtonClick:textArea.copy() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + + Button{ + id: saveButton + height: actionContainer.height + width: actionContainer.width/6 + buttonColor: buttonFillColor + label: "Paste" + borderColor:buttonBorderColor + labelSize:16 + onButtonClick:textArea.paste() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button{ + id: exitButton + label: "Select All" + height: actionContainer.height + width: actionContainer.width/6 + labelSize:16 + buttonColor: buttonFillColor + borderColor:buttonBorderColor + onButtonClick:textArea.selectAll() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml new file mode 100644 index 00000000..ca9e5c23 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id:dialog + height: 200 * partition; width: 200 + color: "transparent" + + signal selectChanged() + signal notifyRefresh() + onNotifyRefresh:dirView.model = directory.files + + property string selectedFile + property int selectedIndex: 0 + + Rectangle{ + id: dirBox + radius: 10 + anchors.centerIn:parent + height: parent.height -15; width: parent.width -30 + + Rectangle{ + id:header + height:parent.height*0.1 + width: parent.width + radius:3 + z:1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + Text{ + height: header.height + anchors.centerIn: header + text: "files:" + color: "lightblue" + font.weight: Font.Light + font.italic: true + } + } + GridView{ + id:dirView + width:parent.width + height:parent.height*.9 + anchors.top: header.bottom + cellWidth: 100 + cellHeight: 75 +// highlight: Rectangle { width:cellWidth; height: cellHeight; color: "lightsteelblue" ;radius: 13} + model: directory.files + delegate: dirDelegate + clip: true + highlightMoveDuration:40 + } + + Component{ + id:dirDelegate + + Rectangle{ + id:file + color: "transparent" + width: file.GridView.view.cellWidth; height: file.GridView.view.cellHeight + + Text{ + id:fileName + width: parent.width + anchors.centerIn:parent + text: name + color: "#BDCACD" + font.weight: file.GridView.view.currentIndex == index ? Font.DemiBold : Font.Normal + font.pointSize: file.GridView.view.currentIndex == index ? 12 : 10 + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + } + Rectangle{ + id:selection + width:parent.width; height:parent.height + anchors.centerIn: parent + radius: 10 + smooth: true + scale: file.GridView.view.currentIndex == index ? 1 : 0.5 + opacity: file.GridView.view.currentIndex == index ? 1 : 0 + Text{ + id:overlay + width: parent.width + anchors.centerIn:parent + text: name + color: "#696167" + font.weight: Font.DemiBold + font.pointSize: 12 + smooth:true + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + } + Behavior on opacity{ NumberAnimation{ duration: 45} } + Behavior on scale { NumberAnimation{ duration: 45} } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter("lightsteelblue",1.25) } + GradientStop { position: 0.67; color: Qt.darker("lightsteelblue",1.3) } + } + border.color:"lightsteelblue" + border.width:1 + } + MouseArea{ + id:fileMouseArea + anchors.fill:parent + hoverEnabled: true + + onClicked:{ + file.GridView.view.currentIndex = index + selectedFile = directory.files[index].name + selectChanged() + } + onEntered:{ + fileName.color = "lightsteelblue" + fileName.font.weight = Font.DemiBold + } + onExited: { + fileName.font.weight = Font.Normal + fileName.color = "#BDCACD" + } + } + } + } + gradient: Gradient{ + GradientStop { position: 0.0; color: "#A5333333" } + GradientStop { position: 1.0; color: "#03333333" } + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml new file mode 100644 index 00000000..c4bbad00 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml @@ -0,0 +1,232 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + height: 480; width:1000 + property color buttonBorderColor: "#7F8487" + property color buttonFillColor: "#8FBDCACD" + property string fileContent:directory.fileContent + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //used to divide the screen into parts. + property real partition: 1/3 + + color: "#6C646A" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6C646A" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } + } + + Directory{ + id:directory + filename: textInput.text + onDirectoryChanged:fileDialog.notifyRefresh() + } + + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.left: parent.left + + //the height is a good proportion that creates more space at the top of the column of buttons + width: fileMenu.width * partition; height: fileMenu.height + + Column{ + anchors.centerIn: parent + spacing: parent.height/32 + Button{ + id: saveButton + label: "Save" + borderColor: buttonBorderColor + buttonColor: buttonFillColor + width: actionContainer.width/ 1.3 + height:actionContainer.height / 8 + labelSize:24 + onButtonClick:{ + directory.fileContent = textArea.textContent + directory.filename = textInput.text + directory.saveFile() + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + + } + Button{ + id: loadButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + label: "Load" + labelSize:24 + onButtonClick:{ + directory.filename = textInput.text + directory.loadFile() + textArea.textContent = directory.fileContent + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button{ + id: newButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + label: "New" + labelSize:24 + onButtonClick:{ + textArea.textContent = "" + textInput.text = "" + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + + } + Rectangle{ + id: space + width: actionContainer.width/ 1.3 + height:actionContainer.height / 16 + color:"transparent" + } + Button{ + id: exitButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + label: "Exit" + labelSize:24 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + onButtonClick:Qt.quit() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + } + } + + Rectangle{ + id:dialogContainer + + width: 2*fileMenu.width * partition; height: fileMenu.height + anchors.right:parent.right + color:"transparent" + + Column { + anchors.centerIn: parent + spacing: parent.height /640 + FileDialog{ + id:fileDialog + height: 2*dialogContainer.height * partition; width: dialogContainer.width + onSelectChanged: textInput.text = selectedFile + } + + Rectangle{ + id:lowerPartition + height: dialogContainer.height * partition; width: dialogContainer.width + color: "transparent" + + Rectangle{ + id: nameField + gradient: Gradient{ + GradientStop { position: 0.0; color: "#806F6F6F" } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + + radius: 10 + anchors {centerIn:parent; leftMargin: 15; rightMargin: 15; topMargin: 15} + height: parent.height-15; width: parent.width -20 + border {color:"#4A4A4A"; width:1} + + TextInput{ + id: textInput + z:2 + anchors {bottom: parent.bottom; topMargin: 10; horizontalCenter:parent.horizontalCenter} + width: parent.width - 10 + height: parent.height -10 + font.pointSize: 40 + color:"lightsteelblue" + focus:true + } + Text{ + id: textInstruction + anchors.centerIn:parent + text: "Select file name and press save or load" + font {pointSize: 11; weight:Font.Light; italic: true} + color: "lightblue" + z:2 + opacity: (textInput.text == "") ? 1: 0 + } + Text{ + id:fieldLabel + anchors {top: parent.top; left: parent.left} + text: " file name: " + font {pointSize: 11; weight: Font.Light; italic: true} + color: "lightblue" + z:2 + } + MouseArea{ + anchors.centerIn:parent + width: nameField.width; height: nameField.height + onClicked:{ + textInput.text = "" + textInput.focus = true + textInput.forceFocus() + } + } + } + } + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml new file mode 100644 index 00000000..db698518 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000; height:300 + color:"transparent" + property color fileColor: "plum" + property color editColor: "powderblue" + + property real partition: 1/10 + + Column{ + anchors.fill: parent + //container for the header and the buttons + z: 1 + Rectangle{ + id: labelList + height:menuBar.height*partition + width: menuBar.width + color: "beige" + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + Text{ + height: parent.height + anchors {right: labelRow.left ; verticalCenter: parent.bottom} + text: "menu: " + color: "lightblue" + font {weight: Font.Light; italic: true} + smooth: true + } + + //row displays its children in a vertical row + Row{ + id: labelRow + anchors.centerIn: parent + spacing:40 + Button{ + id: fileButton + height: 20; width: 50 + label: "File" + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + labelSize: menuListView.currentIndex == 0? 16:12 + radius: 1 + smooth:true + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: menuListView.currentIndex = 0 + gradient: Gradient{ + GradientStop { position: 0.0; color: fileColor } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + } + Button{ + id: editButton + height: 20; width: 50 + buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + labelSize: menuListView.currentIndex == 1? 16:12 + smooth:true + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: menuListView.currentIndex = 1 + gradient: Gradient{ + GradientStop { position: 0.0; color: editColor } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + } + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + width:menuBar.width; height: 9*menuBar.height*partition + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + } + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + id:fileMenu + width: menuListView.width; height: menuListView.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width; height: menuListView.height + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml new file mode 100644 index 00000000..64a1bae6 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id:textArea + + function paste(){ textEdit.paste()} + function copy() { textEdit.copy() } + function selectAll() { textEdit.selectAll() } + + width :400; height:400 + + property color fontColor: "white" + property alias textContent: textEdit.text + Flickable{ + id: flickArea + width: parent.width; height: parent.height + anchors.fill:parent + + boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.HorizontalFlick + interactive: true + //Will move the text Edit area to make the area visible when scrolled with keyboard strokes + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit{ + id: textEdit + anchors.fill:parent + width:parent.width; height:parent.height + color:fontColor + focus: true + wrapMode: TextEdit.Wrap + font.pointSize:10 + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + selectByMouse: true + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir new file mode 100644 index 00000000..3f22778a --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir @@ -0,0 +1,13 @@ + +Button ./Button.qml +FileDialog ./FileDialog.qml +TextArea ./TextArea.qml +TextEditor ./TextEditor.qml +EditMenu ./EditMenu.qml +MenuBar ./MenuBar.qml + +plugin FileDialog ../plugins + + + + diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp new file mode 100644 index 00000000..286374d8 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "dialogPlugin.h" +#include "directory.h" +#include "file.h" +#include + +void DialogPlugin::registerTypes(const char *uri){ + + //register the class Directory into QML as a "Directory" element version 1.0 + qmlRegisterType(uri, 1, 0, "Directory"); + qmlRegisterType(uri,1,0,"File"); + + //qRegisterMetaType > ("QDeclarativeListProperty"); + +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h new file mode 100644 index 00000000..ddcf82be --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DIALOGPLUGIN_H +#define DIALOGPLUGIN_H + +#include + +class DialogPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "filedialog.json") + + public: + //registerTypes is inherited from QDeclarativeExtensionPlugin + void registerTypes(const char *uri); + +}; + +#endif + diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp new file mode 100644 index 00000000..c5f455c7 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp @@ -0,0 +1,219 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "directory.h" +#include + +/* +Directory constructor + +Initialize the saves directory and creates the file list +*/ +Directory::Directory(QObject *parent) : QObject(parent) +{ + + + m_dir.cd( QDir::currentPath()); + + //go to the saved directory. if not found, create save directory + m_saveDir = "saves"; + if (m_dir.cd(m_saveDir) == 0){ + m_dir.mkdir(m_saveDir); + m_dir.cd(m_saveDir); + } + m_filterList << "*.txt"; + + refresh(); +} + +/* +Directory::filesNumber +Return the number of Files +*/ +int Directory:: filesCount() const{ + return m_fileList.size(); +} + +/* +Function called to append data onto list property +*/ +void appendFiles(QDeclarativeListProperty * property, File * file){ + //Do nothing. can't add to a directory using this method +} + +/* +Function called to retrieve file in the list using an index +*/ +File* fileAt(QDeclarativeListProperty * property, int index){ + return static_cast< QList *>(property->data)->at(index); +} + +/* +Returns the number of files in the list +*/ +int filesSize(QDeclarativeListProperty * property){ + return static_cast< QList *>(property->data)->size(); +} + +/* +Function called to empty the list property contents +*/ +void clearFilesPtr(QDeclarativeListProperty *property){ + return static_cast< QList *>(property->data)->clear(); +} + +/* +Returns the list of files as a QDeclarativeListProperty. +*/ +QDeclarativeListProperty Directory::files(){ + + refresh(); +// return QDeclarativeListProperty(this,m_filePtrList); //not recommended in the docs + return QDeclarativeListProperty( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr ); +} + +/* +Return te name of the currently selected file +*/ +QString Directory::filename() const{ + return currentFile.name(); +} + +/* +Return the file's content as a string. +*/ +QString Directory::fileContent() const{ + return m_fileContent; +} + +/* +Set the file name of the current file +*/ +void Directory::setFilename(const QString &str){ + if(str != currentFile.name()){ + currentFile.setName(str); + emit filenameChanged(); + } +} + +/* +Set the content of the file as a string +*/ +void Directory::setFileContent(const QString &str){ + if(str != m_fileContent){ + m_fileContent = str; + emit fileContentChanged(); + } +} + +/* +Called from QML to save the file using the filename and file content. +Saving makes sure that the file has a .txt extension. +*/ +void Directory::saveFile(){ + + if(currentFile.name().size() == 0){ + qWarning()<< "Empty filename. no save"; + return; + } + + QString extendedName = currentFile.name(); + if(!currentFile.name().endsWith(".txt")){ + extendedName.append(".txt"); + } + + QFile file( m_dir.filePath(extendedName) ); + if (file.open(QFile::WriteOnly | QFile::Truncate)){ + QTextStream outStream(&file); + outStream << m_fileContent; + } + file.close(); + refresh(); + emit directoryChanged(); +} + +/* +Load the contents of a file. +Only loads files with a .txt extension +*/ +void Directory::loadFile(){ + + m_fileContent.clear(); + QString extendedName = currentFile.name(); + if(!currentFile.name().endsWith(".txt")){ + extendedName.append(".txt"); + } + + QFile file( m_dir.filePath(extendedName) ); + if (file.open(QFile::ReadOnly )){ + QTextStream inStream(&file); + + QString line; + do{ + line = inStream.read(75); + m_fileContent.append(line); + }while (!line .isNull()); + } + file.close(); +} + +/* +Reloads the content of the files list. This is to ensure that the newly +created files are added onto the list. +*/ +void Directory::refresh(){ + m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name); + m_fileList.clear(); + + File * file; + for(int i = 0; i < m_dirFiles.size() ; i ++){ + + file = new File(); + + if(m_dirFiles.at(i).endsWith(".txt")){ + QString name = m_dirFiles.at(i); + file->setName( name.remove(".txt",Qt::CaseSensitive)); + } + else{ + file->setName(m_dirFiles.at(i)); + } + m_fileList.append(file); + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h new file mode 100644 index 00000000..1d01372e --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DIRECTORY_H +#define DIRECTORY_H + +#include "file.h" + +#include +#include +#include +#include +#include + +class Directory : public QObject{ + + Q_OBJECT + + //number of files in the directory + Q_PROPERTY(int filesCount READ filesCount) + + //list property containing file names as QString + Q_PROPERTY(QDeclarativeListProperty files READ files CONSTANT ) + + //file name of the text file to read/write + Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) + + //text content of the file + Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) + + public: + Directory(QObject *parent = 0); + + //properties' read functions + int filesCount() const; + QString filename() const; + QString fileContent() const; + QDeclarativeListProperty files(); + + //properties' write functions + void setFilename(const QString &str); + void setFileContent(const QString &str); + + //accessible from QML + Q_INVOKABLE void saveFile(); + Q_INVOKABLE void loadFile(); + + signals: + void directoryChanged(); + void filenameChanged(); + void fileContentChanged(); + + private: + QDir m_dir; + QStringList m_dirFiles; + File currentFile; + QString m_saveDir; + QStringList m_filterList; + + //contains the file data in QString format + QString m_fileContent; + + //Registered to QML in a plugin. Accessible from QML as a property of Directory + QList m_fileList; + + //refresh content of the directory + void refresh(); +}; + + +#endif diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp new file mode 100644 index 00000000..9da61921 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "file.h" + +File::File(QObject *parent) : QObject(parent) +{ + m_name = ""; +} + +QString File::name() const{ + return m_name; +} +void File::setName(const QString &str){ + if(str != m_name){ + m_name = str; + emit nameChanged(); + } +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h new file mode 100644 index 00000000..76c192e3 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FILE_H +#define FILE_H + + +#include +#include + +class File : public QObject{ + + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + + public: + File(QObject *parent = 0); + + QString name() const; + void setName(const QString &str); + + signals: + void nameChanged(); + + private: + QString m_name; +}; + +#endif diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.json b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.json @@ -0,0 +1 @@ +{} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro new file mode 100644 index 00000000..62477470 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG += qt plugin +QT += declarative + +DESTDIR += ../plugins +OBJECTS_DIR = tmp +MOC_DIR = tmp + +TARGET = FileDialog + +HEADERS += directory.h \ + file.h \ + dialogPlugin.h + +SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir new file mode 100644 index 00000000..c2b27dad --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir @@ -0,0 +1 @@ +plugin FileDialog plugins diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png new file mode 100644 index 00000000..14978c2e Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png new file mode 100644 index 00000000..27feed5e Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png new file mode 100644 index 00000000..4d8f9f22 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png new file mode 100644 index 00000000..680acfe8 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject new file mode 100644 index 00000000..ed034dff --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject @@ -0,0 +1,18 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + directory: "core" + directory: "filedialog" + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + importPaths: [ " ./plugins " ] +} diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_editmenu.png b/examples/declarative/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_editmenu.png new file mode 100644 index 00000000..27feed5e Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_editmenu.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_filemenu.png b/examples/declarative/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_filemenu.png new file mode 100644 index 00000000..4d8f9f22 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_filemenu.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_newfile.png b/examples/declarative/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_newfile.png new file mode 100644 index 00000000..680acfe8 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_newfile.png differ diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/texteditor.pro b/examples/declarative/tutorials/gettingStarted/gsQml/texteditor.pro new file mode 100644 index 00000000..aa5306cc --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/texteditor.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +SUBDIRS = \ + filedialog\ + diff --git a/examples/declarative/tutorials/gettingStarted/gsQml/texteditor.qml b/examples/declarative/tutorials/gettingStarted/gsQml/texteditor.qml new file mode 100644 index 00000000..84bb0c7d --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/gsQml/texteditor.qml @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "core" + +Rectangle { + id: screen + width: 1000; height: 1000 + property int partition: height/3 + border { width: 1; color: "#DCDCCC"} + state: "DRAWER_CLOSED" + + //Item 1: MenuBar on the top portion of the screen + MenuBar { + id:menuBar + height: screen.partition; width: screen.width + z: 1 + } + + //Item 2: The editable text area + TextArea { + id: textArea + y: drawer.height + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2; width:parent.width + } + + //Item 3: The drawer handle + Rectangle { + id: drawer + height: 15; width: parent.width + border { color : "#6A6D6A"; width: 1 } + z: 1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + Image { + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + Behavior{ NumberAnimation { property: "rotation"; easing.type: Easing.OutExpo } } + } + + MouseArea { + id: drawerMouseArea + anchors.fill: parent + hoverEnabled: true + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + onExited: parent.border.color = "#6A6D6A" + onClicked: { + if (screen.state == "DRAWER_CLOSED") { + screen.state = "DRAWER_OPEN" + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + } + } + } + } + +//! [states] + states:[ + State { + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y: 0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State { + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-height; } + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height } + PropertyChanges { target: drawer; y: 0 } + PropertyChanges { target: arrowIcon; rotation: 0 } + } + ] +//! [states] + +//! [transitions] + transitions: [ + Transition { + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100; easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100; easing.type: Easing.OutExpo } + } + ] +//! [transitions] +} diff --git a/examples/declarative/tutorials/gettingStarted/images/arrow.png b/examples/declarative/tutorials/gettingStarted/images/arrow.png new file mode 100644 index 00000000..14978c2e Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/images/arrow.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part0/Button.qml b/examples/declarative/tutorials/gettingStarted/parts/part0/Button.qml new file mode 100644 index 00000000..0794e8a2 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part0/Button.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import QtQuick 1.0 + +Rectangle { + id: simplebutton + color: "grey" + width: 150; height: 75 + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: "button label" + } +} +//! [document] diff --git a/examples/declarative/tutorials/gettingStarted/parts/part1/Button.qml b/examples/declarative/tutorials/gettingStarted/parts/part1/Button.qml new file mode 100644 index 00000000..1048711a --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part1/Button.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius: 10 + smooth: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part1/EditMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part1/EditMenu.qml new file mode 100644 index 00000000..cf5e481d --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part1/EditMenu.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part1/FileMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part1/FileMenu.qml new file mode 100644 index 00000000..b74ea0e4 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part1/FileMenu.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part1/SimpleButton.qml b/examples/declarative/tutorials/gettingStarted/parts/part1/SimpleButton.qml new file mode 100644 index 00000000..a1512e0b --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part1/SimpleButton.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: simplebutton + + //the rectangle's fill color + color: "grey" + + //dimensions of the button + width: 150; height: 75 + + //A text element contains functionalities for creating texts + Text { + id: buttonLabel + + //center the text inside the parent + anchors.centerIn: parent + + //text property binds to the label displayed on the button + text: "button label" + } + + //define the clickable area to be the whole rectangle + MouseArea { + id: buttonMouseArea + anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors + + //onClicked handles valid mouse button clicks + onClicked: console.log(buttonLabel.text + " clicked" ) + } +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_button.png b/examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_button.png new file mode 100644 index 00000000..aab64bcf Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_button.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_editmenu.png b/examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_editmenu.png new file mode 100644 index 00000000..d3ff66f2 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_editmenu.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_filemenu.png b/examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_filemenu.png new file mode 100644 index 00000000..f2e2b0d9 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_filemenu.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_simplebutton.png b/examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_simplebutton.png new file mode 100644 index 00000000..21ce5092 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part1/pics/qml-texteditor1_simplebutton.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part1/qml-texteditor.qmlproject b/examples/declarative/tutorials/gettingStarted/parts/part1/qml-texteditor.qmlproject new file mode 100644 index 00000000..d4909f86 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part1/qml-texteditor.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part2/Button.qml b/examples/declarative/tutorials/gettingStarted/parts/part2/Button.qml new file mode 100644 index 00000000..744d4bf4 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part2/Button.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + smooth: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part2/EditMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part2/EditMenu.qml new file mode 100644 index 00000000..20f88545 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part2/EditMenu.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part2/FileMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part2/FileMenu.qml new file mode 100644 index 00000000..75aac68b --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part2/FileMenu.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part2/MenuBar.qml b/examples/declarative/tutorials/gettingStarted/parts/part2/MenuBar.qml new file mode 100644 index 00000000..c53196a4 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part2/MenuBar.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000 + height:300 + + property color fileColor: "thistle" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "steelblue" + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part2/pics/qml-texteditor2_menubar.png b/examples/declarative/tutorials/gettingStarted/parts/part2/pics/qml-texteditor2_menubar.png new file mode 100644 index 00000000..da959a34 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part2/pics/qml-texteditor2_menubar.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part2/qml-texteditor2.qmlproject b/examples/declarative/tutorials/gettingStarted/parts/part2/qml-texteditor2.qmlproject new file mode 100644 index 00000000..d4909f86 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part2/qml-texteditor2.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/Button.qml b/examples/declarative/tutorials/gettingStarted/parts/part3/Button.qml new file mode 100644 index 00000000..744d4bf4 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/Button.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + smooth: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/EditMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part3/EditMenu.qml new file mode 100644 index 00000000..20f88545 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/EditMenu.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/FileMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part3/FileMenu.qml new file mode 100644 index 00000000..75aac68b --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/FileMenu.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/MenuBar.qml b/examples/declarative/tutorials/gettingStarted/parts/part3/MenuBar.qml new file mode 100644 index 00000000..c53196a4 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/MenuBar.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000 + height:300 + + property color fileColor: "thistle" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "steelblue" + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/TextArea.qml b/examples/declarative/tutorials/gettingStarted/parts/part3/TextArea.qml new file mode 100644 index 00000000..4b09eff5 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/TextArea.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id:textArea + + width :400 + height:400 + color: "white" + + Flickable{ + id: flickArea + + width: parent.width + height: parent.height + anchors.fill:parent + + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit{ + id: textEditor + anchors.fill:parent + width:parent.width; height:parent.height + color:"midnightblue" + focus: true + + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/TextEditor.qml b/examples/declarative/tutorials/gettingStarted/parts/part3/TextEditor.qml new file mode 100644 index 00000000..61beb1c6 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/TextEditor.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + id: screen + width: 1000; height: 1000 + border.color:"black" + //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar + property int partition: height/3 + + MenuBar{ + id:menuBar + height: partition + width:parent.width + z: 1 + } + + + TextArea{ + id:textArea + anchors.bottom:parent.bottom + y: partition + color: "azure" + height: partition*2 + width:parent.width + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/images/arrow.png b/examples/declarative/tutorials/gettingStarted/parts/part3/images/arrow.png new file mode 100644 index 00000000..14978c2e Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part3/images/arrow.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/pics/qml-texteditor3_texteditor.png b/examples/declarative/tutorials/gettingStarted/parts/part3/pics/qml-texteditor3_texteditor.png new file mode 100644 index 00000000..d0623b5a Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part3/pics/qml-texteditor3_texteditor.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/qml-texteditor3.qmlproject b/examples/declarative/tutorials/gettingStarted/parts/part3/qml-texteditor3.qmlproject new file mode 100644 index 00000000..d4909f86 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/qml-texteditor3.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/Button.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/Button.qml new file mode 100644 index 00000000..e0ba7ed7 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/Button.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //attaches to the Text element's text content + property string label + property color textColor: buttonLabel.color + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + smooth: true + border.color: "white" + border.width: 3 + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label //"button label" //bind the text to the parent's text + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + //animate the color whenever the color property changes + Behavior on color { ColorAnimation{ duration: 55} } + + //scale the button when pressed + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + //Animate the scale property change + Behavior on scale { NumberAnimation{ duration: 55} } + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/EditMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/EditMenu.qml new file mode 100644 index 00000000..7177ed25 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/EditMenu.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6A6F70" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D67") } + } + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/FileMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/FileMenu.qml new file mode 100644 index 00000000..f897be60 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/FileMenu.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6C646A" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } + } + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/MenuBar.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/MenuBar.qml new file mode 100644 index 00000000..7dbb1c9a --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/MenuBar.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000 + height:300 + + property color fileColor: "plum" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "beige" + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/SimpleButton.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/SimpleButton.qml new file mode 100644 index 00000000..df28ba3f --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/SimpleButton.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: simplebutton + color: "grey" + width: 150; height: 75 + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: "button label" + } + + MouseArea{ + id: buttonMouseArea + anchors.fill: parent + onClicked: console.log(buttonLabel.text + " clicked" ) + } +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/TextArea.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/TextArea.qml new file mode 100644 index 00000000..f83e5d49 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/TextArea.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id:textArea + + width :400 + height:400 + property color fontColor: "white" + + Flickable{ + id: flickArea + + width: parent.width + height: parent.height + anchors.fill:parent + + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit{ + id: textEditor + anchors.fill:parent + width:parent.width; height:parent.height + color:fontColor + focus: true + + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + } + } +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/TextEditor.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/TextEditor.qml new file mode 100644 index 00000000..35d0e88c --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/TextEditor.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: screen + width: 1000; height: 1000 + property int partition: height/3 + state: "DRAWER_CLOSED" + + + //Item 1: MenuBar on the top portion of the screen + MenuBar{ + id:menuBar + height: partition + //anchors.top:parent.top + width:parent.width + z:1 + } + + + //Item 2: The editable text area + TextArea{ + id:textArea + y:drawer.height + border.color: Qt.darker(color, 1.4) + border.width: 2 + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2 + width:parent.width + } + + //Item 3: The drawer handle + Rectangle{ + id:drawer + height:15 + width: parent.width + border.color : "#6A6D6A" + border.width: 1 + + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + + Image{ + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + + Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} + } + + MouseArea{ + id: drawerMouseArea + anchors.fill:parent + onClicked:{ + if (screen.state == "DRAWER_CLOSED"){ + screen.state = "DRAWER_OPEN" + console.log("drawer OPEN") + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + console.log("drawer closed") + } + } + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = "#6A6D6A" + } + + } + states:[ + State{ + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y:0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State{ + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-partition} + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} + PropertyChanges { target: drawer; y: 0} + PropertyChanges { target: arrowIcon; rotation: 0} + } + + ] + transitions: [ + Transition{ + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + } + + ] +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/images/arrow.png b/examples/declarative/tutorials/gettingStarted/parts/part4/images/arrow.png new file mode 100644 index 00000000..14978c2e Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part4/images/arrow.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/pics/qml-texteditor4_texteditor.png b/examples/declarative/tutorials/gettingStarted/parts/part4/pics/qml-texteditor4_texteditor.png new file mode 100644 index 00000000..a195fb87 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part4/pics/qml-texteditor4_texteditor.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/qml-texteditor4.qmlproject b/examples/declarative/tutorials/gettingStarted/parts/part4/qml-texteditor4.qmlproject new file mode 100644 index 00000000..d4909f86 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/qml-texteditor4.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml b/examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml new file mode 100644 index 00000000..84d8d874 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "core" + +Rectangle { + id: screen + width: 1000; height: 1000 + property int partition: height/3 + state: "DRAWER_CLOSED" + + //Item 1: MenuBar on the top portion of the screen + MenuBar{ + id:menuBar + height: screen.partition; width: screen.width + z:1 + } + //Item 2: The editable text area + TextArea{ + id:textArea + y:drawer.height + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2; width:parent.width + } + //Item 3: The drawer handle + Rectangle{ + id:drawer + height:15; width: parent.width + border.color : "#6A6D6A" + border.width: 1 + z:1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + Image{ + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + + Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} + } + + MouseArea{ + id: drawerMouseArea + anchors.fill:parent + hoverEnabled: true + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + onExited: parent.border.color = "#6A6D6A" + onClicked:{ + if (screen.state == "DRAWER_CLOSED"){ + screen.state = "DRAWER_OPEN" + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + } + } + } + } + + states:[ + State{ + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y: 0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State{ + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-height; } + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} + PropertyChanges { target: drawer; y: 0} + PropertyChanges { target: arrowIcon; rotation: 0} + } + ] + + transitions: [ + Transition{ + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + } + ] +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp new file mode 100644 index 00000000..286374d8 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "dialogPlugin.h" +#include "directory.h" +#include "file.h" +#include + +void DialogPlugin::registerTypes(const char *uri){ + + //register the class Directory into QML as a "Directory" element version 1.0 + qmlRegisterType(uri, 1, 0, "Directory"); + qmlRegisterType(uri,1,0,"File"); + + //qRegisterMetaType > ("QDeclarativeListProperty"); + +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h new file mode 100644 index 00000000..ddcf82be --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DIALOGPLUGIN_H +#define DIALOGPLUGIN_H + +#include + +class DialogPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "filedialog.json") + + public: + //registerTypes is inherited from QDeclarativeExtensionPlugin + void registerTypes(const char *uri); + +}; + +#endif + diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp new file mode 100644 index 00000000..c5f455c7 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp @@ -0,0 +1,219 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "directory.h" +#include + +/* +Directory constructor + +Initialize the saves directory and creates the file list +*/ +Directory::Directory(QObject *parent) : QObject(parent) +{ + + + m_dir.cd( QDir::currentPath()); + + //go to the saved directory. if not found, create save directory + m_saveDir = "saves"; + if (m_dir.cd(m_saveDir) == 0){ + m_dir.mkdir(m_saveDir); + m_dir.cd(m_saveDir); + } + m_filterList << "*.txt"; + + refresh(); +} + +/* +Directory::filesNumber +Return the number of Files +*/ +int Directory:: filesCount() const{ + return m_fileList.size(); +} + +/* +Function called to append data onto list property +*/ +void appendFiles(QDeclarativeListProperty * property, File * file){ + //Do nothing. can't add to a directory using this method +} + +/* +Function called to retrieve file in the list using an index +*/ +File* fileAt(QDeclarativeListProperty * property, int index){ + return static_cast< QList *>(property->data)->at(index); +} + +/* +Returns the number of files in the list +*/ +int filesSize(QDeclarativeListProperty * property){ + return static_cast< QList *>(property->data)->size(); +} + +/* +Function called to empty the list property contents +*/ +void clearFilesPtr(QDeclarativeListProperty *property){ + return static_cast< QList *>(property->data)->clear(); +} + +/* +Returns the list of files as a QDeclarativeListProperty. +*/ +QDeclarativeListProperty Directory::files(){ + + refresh(); +// return QDeclarativeListProperty(this,m_filePtrList); //not recommended in the docs + return QDeclarativeListProperty( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr ); +} + +/* +Return te name of the currently selected file +*/ +QString Directory::filename() const{ + return currentFile.name(); +} + +/* +Return the file's content as a string. +*/ +QString Directory::fileContent() const{ + return m_fileContent; +} + +/* +Set the file name of the current file +*/ +void Directory::setFilename(const QString &str){ + if(str != currentFile.name()){ + currentFile.setName(str); + emit filenameChanged(); + } +} + +/* +Set the content of the file as a string +*/ +void Directory::setFileContent(const QString &str){ + if(str != m_fileContent){ + m_fileContent = str; + emit fileContentChanged(); + } +} + +/* +Called from QML to save the file using the filename and file content. +Saving makes sure that the file has a .txt extension. +*/ +void Directory::saveFile(){ + + if(currentFile.name().size() == 0){ + qWarning()<< "Empty filename. no save"; + return; + } + + QString extendedName = currentFile.name(); + if(!currentFile.name().endsWith(".txt")){ + extendedName.append(".txt"); + } + + QFile file( m_dir.filePath(extendedName) ); + if (file.open(QFile::WriteOnly | QFile::Truncate)){ + QTextStream outStream(&file); + outStream << m_fileContent; + } + file.close(); + refresh(); + emit directoryChanged(); +} + +/* +Load the contents of a file. +Only loads files with a .txt extension +*/ +void Directory::loadFile(){ + + m_fileContent.clear(); + QString extendedName = currentFile.name(); + if(!currentFile.name().endsWith(".txt")){ + extendedName.append(".txt"); + } + + QFile file( m_dir.filePath(extendedName) ); + if (file.open(QFile::ReadOnly )){ + QTextStream inStream(&file); + + QString line; + do{ + line = inStream.read(75); + m_fileContent.append(line); + }while (!line .isNull()); + } + file.close(); +} + +/* +Reloads the content of the files list. This is to ensure that the newly +created files are added onto the list. +*/ +void Directory::refresh(){ + m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name); + m_fileList.clear(); + + File * file; + for(int i = 0; i < m_dirFiles.size() ; i ++){ + + file = new File(); + + if(m_dirFiles.at(i).endsWith(".txt")){ + QString name = m_dirFiles.at(i); + file->setName( name.remove(".txt",Qt::CaseSensitive)); + } + else{ + file->setName(m_dirFiles.at(i)); + } + m_fileList.append(file); + } +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h new file mode 100644 index 00000000..1d01372e --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DIRECTORY_H +#define DIRECTORY_H + +#include "file.h" + +#include +#include +#include +#include +#include + +class Directory : public QObject{ + + Q_OBJECT + + //number of files in the directory + Q_PROPERTY(int filesCount READ filesCount) + + //list property containing file names as QString + Q_PROPERTY(QDeclarativeListProperty files READ files CONSTANT ) + + //file name of the text file to read/write + Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) + + //text content of the file + Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) + + public: + Directory(QObject *parent = 0); + + //properties' read functions + int filesCount() const; + QString filename() const; + QString fileContent() const; + QDeclarativeListProperty files(); + + //properties' write functions + void setFilename(const QString &str); + void setFileContent(const QString &str); + + //accessible from QML + Q_INVOKABLE void saveFile(); + Q_INVOKABLE void loadFile(); + + signals: + void directoryChanged(); + void filenameChanged(); + void fileContentChanged(); + + private: + QDir m_dir; + QStringList m_dirFiles; + File currentFile; + QString m_saveDir; + QStringList m_filterList; + + //contains the file data in QString format + QString m_fileContent; + + //Registered to QML in a plugin. Accessible from QML as a property of Directory + QList m_fileList; + + //refresh content of the directory + void refresh(); +}; + + +#endif diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.cpp b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.cpp new file mode 100644 index 00000000..9da61921 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "file.h" + +File::File(QObject *parent) : QObject(parent) +{ + m_name = ""; +} + +QString File::name() const{ + return m_name; +} +void File::setName(const QString &str){ + if(str != m_name){ + m_name = str; + emit nameChanged(); + } +} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h new file mode 100644 index 00000000..76c192e3 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FILE_H +#define FILE_H + + +#include +#include + +class File : public QObject{ + + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + + public: + File(QObject *parent = 0); + + QString name() const; + void setName(const QString &str); + + signals: + void nameChanged(); + + private: + QString m_name; +}; + +#endif diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.json b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.json @@ -0,0 +1 @@ +{} diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro new file mode 100644 index 00000000..62477470 --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG += qt plugin +QT += declarative + +DESTDIR += ../plugins +OBJECTS_DIR = tmp +MOC_DIR = tmp + +TARGET = FileDialog + +HEADERS += directory.h \ + file.h \ + dialogPlugin.h + +SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/qmldir b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/qmldir new file mode 100644 index 00000000..c2b27dad --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/qmldir @@ -0,0 +1 @@ +plugin FileDialog plugins diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/images/arrow.png b/examples/declarative/tutorials/gettingStarted/parts/part5/images/arrow.png new file mode 100644 index 00000000..14978c2e Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part5/images/arrow.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/pics/qml-texteditor5_editmenu.png b/examples/declarative/tutorials/gettingStarted/parts/part5/pics/qml-texteditor5_editmenu.png new file mode 100644 index 00000000..27feed5e Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part5/pics/qml-texteditor5_editmenu.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/pics/qml-texteditor5_filemenu.png b/examples/declarative/tutorials/gettingStarted/parts/part5/pics/qml-texteditor5_filemenu.png new file mode 100644 index 00000000..4d8f9f22 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part5/pics/qml-texteditor5_filemenu.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/pics/qml-texteditor5_newfile.png b/examples/declarative/tutorials/gettingStarted/parts/part5/pics/qml-texteditor5_newfile.png new file mode 100644 index 00000000..680acfe8 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/parts/part5/pics/qml-texteditor5_newfile.png differ diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject b/examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject new file mode 100644 index 00000000..ed034dff --- /dev/null +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject @@ -0,0 +1,18 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + directory: "core" + directory: "filedialog" + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + importPaths: [ " ./plugins " ] +} diff --git a/examples/declarative/tutorials/gettingStarted/pics/qml-texteditor5_editmenu.png b/examples/declarative/tutorials/gettingStarted/pics/qml-texteditor5_editmenu.png new file mode 100644 index 00000000..27feed5e Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/pics/qml-texteditor5_editmenu.png differ diff --git a/examples/declarative/tutorials/gettingStarted/pics/qml-texteditor5_filemenu.png b/examples/declarative/tutorials/gettingStarted/pics/qml-texteditor5_filemenu.png new file mode 100644 index 00000000..4d8f9f22 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/pics/qml-texteditor5_filemenu.png differ diff --git a/examples/declarative/tutorials/gettingStarted/pics/qml-texteditor5_newfile.png b/examples/declarative/tutorials/gettingStarted/pics/qml-texteditor5_newfile.png new file mode 100644 index 00000000..680acfe8 Binary files /dev/null and b/examples/declarative/tutorials/gettingStarted/pics/qml-texteditor5_newfile.png differ diff --git a/examples/declarative/tutorials/tutorials.pro b/examples/declarative/tutorials/tutorials.pro index 5ad5b37a..7e26353e 100644 --- a/examples/declarative/tutorials/tutorials.pro +++ b/examples/declarative/tutorials/tutorials.pro @@ -1,9 +1,9 @@ TEMPLATE = subdirs SUBDIRS += \ - extending + extending \ + gettingStarted -# install -sources.files = tutorials.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/tutorials -INSTALLS += sources +EXAMPLE_FILES = \ + helloworld \ + samegame diff --git a/examples/declarative/twitter/main.cpp b/examples/declarative/twitter/main.cpp new file mode 100644 index 00000000..c79424b7 --- /dev/null +++ b/examples/declarative/twitter/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlapplicationviewer.h" +#include + +Q_DECL_EXPORT int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/twitter/twitter.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/Button.qml b/examples/declarative/twitter/qml/twitter/TwitterCore/Button.qml new file mode 100644 index 00000000..9b9b2d67 --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/Button.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + signal clicked + + property string text + property bool keyUsing: false + + BorderImage { + id: buttonImage + source: "images/toolbutton.sci" + width: container.width; height: container.height + } + BorderImage { + id: pressed + opacity: 0 + source: "images/toolbutton.sci" + width: container.width; height: container.height + } + MouseArea { + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.clicked(); } + } + Text { + id: btnText + color: if(container.keyUsing){"#D0D0D0";} else {"#FFFFFF";} + anchors.centerIn: buttonImage; font.bold: true + text: container.text; style: Text.Raised; styleColor: "black" + font.pixelSize: 12 + } + states: [ + State { + name: "Pressed" + when: mouseRegion.pressed == true + PropertyChanges { target: pressed; opacity: 1 } + }, + State { + name: "Focused" + when: container.activeFocus == true + PropertyChanges { target: btnText; color: "#FFFFFF" } + } + ] + transitions: Transition { + ColorAnimation { target: btnText; } + } +} diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/FatDelegate.qml b/examples/declarative/twitter/qml/twitter/TwitterCore/FatDelegate.qml new file mode 100644 index 00000000..e4a6e150 --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/FatDelegate.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Component { + id: listDelegate + Item { + id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 60){txt.height+10}else{60} //50+5+5 + function handleLink(link){ + if(link.slice(0,3) == 'app'){ + screen.setUser(link.slice(7)); + }else if(link.slice(0,4) == 'http'){ + Qt.openUrlExternally(link); + } + } + function addTags(str){ + var ret = str.replace(/@[a-zA-Z0-9_]+/g, '$&');//click to jump to user? + var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '$&');//surrounds http links with html link tags + return ret2; + } + + // Strip away paranthesis + function userName(str) { + var user = str.replace(/\([\S|\s]*\)/gi, ""); + return user.trim(); + } + + Item { + id: moveMe; height: parent.height + Rectangle { + id: blackRect + color: "black"; opacity: wrapper.ListView.index % 2 ? 0.2 : 0.3; height: wrapper.height-2; width: wrapper.width; y: 1 + } + Item { + id: image; x: 6; width: 48; height: 48; smooth: true + anchors.verticalCenter: parent.verticalCenter + + Loading { x: 1; y: 1; width: 48; height: 48; visible: realImage.status != Image.Ready } + Image { + id: realImage; + source: userImage; x: 1; y: 1; + width:48; height:48; opacity:0 ; + onStatusChanged: { + if(status==Image.Ready) + image.state="loaded" + } + } + states: State { + name: "loaded"; + PropertyChanges { target: realImage ; opacity:1 } + } + transitions: Transition { NumberAnimation { target: realImage; property: "opacity"; duration: 200 } } + + } + Text { id:txt; y:4; x: 56 + text: '' + + ''+userName(name) + " from " +source + + "
" + statusText + ""; + textFormat: Qt.RichText + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap + anchors.left: image.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 + onLinkActivated: wrapper.handleLink(link) + } + } + } +} diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/Input.qml b/examples/declarative/twitter/qml/twitter/TwitterCore/Input.qml new file mode 100644 index 00000000..ce1bc0e9 --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/Input.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +FocusScope { + id:container + width: 220 + height: 28 + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } + signal accepted + property alias text: input.text + property alias item:input + TextInput{ + id: input + width: parent.width - 12 + anchors.centerIn: parent + maximumLength:21 + font.pixelSize: 16; + font.bold: true + color: "#151515"; selectionColor: "mediumseagreen" + focus: true + onAccepted:{container.accepted()} + text: "" + selectByMouse: true + } +} diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/Loading.qml b/examples/declarative/twitter/qml/twitter/TwitterCore/Loading.qml new file mode 100644 index 00000000..b8fe357a --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/Loading.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: loading; source: "images/loading.png" + NumberAnimation on rotation { + from: 0; to: 360; running: loading.visible == true; loops: Animation.Infinite; duration: 900 + } +} diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/MultiTitleBar.qml b/examples/declarative/twitter/qml/twitter/TwitterCore/MultiTitleBar.qml new file mode 100644 index 00000000..1e1dbd62 --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/MultiTitleBar.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + TitleBar { id: titleBar; width: parent.width; height: 60; + y: -80 + untaggedString: "Latest tweets from everyone" + taggedString: "Latest tweets from " + } + states: [ + State { + name: "search"; when: screen.state!="search" + PropertyChanges { target: titleBar; y: 0 } + } + ] + transitions: [ + Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } } + ] +} + diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/RssModel.qml b/examples/declarative/twitter/qml/twitter/TwitterCore/RssModel.qml new file mode 100644 index 00000000..348fd2a8 --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/RssModel.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { id: wrapper + property variant model: xmlModel + property string from : "" + property string to : "" + property string phrase : "" + + property string mode : "everyone" + property int status: xmlModel.status + function reload() { xmlModel.reload(); } + XmlListModel { + id: xmlModel + + source: (from=="" && to=="" && phrase=="") ? "" : + 'http://search.twitter.com/search.atom?from='+from+"&to="+to+"&phrase="+phrase + + namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom'; " + + "declare namespace twitter=\"http://api.twitter.com/\";"; + + query: "/feed/entry" + + XmlRole { name: "statusText"; query: "content/string()" } + XmlRole { name: "timestamp"; query: "published/string()" } + XmlRole { name: "source"; query: "twitter:source/string()" } + XmlRole { name: "name"; query: "author/name/string()" } + XmlRole { name: "userImage"; query: "link[@rel = 'image']/@href/string()" } + + } + Binding { + property: "mode" + target: wrapper + value: {if(wrapper.tags==''){"everyone";}else if(wrapper.tags=='my timeline'){"self";}else{"user";}} + } +} diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/SearchView.qml b/examples/declarative/twitter/qml/twitter/TwitterCore/SearchView.qml new file mode 100644 index 00000000..d1c50fca --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/SearchView.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +FocusScope { + id: wrapper + Column { + anchors.centerIn: parent + spacing: 20 + Column{ + spacing: 4 + Text { + text: "Posted by:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Input{ + id: fromIn + KeyNavigation.backtab: searchbutton + KeyNavigation.tab:toIn + onAccepted:searchbutton.doSearch(); + focus: true + } + Text { + text: "In reply to:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Input{ + id: toIn + KeyNavigation.backtab: fromIn + KeyNavigation.tab:phraseIn + onAccepted:searchbutton.doSearch(); + } + Text { + text: "Search phrase:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Input{ + id: phraseIn + KeyNavigation.backtab: toIn + KeyNavigation.tab:searchbutton + onAccepted:searchbutton.doSearch(); + text: "Qt Quick" + } + } + Button { + width: 100 + height: 32 + id: searchbutton + keyUsing: true; + opacity: 1 + text: "Search" + KeyNavigation.tab: fromIn + Keys.onReturnPressed: searchbutton.doSearch(); + Keys.onEnterPressed: searchbutton.doSearch(); + Keys.onSelectPressed: searchbutton.doSearch(); + Keys.onSpacePressed: searchbutton.doSearch(); + onClicked: searchbutton.doSearch(); + + function doSearch() { + // Search ! allowed + if (wrapper.state=="invalidinput") + return; + + rssModel.from=fromIn.text; + rssModel.to= toIn.text; + rssModel.phrase = phraseIn.text; + screen.focus = true; + screen.state = "" + } + } + } + states: + State { + name: "invalidinput" + when: fromIn.text=="" && toIn.text=="" && phraseIn.text=="" + PropertyChanges { target: searchbutton ; opacity: 0.6 ; } + } + transitions: + Transition { + NumberAnimation { target: searchbutton; property: "opacity"; duration: 200 } + } +} diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/TitleBar.qml b/examples/declarative/twitter/qml/twitter/TwitterCore/TitleBar.qml new file mode 100644 index 00000000..7f094028 --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/TitleBar.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: titleBar + property string untaggedString: "Uploads from everyone" + property string taggedString: "Recent uploads tagged " + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + + Item { + id: container + width: (parent.width * 2) - 55 ; height: parent.height + + function accept() { + titleBar.state = "" + background.state = "" + rssModel.tags = editor.text + } + + Item { + id:imageBox + x: 6; width: 0; height: 50; smooth: true + anchors.verticalCenter: parent.verticalCenter + + UserModel { user: rssModel.from; id: userModel } + Component { + id: imgDelegate; + Item { + id:imageitem + visible:true + Loading { width:48; height:48; visible: realImage.status != Image.Ready } + Image { id: realImage; source: image; width:48; height:48; opacity:0; } + states: + State { + name: "loaded" + when: (realImage.status == Image.Ready) + PropertyChanges { target: realImage; opacity:1 } + } + transitions: Transition { + NumberAnimation { target: realImage; property: "opacity"; duration: 200 } + } + } + } + ListView { id:view; model: userModel.model; x:1; y:1; delegate: imgDelegate } + states: + State { + when: !userModel.user=="" + PropertyChanges { target: imageBox; width: 50; } + } + transitions: + Transition { + NumberAnimation { target: imageBox; property: "width"; duration: 200 } + } + } + + Image { + id: quitButton + x: 5 + anchors.verticalCenter: parent.verticalCenter + source: "images/quit.png" + MouseArea { + anchors.fill: parent + onClicked: Qt.quit() + } + } + + Text { + id: categoryText + anchors { + left: quitButton.right; right: parent.right; leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + elide: Text.ElideLeft + text: (rssModel.from=="" ? untaggedString : taggedString + rssModel.from) + font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black" + font.pixelSize: 12 + } + } + + states: State { + name: "Tags" + PropertyChanges { target: container; x: -tagButton.x + 5 } + PropertyChanges { target: editor; focus: true } + } + + transitions: Transition { + NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad } + } +} diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/ToolBar.qml b/examples/declarative/twitter/qml/twitter/TwitterCore/ToolBar.qml new file mode 100644 index 00000000..87cea7af --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/ToolBar.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: toolbar + + property alias button1Label: button1.text + property alias button2Label: button2.text + signal button1Clicked + signal button2Clicked + focus:true + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + Button { + id: button1 + anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32 + onClicked: toolbar.button1Clicked() + focus:true + } + Button { + id: button2 + anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32 + onClicked: toolbar.button2Clicked() + } +} diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/UserModel.qml b/examples/declarative/twitter/qml/twitter/TwitterCore/UserModel.qml new file mode 100644 index 00000000..d5714754 --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/UserModel.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +//This "model" gets the user information about the searched user. Mainly for the icon. + +Item { id: wrapper + property variant model: xmlModel + property string user : "" + property int status: xmlModel.status + function reload() { xmlModel.reload(); } + XmlListModel { + id: xmlModel + + source: user!= "" ? "http://twitter.com/users/show.xml?screen_name="+user : "" + query: "/user" + + XmlRole { name: "name"; query: "name/string()" } + XmlRole { name: "screenName"; query: "screen_name/string()" } + XmlRole { name: "image"; query: "profile_image_url/string()" } + XmlRole { name: "location"; query: "location/string()" } + XmlRole { name: "description"; query: "description/string()" } + XmlRole { name: "followers"; query: "followers_count/string()" } + //TODO: Could also get the user's color scheme, timezone and a few other things + } +} diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/images/gloss.png b/examples/declarative/twitter/qml/twitter/TwitterCore/images/gloss.png new file mode 100644 index 00000000..5d370cd9 Binary files /dev/null and b/examples/declarative/twitter/qml/twitter/TwitterCore/images/gloss.png differ diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/images/lineedit.png b/examples/declarative/twitter/qml/twitter/TwitterCore/images/lineedit.png new file mode 100644 index 00000000..2cc38dc3 Binary files /dev/null and b/examples/declarative/twitter/qml/twitter/TwitterCore/images/lineedit.png differ diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/images/lineedit.sci b/examples/declarative/twitter/qml/twitter/TwitterCore/images/lineedit.sci new file mode 100644 index 00000000..054bff78 --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/images/lineedit.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 10 +border.bottom: 10 +border.right: 10 +source: lineedit.png diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/images/loading.png b/examples/declarative/twitter/qml/twitter/TwitterCore/images/loading.png new file mode 100644 index 00000000..47a1589c Binary files /dev/null and b/examples/declarative/twitter/qml/twitter/TwitterCore/images/loading.png differ diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/images/quit.png b/examples/declarative/twitter/qml/twitter/TwitterCore/images/quit.png new file mode 100644 index 00000000..5bda1b6e Binary files /dev/null and b/examples/declarative/twitter/qml/twitter/TwitterCore/images/quit.png differ diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/images/stripes.png b/examples/declarative/twitter/qml/twitter/TwitterCore/images/stripes.png new file mode 100644 index 00000000..9f36727e Binary files /dev/null and b/examples/declarative/twitter/qml/twitter/TwitterCore/images/stripes.png differ diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/images/titlebar.png b/examples/declarative/twitter/qml/twitter/TwitterCore/images/titlebar.png new file mode 100644 index 00000000..51c90082 Binary files /dev/null and b/examples/declarative/twitter/qml/twitter/TwitterCore/images/titlebar.png differ diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/images/titlebar.sci b/examples/declarative/twitter/qml/twitter/TwitterCore/images/titlebar.sci new file mode 100644 index 00000000..0418d94c --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/images/titlebar.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 12 +border.bottom: 12 +border.right: 10 +source: titlebar.png diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/images/toolbutton.png b/examples/declarative/twitter/qml/twitter/TwitterCore/images/toolbutton.png new file mode 100644 index 00000000..11310013 Binary files /dev/null and b/examples/declarative/twitter/qml/twitter/TwitterCore/images/toolbutton.png differ diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/images/toolbutton.sci b/examples/declarative/twitter/qml/twitter/TwitterCore/images/toolbutton.sci new file mode 100644 index 00000000..9e4f9653 --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/images/toolbutton.sci @@ -0,0 +1,5 @@ +border.left: 15 +border.top: 4 +border.bottom: 4 +border.right: 15 +source: toolbutton.png diff --git a/examples/declarative/twitter/qml/twitter/TwitterCore/qmldir b/examples/declarative/twitter/qml/twitter/TwitterCore/qmldir new file mode 100644 index 00000000..84d85c28 --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/TwitterCore/qmldir @@ -0,0 +1,10 @@ +SearchView 1.0 SearchView.qml +Button 1.0 Button.qml +Input 1.0 Input.qml +FatDelegate 1.0 FatDelegate.qml +Loading 1.0 Loading.qml +MultiTitleBar 1.0 MultiTitleBar.qml +TitleBar 1.0 TitleBar.qml +RssModel 1.0 RssModel.qml +UserModel 1.0 UserModel.qml +ToolBar 1.0 ToolBar.qml diff --git a/examples/declarative/twitter/qml/twitter/twitter.qml b/examples/declarative/twitter/qml/twitter/twitter.qml new file mode 100644 index 00000000..5d4cd885 --- /dev/null +++ b/examples/declarative/twitter/qml/twitter/twitter.qml @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "TwitterCore" 1.0 as Twitter + +Item { + id: screen; width: 320; height: 480 + property bool userView : false + property variant tmpStr + function setUser(str){hack.running = true; tmpStr = str} + function reallySetUser(){rssModel.from = tmpStr;rssModel.to = ""; rssModel.phrase = ""} + state:"searchquery" + //Workaround for bug 260266 + Timer{ interval: 1; running: false; repeat: false; onTriggered: screen.reallySetUser(); id:hack } + Keys.onEscapePressed: screen.state="searchquery" + Keys.onBacktabPressed: screen.state="searchquery" + Rectangle { + id: background + anchors.fill: parent; color: "#343434"; + + state:"searchquery" + Image { source: "TwitterCore/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } + + MouseArea { + anchors.fill: parent + onClicked: screen.focus = false; + } + + Twitter.RssModel { id: rssModel } + Twitter.Loading { anchors.centerIn: parent; visible: rssModel.status==XmlListModel.Loading && state!='unauthed'} + Text { + width: 180 + text: "Could not access twitter using this screen name and password pair."; + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap + visible: rssModel.status==XmlListModel.Error; anchors.centerIn: parent + } + + Item { + id: views + x: 2; width: parent.width - 4 + y:60 //Below the title bars + height: parent.height - 100 + + Text { + id:title + text: "Search Twitter" + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 20; font.bold: true; color: "#bbb"; style: Text.Raised; styleColor: "black" + opacity:0 + } + + Twitter.SearchView{ + id: searchView + anchors.verticalCenter: parent.verticalCenter + width: parent.width; height: parent.height-60; + x: -(screen.width * 1.5) + } + + Twitter.FatDelegate { id: fatDelegate } + ListView { + id: mainView; model: rssModel.model; delegate: fatDelegate; + width: parent.width; height: parent.height; x: 0; cacheBuffer: 100; + } + } + + Twitter.MultiTitleBar { id: titleBar; width: parent.width } + Twitter.ToolBar { id: toolBar; height: 40; + //anchors.bottom: parent.bottom; + //TODO: Use anchor changes instead of hard coding + y: screen.height - 40 + width: parent.width; opacity: 0.9 + button1Label: "New Search" + button2Label: "Update" + onButton1Clicked: + { + screen.state="searchquery" + } + onButton2Clicked: rssModel.reload(); + } + } + states: [ + State { + name: "searchquery"; + PropertyChanges { target: searchView; x: 0; focus:true} + PropertyChanges { target: mainView; x: -(parent.width * 1.5) } + PropertyChanges { target: titleBar; y: -80 } + PropertyChanges { target: toolBar; y: screen.height } + PropertyChanges { target: toolBar } + PropertyChanges { target: title; opacity:1} + } + ] + transitions: [ + Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutQuad } } + ] +} diff --git a/examples/declarative/twitter/twitter.desktop b/examples/declarative/twitter/twitter.desktop new file mode 100644 index 00000000..5d1b851b --- /dev/null +++ b/examples/declarative/twitter/twitter.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=twitter +Exec=/opt/twitter/bin/twitter +Icon=twitter64 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/twitter/twitter.pro b/examples/declarative/twitter/twitter.pro new file mode 100644 index 00000000..68ece226 --- /dev/null +++ b/examples/declarative/twitter/twitter.pro @@ -0,0 +1,24 @@ +# Add more folders to ship with the application, here +folder_01.source = qml/twitter +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# If your application uses the Qt Mobility libraries, uncomment the following +# lines and add the respective components to the MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# Speed up launching on MeeGo/Harmattan when using applauncherd daemon +# CONFIG += qdeclarative-boostable + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/twitter +exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/twitter/twitter.qmlproject b/examples/declarative/twitter/twitter.qmlproject new file mode 100644 index 00000000..3b360cf2 --- /dev/null +++ b/examples/declarative/twitter/twitter.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "qml/twitter" + } + JavaScriptFiles { + directory: "qml/twitter" + } + ImageFiles { + directory: "qml/twitter" + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/twitter/twitter.svg b/examples/declarative/twitter/twitter.svg new file mode 100644 index 00000000..566acfad --- /dev/null +++ b/examples/declarative/twitter/twitter.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/examples/declarative/twitter/twitter64.png b/examples/declarative/twitter/twitter64.png new file mode 100644 index 00000000..707d5c4e Binary files /dev/null and b/examples/declarative/twitter/twitter64.png differ diff --git a/examples/declarative/twitter/twitter80.png b/examples/declarative/twitter/twitter80.png new file mode 100644 index 00000000..6ad8096c Binary files /dev/null and b/examples/declarative/twitter/twitter80.png differ diff --git a/examples/declarative/twitter/twitter_harmattan.desktop b/examples/declarative/twitter/twitter_harmattan.desktop new file mode 100644 index 00000000..40a4a1bc --- /dev/null +++ b/examples/declarative/twitter/twitter_harmattan.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=twitter +Exec=/usr/bin/single-instance /opt/twitter/bin/twitter +Icon=/usr/share/icons/hicolor/80x80/apps/twitter80.png +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.pro b/examples/declarative/ui-components/dialcontrol/dialcontrol.pro index 5e112a8d..a2159f30 100644 --- a/examples/declarative/ui-components/dialcontrol/dialcontrol.pro +++ b/examples/declarative/ui-components/dialcontrol/dialcontrol.pro @@ -23,7 +23,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/ui-components/dialcontrol +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/ui-components/dialcontrol exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/ui-components/flipable/flipable.pro b/examples/declarative/ui-components/flipable/flipable.pro index 0cfd2ec2..af1892f7 100644 --- a/examples/declarative/ui-components/flipable/flipable.pro +++ b/examples/declarative/ui-components/flipable/flipable.pro @@ -23,7 +23,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/ui-components/flipable +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/ui-components/flipable exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/ui-components/main/main.pro b/examples/declarative/ui-components/main/main.pro index 428ffd47..d44b7adc 100644 --- a/examples/declarative/ui-components/main/main.pro +++ b/examples/declarative/ui-components/main/main.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/ui-components/main +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/ui-components/main exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/ui-components/progressbar/progressbar.pro b/examples/declarative/ui-components/progressbar/progressbar.pro index 8e232277..66365c2e 100644 --- a/examples/declarative/ui-components/progressbar/progressbar.pro +++ b/examples/declarative/ui-components/progressbar/progressbar.pro @@ -23,7 +23,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/ui-components/progressbar +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/ui-components/progressbar exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/ui-components/scrollbar/scrollbar.pro b/examples/declarative/ui-components/scrollbar/scrollbar.pro index 5843ef7f..3f131b85 100644 --- a/examples/declarative/ui-components/scrollbar/scrollbar.pro +++ b/examples/declarative/ui-components/scrollbar/scrollbar.pro @@ -18,7 +18,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/ui-components/scrollbar +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/ui-components/scrollbar exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/ui-components/searchbox/searchbox.pro b/examples/declarative/ui-components/searchbox/searchbox.pro index 6219524f..aa8dd9c2 100644 --- a/examples/declarative/ui-components/searchbox/searchbox.pro +++ b/examples/declarative/ui-components/searchbox/searchbox.pro @@ -18,7 +18,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/ui-components/searchbox +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/ui-components/searchbox exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/ui-components/slideswitch/slideswitch.pro b/examples/declarative/ui-components/slideswitch/slideswitch.pro index 63e471cf..7f7c981c 100644 --- a/examples/declarative/ui-components/slideswitch/slideswitch.pro +++ b/examples/declarative/ui-components/slideswitch/slideswitch.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/ui-components/slideswitch +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/ui-components/slideswitch exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/ui-components/spinner/spinner.pro b/examples/declarative/ui-components/spinner/spinner.pro index 0c65f28d..80c4e523 100644 --- a/examples/declarative/ui-components/spinner/spinner.pro +++ b/examples/declarative/ui-components/spinner/spinner.pro @@ -18,7 +18,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/ui-components/spinner +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/ui-components/spinner exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/ui-components/tabwidget/tabwidget.pro b/examples/declarative/ui-components/tabwidget/tabwidget.pro index 97d49ea2..83618d03 100644 --- a/examples/declarative/ui-components/tabwidget/tabwidget.pro +++ b/examples/declarative/ui-components/tabwidget/tabwidget.pro @@ -18,7 +18,7 @@ QML_IMPORT_PATH = SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/ui-components/tabwidget +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/ui-components/tabwidget exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/declarative/ui-components/ui-components.pro b/examples/declarative/ui-components/ui-components.pro index 951121f3..62d1cdf8 100644 --- a/examples/declarative/ui-components/ui-components.pro +++ b/examples/declarative/ui-components/ui-components.pro @@ -9,8 +9,3 @@ SUBDIRS += dialcontrol \ slideswitch \ spinner \ tabwidget - -# install -sources.files = ui-components.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/ui-components -INSTALLS += sources diff --git a/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.pro b/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.pro index 9c75b8b0..3755d5fc 100644 --- a/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.pro +++ b/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.pro @@ -23,7 +23,7 @@ DEFINES += ORIENTATIONLOCK SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/declarative/xml/xmlhttprequest-example +desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/declarative/xml/xmlhttprequest-example exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) +else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) qtcAddDeployment() diff --git a/examples/demos/calculator/calculator.desktop b/examples/demos/calculator/calculator.desktop deleted file mode 100644 index 854120f2..00000000 --- a/examples/demos/calculator/calculator.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=calculator -Exec=/opt/calculator/bin/calculator -Icon=calculator64 -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/calculator/calculator.pro b/examples/demos/calculator/calculator.pro deleted file mode 100644 index 7db59b96..00000000 --- a/examples/demos/calculator/calculator.pro +++ /dev/null @@ -1,24 +0,0 @@ -# Add more folders to ship with the application, here -folder_01.source = qml/calculator -folder_01.target = qml -DEPLOYMENTFOLDERS = folder_01 - -# Additional import path used to resolve QML modules in Creator's code model -QML_IMPORT_PATH = - -# If your application uses the Qt Mobility libraries, uncomment the following -# lines and add the respective components to the MOBILITY variable. -# CONFIG += mobility -# MOBILITY += - -# Speed up launching on MeeGo/Harmattan when using applauncherd daemon -# CONFIG += qdeclarative-boostable - -# The .cpp file which was generated for your project. Feel free to hack it. -SOURCES += main.cpp - -# Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/demos/calculator -exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) -qtcAddDeployment() diff --git a/examples/demos/calculator/calculator.qmlproject b/examples/demos/calculator/calculator.qmlproject deleted file mode 100644 index 88ca3caa..00000000 --- a/examples/demos/calculator/calculator.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "qml/calculator" - } - JavaScriptFiles { - directory: "qml/calculator" - } - ImageFiles { - directory: "qml/calculator" - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/demos/calculator/calculator.svg b/examples/demos/calculator/calculator.svg deleted file mode 100644 index 566acfad..00000000 --- a/examples/demos/calculator/calculator.svg +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/examples/demos/calculator/calculator64.png b/examples/demos/calculator/calculator64.png deleted file mode 100644 index 707d5c4e..00000000 Binary files a/examples/demos/calculator/calculator64.png and /dev/null differ diff --git a/examples/demos/calculator/calculator80.png b/examples/demos/calculator/calculator80.png deleted file mode 100644 index 6ad8096c..00000000 Binary files a/examples/demos/calculator/calculator80.png and /dev/null differ diff --git a/examples/demos/calculator/calculator_harmattan.desktop b/examples/demos/calculator/calculator_harmattan.desktop deleted file mode 100644 index 574521d8..00000000 --- a/examples/demos/calculator/calculator_harmattan.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=calculator -Exec=/usr/bin/single-instance /opt/calculator/bin/calculator -Icon=/usr/share/icons/hicolor/80x80/apps/calculator80.png -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/calculator/main.cpp b/examples/demos/calculator/main.cpp deleted file mode 100644 index 9d2d4168..00000000 --- a/examples/demos/calculator/main.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlapplicationviewer.h" -#include -#include - -Q_DECL_EXPORT int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - qDebug() << "NOTE: The runtime property and the Orientation enum are only available" - << "through qmlviewer and are not available in the complied version.\n" - << "Run 'qmlviewer calculator.qmlproject' or load 'calculator.qmlproject'" - << "in Qt Creator and run the project."; - - QmlApplicationViewer viewer; - viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); - viewer.setMainQmlFile(QLatin1String("qml/calculator/calculator.qml")); - viewer.showExpanded(); - - return app.exec(); -} diff --git a/examples/demos/calculator/qml/calculator/CalculatorCore/Button.qml b/examples/demos/calculator/qml/calculator/CalculatorCore/Button.qml deleted file mode 100644 index a6126b00..00000000 --- a/examples/demos/calculator/qml/calculator/CalculatorCore/Button.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -BorderImage { - id: button - - property alias operation: buttonText.text - property string color: "" - - signal clicked - - source: "images/button-" + color + ".png"; clip: true - border { left: 10; top: 10; right: 10; bottom: 10 } - - Rectangle { - id: shade - anchors.fill: button; radius: 10; color: "black"; opacity: 0 - } - - Text { - id: buttonText - anchors.centerIn: parent; anchors.verticalCenterOffset: -1 - font.pixelSize: parent.width > parent.height ? parent.height * .5 : parent.width * .5 - style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true - } - - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: { - doOp(operation) - button.clicked() - } - } - - states: State { - name: "pressed"; when: mouseArea.pressed == true - PropertyChanges { target: shade; opacity: .4 } - } -} diff --git a/examples/demos/calculator/qml/calculator/CalculatorCore/Display.qml b/examples/demos/calculator/qml/calculator/CalculatorCore/Display.qml deleted file mode 100644 index 9e7653fd..00000000 --- a/examples/demos/calculator/qml/calculator/CalculatorCore/Display.qml +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -BorderImage { - id: image - - property alias text : displayText.text - property alias currentOperation : operationText - - source: "images/display.png" - border { left: 10; top: 10; right: 10; bottom: 10 } - - Text { - id: displayText - anchors { - right: parent.right; verticalCenter: parent.verticalCenter; verticalCenterOffset: -1 - rightMargin: 6; left: operationText.right - } - font.pixelSize: parent.height * .6; text: "0"; horizontalAlignment: Text.AlignRight; elide: Text.ElideRight - color: "#343434"; smooth: true; font.bold: true - } - Text { - id: operationText - font.bold: true; font.pixelSize: parent.height * .7 - color: "#343434"; smooth: true - anchors { left: parent.left; leftMargin: 6; verticalCenterOffset: -3; verticalCenter: parent.verticalCenter } - } -} diff --git a/examples/demos/calculator/qml/calculator/CalculatorCore/calculator.js b/examples/demos/calculator/qml/calculator/CalculatorCore/calculator.js deleted file mode 100644 index 7c363c7f..00000000 --- a/examples/demos/calculator/qml/calculator/CalculatorCore/calculator.js +++ /dev/null @@ -1,91 +0,0 @@ - -var curVal = 0 -var memory = 0 -var lastOp = "" -var timer = 0 - -function disabled(op) { - if (op == "." && display.text.toString().search(/\./) != -1) { - return true - } else if (op == squareRoot && display.text.toString().search(/-/) != -1) { - return true - } else { - return false - } -} - -function doOperation(op) { - if (disabled(op)) { - return - } - - if (op.toString().length==1 && ((op >= "0" && op <= "9") || op==".") ) { - if (display.text.toString().length >= 14) - return; // No arbitrary length numbers - if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp == ".") ) { - display.text = display.text + op.toString() - } else { - display.text = op - } - lastOp = op - return - } - lastOp = op - - if (display.currentOperation.text == "+") { - display.text = Number(display.text.valueOf()) + Number(curVal.valueOf()) - } else if (display.currentOperation.text == "-") { - display.text = Number(curVal) - Number(display.text.valueOf()) - } else if (display.currentOperation.text == multiplication) { - display.text = Number(curVal) * Number(display.text.valueOf()) - } else if (display.currentOperation.text == division) { - display.text = Number(Number(curVal) / Number(display.text.valueOf())).toString() - } else if (display.currentOperation.text == "=") { - } - - if (op == "+" || op == "-" || op == multiplication || op == division) { - display.currentOperation.text = op - curVal = display.text.valueOf() - return - } - - curVal = 0 - display.currentOperation.text = "" - - if (op == "1/x") { - display.text = (1 / display.text.valueOf()).toString() - } else if (op == "x^2") { - display.text = (display.text.valueOf() * display.text.valueOf()).toString() - } else if (op == "Abs") { - display.text = (Math.abs(display.text.valueOf())).toString() - } else if (op == "Int") { - display.text = (Math.floor(display.text.valueOf())).toString() - } else if (op == plusminus) { - display.text = (display.text.valueOf() * -1).toString() - } else if (op == squareRoot) { - display.text = (Math.sqrt(display.text.valueOf())).toString() - } else if (op == "mc") { - memory = 0; - } else if (op == "m+") { - memory += display.text.valueOf() - } else if (op == "mr") { - display.text = memory.toString() - } else if (op == "m-") { - memory = display.text.valueOf() - } else if (op == leftArrow) { - display.text = display.text.toString().slice(0, -1) - if (display.text.length == 0) { - display.text = "0" - } - } else if (op == "Off") { - Qt.quit(); - } else if (op == "C") { - display.text = "0" - } else if (op == "AC") { - curVal = 0 - memory = 0 - lastOp = "" - display.text ="0" - } -} - diff --git a/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-.png b/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-.png deleted file mode 100644 index 544e5145..00000000 Binary files a/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-.png and /dev/null differ diff --git a/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-blue.png b/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-blue.png deleted file mode 100644 index 5f92de32..00000000 Binary files a/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-blue.png and /dev/null differ diff --git a/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-green.png b/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-green.png deleted file mode 100644 index 36c93914..00000000 Binary files a/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-green.png and /dev/null differ diff --git a/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-purple.png b/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-purple.png deleted file mode 100644 index 347cbbea..00000000 Binary files a/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-purple.png and /dev/null differ diff --git a/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-red.png b/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-red.png deleted file mode 100644 index 3b335891..00000000 Binary files a/examples/demos/calculator/qml/calculator/CalculatorCore/images/button-red.png and /dev/null differ diff --git a/examples/demos/calculator/qml/calculator/CalculatorCore/images/display.png b/examples/demos/calculator/qml/calculator/CalculatorCore/images/display.png deleted file mode 100644 index 9507f438..00000000 Binary files a/examples/demos/calculator/qml/calculator/CalculatorCore/images/display.png and /dev/null differ diff --git a/examples/demos/calculator/qml/calculator/CalculatorCore/qmldir b/examples/demos/calculator/qml/calculator/CalculatorCore/qmldir deleted file mode 100644 index a926b93f..00000000 --- a/examples/demos/calculator/qml/calculator/CalculatorCore/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -Button Button.qml -Display Display.qml diff --git a/examples/demos/calculator/qml/calculator/calculator.qml b/examples/demos/calculator/qml/calculator/calculator.qml deleted file mode 100644 index 5c7c5e5d..00000000 --- a/examples/demos/calculator/qml/calculator/calculator.qml +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import "CalculatorCore" -import "CalculatorCore/calculator.js" as CalcEngine - -Rectangle { - id: window - - width: 360; height: 480 - color: "#282828" - - property string rotateLeft: "\u2939" - property string rotateRight: "\u2935" - property string leftArrow: "\u2190" - property string division : "\u00f7" - property string multiplication : "\u00d7" - property string squareRoot : "\u221a" - property string plusminus : "\u00b1" - - function doOp(operation) { CalcEngine.doOperation(operation) } - - Item { - id: main - state: "orientation " + runtime.orientation - - property bool landscapeWindow: window.width > window.height - property real baseWidth: landscapeWindow ? window.height : window.width - property real baseHeight: landscapeWindow ? window.width : window.height - property real rotationDelta: landscapeWindow ? -90 : 0 - - rotation: rotationDelta - width: main.baseWidth - height: main.baseHeight - anchors.centerIn: parent - - Column { - id: box; spacing: 8 - - anchors { fill: parent; topMargin: 6; bottomMargin: 6; leftMargin: 6; rightMargin: 6 } - - Display { - id: display - width: box.width-3 - height: 64 - } - - Column { - id: column; spacing: 6 - - property real h: ((box.height - 72) / 6) - ((spacing * (6 - 1)) / 6) - property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) - - Row { - spacing: 6 - Button { width: column.w; height: column.h; color: 'purple'; operation: "Off" } - Button { width: column.w; height: column.h; color: 'purple'; operation: leftArrow } - Button { width: column.w; height: column.h; color: 'purple'; operation: "C" } - Button { width: column.w; height: column.h; color: 'purple'; operation: "AC" } - } - - Row { - spacing: 6 - property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) - - Button { width: column.w; height: column.h; color: 'green'; operation: "mc" } - Button { width: column.w; height: column.h; color: 'green'; operation: "m+" } - Button { width: column.w; height: column.h; color: 'green'; operation: "m-" } - Button { width: column.w; height: column.h; color: 'green'; operation: "mr" } - } - - Grid { - id: grid; rows: 5; columns: 5; spacing: 6 - - property real w: (box.width / columns) - ((spacing * (columns - 1)) / columns) - - Button { width: grid.w; height: column.h; operation: "7"; color: 'blue' } - Button { width: grid.w; height: column.h; operation: "8"; color: 'blue' } - Button { width: grid.w; height: column.h; operation: "9"; color: 'blue' } - Button { width: grid.w; height: column.h; operation: division } - Button { width: grid.w; height: column.h; operation: squareRoot } - Button { width: grid.w; height: column.h; operation: "4"; color: 'blue' } - Button { width: grid.w; height: column.h; operation: "5"; color: 'blue' } - Button { width: grid.w; height: column.h; operation: "6"; color: 'blue' } - Button { width: grid.w; height: column.h; operation: multiplication } - Button { width: grid.w; height: column.h; operation: "x^2" } - Button { width: grid.w; height: column.h; operation: "1"; color: 'blue' } - Button { width: grid.w; height: column.h; operation: "2"; color: 'blue' } - Button { width: grid.w; height: column.h; operation: "3"; color: 'blue' } - Button { width: grid.w; height: column.h; operation: "-" } - Button { width: grid.w; height: column.h; operation: "1/x" } - Button { width: grid.w; height: column.h; operation: "0"; color: 'blue' } - Button { width: grid.w; height: column.h; operation: "." } - Button { width: grid.w; height: column.h; operation: plusminus } - Button { width: grid.w; height: column.h; operation: "+" } - Button { width: grid.w; height: column.h; operation: "="; color: 'red' } - } - } - } - - states: [ - State { - name: "orientation " + Orientation.Landscape - PropertyChanges { target: main; rotation: 90 + rotationDelta; width: main.baseHeight; height: main.baseWidth } - }, - State { - name: "orientation " + Orientation.PortraitInverted - PropertyChanges { target: main; rotation: 180 + rotationDelta; } - }, - State { - name: "orientation " + Orientation.LandscapeInverted - PropertyChanges { target: main; rotation: 270 + rotationDelta; width: main.baseHeight; height: main.baseWidth } - } - ] - - transitions: Transition { - SequentialAnimation { - RotationAnimation { direction: RotationAnimation.Shortest; duration: 300; easing.type: Easing.InOutQuint } - NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint } - } - } - } -} diff --git a/examples/demos/demos.pro b/examples/demos/demos.pro deleted file mode 100644 index b0ac9ce3..00000000 --- a/examples/demos/demos.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = subdirs - -# These demos contain C++ and need to be compiled -SUBDIRS = \ - calculator \ - flickr \ - photoviewer \ - minehunt \ - samegame \ - snake \ - rssnews \ - twitter - -# install -sources.files = demos.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/demos -INSTALLS += sources diff --git a/examples/demos/flickr/flickr.desktop b/examples/demos/flickr/flickr.desktop deleted file mode 100644 index 8467f39b..00000000 --- a/examples/demos/flickr/flickr.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=flickr -Exec=/opt/flickr/bin/flickr -Icon=flickr64 -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/flickr/flickr.pro b/examples/demos/flickr/flickr.pro deleted file mode 100644 index 625b2a57..00000000 --- a/examples/demos/flickr/flickr.pro +++ /dev/null @@ -1,24 +0,0 @@ -# Add more folders to ship with the application, here -folder_01.source = qml/flickr -folder_01.target = qml -DEPLOYMENTFOLDERS = folder_01 - -# Additional import path used to resolve QML modules in Creator's code model -QML_IMPORT_PATH = - -# If your application uses the Qt Mobility libraries, uncomment the following -# lines and add the respective components to the MOBILITY variable. -# CONFIG += mobility -# MOBILITY += - -# Speed up launching on MeeGo/Harmattan when using applauncherd daemon -# CONFIG += qdeclarative-boostable - -# The .cpp file which was generated for your project. Feel free to hack it. -SOURCES += main.cpp - -# Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/demos/flickr -exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) -qtcAddDeployment() diff --git a/examples/demos/flickr/flickr.qmlproject b/examples/demos/flickr/flickr.qmlproject deleted file mode 100644 index 3a6d8210..00000000 --- a/examples/demos/flickr/flickr.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "qml/flickr" - } - JavaScriptFiles { - directory: "qml/flickr" - } - ImageFiles { - directory: "qml/flickr" - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/demos/flickr/flickr.svg b/examples/demos/flickr/flickr.svg deleted file mode 100644 index 566acfad..00000000 --- a/examples/demos/flickr/flickr.svg +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/examples/demos/flickr/flickr64.png b/examples/demos/flickr/flickr64.png deleted file mode 100644 index 707d5c4e..00000000 Binary files a/examples/demos/flickr/flickr64.png and /dev/null differ diff --git a/examples/demos/flickr/flickr80.png b/examples/demos/flickr/flickr80.png deleted file mode 100644 index 6ad8096c..00000000 Binary files a/examples/demos/flickr/flickr80.png and /dev/null differ diff --git a/examples/demos/flickr/flickr_harmattan.desktop b/examples/demos/flickr/flickr_harmattan.desktop deleted file mode 100644 index 19cf6264..00000000 --- a/examples/demos/flickr/flickr_harmattan.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=flickr -Exec=/usr/bin/single-instance /opt/flickr/bin/flickr -Icon=/usr/share/icons/hicolor/80x80/apps/flickr80.png -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/flickr/main.cpp b/examples/demos/flickr/main.cpp deleted file mode 100644 index 62e3246e..00000000 --- a/examples/demos/flickr/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlapplicationviewer.h" -#include - -Q_DECL_EXPORT int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QmlApplicationViewer viewer; - viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); - viewer.setMainQmlFile(QLatin1String("qml/flickr/flickr.qml")); - viewer.showExpanded(); - - return app.exec(); -} diff --git a/examples/demos/flickr/qml/flickr/common/Progress.qml b/examples/demos/flickr/qml/flickr/common/Progress.qml deleted file mode 100644 index 1781497f..00000000 --- a/examples/demos/flickr/qml/flickr/common/Progress.qml +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - property variant progress: 0 - - Rectangle { - anchors.fill: parent; smooth: true - border.color: "white"; border.width: 0; radius: height/2 - 2 - gradient: Gradient { - GradientStop { position: 0; color: "#66343434" } - GradientStop { position: 1.0; color: "#66000000" } - } - } - - Rectangle { - y: 2; height: parent.height-4; - x: 2; width: Math.max(parent.width * progress - 4, 0); - opacity: width < 1 ? 0 : 1; smooth: true - gradient: Gradient { - GradientStop { position: 0; color: "lightsteelblue" } - GradientStop { position: 1.0; color: "steelblue" } - } - radius: height/2 - 2 - } - - Text { - text: Math.round(progress * 100) + "%" - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - color: "white"; font.bold: true; font.pixelSize: 15 - } -} diff --git a/examples/demos/flickr/qml/flickr/common/RssModel.qml b/examples/demos/flickr/qml/flickr/common/RssModel.qml deleted file mode 100644 index f7070f43..00000000 --- a/examples/demos/flickr/qml/flickr/common/RssModel.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -XmlListModel { - property string tags : "" - - function commasep(x) - { - return x.replace(' ',','); - } - - source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+commasep(tags)+"&" : "")+"format=rss2" - query: "/rss/channel/item" - namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";" - - XmlRole { name: "title"; query: "title/string()" } - XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" } - XmlRole { name: "url"; query: "media:content/@url/string()" } - XmlRole { name: "description"; query: "description/string()" } - XmlRole { name: "tags"; query: "media:category/string()" } - XmlRole { name: "photoWidth"; query: "media:content/@width/string()" } - XmlRole { name: "photoHeight"; query: "media:content/@height/string()" } - XmlRole { name: "photoType"; query: "media:content/@type/string()" } - XmlRole { name: "photoAuthor"; query: "author/string()" } - XmlRole { name: "photoDate"; query: "pubDate/string()" } -} diff --git a/examples/demos/flickr/qml/flickr/common/ScrollBar.qml b/examples/demos/flickr/qml/flickr/common/ScrollBar.qml deleted file mode 100644 index 409cfb7e..00000000 --- a/examples/demos/flickr/qml/flickr/common/ScrollBar.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: container - - property variant flickableArea - - Rectangle { - radius: 5 - color: "black" - opacity: 0.3 - border.color: "white" - border.width: 2 - x: 0 - y: flickableArea.visibleArea.yPosition * container.height - width: parent.width - height: flickableArea.visibleArea.heightRatio * container.height - } - states: [ - State { - name: "show" - when: flickableArea.movingVertically - PropertyChanges { - target: container - opacity: 1 - } - } - ] - transitions: [ - Transition { - from: "*" - to: "*" - NumberAnimation { - target: container - properties: "opacity" - duration: 400 - } - } - ] -} diff --git a/examples/demos/flickr/qml/flickr/common/Slider.qml b/examples/demos/flickr/qml/flickr/common/Slider.qml deleted file mode 100644 index dfb4ac11..00000000 --- a/examples/demos/flickr/qml/flickr/common/Slider.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: slider; width: 400; height: 16 - - // value is read/write. - property real value: 1 - onValueChanged: updatePos(); - property real maximum: 1 - property real minimum: 1 - property int xMax: width - handle.width - 4 - onXMaxChanged: updatePos(); - onMinimumChanged: updatePos(); - - function updatePos() { - if (maximum > minimum) { - var pos = 2 + (value - minimum) * slider.xMax / (maximum - minimum); - pos = Math.min(pos, width - handle.width - 2); - pos = Math.max(pos, 2); - handle.x = pos; - } else { - handle.x = 2; - } - } - - Rectangle { - anchors.fill: parent - border.color: "white"; border.width: 0; radius: 8 - gradient: Gradient { - GradientStop { position: 0.0; color: "#66343434" } - GradientStop { position: 1.0; color: "#66000000" } - } - } - - Rectangle { - id: handle; smooth: true - y: 2; width: 30; height: slider.height-4; radius: 6 - gradient: Gradient { - GradientStop { position: 0.0; color: "lightgray" } - GradientStop { position: 1.0; color: "gray" } - } - - MouseArea { - id: mouse - anchors.fill: parent; drag.target: parent - drag.axis: Drag.XAxis; drag.minimumX: 2; drag.maximumX: slider.xMax+2 - onPositionChanged: { value = (maximum - minimum) * (handle.x-2) / slider.xMax + minimum; } - } - } -} diff --git a/examples/demos/flickr/qml/flickr/common/qmldir b/examples/demos/flickr/qml/flickr/common/qmldir deleted file mode 100644 index adc2479b..00000000 --- a/examples/demos/flickr/qml/flickr/common/qmldir +++ /dev/null @@ -1,10 +0,0 @@ -ImageDetails ImageDetails.qml -LikeOMeter LikeOMeter.qml -Loading Loading.qml -MediaButton MediaButton.qml -MediaLineEdit MediaLineEdit.qml -Progress Progress.qml -RssModel RssModel.qml -ScrollBar ScrollBar.qml -Slider Slider.qml -Star Star.qml diff --git a/examples/demos/flickr/qml/flickr/flickr-90.qml b/examples/demos/flickr/qml/flickr/flickr-90.qml deleted file mode 100644 index 6acc92cb..00000000 --- a/examples/demos/flickr/qml/flickr/flickr-90.qml +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - width: 480; height: 320 - - Loader { - y: 320; rotation: -90 - transformOrigin: Item.TopLeft - source: "flickr.qml" - } -} diff --git a/examples/demos/flickr/qml/flickr/flickr.qml b/examples/demos/flickr/qml/flickr/flickr.qml deleted file mode 100644 index fa303e76..00000000 --- a/examples/demos/flickr/qml/flickr/flickr.qml +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import "common" as Common -import "mobile" as Mobile - -Item { - id: screen; width: 320; height: 480 - property bool inListView : false - - Rectangle { - id: background - anchors.fill: parent; color: "#343434"; - - Image { source: "mobile/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } - - Common.RssModel { id: rssModel } - - Item { - id: views - width: parent.width - anchors.top: titleBar.bottom; anchors.bottom: toolBar.top - - GridView { - id: photoGridView; model: rssModel; delegate: Mobile.GridDelegate {} - cacheBuffer: 1000 - cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height - } - - ListView { - id: photoListView; model: rssModel; delegate: Mobile.ListDelegate { } - width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100; - } - - states: State { - name: "ListView"; when: screen.inListView == true - PropertyChanges { target: photoListView; x: 0 } - PropertyChanges { target: photoGridView; x: -(parent.width * 1.5) } - } - - transitions: Transition { - NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad } - } - - Mobile.ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height } - - Item { id: foreground; anchors.fill: parent } - } - - Mobile.TitleBar { id: titleBar; width: parent.width; height: 40; opacity: 0.9 } - - Mobile.ToolBar { - id: toolBar - height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9 - button1Label: "Update"; button2Label: "View mode" - onButton1Clicked: rssModel.reload() - onButton2Clicked: if (screen.inListView == true) screen.inListView = false; else screen.inListView = true - } - - Connections { - target: imageDetails - onClosed: { - if (background.state == "DetailedView") { - background.state = ''; - imageDetails.photoUrl = ""; - } - } - } - - states: State { - name: "DetailedView" - PropertyChanges { target: views; x: -parent.width } - PropertyChanges { target: toolBar; button1Label: "View..." } - PropertyChanges { - target: toolBar - onButton1Clicked: if (imageDetails.state=='') imageDetails.state='Back'; else imageDetails.state='' - } - PropertyChanges { target: toolBar; button2Label: "Back" } - PropertyChanges { target: toolBar; onButton2Clicked: imageDetails.closed() } - } - - transitions: Transition { - NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad } - } - } -} diff --git a/examples/demos/flickr/qml/flickr/mobile/Button.qml b/examples/demos/flickr/qml/flickr/mobile/Button.qml deleted file mode 100644 index a993d7d9..00000000 --- a/examples/demos/flickr/qml/flickr/mobile/Button.qml +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: container - - signal clicked - - property string text - - BorderImage { - id: buttonImage - source: "images/toolbutton.sci" - width: container.width; height: container.height - } - BorderImage { - id: pressed - opacity: 0 - source: "images/toolbutton.sci" - width: container.width; height: container.height - } - MouseArea { - id: mouseRegion - anchors.fill: buttonImage - onClicked: { container.clicked(); } - } - Text { - color: "white" - anchors.centerIn: buttonImage; font.bold: true; font.pixelSize: 15 - text: container.text; style: Text.Raised; styleColor: "black" - } - states: [ - State { - name: "Pressed" - when: mouseRegion.pressed == true - PropertyChanges { target: pressed; opacity: 1 } - } - ] -} diff --git a/examples/demos/flickr/qml/flickr/mobile/GridDelegate.qml b/examples/demos/flickr/qml/flickr/mobile/GridDelegate.qml deleted file mode 100644 index d6df1d0c..00000000 --- a/examples/demos/flickr/qml/flickr/mobile/GridDelegate.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: wrapper; width: GridView.view.cellWidth; height: GridView.view.cellHeight - - function photoClicked() { - imageDetails.photoTitle = title; - imageDetails.photoTags = tags; - imageDetails.photoWidth = photoWidth; - imageDetails.photoHeight = photoHeight; - imageDetails.photoType = photoType; - imageDetails.photoAuthor = photoAuthor; - imageDetails.photoDate = photoDate; - imageDetails.photoUrl = url; - imageDetails.rating = 0; - scaleMe.state = "Details"; - } - - Item { - anchors.centerIn: parent - scale: 0.0 - Behavior on scale { NumberAnimation { easing.type: Easing.InOutQuad} } - id: scaleMe - - Item { - width: 77; height: 77; anchors.centerIn: parent - Rectangle { - id: whiteRect; width: 77; height: 77; color: "#dddddd"; smooth: true - Image { id: thumb; source: imagePath; x: 1; y: 1; smooth: true } - Image { source: "images/gloss.png" } - } - } - - Connections { - target: toolBar - onButton2Clicked: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show' - } - - states: [ - State { - name: "Show"; when: thumb.status == Image.Ready - PropertyChanges { target: scaleMe; scale: 1 } - }, - State { - name: "Details" - PropertyChanges { target: scaleMe; scale: 1 } - ParentChange { target: whiteRect; x: 10; y: 20; parent: imageDetails.frontContainer } - PropertyChanges { target: background; state: "DetailedView" } - } - ] - transitions: [ - Transition { - from: "Show"; to: "Details" - ParentAnimation { - via: foreground - NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } - } - }, - Transition { - from: "Details"; to: "Show" - ParentAnimation { - via: foreground - NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } - } - } - ] - } - MouseArea { anchors.fill: wrapper; onClicked: photoClicked() } -} - diff --git a/examples/demos/flickr/qml/flickr/mobile/ImageDetails.qml b/examples/demos/flickr/qml/flickr/mobile/ImageDetails.qml deleted file mode 100644 index 27a8f44c..00000000 --- a/examples/demos/flickr/qml/flickr/mobile/ImageDetails.qml +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import "../common" as Common - -Flipable { - id: container - - property alias frontContainer: containerFront - property string photoTitle: "" - property string photoTags: "" - property int photoWidth - property int photoHeight - property string photoType - property string photoAuthor - property string photoDate - property string photoUrl - property int rating: 2 - property variant prevScale: 1.0 - - signal closed - - transform: Rotation { - id: itemRotation - origin.x: container.width / 2; - axis.y: 1; axis.z: 0 - } - - front: Item { - id: containerFront; anchors.fill: container - - Rectangle { - anchors.fill: parent - color: "black"; opacity: 0.4 - } - - Column { - spacing: 10 - anchors { - left: parent.left; leftMargin: 10 - right: parent.right; rightMargin: 10 - top: parent.top; topMargin: 120 - } - Text { font.bold: true; color: "white"; elide: Text.ElideRight; text: container.photoTitle; width: parent.width } - Text { color: "white"; elide: Text.ElideRight; text: "Size: " + container.photoWidth + 'x' + container.photoHeight; width: parent.width } - Text { color: "white"; elide: Text.ElideRight; text: "Type: " + container.photoType; width: parent.width } - Text { color: "white"; elide: Text.ElideRight; text: "Author: " + container.photoAuthor; width: parent.width } - Text { color: "white"; elide: Text.ElideRight; text: "Published: " + container.photoDate; width: parent.width } - Text { color: "white"; elide: Text.ElideRight; text: container.photoTags == "" ? "" : "Tags: "; width: parent.width } - Text { color: "white"; elide: Text.ElideRight; text: container.photoTags; width: parent.width } - } - } - - back: Item { - anchors.fill: container - - Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4 } - - Common.Progress { - anchors.centerIn: parent; width: 200; height: 22 - progress: bigImage.progress; visible: bigImage.status != Image.Ready - } - - Flickable { - id: flickable; anchors.fill: parent; clip: true - contentWidth: imageContainer.width; contentHeight: imageContainer.height - - function updateMinimumScale() { - if (bigImage.status == Image.Ready && bigImage.width != 0) { - slider.minimum = Math.min(flickable.width / bigImage.width, flickable.height / bigImage.height); - if (bigImage.width * slider.value > flickable.width) { - var xoff = (flickable.width/2 + flickable.contentX) * slider.value / prevScale; - flickable.contentX = xoff - flickable.width/2; - } - if (bigImage.height * slider.value > flickable.height) { - var yoff = (flickable.height/2 + flickable.contentY) * slider.value / prevScale; - flickable.contentY = yoff - flickable.height/2; - } - prevScale = slider.value; - } - } - - onWidthChanged: updateMinimumScale() - onHeightChanged: updateMinimumScale() - - Item { - id: imageContainer - width: Math.max(bigImage.width * bigImage.scale, flickable.width); - height: Math.max(bigImage.height * bigImage.scale, flickable.height); - - Image { - id: bigImage; source: container.photoUrl; scale: slider.value - anchors.centerIn: parent; smooth: !flickable.movingVertically - onStatusChanged : { - // Default scale shows the entire image. - if (bigImage.status == Image.Ready && bigImage.width != 0) { - slider.minimum = Math.min(flickable.width / bigImage.width, flickable.height / bigImage.height); - prevScale = Math.min(slider.minimum, 1); - slider.value = prevScale; - } - } - } - } - } - - Text { - text: "Image Unavailable" - visible: bigImage.status == Image.Error - anchors.centerIn: parent; color: "white"; font.bold: true - } - - Common.Slider { - id: slider; visible: { bigImage.status == Image.Ready && maximum > minimum } - anchors { - bottom: parent.bottom; bottomMargin: 65 - left: parent.left; leftMargin: 25 - right: parent.right; rightMargin: 25 - } - onValueChanged: { - if (bigImage.width * value > flickable.width) { - var xoff = (flickable.width/2 + flickable.contentX) * value / prevScale; - flickable.contentX = xoff - flickable.width/2; - } - if (bigImage.height * value > flickable.height) { - var yoff = (flickable.height/2 + flickable.contentY) * value / prevScale; - flickable.contentY = yoff - flickable.height/2; - } - prevScale = value; - } - } - } - - states: State { - name: "Back" - PropertyChanges { target: itemRotation; angle: 180 } - PropertyChanges { target: toolBar; button2Visible: false } - PropertyChanges { target: toolBar; button1Label: "Back" } - } - - transitions: Transition { - SequentialAnimation { - PropertyAction { target: bigImage; property: "smooth"; value: false } - NumberAnimation { easing.type: Easing.InOutQuad; properties: "angle"; duration: 500 } - PropertyAction { target: bigImage; property: "smooth"; value: !flickable.movingVertically } - } - } -} diff --git a/examples/demos/flickr/qml/flickr/mobile/ListDelegate.qml b/examples/demos/flickr/qml/flickr/mobile/ListDelegate.qml deleted file mode 100644 index 0165ffb0..00000000 --- a/examples/demos/flickr/qml/flickr/mobile/ListDelegate.qml +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Component { - Item { - id: wrapper; width: wrapper.ListView.view.width; height: 86 - Item { - id: moveMe - Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 } - Rectangle { - x: 6; y: 4; width: 77; height: 77; color: "white"; smooth: true - - Image { source: imagePath; x: 1; y: 1 } - Image { source: "images/gloss.png" } - } - Column { - x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2 - Text { text: title; color: "white"; width: parent.width; font.pixelSize: 14; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" } - Text { text: photoAuthor; width: parent.width; font.pixelSize: 14; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } - Text { text: photoDate; width: parent.width; font.pixelSize: 14; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" } - } - } - } -} diff --git a/examples/demos/flickr/qml/flickr/mobile/TitleBar.qml b/examples/demos/flickr/qml/flickr/mobile/TitleBar.qml deleted file mode 100644 index 82370212..00000000 --- a/examples/demos/flickr/qml/flickr/mobile/TitleBar.qml +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: titleBar - property string untaggedString: "Uploads from everyone" - property string taggedString: "Recent uploads tagged " - - BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } - - Item { - id: container - width: (parent.width * 2) - 55 ; height: parent.height - - function accept() { - imageDetails.closed() - titleBar.state = "" - background.state = "" - rssModel.tags = editor.text - } - - Image { - id: quitButton - anchors.left: parent.left//; anchors.leftMargin: 0 - anchors.verticalCenter: parent.verticalCenter - source: "images/quit.png" - MouseArea { - anchors.fill: parent - onClicked: Qt.quit() - } - } - - Text { - id: categoryText - anchors { - left: quitButton.right; right: tagButton.left; leftMargin: 10; rightMargin: 10 - verticalCenter: parent.verticalCenter - } - elide: Text.ElideLeft - text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags) - font.bold: true; font.pixelSize: 15; color: "White"; style: Text.Raised; styleColor: "Black" - } - - Button { - id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..." - onClicked: if (titleBar.state == "Tags") container.accept(); else titleBar.state = "Tags" - anchors.verticalCenter: parent.verticalCenter - } - - Item { - id: lineEdit - y: 4; height: parent.height - 9 - anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 } - - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - - TextInput { - id: editor - anchors { - left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10 - verticalCenter: parent.verticalCenter - } - cursorVisible: true; font.bold: true - color: "#151515"; selectionColor: "Green" - } - - Keys.forwardTo: [ (returnKey), (editor)] - - Item { - id: returnKey - Keys.onReturnPressed: container.accept() - Keys.onEnterPressed: container.accept() - Keys.onEscapePressed: titleBar.state = "" - } - } - } - - states: State { - name: "Tags" - PropertyChanges { target: container; x: -tagButton.x + 5 } - PropertyChanges { target: tagButton; text: "OK" } - PropertyChanges { target: editor; focus: true } - } - - transitions: Transition { - NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad } - } -} diff --git a/examples/demos/flickr/qml/flickr/mobile/ToolBar.qml b/examples/demos/flickr/qml/flickr/mobile/ToolBar.qml deleted file mode 100644 index 7e268303..00000000 --- a/examples/demos/flickr/qml/flickr/mobile/ToolBar.qml +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: toolbar - - property alias button1Label: button1.text - property alias button2Label: button2.text - property alias button2Visible: button2.visible - - signal button1Clicked - signal button2Clicked - - BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } - - Row { - anchors.right: parent.right; anchors.rightMargin: 5; y: 3; height: 32; spacing: 30 - Button { - id: button1 - width: 140; height: 32 - onClicked: toolbar.button1Clicked() - } - - Button { - id: button2; width: 140; height: 32 - onClicked: toolbar.button2Clicked() - } - } -} diff --git a/examples/demos/flickr/qml/flickr/mobile/images/gloss.png b/examples/demos/flickr/qml/flickr/mobile/images/gloss.png deleted file mode 100644 index 5d370cd9..00000000 Binary files a/examples/demos/flickr/qml/flickr/mobile/images/gloss.png and /dev/null differ diff --git a/examples/demos/flickr/qml/flickr/mobile/images/lineedit.png b/examples/demos/flickr/qml/flickr/mobile/images/lineedit.png deleted file mode 100644 index 2cc38dc3..00000000 Binary files a/examples/demos/flickr/qml/flickr/mobile/images/lineedit.png and /dev/null differ diff --git a/examples/demos/flickr/qml/flickr/mobile/images/lineedit.sci b/examples/demos/flickr/qml/flickr/mobile/images/lineedit.sci deleted file mode 100644 index 054bff78..00000000 --- a/examples/demos/flickr/qml/flickr/mobile/images/lineedit.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 10 -border.top: 10 -border.bottom: 10 -border.right: 10 -source: lineedit.png diff --git a/examples/demos/flickr/qml/flickr/mobile/images/quit.png b/examples/demos/flickr/qml/flickr/mobile/images/quit.png deleted file mode 100644 index 5bda1b6e..00000000 Binary files a/examples/demos/flickr/qml/flickr/mobile/images/quit.png and /dev/null differ diff --git a/examples/demos/flickr/qml/flickr/mobile/images/stripes.png b/examples/demos/flickr/qml/flickr/mobile/images/stripes.png deleted file mode 100644 index 9f36727e..00000000 Binary files a/examples/demos/flickr/qml/flickr/mobile/images/stripes.png and /dev/null differ diff --git a/examples/demos/flickr/qml/flickr/mobile/images/titlebar.png b/examples/demos/flickr/qml/flickr/mobile/images/titlebar.png deleted file mode 100644 index 51c90082..00000000 Binary files a/examples/demos/flickr/qml/flickr/mobile/images/titlebar.png and /dev/null differ diff --git a/examples/demos/flickr/qml/flickr/mobile/images/titlebar.sci b/examples/demos/flickr/qml/flickr/mobile/images/titlebar.sci deleted file mode 100644 index 0418d94c..00000000 --- a/examples/demos/flickr/qml/flickr/mobile/images/titlebar.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 10 -border.top: 12 -border.bottom: 12 -border.right: 10 -source: titlebar.png diff --git a/examples/demos/flickr/qml/flickr/mobile/images/toolbutton.png b/examples/demos/flickr/qml/flickr/mobile/images/toolbutton.png deleted file mode 100644 index 11310013..00000000 Binary files a/examples/demos/flickr/qml/flickr/mobile/images/toolbutton.png and /dev/null differ diff --git a/examples/demos/flickr/qml/flickr/mobile/images/toolbutton.sci b/examples/demos/flickr/qml/flickr/mobile/images/toolbutton.sci deleted file mode 100644 index 9e4f9653..00000000 --- a/examples/demos/flickr/qml/flickr/mobile/images/toolbutton.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 15 -border.top: 4 -border.bottom: 4 -border.right: 15 -source: toolbutton.png diff --git a/examples/demos/minehunt/README b/examples/demos/minehunt/README deleted file mode 100644 index 3849ca5f..00000000 --- a/examples/demos/minehunt/README +++ /dev/null @@ -1,6 +0,0 @@ -Minehunt has to be compiled to run. - -To compile the C++ part, do 'qmake && make'. -To run, simply run the executable. -To deploy on a device, do 'make sis'. - diff --git a/examples/demos/minehunt/main.cpp b/examples/demos/minehunt/main.cpp deleted file mode 100644 index cfe36f0b..00000000 --- a/examples/demos/minehunt/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlapplicationviewer.h" -#include "minehunt.h" -#include -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - QmlApplicationViewer viewer; - - qmlRegisterType(); - MinehuntGame* game = new MinehuntGame(); - - viewer.engine()->rootContext()->setContextObject(game); - viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); - viewer.setMainQmlFile(QLatin1String("qml/minehunt/minehunt.qml")); - viewer.showExpanded(); - - return app.exec(); -} diff --git a/examples/demos/minehunt/minehunt.cpp b/examples/demos/minehunt/minehunt.cpp deleted file mode 100644 index 3527cc17..00000000 --- a/examples/demos/minehunt/minehunt.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "minehunt.h" - -void tilesPropAppend(QDeclarativeListProperty* prop, TileData* value) -{ - Q_UNUSED(prop); - Q_UNUSED(value); - return; //Append not supported -} - -int tilesPropCount(QDeclarativeListProperty* prop) -{ - return static_cast*>(prop->data)->count(); -} - -TileData* tilesPropAt(QDeclarativeListProperty* prop, int index) -{ - return static_cast*>(prop->data)->at(index); -} - -QDeclarativeListProperty MinehuntGame::tiles(){ - return QDeclarativeListProperty(this, &_tiles, &tilesPropAppend, - &tilesPropCount, &tilesPropAt, 0); -} - -MinehuntGame::MinehuntGame() -: numCols(9), numRows(9), playing(true), won(false) -{ - setObjectName("mainObject"); - srand(QTime(0,0,0).secsTo(QTime::currentTime())); - - //initialize array - for(int ii = 0; ii < numRows * numCols; ++ii) { - _tiles << new TileData; - } - reset(); - -} - -void MinehuntGame::setBoard() -{ - foreach(TileData* t, _tiles){ - t->setHasMine(false); - t->setHint(-1); - } - //place mines - int mines = nMines; - remaining = numRows*numCols-mines; - while ( mines ) { - int col = int((double(rand()) / double(RAND_MAX)) * numCols); - int row = int((double(rand()) / double(RAND_MAX)) * numRows); - - TileData* t = tile( row, col ); - - if (t && !t->hasMine()) { - t->setHasMine( true ); - mines--; - } - } - - //set hints - for (int r = 0; r < numRows; r++) - for (int c = 0; c < numCols; c++) { - TileData* t = tile(r, c); - if (t && !t->hasMine()) { - int hint = getHint(r,c); - t->setHint(hint); - } - } - - setPlaying(true); -} - -void MinehuntGame::reset() -{ - foreach(TileData* t, _tiles){ - t->unflip(); - t->setHasFlag(false); - } - nMines = 12; - nFlags = 0; - emit numMinesChanged(); - emit numFlagsChanged(); - setPlaying(false); - QTimer::singleShot(600,this, SLOT(setBoard())); -} - -int MinehuntGame::getHint(int row, int col) -{ - int hint = 0; - for (int c = col-1; c <= col+1; c++) - for (int r = row-1; r <= row+1; r++) { - TileData* t = tile(r, c); - if (t && t->hasMine()) - hint++; - } - return hint; -} - -bool MinehuntGame::flip(int row, int col) -{ - if(!playing) - return false; - - TileData *t = tile(row, col); - if (!t || t->hasFlag()) - return false; - - if(t->flipped()){ - int flags = 0; - for (int c = col-1; c <= col+1; c++) - for (int r = row-1; r <= row+1; r++) { - TileData *nearT = tile(r, c); - if(!nearT || nearT == t) - continue; - if(nearT->hasFlag()) - flags++; - } - if(!t->hint() || t->hint() != flags) - return false; - for (int c = col-1; c <= col+1; c++) - for (int r = row-1; r <= row+1; r++) { - TileData *nearT = tile(r, c); - if (nearT && !nearT->flipped() && !nearT->hasFlag()) { - flip( r, c ); - } - } - return true; - } - - t->flip(); - - if (t->hint() == 0) { - for (int c = col-1; c <= col+1; c++) - for (int r = row-1; r <= row+1; r++) { - TileData* t = tile(r, c); - if (t && !t->flipped()) { - flip( r, c ); - } - } - } - - if(t->hasMine()){ - for (int r = 0; r < numRows; r++)//Flip all other mines - for (int c = 0; c < numCols; c++) { - TileData* t = tile(r, c); - if (t && t->hasMine()) { - flip(r, c); - } - } - won = false; - hasWonChanged(); - setPlaying(false); - return true; - } - - remaining--; - if(!remaining){ - won = true; - hasWonChanged(); - setPlaying(false); - return true; - } - return true; -} - -bool MinehuntGame::flag(int row, int col) -{ - TileData *t = tile(row, col); - if(!t || !playing || t->flipped()) - return false; - - t->setHasFlag(!t->hasFlag()); - nFlags += (t->hasFlag()?1:-1); - emit numFlagsChanged(); - return true; -} diff --git a/examples/demos/minehunt/minehunt.h b/examples/demos/minehunt/minehunt.h deleted file mode 100644 index f949ffd7..00000000 --- a/examples/demos/minehunt/minehunt.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include - -class TileData : public QObject -{ - Q_OBJECT -public: - TileData() : _hasFlag(false), _hasMine(false), _hint(-1), _flipped(false) {} - - Q_PROPERTY(bool hasFlag READ hasFlag WRITE setHasFlag NOTIFY hasFlagChanged) - bool hasFlag() const { return _hasFlag; } - - Q_PROPERTY(bool hasMine READ hasMine NOTIFY hasMineChanged) - bool hasMine() const { return _hasMine; } - - Q_PROPERTY(int hint READ hint NOTIFY hintChanged) - int hint() const { return _hint; } - - Q_PROPERTY(bool flipped READ flipped NOTIFY flippedChanged()) - bool flipped() const { return _flipped; } - - void setHasFlag(bool flag) {if(flag==_hasFlag) return; _hasFlag = flag; emit hasFlagChanged();} - void setHasMine(bool mine) {if(mine==_hasMine) return; _hasMine = mine; emit hasMineChanged();} - void setHint(int hint) { if(hint == _hint) return; _hint = hint; emit hintChanged(); } - void flip() { if (_flipped) return; _flipped = true; emit flippedChanged(); } - void unflip() { if(!_flipped) return; _flipped = false; emit flippedChanged(); } - -signals: - void flippedChanged(); - void hasFlagChanged(); - void hintChanged(); - void hasMineChanged(); - -private: - bool _hasFlag; - bool _hasMine; - int _hint; - bool _flipped; -}; - -class MinehuntGame : public QObject -{ - Q_OBJECT -public: - MinehuntGame(); - - Q_PROPERTY(QDeclarativeListProperty tiles READ tiles CONSTANT) - QDeclarativeListProperty tiles(); - - Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged) - bool isPlaying() {return playing;} - - Q_PROPERTY(bool hasWon READ hasWon NOTIFY hasWonChanged) - bool hasWon() {return won;} - - Q_PROPERTY(int numMines READ numMines NOTIFY numMinesChanged) - int numMines() const{return nMines;} - - Q_PROPERTY(int numFlags READ numFlags NOTIFY numFlagsChanged) - int numFlags() const{return nFlags;} - -public slots: - Q_INVOKABLE bool flip(int row, int col); - Q_INVOKABLE bool flag(int row, int col); - void setBoard(); - void reset(); - -signals: - void isPlayingChanged(); - void hasWonChanged(); - void numMinesChanged(); - void numFlagsChanged(); - -private: - bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; } - TileData *tile( int row, int col ) { return onBoard(row, col) ? _tiles[col+numRows*row] : 0; } - int getHint(int row, int col); - void setPlaying(bool b){if(b==playing) return; playing=b; emit isPlayingChanged();} - - QList _tiles; - int numCols; - int numRows; - bool playing; - bool won; - int remaining; - int nMines; - int nFlags; -}; diff --git a/examples/demos/minehunt/minehunt.pro b/examples/demos/minehunt/minehunt.pro deleted file mode 100644 index 2a43a11f..00000000 --- a/examples/demos/minehunt/minehunt.pro +++ /dev/null @@ -1,25 +0,0 @@ -# Add more folders to ship with the application, here -folder_01.source = qml/minehunt -folder_01.target = qml -DEPLOYMENTFOLDERS = folder_01 - -# Additional import path used to resolve QML modules in Creator's code model -QML_IMPORT_PATH = - -# If your application uses the Qt Mobility libraries, uncomment the following -# lines and add the respective components to the MOBILITY variable. -# CONFIG += mobility -# MOBILITY += - -# Speed up launching on MeeGo/Harmattan when using applauncherd daemon -# CONFIG += qdeclarative-boostable - -HEADERS += minehunt.h -SOURCES += main.cpp minehunt.cpp -RESOURCES = minehunt.qrc - -# Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/demos/minehunt -exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) -qtcAddDeployment() diff --git a/examples/demos/minehunt/minehunt.qmlproject b/examples/demos/minehunt/minehunt.qmlproject deleted file mode 100644 index 1f8b659f..00000000 --- a/examples/demos/minehunt/minehunt.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "qml/minehunt" - } - JavaScriptFiles { - directory: "qml/minehunt" - } - ImageFiles { - directory: "qml/minehunt" - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/demos/minehunt/minehunt.qrc b/examples/demos/minehunt/minehunt.qrc deleted file mode 100644 index 4694beb1..00000000 --- a/examples/demos/minehunt/minehunt.qrc +++ /dev/null @@ -1,19 +0,0 @@ - - - qml/minehunt/minehunt.qml - qml/minehunt/MinehuntCore/Explosion.qml - qml/minehunt/MinehuntCore/Tile.qml - qml/minehunt/MinehuntCore/pics/background.png - qml/minehunt/MinehuntCore/pics/back.png - qml/minehunt/MinehuntCore/pics/bomb-color.png - qml/minehunt/MinehuntCore/pics/bomb.png - qml/minehunt/MinehuntCore/pics/face-sad.png - qml/minehunt/MinehuntCore/pics/face-smile-big.png - qml/minehunt/MinehuntCore/pics/face-smile.png - qml/minehunt/MinehuntCore/pics/flag-color.png - qml/minehunt/MinehuntCore/pics/flag.png - qml/minehunt/MinehuntCore/pics/front.png - qml/minehunt/MinehuntCore/pics/quit.png - qml/minehunt/MinehuntCore/pics/star.png - - diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/Explosion.qml b/examples/demos/minehunt/qml/minehunt/MinehuntCore/Explosion.qml deleted file mode 100644 index f096c26c..00000000 --- a/examples/demos/minehunt/qml/minehunt/MinehuntCore/Explosion.qml +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import Qt.labs.particles 1.0 - -Item { - property bool explode : false - - Particles { - id: particles - width: 40 - height: 40 - lifeSpan: 1000 - lifeSpanDeviation: 0 - source: "pics/star.png" - count: 0 - angle: 270 - angleDeviation: 360 - velocity: 100 - velocityDeviation: 20 - z: 100 - } - states: State { name: "exploding"; when: explode - StateChangeScript {script: particles.burst(200); } - } -} diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/Tile.qml b/examples/demos/minehunt/qml/minehunt/MinehuntCore/Tile.qml deleted file mode 100644 index 15b8f871..00000000 --- a/examples/demos/minehunt/qml/minehunt/MinehuntCore/Tile.qml +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Flipable { - id: flipable - property int angle: 0 - - width: 40; height: 40 - transform: Rotation { origin.x: 20; origin.y: 20; axis.x: 1; axis.z: 0; angle: flipable.angle } - - front: Image { - source: "pics/front.png"; width: 40; height: 40 - - Image { - anchors.centerIn: parent - source: "pics/flag.png"; opacity: modelData.hasFlag - - Behavior on opacity { NumberAnimation {} } - } - } - - back: Image { - source: "pics/back.png" - width: 40; height: 40 - - Text { - anchors.centerIn: parent - text: modelData.hint; color: "white"; font.bold: true - opacity: !modelData.hasMine && modelData.hint > 0 - } - - Image { - anchors.centerIn: parent - source: "pics/bomb.png"; opacity: modelData.hasMine - } - - Explosion { id: expl } - } - - states: State { - name: "back"; when: modelData.flipped - PropertyChanges { target: flipable; angle: 180 } - } - - property real pauseDur: 250 - transitions: Transition { - SequentialAnimation { - ScriptAction { - script: { - var ret = Math.abs(flipable.x - field.clickx) - + Math.abs(flipable.y - field.clicky); - if (modelData.hasMine && modelData.flipped) - pauseDur = ret * 3 - else - pauseDur = ret - } - } - PauseAnimation { - duration: pauseDur - } - RotationAnimation { easing.type: Easing.InOutQuad } - ScriptAction { script: if (modelData.hasMine && modelData.flipped) { expl.explode = true } } - } - } - - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: { - field.clickx = flipable.x - field.clicky = flipable.y - var row = Math.floor(index / 9) - var col = index - (Math.floor(index / 9) * 9) - if (mouse.button == undefined || mouse.button == Qt.RightButton) { - flag(row, col) - } else { - flip(row, col) - } - } - onPressAndHold: { - field.clickx = flipable.x - field.clicky = flipable.y - var row = Math.floor(index / 9) - var col = index - (Math.floor(index / 9) * 9) - flag(row, col) - } - } -} diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/back.png b/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/back.png deleted file mode 100644 index f6b3f0b4..00000000 Binary files a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/back.png and /dev/null differ diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/background.png b/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/background.png deleted file mode 100644 index 3734a277..00000000 Binary files a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/background.png and /dev/null differ diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/bomb-color.png b/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/bomb-color.png deleted file mode 100644 index 61ad0a92..00000000 Binary files a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/bomb-color.png and /dev/null differ diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/bomb.png b/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/bomb.png deleted file mode 100644 index a9925755..00000000 Binary files a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/bomb.png and /dev/null differ diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/face-sad.png b/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/face-sad.png deleted file mode 100644 index cf00aafe..00000000 Binary files a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/face-sad.png and /dev/null differ diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/face-smile-big.png b/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/face-smile-big.png deleted file mode 100644 index f9c2335d..00000000 Binary files a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/face-smile-big.png and /dev/null differ diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/face-smile.png b/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/face-smile.png deleted file mode 100644 index 3d66d725..00000000 Binary files a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/face-smile.png and /dev/null differ diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/flag-color.png b/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/flag-color.png deleted file mode 100644 index aadad0f1..00000000 Binary files a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/flag-color.png and /dev/null differ diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/flag.png b/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/flag.png deleted file mode 100644 index 39cde4df..00000000 Binary files a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/flag.png and /dev/null differ diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/front.png b/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/front.png deleted file mode 100644 index 834331bd..00000000 Binary files a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/front.png and /dev/null differ diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/quit.png b/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/quit.png deleted file mode 100644 index b822057d..00000000 Binary files a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/quit.png and /dev/null differ diff --git a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/star.png b/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/star.png deleted file mode 100644 index 37723591..00000000 Binary files a/examples/demos/minehunt/qml/minehunt/MinehuntCore/pics/star.png and /dev/null differ diff --git a/examples/demos/minehunt/qml/minehunt/minehunt.qml b/examples/demos/minehunt/qml/minehunt/minehunt.qml deleted file mode 100644 index 2c0911a2..00000000 --- a/examples/demos/minehunt/qml/minehunt/minehunt.qml +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import "MinehuntCore" - -Item { - id: field - property int clickx: 0 - property int clicky: 0 - - width: 450; height: 450 - - Image { source: "MinehuntCore/pics/background.png"; anchors.fill: parent; fillMode: Image.Tile } - - Grid { - anchors.horizontalCenter: parent.horizontalCenter - columns: 9; spacing: 1 - - Repeater { - id: repeater - model: tiles - delegate: Tile {} - } - } - - Row { - id: gamedata - x: 20; spacing: 20 - anchors.bottom: field.bottom; anchors.bottomMargin: 15 - - Image { - source: "MinehuntCore/pics/quit.png" - scale: quitMouse.pressed ? 0.8 : 1.0 - smooth: quitMouse.pressed - y: 10 - MouseArea { - id: quitMouse - anchors.fill: parent - anchors.margins: -20 - onClicked: Qt.quit() - } - } - Column { - spacing: 2 - Image { source: "MinehuntCore/pics/bomb-color.png" } - Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numMines } - } - - Column { - spacing: 2 - Image { source: "MinehuntCore/pics/flag-color.png" } - Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numFlags } - } - } - - Image { - anchors.bottom: field.bottom; anchors.bottomMargin: 15 - anchors.right: field.right; anchors.rightMargin: 20 - source: isPlaying ? 'MinehuntCore/pics/face-smile.png' : - hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png' - - MouseArea { anchors.fill: parent; onPressed: reset() } - } - Text { - anchors.centerIn: parent; width: parent.width - 20 - horizontalAlignment: Text.AlignHCenter - wrapMode: Text.WordWrap - text: "Minehunt demo has to be compiled to run.\n\nPlease see README." - color: "white"; font.bold: true; font.pixelSize: 14 - visible: tiles == undefined - } - -} diff --git a/examples/demos/photoviewer/main.cpp b/examples/demos/photoviewer/main.cpp deleted file mode 100644 index ba976b2d..00000000 --- a/examples/demos/photoviewer/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlapplicationviewer.h" -#include - -Q_DECL_EXPORT int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QmlApplicationViewer viewer; - viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); - viewer.setMainQmlFile(QLatin1String("qml/photoviewer/photoviewer.qml")); - viewer.showExpanded(); - - return app.exec(); -} diff --git a/examples/demos/photoviewer/photoviewer.desktop b/examples/demos/photoviewer/photoviewer.desktop deleted file mode 100644 index 4246b9f3..00000000 --- a/examples/demos/photoviewer/photoviewer.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=photoviewer -Exec=/opt/photoviewer/bin/photoviewer -Icon=photoviewer64 -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/photoviewer/photoviewer.pro b/examples/demos/photoviewer/photoviewer.pro deleted file mode 100644 index 694aeb36..00000000 --- a/examples/demos/photoviewer/photoviewer.pro +++ /dev/null @@ -1,24 +0,0 @@ -# Add more folders to ship with the application, here -folder_01.source = qml/photoviewer -folder_01.target = qml -DEPLOYMENTFOLDERS = folder_01 - -# Additional import path used to resolve QML modules in Creator's code model -QML_IMPORT_PATH = - -# If your application uses the Qt Mobility libraries, uncomment the following -# lines and add the respective components to the MOBILITY variable. -# CONFIG += mobility -# MOBILITY += - -# Speed up launching on MeeGo/Harmattan when using applauncherd daemon -# CONFIG += qdeclarative-boostable - -# The .cpp file which was generated for your project. Feel free to hack it. -SOURCES += main.cpp - -# Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/demos/photoviewer -exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) -qtcAddDeployment() diff --git a/examples/demos/photoviewer/photoviewer.qmlproject b/examples/demos/photoviewer/photoviewer.qmlproject deleted file mode 100644 index 025a3a8f..00000000 --- a/examples/demos/photoviewer/photoviewer.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "qml/photoviewer" - } - JavaScriptFiles { - directory: "qml/photoviewer" - } - ImageFiles { - directory: "qml/photoviewer" - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/demos/photoviewer/photoviewer.svg b/examples/demos/photoviewer/photoviewer.svg deleted file mode 100644 index 566acfad..00000000 --- a/examples/demos/photoviewer/photoviewer.svg +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/examples/demos/photoviewer/photoviewer64.png b/examples/demos/photoviewer/photoviewer64.png deleted file mode 100644 index 707d5c4e..00000000 Binary files a/examples/demos/photoviewer/photoviewer64.png and /dev/null differ diff --git a/examples/demos/photoviewer/photoviewer80.png b/examples/demos/photoviewer/photoviewer80.png deleted file mode 100644 index 6ad8096c..00000000 Binary files a/examples/demos/photoviewer/photoviewer80.png and /dev/null differ diff --git a/examples/demos/photoviewer/photoviewer_harmattan.desktop b/examples/demos/photoviewer/photoviewer_harmattan.desktop deleted file mode 100644 index 2dced148..00000000 --- a/examples/demos/photoviewer/photoviewer_harmattan.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=photoviewer -Exec=/usr/bin/single-instance /opt/photoviewer/bin/photoviewer -Icon=/usr/share/icons/hicolor/80x80/apps/photoviewer80.png -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/AlbumDelegate.qml deleted file mode 100644 index 1b6e522b..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/AlbumDelegate.qml +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Component { - id: albumDelegate - Package { - - Item { - Package.name: 'browser' - GridView { - id: photosGridView; model: visualModel.parts.grid; width: mainWindow.width; height: mainWindow.height - 21 - x: 0; y: 21; cellWidth: 160; cellHeight: 153; interactive: false - onCurrentIndexChanged: photosListView.positionViewAtIndex(currentIndex, ListView.Contain) - } - } - - Item { - Package.name: 'fullscreen' - ListView { - id: photosListView; model: visualModel.parts.list; orientation: Qt.Horizontal - width: mainWindow.width; height: mainWindow.height; interactive: false - onCurrentIndexChanged: photosGridView.positionViewAtIndex(currentIndex, GridView.Contain) - highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem - } - } - - Item { - Package.name: 'album' - id: albumWrapper; width: 210; height: 220 - - VisualDataModel { - id: visualModel; delegate: PhotoDelegate { } - model: RssModel { id: rssModel; tags: tag } - } - - BusyIndicator { - id: busyIndicator - anchors { centerIn: parent; verticalCenterOffset: -20 } - on: rssModel.status != XmlListModel.Ready - } - - PathView { - id: photosPathView; model: visualModel.parts.stack; pathItemCount: 5 - visible: !busyIndicator.visible - anchors.centerIn: parent; anchors.verticalCenterOffset: -30 - path: Path { - PathAttribute { name: 'z'; value: 9999.0 } - PathLine { x: 1; y: 1 } - PathAttribute { name: 'z'; value: 0.0 } - } - } - - MouseArea { - anchors.fill: parent - onClicked: mainWindow.editMode ? photosModel.remove(index) : albumWrapper.state = 'inGrid' - } - - Tag { - anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 10 } - frontLabel: tag; backLabel: qsTr("Remove"); flipped: mainWindow.editMode - onTagChanged: rssModel.tags = tag - onBackClicked: if (mainWindow.editMode) photosModel.remove(index); - } - - states: [ - State { - name: 'inGrid' - PropertyChanges { target: photosGridView; interactive: true } - PropertyChanges { target: albumsShade; opacity: 1 } - PropertyChanges { target: backButton; onClicked: albumWrapper.state = ''; y: 6 } - }, - State { - name: 'fullscreen'; extend: 'inGrid' - PropertyChanges { target: photosGridView; interactive: false } - PropertyChanges { target: photosListView; interactive: true } - PropertyChanges { target: photosShade; opacity: 1 } - PropertyChanges { target: backButton; y: -backButton.height - 8 } - } - ] - - GridView.onAdd: NumberAnimation { - target: albumWrapper; properties: "scale"; from: 0.0; to: 1.0; easing.type: Easing.OutQuad - } - GridView.onRemove: SequentialAnimation { - PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: true } - NumberAnimation { target: albumWrapper; property: "scale"; from: 1.0; to: 0.0; easing.type: Easing.OutQuad } - PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: false } - } - - transitions: [ - Transition { - from: '*'; to: 'inGrid' - SequentialAnimation { - NumberAnimation { properties: 'opacity'; duration: 250 } - PauseAnimation { duration: 350 } - NumberAnimation { target: backButton; properties: "y"; duration: 200; easing.type: Easing.OutQuad } - } - }, - Transition { - from: 'inGrid'; to: '*' - NumberAnimation { properties: "y,opacity"; easing.type: Easing.OutQuad; duration: 300 } - } - ] - } - } -} diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/BusyIndicator.qml b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/BusyIndicator.qml deleted file mode 100644 index 3cfeaf83..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/BusyIndicator.qml +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Image { - id: container - property bool on: false - - source: "images/busy.png"; visible: container.on - NumberAnimation on rotation { running: container.on; from: 0; to: 360; loops: Animation.Infinite; duration: 1200 } -} diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/Button.qml b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/Button.qml deleted file mode 100644 index 29635d5a..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/Button.qml +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: container - - property alias label: labelText.text - property color tint: "transparent" - signal clicked - - width: labelText.width + 70 ; height: labelText.height + 18 - - BorderImage { - anchors { fill: container; leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } - source: 'images/box-shadow.png'; smooth: true - border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 - } - - Image { anchors.fill: parent; source: "images/cardboard.png"; smooth: true } - - Rectangle { - anchors.fill: container; color: container.tint; visible: container.tint != "" - opacity: 0.25; smooth: true - } - - Text { id: labelText; font.pixelSize: 15; anchors.centerIn: parent; smooth: true } - - MouseArea { - anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } - onClicked: container.clicked() - } -} diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/EditableButton.qml b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/EditableButton.qml deleted file mode 100644 index de98a515..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/EditableButton.qml +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: container - - property string label - signal clicked - signal labelChanged(string label) - - width: textInput.width + 70 ; height: textInput.height + 18 - - BorderImage { - anchors { fill: container; leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } - source: 'images/box-shadow.png'; smooth: true - border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 - } - - Image { anchors.fill: parent; source: "images/cardboard.png"; smooth: true } - - TextInput { - id: textInput; text: label; font.pixelSize: 15; anchors.centerIn: parent; smooth: true - Keys.onReturnPressed: { - container.labelChanged(textInput.text) - container.focus = true - } - Keys.onEnterPressed: { - container.labelChanged(textInput.text) - container.focus = true - } - Keys.onEscapePressed: { - textInput.text = container.label - container.focus = true - } - } - - Rectangle { - anchors.fill: container; border.color: "steelblue"; border.width: 4 - color: "transparent"; visible: textInput.focus; smooth: true - } - - MouseArea { - anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } - onClicked: { textInput.forceActiveFocus(); textInput.openSoftwareInputPanel(); } - } -} diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/PhotoDelegate.qml deleted file mode 100644 index bf7d92ee..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/PhotoDelegate.qml +++ /dev/null @@ -1,188 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.1 -import "script/script.js" as Script - -Package { - Item { id: stackItem; Package.name: 'stack'; width: 160; height: 153; z: stackItem.PathView.z } - Item { id: listItem; Package.name: 'list'; width: mainWindow.width + 40; height: 153 } - Item { id: gridItem; Package.name: 'grid'; width: 160; height: 153 } - - Item { - width: 160; height: 153 - - Item { - id: photoWrapper - - property double randomAngle: Math.random() * (2 * 6 + 1) - 6 - property double randomAngle2: Math.random() * (2 * 6 + 1) - 6 - - x: 0; y: 0; width: 140; height: 133 - z: stackItem.PathView.z; rotation: photoWrapper.randomAngle - - BorderImage { - anchors { - fill: originalImage.status == Image.Ready ? border : placeHolder - leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 - } - source: 'images/box-shadow.png'; smooth: true - border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 - } - Rectangle { - id: placeHolder - - property int w: Script.getWidth(content) - property int h: Script.getHeight(content) - property double s: Script.calculateScale(w, h, photoWrapper.width) - - color: 'white'; anchors.centerIn: parent; smooth: true - width: w * s; height: h * s; visible: originalImage.status != Image.Ready - Rectangle { - color: "#878787"; smooth: true - anchors { fill: parent; topMargin: 3; bottomMargin: 3; leftMargin: 3; rightMargin: 3 } - } - } - Rectangle { - id: border; color: 'white'; anchors.centerIn: parent; smooth: true - width: originalImage.paintedWidth + 6; height: originalImage.paintedHeight + 6 - visible: !placeHolder.visible - } - BusyIndicator { anchors.centerIn: parent; on: originalImage.status != Image.Ready } - Image { - id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content); cache: false - fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height - } - Image { - id: hqImage; smooth: true; source: ""; visible: false; cache: false - fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height - } - Binding { - target: mainWindow; property: "downloadProgress"; value: hqImage.progress - when: listItem.ListView.isCurrentItem - } - Binding { - target: mainWindow; property: "imageLoading" - value: (hqImage.status == Image.Loading) ? 1 : 0; when: listItem.ListView.isCurrentItem - } - MouseArea { - width: originalImage.paintedWidth; height: originalImage.paintedHeight; anchors.centerIn: originalImage - onClicked: { - if (albumWrapper.state == 'inGrid') { - gridItem.GridView.view.currentIndex = index; - albumWrapper.state = 'fullscreen' - } else { - gridItem.GridView.view.currentIndex = index; - albumWrapper.state = 'inGrid' - } - } - } - - states: [ - State { - name: 'stacked'; when: albumWrapper.state == '' - ParentChange { target: photoWrapper; parent: stackItem; x: 10; y: 10 } - PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 } - }, - State { - name: 'inGrid'; when: albumWrapper.state == 'inGrid' - ParentChange { target: photoWrapper; parent: gridItem; x: 10; y: 10; rotation: photoWrapper.randomAngle2 } - }, - State { - name: 'fullscreen'; when: albumWrapper.state == 'fullscreen' - ParentChange { - target: photoWrapper; parent: listItem; x: 0; y: 0; rotation: 0 - width: mainWindow.width; height: mainWindow.height - } - PropertyChanges { target: border; opacity: 0 } - PropertyChanges { target: hqImage; source: listItem.ListView.isCurrentItem ? hq : ""; visible: true } - } - ] - - transitions: [ - Transition { - from: 'stacked'; to: 'inGrid' - SequentialAnimation { - PauseAnimation { duration: 10 * index } - ParentAnimation { - target: photoWrapper; via: foreground - NumberAnimation { - target: photoWrapper; properties: 'x,y,rotation,opacity'; duration: 600; easing.type: 'OutQuart' - } - } - } - }, - Transition { - from: 'inGrid'; to: 'stacked' - ParentAnimation { - target: photoWrapper; via: foreground - NumberAnimation { properties: 'x,y,rotation,opacity'; duration: 600; easing.type: 'OutQuart' } - } - }, - Transition { - from: 'inGrid'; to: 'fullscreen' - SequentialAnimation { - PauseAnimation { duration: gridItem.GridView.isCurrentItem ? 0 : 600 } - ParentAnimation { - target: photoWrapper; via: foreground - NumberAnimation { - targets: [ photoWrapper, border ] - properties: 'x,y,width,height,opacity,rotation' - duration: gridItem.GridView.isCurrentItem ? 600 : 1; easing.type: 'OutQuart' - } - } - } - }, - Transition { - from: 'fullscreen'; to: 'inGrid' - ParentAnimation { - target: photoWrapper; via: foreground - NumberAnimation { - targets: [ photoWrapper, border ] - properties: 'x,y,width,height,rotation,opacity' - duration: gridItem.GridView.isCurrentItem ? 600 : 1; easing.type: 'OutQuart' - } - } - } - ] - } - } -} diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/ProgressBar.qml b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/ProgressBar.qml deleted file mode 100644 index 2e3e2fa8..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/ProgressBar.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: container - - property real progress: 0 - - Behavior on opacity { NumberAnimation { duration: 600 } } - - Rectangle { anchors.fill: parent; color: "black"; opacity: 0.5 } - - Rectangle { - id: fill; color: "white"; height: container.height - width: container.width * container.progress - } -} diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/RssModel.qml b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/RssModel.qml deleted file mode 100644 index 3bbcb5ab..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/RssModel.qml +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -XmlListModel { - property string tags : "" - - source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+tags+"&" : "") - query: "/feed/entry" - namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';" - - XmlRole { name: "title"; query: "title/string()" } - XmlRole { name: "content"; query: "content/string()" } - XmlRole { name: "hq"; query: "link[@rel='enclosure']/@href/string()" } -} diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/Tag.qml b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/Tag.qml deleted file mode 100644 index 8f783d40..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/Tag.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Flipable { - id: flipable - - property alias frontLabel: frontButton.label - property alias backLabel: backButton.label - - property int angle: 0 - property int randomAngle: Math.random() * (2 * 6 + 1) - 6 - property bool flipped: false - - signal frontClicked - signal backClicked - signal tagChanged(string tag) - - front: EditableButton { - id: frontButton; rotation: flipable.randomAngle - anchors { centerIn: parent; verticalCenterOffset: -20 } - onClicked: flipable.frontClicked() - onLabelChanged: flipable.tagChanged(label) - } - - back: Button { - id: backButton; tint: "red"; rotation: flipable.randomAngle - anchors { centerIn: parent; verticalCenterOffset: -20 } - onClicked: flipable.backClicked() - } - - transform: Rotation { - origin.x: flipable.width / 2; origin.y: flipable.height / 2 - axis.x: 0; axis.y: 1; axis.z: 0 - angle: flipable.angle - } - - states: State { - name: "back"; when: flipable.flipped - PropertyChanges { target: flipable; angle: 180 } - } - - transitions: Transition { - ParallelAnimation { - NumberAnimation { properties: "angle"; duration: 400 } - SequentialAnimation { - NumberAnimation { target: flipable; property: "scale"; to: 0.8; duration: 200 } - NumberAnimation { target: flipable; property: "scale"; to: 1.0; duration: 200 } - } - } - } -} diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/images/box-shadow.png b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/images/box-shadow.png deleted file mode 100644 index 431af854..00000000 Binary files a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/images/box-shadow.png and /dev/null differ diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/images/busy.png b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/images/busy.png deleted file mode 100644 index 664c2b14..00000000 Binary files a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/images/busy.png and /dev/null differ diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/images/cardboard.png b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/images/cardboard.png deleted file mode 100644 index 1847ab52..00000000 Binary files a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/images/cardboard.png and /dev/null differ diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/qmldir b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/qmldir deleted file mode 100644 index d3c247f2..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/qmldir +++ /dev/null @@ -1,8 +0,0 @@ -AlbumDelegate AlbumDelegate.qml -PhotoDelegate PhotoDelegate.qml -ProgressBar ProgressBar.qml -RssModel RssModel.qml -BusyIndicator BusyIndicator.qml -EditableButton EditableButton.qml -Button Button.qml -Tag Tag.qml diff --git a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/script/script.js b/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/script/script.js deleted file mode 100644 index e8ef93a8..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/PhotoViewerCore/script/script.js +++ /dev/null @@ -1,27 +0,0 @@ -.pragma library - -function getWidth(string) { - return (string.match(/width=\"([0-9]+)\"/))[1] -} - -function getHeight(string) { - return (string.match(/height=\"([0-9]+)\"/))[1] -} - -function getImagePath(string) { - var pattern = /src=\"http:\/\/(\S+)\"/ - return (string.match(pattern))[1] -} - -function calculateScale(width, height, cellSize) { - var widthScale = (cellSize * 1.0) / width - var heightScale = (cellSize * 1.0) / height - var scale = 0 - - if (widthScale <= heightScale) { - scale = widthScale; - } else if (heightScale < widthScale) { - scale = heightScale; - } - return scale; -} diff --git a/examples/demos/photoviewer/qml/photoviewer/i18n/base.ts b/examples/demos/photoviewer/qml/photoviewer/i18n/base.ts deleted file mode 100644 index 1accfd2f..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/i18n/base.ts +++ /dev/null @@ -1,30 +0,0 @@ - - - - - AlbumDelegate - - - Remove - - - - - photoviewer - - - Add - - - - - Edit - - - - - Back - - - - diff --git a/examples/demos/photoviewer/qml/photoviewer/i18n/qml_fr.qm b/examples/demos/photoviewer/qml/photoviewer/i18n/qml_fr.qm deleted file mode 100644 index c24fcbc4..00000000 Binary files a/examples/demos/photoviewer/qml/photoviewer/i18n/qml_fr.qm and /dev/null differ diff --git a/examples/demos/photoviewer/qml/photoviewer/i18n/qml_fr.ts b/examples/demos/photoviewer/qml/photoviewer/i18n/qml_fr.ts deleted file mode 100644 index 9f892db6..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/i18n/qml_fr.ts +++ /dev/null @@ -1,30 +0,0 @@ - - - - - AlbumDelegate - - - Remove - Supprimer - - - - photoviewer - - - Add - Ajouter - - - - Edit - Éditer - - - - Back - Retour - - - diff --git a/examples/demos/photoviewer/qml/photoviewer/photoviewer.qml b/examples/demos/photoviewer/qml/photoviewer/photoviewer.qml deleted file mode 100644 index 9c07e3ce..00000000 --- a/examples/demos/photoviewer/qml/photoviewer/photoviewer.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import "PhotoViewerCore" - -Rectangle { - id: mainWindow - - property real downloadProgress: 0 - property bool imageLoading: false - property bool editMode: false - - width: 800; height: 480; color: "#d5d6d8" - - ListModel { - id: photosModel - ListElement { tag: "Flowers" } - ListElement { tag: "Wildlife" } - ListElement { tag: "Prague" } - } - - VisualDataModel { id: albumVisualModel; model: photosModel; delegate: AlbumDelegate {} } - - GridView { - id: albumView; width: parent.width; height: parent.height; cellWidth: 210; cellHeight: 220 - model: albumVisualModel.parts.album; visible: albumsShade.opacity != 1.0 - } - - Column { - spacing: 20; anchors { bottom: parent.bottom; right: parent.right; rightMargin: 20; bottomMargin: 20 } - Button { - id: newButton; label: qsTr("Add"); rotation: 3 - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - mainWindow.editMode = false - photosModel.append( { tag: "" } ) - albumView.positionViewAtIndex(albumView.count - 1, GridView.Contain) - } - } - Button { - id: deleteButton; label: qsTr("Edit"); rotation: -2; - onClicked: mainWindow.editMode = !mainWindow.editMode - anchors.horizontalCenter: parent.horizontalCenter - } - Button { - id: quitButton; label: qsTr("Quit"); rotation: -2; - onClicked: Qt.quit() - anchors.horizontalCenter: parent.horizontalCenter - } - } - - Rectangle { - id: albumsShade; color: mainWindow.color - width: parent.width; height: parent.height; opacity: 0.0 - } - - ListView { anchors.fill: parent; model: albumVisualModel.parts.browser; interactive: false } - - Button { id: backButton; label: qsTr("Back"); rotation: 3; x: parent.width - backButton.width - 6; y: -backButton.height - 8 } - - Rectangle { id: photosShade; color: 'black'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 } - - ListView { anchors.fill: parent; model: albumVisualModel.parts.fullscreen; interactive: false } - - Item { id: foreground; anchors.fill: parent } - - ProgressBar { - progress: mainWindow.downloadProgress; width: parent.width; height: 4 - anchors.bottom: parent.bottom; opacity: mainWindow.imageLoading; visible: opacity != 0.0 - } -} diff --git a/examples/demos/rssnews/main.cpp b/examples/demos/rssnews/main.cpp deleted file mode 100644 index fb6cd05e..00000000 --- a/examples/demos/rssnews/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlapplicationviewer.h" -#include - -Q_DECL_EXPORT int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QmlApplicationViewer viewer; - viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); - viewer.setMainQmlFile(QLatin1String("qml/rssnews/rssnews.qml")); - viewer.showExpanded(); - - return app.exec(); -} diff --git a/examples/demos/rssnews/qml/rssnews/content/BusyIndicator.qml b/examples/demos/rssnews/qml/rssnews/content/BusyIndicator.qml deleted file mode 100644 index e3671cf8..00000000 --- a/examples/demos/rssnews/qml/rssnews/content/BusyIndicator.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Image { - id: container - property bool on: false - - source: "images/busy.png"; visible: container.on - - NumberAnimation on rotation { - running: container.on; from: 0; to: 360; loops: Animation.Infinite; duration: 1200 - } -} diff --git a/examples/demos/rssnews/qml/rssnews/content/CategoryDelegate.qml b/examples/demos/rssnews/qml/rssnews/content/CategoryDelegate.qml deleted file mode 100644 index fff34953..00000000 --- a/examples/demos/rssnews/qml/rssnews/content/CategoryDelegate.qml +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: delegate - - width: delegate.ListView.view.width; height: 60 - - Text { - text: name - color: delegate.ListView.isCurrentItem ? "white" : "black" - font { family: "Helvetica"; pixelSize: 16; bold: true } - anchors { - left: parent.left; leftMargin: 15 - verticalCenter: parent.verticalCenter - } - } - - BusyIndicator { - scale: 0.6 - on: delegate.ListView.isCurrentItem && window.loading - anchors { right: parent.right; rightMargin: 10; verticalCenter: parent.verticalCenter } - } - - Rectangle { - width: delegate.width; height: 1; color: "#cccccc" - anchors.bottom: delegate.bottom - visible: delegate.ListView.isCurrentItem ? false : true - } - Rectangle { - width: delegate.width; height: 1; color: "white" - visible: delegate.ListView.isCurrentItem ? false : true - } - - MouseArea { - anchors.fill: delegate - onClicked: { - delegate.ListView.view.currentIndex = index - window.currentFeed = feed - } - } -} diff --git a/examples/demos/rssnews/qml/rssnews/content/NewsDelegate.qml b/examples/demos/rssnews/qml/rssnews/content/NewsDelegate.qml deleted file mode 100644 index 030f1d88..00000000 --- a/examples/demos/rssnews/qml/rssnews/content/NewsDelegate.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: delegate - height: column.height + 40 - width: delegate.ListView.view.width - - Column { - id: column - x: 20; y: 20 - width: parent.width - 40 - - Text { - id: titleText - text: title; width: parent.width; wrapMode: Text.WordWrap - font { bold: true; family: "Helvetica"; pointSize: 16 } - } - - Text { - id: descriptionText - width: parent.width; text: description - wrapMode: Text.WordWrap; font.family: "Helvetica" - } - } - - Rectangle { - width: parent.width; height: 1; color: "#cccccc" - anchors.bottom: parent.bottom - } -} diff --git a/examples/demos/rssnews/qml/rssnews/content/RssFeeds.qml b/examples/demos/rssnews/qml/rssnews/content/RssFeeds.qml deleted file mode 100644 index 7aaa5ea8..00000000 --- a/examples/demos/rssnews/qml/rssnews/content/RssFeeds.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -ListModel { - id: rssFeeds - - ListElement { name: "Top Stories"; feed: "rss.news.yahoo.com/rss/topstories" } - ListElement { name: "World"; feed: "rss.news.yahoo.com/rss/world" } - ListElement { name: "Europe"; feed: "rss.news.yahoo.com/rss/europe" } - ListElement { name: "Oceania"; feed: "rss.news.yahoo.com/rss/oceania" } - ListElement { name: "U.S. National"; feed: "rss.news.yahoo.com/rss/us" } - ListElement { name: "Politics"; feed: "rss.news.yahoo.com/rss/politics" } - ListElement { name: "Business"; feed: "rss.news.yahoo.com/rss/business" } - ListElement { name: "Technology"; feed: "rss.news.yahoo.com/rss/tech" } - ListElement { name: "Entertainment"; feed: "rss.news.yahoo.com/rss/entertainment" } - ListElement { name: "Health"; feed: "rss.news.yahoo.com/rss/health" } - ListElement { name: "Science"; feed: "rss.news.yahoo.com/rss/science" } - ListElement { name: "Sports"; feed: "rss.news.yahoo.com/rss/sports" } -} diff --git a/examples/demos/rssnews/qml/rssnews/content/ScrollBar.qml b/examples/demos/rssnews/qml/rssnews/content/ScrollBar.qml deleted file mode 100644 index 0e2275fb..00000000 --- a/examples/demos/rssnews/qml/rssnews/content/ScrollBar.qml +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: container - - property variant scrollArea - property variant orientation: Qt.Vertical - - opacity: 0 - - function position() - { - var ny = 0; - if (container.orientation == Qt.Vertical) - ny = scrollArea.visibleArea.yPosition * container.height; - else - ny = scrollArea.visibleArea.xPosition * container.width; - if (ny > 2) return ny; else return 2; - } - - function size() - { - var nh, ny; - - if (container.orientation == Qt.Vertical) - nh = scrollArea.visibleArea.heightRatio * container.height; - else - nh = scrollArea.visibleArea.widthRatio * container.width; - - if (container.orientation == Qt.Vertical) - ny = scrollArea.visibleArea.yPosition * container.height; - else - ny = scrollArea.visibleArea.xPosition * container.width; - - if (ny > 3) { - var t; - if (container.orientation == Qt.Vertical) - t = Math.ceil(container.height - 3 - ny); - else - t = Math.ceil(container.width - 3 - ny); - if (nh > t) return t; else return nh; - } else return nh + ny; - } - - Rectangle { anchors.fill: parent; color: "Black"; opacity: 0.3 } - - BorderImage { - source: "images/scrollbar.png" - border { left: 1; right: 1; top: 1; bottom: 1 } - x: container.orientation == Qt.Vertical ? 2 : position() - width: container.orientation == Qt.Vertical ? container.width - 4 : size() - y: container.orientation == Qt.Vertical ? position() : 2 - height: container.orientation == Qt.Vertical ? size() : container.height - 4 - } - - states: State { - name: "visible" - when: container.orientation == Qt.Vertical ? scrollArea.movingVertically : scrollArea.movingHorizontally - PropertyChanges { target: container; opacity: 1.0 } - } - - transitions: Transition { - from: "visible"; to: "" - NumberAnimation { properties: "opacity"; duration: 600 } - } -} diff --git a/examples/demos/rssnews/qml/rssnews/content/images/busy.png b/examples/demos/rssnews/qml/rssnews/content/images/busy.png deleted file mode 100644 index 664c2b14..00000000 Binary files a/examples/demos/rssnews/qml/rssnews/content/images/busy.png and /dev/null differ diff --git a/examples/demos/rssnews/qml/rssnews/content/images/scrollbar.png b/examples/demos/rssnews/qml/rssnews/content/images/scrollbar.png deleted file mode 100644 index 0228dcf9..00000000 Binary files a/examples/demos/rssnews/qml/rssnews/content/images/scrollbar.png and /dev/null differ diff --git a/examples/demos/rssnews/qml/rssnews/rssnews.qml b/examples/demos/rssnews/qml/rssnews/rssnews.qml deleted file mode 100644 index 18ea2ed0..00000000 --- a/examples/demos/rssnews/qml/rssnews/rssnews.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import "content" - -Rectangle { - id: window - width: 800; height: 480 - - property string currentFeed: "rss.news.yahoo.com/rss/topstories" - property bool loading: feedModel.status == XmlListModel.Loading - - RssFeeds { id: rssFeeds } - - XmlListModel { - id: feedModel - source: "http://" + window.currentFeed - query: "/rss/channel/item" - - XmlRole { name: "title"; query: "title/string()" } - XmlRole { name: "link"; query: "link/string()" } - XmlRole { name: "description"; query: "description/string()" } - } - - Row { - Rectangle { - width: 220; height: window.height - color: "#efefef" - - ListView { - focus: true - id: categories - anchors.fill: parent - model: rssFeeds - footer: quitButtonDelegate - delegate: CategoryDelegate {} - highlight: Rectangle { color: "steelblue" } - highlightMoveSpeed: 9999999 - } - ScrollBar { - scrollArea: categories; height: categories.height; width: 8 - anchors.right: categories.right - } - } - ListView { - id: list - width: window.width - 220; height: window.height - model: feedModel - delegate: NewsDelegate {} - } - } - Component { - id: quitButtonDelegate - Item { - width: categories.width; height: 60 - Text { - text: "Quit" - font { family: "Helvetica"; pixelSize: 16; bold: true } - anchors { - left: parent.left; leftMargin: 15 - verticalCenter: parent.verticalCenter - } - } - MouseArea { - anchors.fill: parent - onClicked: Qt.quit() - } - } - } - ScrollBar { scrollArea: list; height: list.height; width: 8; anchors.right: window.right } - Rectangle { x: 220; height: window.height; width: 1; color: "#cccccc" } -} diff --git a/examples/demos/rssnews/rssnews.desktop b/examples/demos/rssnews/rssnews.desktop deleted file mode 100644 index 7d02ed5f..00000000 --- a/examples/demos/rssnews/rssnews.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=rssnews -Exec=/opt/rssnews/bin/rssnews -Icon=rssnews64 -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/rssnews/rssnews.pro b/examples/demos/rssnews/rssnews.pro deleted file mode 100644 index 14002fb1..00000000 --- a/examples/demos/rssnews/rssnews.pro +++ /dev/null @@ -1,24 +0,0 @@ -# Add more folders to ship with the application, here -folder_01.source = qml/rssnews -folder_01.target = qml -DEPLOYMENTFOLDERS = folder_01 - -# Additional import path used to resolve QML modules in Creator's code model -QML_IMPORT_PATH = - -# If your application uses the Qt Mobility libraries, uncomment the following -# lines and add the respective components to the MOBILITY variable. -# CONFIG += mobility -# MOBILITY += - -# Speed up launching on MeeGo/Harmattan when using applauncherd daemon -# CONFIG += qdeclarative-boostable - -# The .cpp file which was generated for your project. Feel free to hack it. -SOURCES += main.cpp - -# Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/demos/rssnews -exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) -qtcAddDeployment() diff --git a/examples/demos/rssnews/rssnews.qmlproject b/examples/demos/rssnews/rssnews.qmlproject deleted file mode 100644 index 608be8d3..00000000 --- a/examples/demos/rssnews/rssnews.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "qml/rssnews" - } - JavaScriptFiles { - directory: "qml/rssnews" - } - ImageFiles { - directory: "qml/rssnews" - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/demos/rssnews/rssnews.svg b/examples/demos/rssnews/rssnews.svg deleted file mode 100644 index 566acfad..00000000 --- a/examples/demos/rssnews/rssnews.svg +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/examples/demos/rssnews/rssnews64.png b/examples/demos/rssnews/rssnews64.png deleted file mode 100644 index 707d5c4e..00000000 Binary files a/examples/demos/rssnews/rssnews64.png and /dev/null differ diff --git a/examples/demos/rssnews/rssnews80.png b/examples/demos/rssnews/rssnews80.png deleted file mode 100644 index 6ad8096c..00000000 Binary files a/examples/demos/rssnews/rssnews80.png and /dev/null differ diff --git a/examples/demos/rssnews/rssnews_harmattan.desktop b/examples/demos/rssnews/rssnews_harmattan.desktop deleted file mode 100644 index df6303ff..00000000 --- a/examples/demos/rssnews/rssnews_harmattan.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=rssnews -Exec=/usr/bin/single-instance /opt/rssnews/bin/rssnews -Icon=/usr/share/icons/hicolor/80x80/apps/rssnews80.png -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/samegame/main.cpp b/examples/demos/samegame/main.cpp deleted file mode 100644 index f6e2b732..00000000 --- a/examples/demos/samegame/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlapplicationviewer.h" -#include - -Q_DECL_EXPORT int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QmlApplicationViewer viewer; - viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); - viewer.setMainQmlFile(QLatin1String("qml/samegame/samegame.qml")); - viewer.showExpanded(); - - return app.exec(); -} diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/BoomBlock.qml b/examples/demos/samegame/qml/samegame/SamegameCore/BoomBlock.qml deleted file mode 100644 index 52cd54db..00000000 --- a/examples/demos/samegame/qml/samegame/SamegameCore/BoomBlock.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.1 -import Qt.labs.particles 1.0 - -Item { - id: block - property bool dying: false - property bool spawned: false - property int type: 0 - - Behavior on x { - enabled: spawned; - SpringAnimation{ spring: 2; damping: 0.2 } - } - Behavior on y { - SpringAnimation{ spring: 2; damping: 0.2 } - } - - Image { - id: img - source: { - if(type == 0){ - "pics/redStone.png"; - } else if(type == 1) { - "pics/blueStone.png"; - } else { - "pics/greenStone.png"; - } - } - opacity: 0 - Behavior on opacity { NumberAnimation { duration: 200 } } - anchors.fill: parent - } - - Particles { - id: particles - - width: 1; height: 1 - anchors.centerIn: parent - - emissionRate: 0 - lifeSpan: 700; lifeSpanDeviation: 600 - angle: 0; angleDeviation: 360; - velocity: 100; velocityDeviation: 30 - source: { - if(type == 0){ - "pics/redStar.png"; - } else if (type == 1) { - "pics/blueStar.png"; - } else { - "pics/greenStar.png"; - } - } - } - - states: [ - State { - name: "AliveState"; when: spawned == true && dying == false - PropertyChanges { target: img; opacity: 1 } - }, - - State { - name: "DeathState"; when: dying == true - StateChangeScript { script: particles.burst(50); } - PropertyChanges { target: img; opacity: 0 } - StateChangeScript { script: block.destroy(1000); } - } - ] -} diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/Button.qml b/examples/demos/samegame/qml/samegame/SamegameCore/Button.qml deleted file mode 100644 index 91247233..00000000 --- a/examples/demos/samegame/qml/samegame/SamegameCore/Button.qml +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.1 - -Rectangle { - id: container - - property string text: "Button" - - signal clicked - - width: buttonLabel.width + 20; height: buttonLabel.height + 20 - smooth: true - border { width: 1; color: Qt.darker(activePalette.button) } - radius: 8 - color: activePalette.button - - gradient: Gradient { - GradientStop { - position: 0.0 - color: { - if (mouseArea.pressed) - return activePalette.dark - else - return activePalette.light - } - } - GradientStop { position: 1.0; color: activePalette.button } - } - - MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } - - Text { - id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText; font.pixelSize: 24 - } -} diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/Dialog.qml b/examples/demos/samegame/qml/samegame/SamegameCore/Dialog.qml deleted file mode 100644 index ba3e9c60..00000000 --- a/examples/demos/samegame/qml/samegame/SamegameCore/Dialog.qml +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.1 - -Rectangle { - id: page - - property Item text: dialogText - - signal closed - signal opened - function forceClose() { - if(page.opacity == 0) - return; //already closed - page.closed(); - page.opacity = 0; - } - - function show(txt) { - page.opened(); - dialogText.text = txt; - page.opacity = 1; - } - - width: dialogText.width + 20; height: dialogText.height + 20 - color: "white" - border.width: 1 - opacity: 0 - visible: opacity > 0 - Behavior on opacity { - NumberAnimation { duration: 1000 } - } - - Text { id: dialogText; anchors.centerIn: parent; text: "Hello World!" } - - MouseArea { anchors.fill: parent; onClicked: forceClose(); } -} - diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/pics/background.png b/examples/demos/samegame/qml/samegame/SamegameCore/pics/background.png deleted file mode 100644 index 3734a277..00000000 Binary files a/examples/demos/samegame/qml/samegame/SamegameCore/pics/background.png and /dev/null differ diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/pics/blueStar.png b/examples/demos/samegame/qml/samegame/SamegameCore/pics/blueStar.png deleted file mode 100644 index ff9588f8..00000000 Binary files a/examples/demos/samegame/qml/samegame/SamegameCore/pics/blueStar.png and /dev/null differ diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/pics/blueStone.png b/examples/demos/samegame/qml/samegame/SamegameCore/pics/blueStone.png deleted file mode 100644 index 20e43c75..00000000 Binary files a/examples/demos/samegame/qml/samegame/SamegameCore/pics/blueStone.png and /dev/null differ diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/pics/greenStar.png b/examples/demos/samegame/qml/samegame/SamegameCore/pics/greenStar.png deleted file mode 100644 index cd068547..00000000 Binary files a/examples/demos/samegame/qml/samegame/SamegameCore/pics/greenStar.png and /dev/null differ diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/pics/greenStone.png b/examples/demos/samegame/qml/samegame/SamegameCore/pics/greenStone.png deleted file mode 100644 index b568a190..00000000 Binary files a/examples/demos/samegame/qml/samegame/SamegameCore/pics/greenStone.png and /dev/null differ diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/pics/redStar.png b/examples/demos/samegame/qml/samegame/SamegameCore/pics/redStar.png deleted file mode 100644 index 0a4dffe5..00000000 Binary files a/examples/demos/samegame/qml/samegame/SamegameCore/pics/redStar.png and /dev/null differ diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/pics/redStone.png b/examples/demos/samegame/qml/samegame/SamegameCore/pics/redStone.png deleted file mode 100644 index 36b09a26..00000000 Binary files a/examples/demos/samegame/qml/samegame/SamegameCore/pics/redStone.png and /dev/null differ diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/pics/star.png b/examples/demos/samegame/qml/samegame/SamegameCore/pics/star.png deleted file mode 100644 index defbde53..00000000 Binary files a/examples/demos/samegame/qml/samegame/SamegameCore/pics/star.png and /dev/null differ diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/pics/yellowStone.png b/examples/demos/samegame/qml/samegame/SamegameCore/pics/yellowStone.png deleted file mode 100644 index b1ce7621..00000000 Binary files a/examples/demos/samegame/qml/samegame/SamegameCore/pics/yellowStone.png and /dev/null differ diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/qmldir b/examples/demos/samegame/qml/samegame/SamegameCore/qmldir deleted file mode 100644 index e17b1f5d..00000000 --- a/examples/demos/samegame/qml/samegame/SamegameCore/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -BoomBlock BoomBlock.qml -Button Button.qml -Dialog Dialog.qml diff --git a/examples/demos/samegame/qml/samegame/SamegameCore/samegame.js b/examples/demos/samegame/qml/samegame/SamegameCore/samegame.js deleted file mode 100644 index d7b827a1..00000000 --- a/examples/demos/samegame/qml/samegame/SamegameCore/samegame.js +++ /dev/null @@ -1,288 +0,0 @@ -/* This script file handles the game logic */ - -var maxColumn = 10; -var maxRow = 15; -var maxIndex = maxColumn*maxRow; -var board = new Array(maxIndex); -var blockSrc = "SamegameCore/BoomBlock.qml"; -var scoresURL = ""; -var gameDuration; -var component = Qt.createComponent(blockSrc); -var highScoreBar = 0; - -// Index function used instead of a 2D array -function index(column, row) -{ - return column + row * maxColumn; -} - -function timeStr(msecs) -{ - var secs = Math.floor(msecs/1000); - var m = Math.floor(secs/60); - var ret = "" + m + "m " + (secs%60) + "s"; - return ret; -} - -function startNewGame() -{ - // Delete blocks from previous game - for (var i = 0; i < maxIndex; i++) { - if (board[i] != null) - board[i].destroy(); - } - - // Calculate board size - maxColumn = Math.floor(gameCanvas.width/gameCanvas.blockSize); - maxRow = Math.floor(gameCanvas.height/gameCanvas.blockSize); - maxIndex = maxRow * maxColumn; - - // Close dialogs - nameInputDialog.forceClose(); - dialog.forceClose(); - - // Initialize Board - board = new Array(maxIndex); - gameCanvas.score = 0; - for (var column = 0; column < maxColumn; column++) { - for (var row = 0; row < maxRow; row++) { - board[index(column, row)] = null; - createBlock(column, row); - } - } - gameDuration = new Date(); -} - -var fillFound; // Set after a floodFill call to the number of blocks found -var floodBoard; // Set to 1 if the floodFill reaches off that node - -// NOTE: Be careful with vars named x,y, as the calling object's x,y are still in scope -function handleClick(x,y) -{ - var column = Math.floor(x/gameCanvas.blockSize); - var row = Math.floor(y/gameCanvas.blockSize); - if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) - return; - if (board[index(column, row)] == null) - return; - // If it's a valid block, remove it and all connected (does nothing if it's not connected) - floodFill(column,row, -1); - if (fillFound <= 0) - return; - gameCanvas.score += (fillFound - 1) * (fillFound - 1); - shuffleDown(); - victoryCheck(); -} - -function floodFill(column,row,type) -{ - if (board[index(column, row)] == null) - return; - var first = false; - if (type == -1) { - first = true; - type = board[index(column,row)].type; - - // Flood fill initialization - fillFound = 0; - floodBoard = new Array(maxIndex); - } - if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) - return; - if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type)) - return; - floodBoard[index(column, row)] = 1; - floodFill(column + 1, row, type); - floodFill(column - 1, row, type); - floodFill(column, row + 1, type); - floodFill(column, row - 1, type); - if (first == true && fillFound == 0) - return; // Can't remove single blocks - board[index(column, row)].dying = true; - board[index(column, row)] = null; - fillFound += 1; -} - -function shuffleDown() -{ - // Fall down - for (var column = 0; column < maxColumn; column++) { - var fallDist = 0; - for (var row = maxRow - 1; row >= 0; row--) { - if (board[index(column,row)] == null) { - fallDist += 1; - } else { - if (fallDist > 0) { - var obj = board[index(column, row)]; - obj.y = (row + fallDist) * gameCanvas.blockSize; - board[index(column, row + fallDist)] = obj; - board[index(column, row)] = null; - } - } - } - } - // Fall to the left - fallDist = 0; - for (column = 0; column < maxColumn; column++) { - if (board[index(column, maxRow - 1)] == null) { - fallDist += 1; - } else { - if (fallDist > 0) { - for (row = 0; row < maxRow; row++) { - obj = board[index(column, row)]; - if (obj == null) - continue; - obj.x = (column - fallDist) * gameCanvas.blockSize; - board[index(column - fallDist,row)] = obj; - board[index(column, row)] = null; - } - } - } - } -} - -function victoryCheck() -{ - // Awards bonuses for no blocks left - var deservesBonus = true; - for (var column = maxColumn - 1; column >= 0; column--) - if (board[index(column, maxRow - 1)] != null) - deservesBonus = false; - if (deservesBonus) - gameCanvas.score += 500; - // Checks for game over - if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1))) { - gameDuration = new Date() - gameDuration; - if(gameCanvas.score > highScoreBar){ - nameInputDialog.show("You won! Please enter your name: "); - nameInputDialog.initialWidth = nameInputDialog.text.width + 20; - if (nameInputDialog.name == "") - nameInputDialog.width = nameInputDialog.initialWidth; - nameInputDialog.text.opacity = 0; // Just a spacer - }else{ - dialog.show("You won!"); - } - } -} - -// Only floods up and right, to see if it can find adjacent same-typed blocks -function floodMoveCheck(column, row, type) -{ - if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) - return false; - if (board[index(column, row)] == null) - return false; - var myType = board[index(column, row)].type; - if (type == myType) - return true; - return floodMoveCheck(column + 1, row, myType) || - floodMoveCheck(column, row - 1, board[index(column, row)].type); -} - -function createBlock(column,row) -{ - // Note that we don't wait for the component to become ready. This will - // only work if the block QML is a local file. Otherwise the component will - // not be ready immediately. There is a statusChanged signal on the - // component you could use if you want to wait to load remote files. - if(component.status == Component.Ready){ - var dynamicObject = component.createObject(gameCanvas, - {"type": Math.floor(Math.random() * 3), - "x": column*gameCanvas.blockSize, - "width": gameCanvas.blockSize, - "height": gameCanvas.blockSize}); - if(dynamicObject == null){ - console.log("error creating block"); - console.log(component.errorString()); - return false; - } - dynamicObject.y = row*gameCanvas.blockSize; - dynamicObject.spawned = true; - - board[index(column,row)] = dynamicObject; - }else{ - console.log("error loading block component"); - console.log(component.errorString()); - return false; - } - return true; -} - -function initHighScoreBar() -{ - if(scoresURL != "") - return true;//don't query remote scores - var db = openDatabaseSync( - "SameGameScores", - "1.0", - "Local SameGame High Scores", - 100 - ); - db.transaction( - function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); - // Only show results for the current grid size - var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "' - + maxColumn + "x" + maxRow + '" ORDER BY score desc LIMIT 10'); - if(rs.rows.length < 10) - highScoreBar = 0; - else - highScoreBar = rs.rows.item(rs.rows.length - 1).score; - } - ); -} - -function saveHighScore(name) -{ - if (scoresURL != "") - sendHighScore(name); - // Offline storage - var db = 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) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); - tx.executeSql(dataStr, data); - - // Only show results for the current grid size - var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "' - + maxColumn + "x" + maxRow + '" ORDER BY score desc LIMIT 10'); - var r = "\nHIGH SCORES for this grid size\n\n" - for (var i = 0; i < rs.rows.length; i++) { - r += (i+1) + ". " + rs.rows.item(i).name + ' got ' - + rs.rows.item(i).score + ' points in ' - + rs.rows.item(i).time + ' seconds.\n'; - } - if(rs.rows.length == 10) - highScoreBar = rs.rows.item(9).score; - dialog.show(r); - } - ); -} - -function sendHighScore(name) -{ - var postman = new XMLHttpRequest() - var postData = "name=" + name + "&score=" + gameCanvas.score - + "&gridSize=" + maxColumn + "x" + maxRow - + "&time=" + Math.floor(gameDuration / 1000); - postman.open("POST", scoresURL, true); - postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - postman.onreadystatechange = function() { - if (postman.readyState == postman.DONE) { - dialog.show("Your score has been uploaded."); - } - } - postman.send(postData); -} diff --git a/examples/demos/samegame/qml/samegame/highscores/README b/examples/demos/samegame/qml/samegame/highscores/README deleted file mode 100644 index eaa00fae..00000000 --- a/examples/demos/samegame/qml/samegame/highscores/README +++ /dev/null @@ -1 +0,0 @@ -The SameGame example can interface with a simple PHP script to store XML high score data on a remote server. We do not have a publically accessible server available for this use, but if you have access to a PHP capable webserver you can copy the files (score_data.xml, score.php, score_style.xsl) to it and alter the highscore_server variable at the top of the samegame.js file to point to it. diff --git a/examples/demos/samegame/qml/samegame/highscores/score_data.xml b/examples/demos/samegame/qml/samegame/highscores/score_data.xml deleted file mode 100644 index c3fd90d9..00000000 --- a/examples/demos/samegame/qml/samegame/highscores/score_data.xml +++ /dev/null @@ -1,2 +0,0 @@ -1000000Alan the Tester0x00 -6213Alan12x1751 diff --git a/examples/demos/samegame/qml/samegame/highscores/score_style.xsl b/examples/demos/samegame/qml/samegame/highscores/score_style.xsl deleted file mode 100644 index 670354c9..00000000 --- a/examples/demos/samegame/qml/samegame/highscores/score_style.xsl +++ /dev/null @@ -1,28 +0,0 @@ - - - - - SameGame High Scores - -

SameGame High Scores

- - - - - - - - - - - - - - - - -
NameScoreGrid SizeTime, s
- - -
-
diff --git a/examples/demos/samegame/qml/samegame/highscores/scores.php b/examples/demos/samegame/qml/samegame/highscores/scores.php deleted file mode 100644 index 3cceb2d7..00000000 --- a/examples/demos/samegame/qml/samegame/highscores/scores.php +++ /dev/null @@ -1,34 +0,0 @@ -"; - echo "SameGame High Scores"; - if($score > 0){#Sending in a new high score - $name = $_POST["name"]; - $grid = $_POST["gridSize"]; - $time = $_POST["time"]; - if($name == "") - $name = "Anonymous"; - //if($grid != "10x10"){ - //Need a standard, so as to reject others? - //} - $file = fopen("score_data.xml", "a"); #It's XML. Happy? - $ret = fwrite($file, "". $score . "" - . $name . "" . $grid . "" - . $time . "\n"); - echo "Your score has been recorded. Thanks for playing!"; - if($ret == False) - echo "
There was an error though, so don't expect to see that score again."; - }else{#Read high score list - #Now uses XSLT to display. So just print the file. With XML cruft added. - #Note that firefox at least won't apply the XSLT on a php file. So redirecting - $file = fopen("scores.xml", "w"); - $ret = fwrite($file, '' . "\n" - . '' . "\n" - . "\n" . file_get_contents("score_data.xml") . "\n"); - if($ret == False) - echo "There was an internal error. Sorry."; - else - echo ''; - } - echo ""; -?> diff --git a/examples/demos/samegame/qml/samegame/samegame.qml b/examples/demos/samegame/qml/samegame/samegame.qml deleted file mode 100644 index 5356ab78..00000000 --- a/examples/demos/samegame/qml/samegame/samegame.qml +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.1 -import "SamegameCore" -import "SamegameCore/samegame.js" as Logic - -Rectangle { - id: screen - width: 490; height: 720 - property bool inAnotherDemo: false //Samegame often is just plonked straight into other demos - - SystemPalette { id: activePalette } - - Item { - width: parent.width - anchors { top: parent.top; bottom: toolBar.top } - - Image { - id: background - anchors.fill: parent - source: "SamegameCore/pics/background.png" - fillMode: Image.PreserveAspectCrop - } - - Item { - id: gameCanvas - property int score: 0 - property int blockSize: 40 - - z: 20; anchors.centerIn: parent - width: parent.width - (parent.width % blockSize); - height: parent.height - (parent.height % blockSize); - - MouseArea { - anchors.fill: parent; onClicked: Logic.handleClick(mouse.x,mouse.y); - } - } - } - - Dialog { id: dialog; anchors.centerIn: parent; z: 21 } - - Dialog { - id: nameInputDialog - - property int initialWidth: 0 - property alias name: nameInputText.text - - anchors.centerIn: parent - z: 22; - - Behavior on width { - NumberAnimation {} - enabled: nameInputDialog.initialWidth != 0 - } - - onClosed: { - if (nameInputText.text != "") - Logic.saveHighScore(nameInputText.text); - } - Text { - id: dialogText - anchors { left: nameInputDialog.left; leftMargin: 20; verticalCenter: parent.verticalCenter } - text: "You won! Please enter your name: " - } - MouseArea { - anchors.fill: parent - onClicked: { - if (nameInputText.text == "") - nameInputText.openSoftwareInputPanel(); - else - nameInputDialog.forceClose(); - } - } - - TextInput { - id: nameInputText - anchors { verticalCenter: parent.verticalCenter; left: dialogText.right } - focus: visible - autoScroll: false - maximumLength: 24 - onTextChanged: { - var newWidth = nameInputText.width + dialogText.width + 40; - if ( (newWidth > nameInputDialog.width && newWidth < screen.width) - || (nameInputDialog.width > nameInputDialog.initialWidth) ) - nameInputDialog.width = newWidth; - } - onAccepted: { - nameInputDialog.forceClose(); - } - } - } - - Rectangle { - id: toolBar - width: parent.width; height: 58 - color: activePalette.window - anchors.bottom: screen.bottom - - Button { - id: newGameButton - anchors { left: parent.left; leftMargin: 3; verticalCenter: parent.verticalCenter } - text: "New Game" - onClicked: Logic.startNewGame() - } - - Button { - visible: !inAnotherDemo - text: "Quit" - anchors { left: newGameButton.right; leftMargin: 3; verticalCenter: parent.verticalCenter } - onClicked: Qt.quit(); - } - - Text { - id: score - anchors { right: parent.right; rightMargin: 3; verticalCenter: parent.verticalCenter } - text: "Score: " + gameCanvas.score - font.bold: true - font.pixelSize: 24 - color: activePalette.windowText - } - } -} diff --git a/examples/demos/samegame/samegame.desktop b/examples/demos/samegame/samegame.desktop deleted file mode 100644 index 18ad2d98..00000000 --- a/examples/demos/samegame/samegame.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=samegame -Exec=/opt/samegame/bin/samegame -Icon=samegame64 -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/samegame/samegame.pro b/examples/demos/samegame/samegame.pro deleted file mode 100644 index 6342ba4a..00000000 --- a/examples/demos/samegame/samegame.pro +++ /dev/null @@ -1,24 +0,0 @@ -# Add more folders to ship with the application, here -folder_01.source = qml/samegame -folder_01.target = qml -DEPLOYMENTFOLDERS = folder_01 - -# Additional import path used to resolve QML modules in Creator's code model -QML_IMPORT_PATH = - -# If your application uses the Qt Mobility libraries, uncomment the following -# lines and add the respective components to the MOBILITY variable. -# CONFIG += mobility -# MOBILITY += - -# Speed up launching on MeeGo/Harmattan when using applauncherd daemon -# CONFIG += qdeclarative-boostable - -# The .cpp file which was generated for your project. Feel free to hack it. -SOURCES += main.cpp - -# Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/demos/samegame -exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) -qtcAddDeployment() diff --git a/examples/demos/samegame/samegame.qmlproject b/examples/demos/samegame/samegame.qmlproject deleted file mode 100644 index c17ee1ee..00000000 --- a/examples/demos/samegame/samegame.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "qml/samegame" - } - JavaScriptFiles { - directory: "qml/samegame" - } - ImageFiles { - directory: "qml/samegame" - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/demos/samegame/samegame.svg b/examples/demos/samegame/samegame.svg deleted file mode 100644 index 566acfad..00000000 --- a/examples/demos/samegame/samegame.svg +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/examples/demos/samegame/samegame64.png b/examples/demos/samegame/samegame64.png deleted file mode 100644 index 707d5c4e..00000000 Binary files a/examples/demos/samegame/samegame64.png and /dev/null differ diff --git a/examples/demos/samegame/samegame80.png b/examples/demos/samegame/samegame80.png deleted file mode 100644 index 6ad8096c..00000000 Binary files a/examples/demos/samegame/samegame80.png and /dev/null differ diff --git a/examples/demos/samegame/samegame_harmattan.desktop b/examples/demos/samegame/samegame_harmattan.desktop deleted file mode 100644 index 1f35b8e3..00000000 --- a/examples/demos/samegame/samegame_harmattan.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=samegame -Exec=/usr/bin/single-instance /opt/samegame/bin/samegame -Icon=/usr/share/icons/hicolor/80x80/apps/samegame80.png -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/snake/main.cpp b/examples/demos/snake/main.cpp deleted file mode 100644 index 7bd252f0..00000000 --- a/examples/demos/snake/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlapplicationviewer.h" -#include - -Q_DECL_EXPORT int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QmlApplicationViewer viewer; - viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); - viewer.setMainQmlFile(QLatin1String("qml/snake/snake.qml")); - viewer.showExpanded(); - - return app.exec(); -} diff --git a/examples/demos/snake/qml/snake/content/Button.qml b/examples/demos/snake/qml/snake/content/Button.qml deleted file mode 100644 index c1e0be5c..00000000 --- a/examples/demos/snake/qml/snake/content/Button.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: container - - signal clicked - property string text: "Button" - - color: activePalette.button; smooth: true - width: txtItem.width + 20; height: txtItem.height + 6 - border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; - - gradient: Gradient { - GradientStop { - id: topGrad; position: 0.0 - color: if (mr.pressed) { activePalette.dark } else { activePalette.light } } - GradientStop { position: 1.0; color: activePalette.button } - } - - MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } - - Text { - id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText - } -} diff --git a/examples/demos/snake/qml/snake/content/Cookie.qml b/examples/demos/snake/qml/snake/content/Cookie.qml deleted file mode 100644 index 353bf508..00000000 --- a/examples/demos/snake/qml/snake/content/Cookie.qml +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import Qt.labs.particles 1.0 - -Item { - id: root - property bool dying: false - property int row; - property int column; - x: margin + column * gridSize - y: margin + row * gridSize - - width: gridSize - height: gridSize - property int value : 1; - - Image { - id: img - anchors.fill: parent - source: "pics/cookie.png" - opacity: 0 - Text { - font.bold: true - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - text: value - } - } - - Particles { id: particles - width:1; height:1; anchors.centerIn: parent; - emissionRate: 0; - lifeSpan: 700; lifeSpanDeviation: 600; - angle: 0; angleDeviation: 360; - velocity: 100; velocityDeviation:30; - source: "pics/yellowStar.png"; - } - - states: [ - State{ name: "AliveState"; when: dying == false - PropertyChanges { target: img; opacity: 1 } - }, - State{ name: "DeathState"; when: dying == true - StateChangeScript { script: particles.burst(50); } - PropertyChanges { target: img; opacity: 0 } - } - ] - transitions: [ - Transition { - NumberAnimation { target: img; property: "opacity"; duration: 100 } - } - ] -} diff --git a/examples/demos/snake/qml/snake/content/HighScoreModel.qml b/examples/demos/snake/qml/snake/content/HighScoreModel.qml deleted file mode 100644 index 58695c6e..00000000 --- a/examples/demos/snake/qml/snake/content/HighScoreModel.qml +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -// Models a high score table. -// -// Use this component like this: -// -// HighScoreModel { -// id: highScores -// game: "MyCoolGame" -// } -// -// Then use either use the top-score properties: -// -// Text { text: "HI: " + highScores.topScore } -// -// or, use the model in a view: -// -// ListView { -// model: highScore -// delegate: Component { -// ... player ... score ... -// } -// } -// -// Add new scores via: -// -// saveScore(newScore) -// -// or: -// -// savePlayerScore(playerName,newScore) -// -// The best maxScore scores added by this method will be retained in an SQL database, -// and presented in the model and in the topScore/topPlayer properties. -// - -ListModel { - id: model - property string game: "" - property int topScore: 0 - property string topPlayer: "" - property int maxScores: 10 - - function __db() - { - return openDatabaseSync("HighScoreModel", "1.0", "Generic High Score Functionality for QML", 1000000); - } - function __ensureTables(tx) - { - tx.executeSql('CREATE TABLE IF NOT EXISTS HighScores(game TEXT, score INT, player TEXT)', []); - } - - function fillModel() { - __db().transaction( - function(tx) { - __ensureTables(tx); - var rs = tx.executeSql("SELECT score,player FROM HighScores WHERE game=? ORDER BY score DESC", [game]); - model.clear(); - if (rs.rows.length > 0) { - topScore = rs.rows.item(0).score - topPlayer = rs.rows.item(0).player - for (var i=0; i maxScores) - tx.executeSql("DELETE FROM HighScores WHERE game=? AND score <= ?", - [game, rs.rows.item(maxScores).score]); - } - } - ) - } - - function savePlayerScore(player,score) { - __db().transaction( - function(tx) { - __ensureTables(tx); - tx.executeSql("INSERT INTO HighScores VALUES(?,?,?)", [game,score,player]); - fillModel(); - } - ) - } - - function saveScore(score) { - savePlayerScore("player",score); - } - - function clearScores() { - __db().transaction( - function(tx) { - tx.executeSql("DELETE FROM HighScores WHERE game=?", [game]); - fillModel(); - } - ) - } - - Component.onCompleted: { fillModel() } -} diff --git a/examples/demos/snake/qml/snake/content/Link.qml b/examples/demos/snake/qml/snake/content/Link.qml deleted file mode 100644 index 7ace4054..00000000 --- a/examples/demos/snake/qml/snake/content/Link.qml +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import Qt.labs.particles 1.0 - -Item { id:link - property bool dying: false - property bool spawned: false - property int type: 0 - property int row: 0 - property int column: 0 - property int rotation; - - width: 40; - height: 40 - - x: margin - 3 + gridSize * column - y: margin - 3 + gridSize * row - Behavior on x { NumberAnimation { duration: spawned ? heartbeatInterval : 0} } - Behavior on y { NumberAnimation { duration: spawned ? heartbeatInterval : 0 } } - - - Item { - id: img - anchors.fill: parent - Image { - source: { - if(type == 1) { - "pics/blueStone.png"; - } else if (type == 2) { - "pics/head.png"; - } else { - "pics/redStone.png"; - } - } - - transform: Rotation { - id: actualImageRotation - origin.x: width/2; origin.y: height/2; - angle: rotation * 90 - Behavior on angle { - RotationAnimation{ - direction: RotationAnimation.Shortest - duration: spawned ? 200 : 0 - } - } - } - } - - Image { - source: "pics/stoneShadow.png" - } - - opacity: 0 - } - - - Particles { id: particles - width:1; height:1; anchors.centerIn: parent; - emissionRate: 0; - lifeSpan: 700; lifeSpanDeviation: 600; - angle: 0; angleDeviation: 360; - velocity: 100; velocityDeviation:30; - source: { - if(type == 1){ - "pics/blueStar.png"; - } else { - "pics/redStar.png"; - } - } - } - - states: [ - State{ name: "AliveState"; when: spawned == true && dying == false - PropertyChanges { target: img; opacity: 1 } - }, - State{ name: "DeathState"; when: dying == true - StateChangeScript { script: particles.burst(50); } - PropertyChanges { target: img; opacity: 0 } - } - ] - - transitions: [ - Transition { - NumberAnimation { target: img; property: "opacity"; duration: 200 } - } - ] - -} diff --git a/examples/demos/snake/qml/snake/content/Skull.qml b/examples/demos/snake/qml/snake/content/Skull.qml deleted file mode 100644 index 111e87b3..00000000 --- a/examples/demos/snake/qml/snake/content/Skull.qml +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Image { - property bool spawned: false - property int row; - property int column; - property int verticalMovement; - property int horizontalMovement; - - x: margin + column * gridSize + 2 - y: margin + row * gridSize - 3 - Behavior on x { NumberAnimation { duration: spawned ? halfbeatInterval : 0} } - Behavior on y { NumberAnimation { duration: spawned ? halfbeatInterval : 0 } } - - opacity: spawned ? 1 : 0 - Behavior on opacity { NumberAnimation { duration: 200 } } - - source: "pics/skull.png" - width: 24 - height: 40 -} diff --git a/examples/demos/snake/qml/snake/content/pics/README b/examples/demos/snake/qml/snake/content/pics/README deleted file mode 100644 index 0215132c..00000000 --- a/examples/demos/snake/qml/snake/content/pics/README +++ /dev/null @@ -1 +0,0 @@ -snake.jpg: This image is based on the picture "Eastern Green Mamba.jpg" from the free media databse Wikimedia Commons and is published under the terms of the GNU Free Documentation License. The original picture was taken by Danleo. diff --git a/examples/demos/snake/qml/snake/content/pics/background.png b/examples/demos/snake/qml/snake/content/pics/background.png deleted file mode 100644 index 72dffaa8..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/background.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/blueStar.png b/examples/demos/snake/qml/snake/content/pics/blueStar.png deleted file mode 100644 index ba7acabd..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/blueStar.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/blueStone.png b/examples/demos/snake/qml/snake/content/pics/blueStone.png deleted file mode 100644 index 356affdd..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/blueStone.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/cookie.png b/examples/demos/snake/qml/snake/content/pics/cookie.png deleted file mode 100644 index aec2957f..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/cookie.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/eyes.svg b/examples/demos/snake/qml/snake/content/pics/eyes.svg deleted file mode 100644 index 10786927..00000000 --- a/examples/demos/snake/qml/snake/content/pics/eyes.svg +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - diff --git a/examples/demos/snake/qml/snake/content/pics/head.png b/examples/demos/snake/qml/snake/content/pics/head.png deleted file mode 100644 index 550e0026..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/head.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/head.svg b/examples/demos/snake/qml/snake/content/pics/head.svg deleted file mode 100644 index 3bf0bd2f..00000000 --- a/examples/demos/snake/qml/snake/content/pics/head.svg +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - diff --git a/examples/demos/snake/qml/snake/content/pics/pause.png b/examples/demos/snake/qml/snake/content/pics/pause.png deleted file mode 100644 index 056d97dd..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/pause.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/redStar.png b/examples/demos/snake/qml/snake/content/pics/redStar.png deleted file mode 100644 index cd068547..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/redStar.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/redStone.png b/examples/demos/snake/qml/snake/content/pics/redStone.png deleted file mode 100644 index 9bb7fe42..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/redStone.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/skull.png b/examples/demos/snake/qml/snake/content/pics/skull.png deleted file mode 100644 index 63186167..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/skull.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/snake.jpg b/examples/demos/snake/qml/snake/content/pics/snake.jpg deleted file mode 100644 index e91a784f..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/snake.jpg and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/star.png b/examples/demos/snake/qml/snake/content/pics/star.png deleted file mode 100644 index defbde53..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/star.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/stoneShadow.png b/examples/demos/snake/qml/snake/content/pics/stoneShadow.png deleted file mode 100644 index 1bd56afd..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/stoneShadow.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/yellowStar.png b/examples/demos/snake/qml/snake/content/pics/yellowStar.png deleted file mode 100644 index 52fb9c4b..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/yellowStar.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/pics/yellowStone.png b/examples/demos/snake/qml/snake/content/pics/yellowStone.png deleted file mode 100644 index c56124a8..00000000 Binary files a/examples/demos/snake/qml/snake/content/pics/yellowStone.png and /dev/null differ diff --git a/examples/demos/snake/qml/snake/content/snake.js b/examples/demos/snake/qml/snake/content/snake.js deleted file mode 100644 index 837b82ad..00000000 --- a/examples/demos/snake/qml/snake/content/snake.js +++ /dev/null @@ -1,316 +0,0 @@ - -var snake = new Array; -var board = new Array; -var links = new Array; -var scheduledDirections = new Array; -var numRows = 1; -var numColumns = 1; -var linkComponent = Qt.createComponent("content/Link.qml"); // XXX should resolve relative to script, not component -var cookieComponent = Qt.createComponent("content/Cookie.qml"); -var cookie; -var linksToGrow = 0; -var linksToDie = 0; -var waitForCookie = 0; -var growType = 0; -var skullMovementsBeforeDirectionChange = 0; - - -function rand(n) -{ - return (Math.floor(Math.random() * n)); -} - -function scheduleDirection(dir) -{ - if (state == "starting") { - direction = dir; - headDirection = direction; - head.rotation = headDirection; - } else if (state == "running"){ - direction = dir; - if(scheduledDirections[scheduledDirections.length-1]!=direction) - scheduledDirections.push(direction); - } -} - -function startNewGame() -{ - if (state == "starting") { - return; - } - - if (activeGame) { - endGame(); - startNewGameTimer.running = true; - return; - } - - state = "starting"; - - numRows = numRowsAvailable; - numColumns = numColumnsAvailable; - board = new Array(numRows * numColumns); - snake = new Array; - scheduledDirections = new Array; - growType = 0; - - skull.z = numRows * numColumns + 1; - - for (var i = 0; i < numRows * numColumns; ++i) { - if (i < links.length) { - var link = links[i]; - link.spawned = false; - link.dying = false; - } else { - if(linkComponent.status != Component.Ready) { - if(linkComponent.status == Component.Error) - console.log(linkComponent.errorString()); - else - console.log("Still loading linkComponent"); - continue;//TODO: Better error handling? - } - var link = linkComponent.createObject(playfield); - link.z = numRows * numColumns + 1 - i; - link.type = i == 0 ? 2 : 0; - link.spawned = false; - link.dying = false; - links.push(link); - } - } - - head = links[0]; - snake.push(head); - head.row = numRows/2 -1; - head.column = numColumns/2 -1; - head.spawned = true; - - linksToGrow = 5; - linksToDie = 0; - waitForCookie = 5; - score = 0; - startHeartbeatTimer.running = true; -} - -function endGame() -{ - activeGame = false; - for(var i in snake) - snake[i].dying = true; - if (cookie) { - cookie.dying = true; - cookie = 0; - } - lastScore = score; - highScores.saveScore(lastScore); - state = ""; -} - -function move() { - - if (!head) - return; - - var dir = direction; - - if (scheduledDirections.length) { - dir = scheduledDirections.shift(); - } - - if (state == "starting") { - var turn = (dir - headDirection); - head.rotation += turn == -3 ? 1 : (turn == 3 ? -1 : turn ); - headDirection = dir; - return; - } - - var row = head.row; - var column = head.column; - - if (dir == 0) { - row = row - 1; - } else if (dir == 1) { - column = column + 1 - } else if (dir == 2) { - row = row + 1; - } else if (dir == 3) { - column = column - 1; - } - - //validate the new position - if (row < 0 || row >= numRows - || column < 0 || column >= numColumns - || (row == skull.row && column == skull.column) - || !isFree(row, column)) { - var turn = (dir - headDirection); - head.rotation += turn == -3 ? 1 : (turn == 3 ? -1 : turn ); - headDirection = dir; - endGame(); - return; - } - - var newLink; - if (linksToGrow > 0) { - --linksToGrow; - newLink = links[snake.length]; - newLink.spawned = false; - newLink.rotation = snake[snake.length-1].rotation; - newLink.type = growType; - newLink.dying = false; - snake.push(newLink); - } else { - var lastLink = snake[snake.length-1]; - board[lastLink.row * numColumns + lastLink.column] = undefined; - } - - if (waitForCookie > 0) { - if (--waitForCookie == 0) - createCookie(cookie? (cookie.value+1) : 1); - } - - for (var i = snake.length-1; i > 0; --i) { - snake[i].row = snake[i-1].row; - snake[i].column = snake[i-1].column; - snake[i].rotation = snake[i-1].rotation; - } - - if (newLink) { - newLink.spawned = true; - } - - // move the head - head.row = row; - head.column = column; - board[row * numColumns + column] = head; - - var turn = (dir - headDirection); - head.rotation += turn == -3 ? 1 : (turn == 3 ? -1 : turn ); - headDirection = dir; - - var value = testCookie(row, column); - if (value > 0) { - linksToGrow += value; - score += value; - } -} - -function isFree(row, column) -{ - return board[row * numColumns + column] == undefined; -} - -function isHead(row, column) -{ - return head.column == column && head.row == row; -} - -function testCookie(row, column) -{ - if (cookie && !cookie.dying && cookie.row == row && cookie.column == column) { - var value = cookie.value; - waitForCookie = value; - growType = snake[snake.length-1].type == 1 ? 0 : 1; - cookie.dying = true; - cookie.z = numRows * numColumns + 2; - return value; - } - return 0; -} - -function moveSkull() -{ - - if (linksToDie > 0) { - --linksToDie; - var link = snake.pop(); - link.dying = true; - board[link.row * numColumns + link.column] = undefined; - if (score > 0) - --score; - if (snake.length == 0) { - endGame(); - return; - } - } - - var row = skull.row; - var column = skull.column; - if (isHead(row, column)) { - endGame(); - return; - } - row += skull.verticalMovement; - column += skull.horizontalMovement; - - var attempts = 4; - - while (skullMovementsBeforeDirectionChange == 0 || row < 0 || row >= numRows - || column < 0 || column >= numColumns - || (!isFree(row, column) && !isHead(row, column))) { - var d = rand(8); - skull.verticalMovement = 0; - skull.horizontalMovement = 0; - skullMovementsBeforeDirectionChange = rand(20)+1; - if (d == 0) { - skull.verticalMovement = -1 - } else if (d == 1) { - skull.horizontalMovement = -1; - } else if (d == 2) { - skull.verticalMovement = 1 - } else if (d == 3){ - skull.horizontalMovement = 1; - } else if (cookie) { - var rd = cookie.row - skull.row; - var rc = cookie.column - skull.column; - if (Math.abs(rd) > Math.abs(rc)) { - skull.verticalMovement = rd > 0 ? 1 : -1; - skullMovementsBeforeDirectionChange = Math.abs(rd); - } else { - skull.horizontalMovement= rc > 0 ? 1 : -1; - skullMovementsBeforeDirectionChange = Math.abs(rc); - } - } - row = skull.row + skull.verticalMovement; - column = skull.column + skull.horizontalMovement; - if (--attempts == 0) - return; - } - - skull.row = row; - skull.column = column; - --skullMovementsBeforeDirectionChange; - var value = testCookie(row, column); - if (value > 0) - linksToDie += value/2; - - if (isHead(row, column)) - endGame(); -} - -function createCookie(value) { - if (numRows * numColumns - snake.length < 10) - return; - - var column = rand(numColumns); - var row = rand(numRows); - while (!isFree(row, column)) { - column++; - if (column == numColumns) { - column = 0; - row++; - if (row == numRows) - row = 0; - } - } - - if(cookieComponent.status != Component.Ready) { - if(cookieComponent.status == Component.Error) - console.log(cookieComponent.errorString()); - else - console.log("Still loading cookieComponent"); - return;//TODO: Better error handling? - } - cookie = cookieComponent.createObject(head.parent); - cookie.value = value; - cookie.row = row; - cookie.column = column; -} diff --git a/examples/demos/snake/qml/snake/snake.qml b/examples/demos/snake/qml/snake/snake.qml deleted file mode 100644 index 47e8501c..00000000 --- a/examples/demos/snake/qml/snake/snake.qml +++ /dev/null @@ -1,272 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import "content" as Content -import "content/snake.js" as Logic - -Rectangle { - id: screen; - SystemPalette { id: activePalette } - color: activePalette.window - property bool activeGame: false - - property int gridSize : 34 - property int margin: 4 - property int numRowsAvailable: Math.floor((height-32-2*margin)/gridSize) - property int numColumnsAvailable: Math.floor((width-2*margin)/gridSize) - - property int lastScore : 0 - - property int score: 0; - property int heartbeatInterval: 200 - property int halfbeatInterval: 160 - - width: 480 - height: 750 - - property int direction - property int headDirection - - property variant head; - - Content.HighScoreModel { - id: highScores - game: "Snake" - } - - Timer { - id: heartbeat; - interval: heartbeatInterval; - running: activeGame - repeat: true - onTriggered: { Logic.move() } - } - Timer { - id: halfbeat; - interval: halfbeatInterval; - repeat: true - running: heartbeat.running - onTriggered: { Logic.moveSkull() } - } - Timer { - id: startNewGameTimer; - interval: 700; - onTriggered: { Logic.startNewGame(); } - } - - Timer { - id: startHeartbeatTimer; - interval: 1000 ; - onTriggered: { state = "running"; activeGame = true; } - } - - Image{ - id: pauseDialog - z: 1 - source: "content/pics/pause.png" - anchors.centerIn: parent; - //opacity is deliberately not animated - opacity: activeGame && !Qt.application.active - } - - Image { - - Image { - id: title - source: "content/pics/snake.jpg" - fillMode: Image.PreserveAspectCrop - anchors.fill: parent - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - - Column { - spacing: 140 - anchors.verticalCenter: parent.verticalCenter; - anchors.left: parent.left; - anchors.right: parent.right; - - Text { - color: "white" - font.pointSize: 48 - font.italic: true; - font.bold: true; - text: "Snake" - anchors.horizontalCenter: parent.horizontalCenter; - } - - Text { - color: "white" - font.pointSize: 24 - anchors.horizontalCenter: parent.horizontalCenter; - //horizontalAlignment: Text.AlignHCenter - text: "Last Score:\t" + lastScore + "\nHighscore:\t" + highScores.topScore; - } - } - } - - source: "content/pics/background.png" - fillMode: Image.PreserveAspectCrop - - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: toolbar.top - - Rectangle { - id: playfield - border.width: 1 - border.color: "white" - color: "transparent" - anchors.horizontalCenter: parent.horizontalCenter - y: (screen.height - 32 - height)/2; - width: numColumnsAvailable * gridSize + 2*margin - height: numRowsAvailable * gridSize + 2*margin - - - Content.Skull { - id: skull - } - - MouseArea { - anchors.fill: parent - onPressed: { - if (screen.state == "") { - Logic.startNewGame(); - return; - } - if (direction == 0 || direction == 2) - Logic.scheduleDirection((mouseX > (head.x + head.width/2)) ? 1 : 3); - else - Logic.scheduleDirection((mouseY > (head.y + head.height/2)) ? 2 : 0); - } - } - } - - } - - Rectangle { - id: progressBar - opacity: 0 - Behavior on opacity { NumberAnimation { duration: 200 } } - color: "transparent" - border.width: 2 - border.color: "#221edd" - x: 50 - y: 50 - width: 200 - height: 30 - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - anchors.verticalCenterOffset: 40 - - Rectangle { - id: progressIndicator - color: "#221edd"; - width: 0; - height: 30; - } - } - - Rectangle { - id: toolbar - color: activePalette.window - height: 32; width: parent.width - anchors.bottom: screen.bottom - - Content.Button { - id: btnA; text: "New Game"; onClicked: Logic.startNewGame(); - anchors.left: parent.left; anchors.leftMargin: 3 - anchors.verticalCenter: parent.verticalCenter - } - - Content.Button { - text: "Quit" - anchors { left: btnA.right; leftMargin: 3; verticalCenter: parent.verticalCenter } - onClicked: Qt.quit(); - } - - Text { - color: activePalette.text - text: "Score: " + score; font.bold: true - anchors.right: parent.right; anchors.rightMargin: 3 - anchors.verticalCenter: parent.verticalCenter - } - } - - focus: true - Keys.onSpacePressed: Logic.startNewGame(); - Keys.onLeftPressed: if (state == "starting" || direction != 1) Logic.scheduleDirection(3); - Keys.onRightPressed: if (state == "starting" || direction != 3) Logic.scheduleDirection(1); - Keys.onUpPressed: if (state == "starting" || direction != 2) Logic.scheduleDirection(0); - Keys.onDownPressed: if (state == "starting" || direction != 0) Logic.scheduleDirection(2); - - states: [ - State { - name: "starting" - PropertyChanges {target: progressIndicator; width: 200} - PropertyChanges {target: title; opacity: 0} - PropertyChanges {target: progressBar; opacity: 1} - }, - State { - name: "running" - PropertyChanges {target: progressIndicator; width: 200} - PropertyChanges {target: title; opacity: 0} - PropertyChanges {target: skull; row: 0; column: 0; } - PropertyChanges {target: skull; spawned: 1} - } - ] - - transitions: [ - Transition { - from: "*" - to: "starting" - NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 } - NumberAnimation { property: "opacity"; duration: 200 } - }, - Transition { - to: "starting" - NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 } - NumberAnimation { property: "opacity"; duration: 200 } - } - ] - -} diff --git a/examples/demos/snake/snake.desktop b/examples/demos/snake/snake.desktop deleted file mode 100644 index fef60907..00000000 --- a/examples/demos/snake/snake.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=snake -Exec=/opt/snake/bin/snake -Icon=snake64 -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/snake/snake.pro b/examples/demos/snake/snake.pro deleted file mode 100644 index 0fa838d5..00000000 --- a/examples/demos/snake/snake.pro +++ /dev/null @@ -1,24 +0,0 @@ -# Add more folders to ship with the application, here -folder_01.source = qml/snake -folder_01.target = qml -DEPLOYMENTFOLDERS = folder_01 - -# Additional import path used to resolve QML modules in Creator's code model -QML_IMPORT_PATH = - -# If your application uses the Qt Mobility libraries, uncomment the following -# lines and add the respective components to the MOBILITY variable. -# CONFIG += mobility -# MOBILITY += - -# Speed up launching on MeeGo/Harmattan when using applauncherd daemon -# CONFIG += qdeclarative-boostable - -# The .cpp file which was generated for your project. Feel free to hack it. -SOURCES += main.cpp - -# Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/demos/snake -exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) -qtcAddDeployment() diff --git a/examples/demos/snake/snake.qmlproject b/examples/demos/snake/snake.qmlproject deleted file mode 100644 index 431d2a9e..00000000 --- a/examples/demos/snake/snake.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "qml/snake" - } - JavaScriptFiles { - directory: "qml/snake" - } - ImageFiles { - directory: "qml/snake" - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/demos/snake/snake.svg b/examples/demos/snake/snake.svg deleted file mode 100644 index 566acfad..00000000 --- a/examples/demos/snake/snake.svg +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/examples/demos/snake/snake64.png b/examples/demos/snake/snake64.png deleted file mode 100644 index 707d5c4e..00000000 Binary files a/examples/demos/snake/snake64.png and /dev/null differ diff --git a/examples/demos/snake/snake80.png b/examples/demos/snake/snake80.png deleted file mode 100644 index 6ad8096c..00000000 Binary files a/examples/demos/snake/snake80.png and /dev/null differ diff --git a/examples/demos/snake/snake_harmattan.desktop b/examples/demos/snake/snake_harmattan.desktop deleted file mode 100644 index 10b0f792..00000000 --- a/examples/demos/snake/snake_harmattan.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=snake -Exec=/usr/bin/single-instance /opt/snake/bin/snake -Icon=/usr/share/icons/hicolor/80x80/apps/snake80.png -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/twitter/main.cpp b/examples/demos/twitter/main.cpp deleted file mode 100644 index c79424b7..00000000 --- a/examples/demos/twitter/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlapplicationviewer.h" -#include - -Q_DECL_EXPORT int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QmlApplicationViewer viewer; - viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); - viewer.setMainQmlFile(QLatin1String("qml/twitter/twitter.qml")); - viewer.showExpanded(); - - return app.exec(); -} diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/Button.qml b/examples/demos/twitter/qml/twitter/TwitterCore/Button.qml deleted file mode 100644 index 9b9b2d67..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/Button.qml +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: container - - signal clicked - - property string text - property bool keyUsing: false - - BorderImage { - id: buttonImage - source: "images/toolbutton.sci" - width: container.width; height: container.height - } - BorderImage { - id: pressed - opacity: 0 - source: "images/toolbutton.sci" - width: container.width; height: container.height - } - MouseArea { - id: mouseRegion - anchors.fill: buttonImage - onClicked: { container.clicked(); } - } - Text { - id: btnText - color: if(container.keyUsing){"#D0D0D0";} else {"#FFFFFF";} - anchors.centerIn: buttonImage; font.bold: true - text: container.text; style: Text.Raised; styleColor: "black" - font.pixelSize: 12 - } - states: [ - State { - name: "Pressed" - when: mouseRegion.pressed == true - PropertyChanges { target: pressed; opacity: 1 } - }, - State { - name: "Focused" - when: container.activeFocus == true - PropertyChanges { target: btnText; color: "#FFFFFF" } - } - ] - transitions: Transition { - ColorAnimation { target: btnText; } - } -} diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/FatDelegate.qml b/examples/demos/twitter/qml/twitter/TwitterCore/FatDelegate.qml deleted file mode 100644 index e4a6e150..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/FatDelegate.qml +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Component { - id: listDelegate - Item { - id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 60){txt.height+10}else{60} //50+5+5 - function handleLink(link){ - if(link.slice(0,3) == 'app'){ - screen.setUser(link.slice(7)); - }else if(link.slice(0,4) == 'http'){ - Qt.openUrlExternally(link); - } - } - function addTags(str){ - var ret = str.replace(/@[a-zA-Z0-9_]+/g, '$&');//click to jump to user? - var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '$&');//surrounds http links with html link tags - return ret2; - } - - // Strip away paranthesis - function userName(str) { - var user = str.replace(/\([\S|\s]*\)/gi, ""); - return user.trim(); - } - - Item { - id: moveMe; height: parent.height - Rectangle { - id: blackRect - color: "black"; opacity: wrapper.ListView.index % 2 ? 0.2 : 0.3; height: wrapper.height-2; width: wrapper.width; y: 1 - } - Item { - id: image; x: 6; width: 48; height: 48; smooth: true - anchors.verticalCenter: parent.verticalCenter - - Loading { x: 1; y: 1; width: 48; height: 48; visible: realImage.status != Image.Ready } - Image { - id: realImage; - source: userImage; x: 1; y: 1; - width:48; height:48; opacity:0 ; - onStatusChanged: { - if(status==Image.Ready) - image.state="loaded" - } - } - states: State { - name: "loaded"; - PropertyChanges { target: realImage ; opacity:1 } - } - transitions: Transition { NumberAnimation { target: realImage; property: "opacity"; duration: 200 } } - - } - Text { id:txt; y:4; x: 56 - text: '' - + ''+userName(name) + " from " +source - + "
" + statusText + ""; - textFormat: Qt.RichText - color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap - anchors.left: image.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 - onLinkActivated: wrapper.handleLink(link) - } - } - } -} diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/Input.qml b/examples/demos/twitter/qml/twitter/TwitterCore/Input.qml deleted file mode 100644 index ce1bc0e9..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/Input.qml +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -FocusScope { - id:container - width: 220 - height: 28 - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - signal accepted - property alias text: input.text - property alias item:input - TextInput{ - id: input - width: parent.width - 12 - anchors.centerIn: parent - maximumLength:21 - font.pixelSize: 16; - font.bold: true - color: "#151515"; selectionColor: "mediumseagreen" - focus: true - onAccepted:{container.accepted()} - text: "" - selectByMouse: true - } -} diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/Loading.qml b/examples/demos/twitter/qml/twitter/TwitterCore/Loading.qml deleted file mode 100644 index b8fe357a..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/Loading.qml +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Image { - id: loading; source: "images/loading.png" - NumberAnimation on rotation { - from: 0; to: 360; running: loading.visible == true; loops: Animation.Infinite; duration: 900 - } -} diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/MultiTitleBar.qml b/examples/demos/twitter/qml/twitter/TwitterCore/MultiTitleBar.qml deleted file mode 100644 index 1e1dbd62..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/MultiTitleBar.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - TitleBar { id: titleBar; width: parent.width; height: 60; - y: -80 - untaggedString: "Latest tweets from everyone" - taggedString: "Latest tweets from " - } - states: [ - State { - name: "search"; when: screen.state!="search" - PropertyChanges { target: titleBar; y: 0 } - } - ] - transitions: [ - Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } } - ] -} - diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/RssModel.qml b/examples/demos/twitter/qml/twitter/TwitterCore/RssModel.qml deleted file mode 100644 index 348fd2a8..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/RssModel.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { id: wrapper - property variant model: xmlModel - property string from : "" - property string to : "" - property string phrase : "" - - property string mode : "everyone" - property int status: xmlModel.status - function reload() { xmlModel.reload(); } - XmlListModel { - id: xmlModel - - source: (from=="" && to=="" && phrase=="") ? "" : - 'http://search.twitter.com/search.atom?from='+from+"&to="+to+"&phrase="+phrase - - namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom'; " + - "declare namespace twitter=\"http://api.twitter.com/\";"; - - query: "/feed/entry" - - XmlRole { name: "statusText"; query: "content/string()" } - XmlRole { name: "timestamp"; query: "published/string()" } - XmlRole { name: "source"; query: "twitter:source/string()" } - XmlRole { name: "name"; query: "author/name/string()" } - XmlRole { name: "userImage"; query: "link[@rel = 'image']/@href/string()" } - - } - Binding { - property: "mode" - target: wrapper - value: {if(wrapper.tags==''){"everyone";}else if(wrapper.tags=='my timeline'){"self";}else{"user";}} - } -} diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/SearchView.qml b/examples/demos/twitter/qml/twitter/TwitterCore/SearchView.qml deleted file mode 100644 index d1c50fca..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/SearchView.qml +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -FocusScope { - id: wrapper - Column { - anchors.centerIn: parent - spacing: 20 - Column{ - spacing: 4 - Text { - text: "Posted by:" - font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - horizontalAlignment: Qt.AlignRight - } - Input{ - id: fromIn - KeyNavigation.backtab: searchbutton - KeyNavigation.tab:toIn - onAccepted:searchbutton.doSearch(); - focus: true - } - Text { - text: "In reply to:" - font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - horizontalAlignment: Qt.AlignRight - } - Input{ - id: toIn - KeyNavigation.backtab: fromIn - KeyNavigation.tab:phraseIn - onAccepted:searchbutton.doSearch(); - } - Text { - text: "Search phrase:" - font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - horizontalAlignment: Qt.AlignRight - } - Input{ - id: phraseIn - KeyNavigation.backtab: toIn - KeyNavigation.tab:searchbutton - onAccepted:searchbutton.doSearch(); - text: "Qt Quick" - } - } - Button { - width: 100 - height: 32 - id: searchbutton - keyUsing: true; - opacity: 1 - text: "Search" - KeyNavigation.tab: fromIn - Keys.onReturnPressed: searchbutton.doSearch(); - Keys.onEnterPressed: searchbutton.doSearch(); - Keys.onSelectPressed: searchbutton.doSearch(); - Keys.onSpacePressed: searchbutton.doSearch(); - onClicked: searchbutton.doSearch(); - - function doSearch() { - // Search ! allowed - if (wrapper.state=="invalidinput") - return; - - rssModel.from=fromIn.text; - rssModel.to= toIn.text; - rssModel.phrase = phraseIn.text; - screen.focus = true; - screen.state = "" - } - } - } - states: - State { - name: "invalidinput" - when: fromIn.text=="" && toIn.text=="" && phraseIn.text=="" - PropertyChanges { target: searchbutton ; opacity: 0.6 ; } - } - transitions: - Transition { - NumberAnimation { target: searchbutton; property: "opacity"; duration: 200 } - } -} diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/TitleBar.qml b/examples/demos/twitter/qml/twitter/TwitterCore/TitleBar.qml deleted file mode 100644 index 7f094028..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/TitleBar.qml +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: titleBar - property string untaggedString: "Uploads from everyone" - property string taggedString: "Recent uploads tagged " - - BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } - - Item { - id: container - width: (parent.width * 2) - 55 ; height: parent.height - - function accept() { - titleBar.state = "" - background.state = "" - rssModel.tags = editor.text - } - - Item { - id:imageBox - x: 6; width: 0; height: 50; smooth: true - anchors.verticalCenter: parent.verticalCenter - - UserModel { user: rssModel.from; id: userModel } - Component { - id: imgDelegate; - Item { - id:imageitem - visible:true - Loading { width:48; height:48; visible: realImage.status != Image.Ready } - Image { id: realImage; source: image; width:48; height:48; opacity:0; } - states: - State { - name: "loaded" - when: (realImage.status == Image.Ready) - PropertyChanges { target: realImage; opacity:1 } - } - transitions: Transition { - NumberAnimation { target: realImage; property: "opacity"; duration: 200 } - } - } - } - ListView { id:view; model: userModel.model; x:1; y:1; delegate: imgDelegate } - states: - State { - when: !userModel.user=="" - PropertyChanges { target: imageBox; width: 50; } - } - transitions: - Transition { - NumberAnimation { target: imageBox; property: "width"; duration: 200 } - } - } - - Image { - id: quitButton - x: 5 - anchors.verticalCenter: parent.verticalCenter - source: "images/quit.png" - MouseArea { - anchors.fill: parent - onClicked: Qt.quit() - } - } - - Text { - id: categoryText - anchors { - left: quitButton.right; right: parent.right; leftMargin: 10; rightMargin: 10 - verticalCenter: parent.verticalCenter - } - elide: Text.ElideLeft - text: (rssModel.from=="" ? untaggedString : taggedString + rssModel.from) - font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black" - font.pixelSize: 12 - } - } - - states: State { - name: "Tags" - PropertyChanges { target: container; x: -tagButton.x + 5 } - PropertyChanges { target: editor; focus: true } - } - - transitions: Transition { - NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad } - } -} diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/ToolBar.qml b/examples/demos/twitter/qml/twitter/TwitterCore/ToolBar.qml deleted file mode 100644 index 87cea7af..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/ToolBar.qml +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: toolbar - - property alias button1Label: button1.text - property alias button2Label: button2.text - signal button1Clicked - signal button2Clicked - focus:true - BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } - Button { - id: button1 - anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32 - onClicked: toolbar.button1Clicked() - focus:true - } - Button { - id: button2 - anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32 - onClicked: toolbar.button2Clicked() - } -} diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/UserModel.qml b/examples/demos/twitter/qml/twitter/TwitterCore/UserModel.qml deleted file mode 100644 index d5714754..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/UserModel.qml +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -//This "model" gets the user information about the searched user. Mainly for the icon. - -Item { id: wrapper - property variant model: xmlModel - property string user : "" - property int status: xmlModel.status - function reload() { xmlModel.reload(); } - XmlListModel { - id: xmlModel - - source: user!= "" ? "http://twitter.com/users/show.xml?screen_name="+user : "" - query: "/user" - - XmlRole { name: "name"; query: "name/string()" } - XmlRole { name: "screenName"; query: "screen_name/string()" } - XmlRole { name: "image"; query: "profile_image_url/string()" } - XmlRole { name: "location"; query: "location/string()" } - XmlRole { name: "description"; query: "description/string()" } - XmlRole { name: "followers"; query: "followers_count/string()" } - //TODO: Could also get the user's color scheme, timezone and a few other things - } -} diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/images/gloss.png b/examples/demos/twitter/qml/twitter/TwitterCore/images/gloss.png deleted file mode 100644 index 5d370cd9..00000000 Binary files a/examples/demos/twitter/qml/twitter/TwitterCore/images/gloss.png and /dev/null differ diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/images/lineedit.png b/examples/demos/twitter/qml/twitter/TwitterCore/images/lineedit.png deleted file mode 100644 index 2cc38dc3..00000000 Binary files a/examples/demos/twitter/qml/twitter/TwitterCore/images/lineedit.png and /dev/null differ diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/images/lineedit.sci b/examples/demos/twitter/qml/twitter/TwitterCore/images/lineedit.sci deleted file mode 100644 index 054bff78..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/images/lineedit.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 10 -border.top: 10 -border.bottom: 10 -border.right: 10 -source: lineedit.png diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/images/loading.png b/examples/demos/twitter/qml/twitter/TwitterCore/images/loading.png deleted file mode 100644 index 47a1589c..00000000 Binary files a/examples/demos/twitter/qml/twitter/TwitterCore/images/loading.png and /dev/null differ diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/images/quit.png b/examples/demos/twitter/qml/twitter/TwitterCore/images/quit.png deleted file mode 100644 index 5bda1b6e..00000000 Binary files a/examples/demos/twitter/qml/twitter/TwitterCore/images/quit.png and /dev/null differ diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/images/stripes.png b/examples/demos/twitter/qml/twitter/TwitterCore/images/stripes.png deleted file mode 100644 index 9f36727e..00000000 Binary files a/examples/demos/twitter/qml/twitter/TwitterCore/images/stripes.png and /dev/null differ diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/images/titlebar.png b/examples/demos/twitter/qml/twitter/TwitterCore/images/titlebar.png deleted file mode 100644 index 51c90082..00000000 Binary files a/examples/demos/twitter/qml/twitter/TwitterCore/images/titlebar.png and /dev/null differ diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/images/titlebar.sci b/examples/demos/twitter/qml/twitter/TwitterCore/images/titlebar.sci deleted file mode 100644 index 0418d94c..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/images/titlebar.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 10 -border.top: 12 -border.bottom: 12 -border.right: 10 -source: titlebar.png diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/images/toolbutton.png b/examples/demos/twitter/qml/twitter/TwitterCore/images/toolbutton.png deleted file mode 100644 index 11310013..00000000 Binary files a/examples/demos/twitter/qml/twitter/TwitterCore/images/toolbutton.png and /dev/null differ diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/images/toolbutton.sci b/examples/demos/twitter/qml/twitter/TwitterCore/images/toolbutton.sci deleted file mode 100644 index 9e4f9653..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/images/toolbutton.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 15 -border.top: 4 -border.bottom: 4 -border.right: 15 -source: toolbutton.png diff --git a/examples/demos/twitter/qml/twitter/TwitterCore/qmldir b/examples/demos/twitter/qml/twitter/TwitterCore/qmldir deleted file mode 100644 index 84d85c28..00000000 --- a/examples/demos/twitter/qml/twitter/TwitterCore/qmldir +++ /dev/null @@ -1,10 +0,0 @@ -SearchView 1.0 SearchView.qml -Button 1.0 Button.qml -Input 1.0 Input.qml -FatDelegate 1.0 FatDelegate.qml -Loading 1.0 Loading.qml -MultiTitleBar 1.0 MultiTitleBar.qml -TitleBar 1.0 TitleBar.qml -RssModel 1.0 RssModel.qml -UserModel 1.0 UserModel.qml -ToolBar 1.0 ToolBar.qml diff --git a/examples/demos/twitter/qml/twitter/twitter.qml b/examples/demos/twitter/qml/twitter/twitter.qml deleted file mode 100644 index 5d4cd885..00000000 --- a/examples/demos/twitter/qml/twitter/twitter.qml +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import "TwitterCore" 1.0 as Twitter - -Item { - id: screen; width: 320; height: 480 - property bool userView : false - property variant tmpStr - function setUser(str){hack.running = true; tmpStr = str} - function reallySetUser(){rssModel.from = tmpStr;rssModel.to = ""; rssModel.phrase = ""} - state:"searchquery" - //Workaround for bug 260266 - Timer{ interval: 1; running: false; repeat: false; onTriggered: screen.reallySetUser(); id:hack } - Keys.onEscapePressed: screen.state="searchquery" - Keys.onBacktabPressed: screen.state="searchquery" - Rectangle { - id: background - anchors.fill: parent; color: "#343434"; - - state:"searchquery" - Image { source: "TwitterCore/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } - - MouseArea { - anchors.fill: parent - onClicked: screen.focus = false; - } - - Twitter.RssModel { id: rssModel } - Twitter.Loading { anchors.centerIn: parent; visible: rssModel.status==XmlListModel.Loading && state!='unauthed'} - Text { - width: 180 - text: "Could not access twitter using this screen name and password pair."; - color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap - visible: rssModel.status==XmlListModel.Error; anchors.centerIn: parent - } - - Item { - id: views - x: 2; width: parent.width - 4 - y:60 //Below the title bars - height: parent.height - 100 - - Text { - id:title - text: "Search Twitter" - anchors.horizontalCenter: parent.horizontalCenter - font.pixelSize: 20; font.bold: true; color: "#bbb"; style: Text.Raised; styleColor: "black" - opacity:0 - } - - Twitter.SearchView{ - id: searchView - anchors.verticalCenter: parent.verticalCenter - width: parent.width; height: parent.height-60; - x: -(screen.width * 1.5) - } - - Twitter.FatDelegate { id: fatDelegate } - ListView { - id: mainView; model: rssModel.model; delegate: fatDelegate; - width: parent.width; height: parent.height; x: 0; cacheBuffer: 100; - } - } - - Twitter.MultiTitleBar { id: titleBar; width: parent.width } - Twitter.ToolBar { id: toolBar; height: 40; - //anchors.bottom: parent.bottom; - //TODO: Use anchor changes instead of hard coding - y: screen.height - 40 - width: parent.width; opacity: 0.9 - button1Label: "New Search" - button2Label: "Update" - onButton1Clicked: - { - screen.state="searchquery" - } - onButton2Clicked: rssModel.reload(); - } - } - states: [ - State { - name: "searchquery"; - PropertyChanges { target: searchView; x: 0; focus:true} - PropertyChanges { target: mainView; x: -(parent.width * 1.5) } - PropertyChanges { target: titleBar; y: -80 } - PropertyChanges { target: toolBar; y: screen.height } - PropertyChanges { target: toolBar } - PropertyChanges { target: title; opacity:1} - } - ] - transitions: [ - Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutQuad } } - ] -} diff --git a/examples/demos/twitter/twitter.desktop b/examples/demos/twitter/twitter.desktop deleted file mode 100644 index 5d1b851b..00000000 --- a/examples/demos/twitter/twitter.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=twitter -Exec=/opt/twitter/bin/twitter -Icon=twitter64 -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/demos/twitter/twitter.pro b/examples/demos/twitter/twitter.pro deleted file mode 100644 index c2beb0e3..00000000 --- a/examples/demos/twitter/twitter.pro +++ /dev/null @@ -1,24 +0,0 @@ -# Add more folders to ship with the application, here -folder_01.source = qml/twitter -folder_01.target = qml -DEPLOYMENTFOLDERS = folder_01 - -# Additional import path used to resolve QML modules in Creator's code model -QML_IMPORT_PATH = - -# If your application uses the Qt Mobility libraries, uncomment the following -# lines and add the respective components to the MOBILITY variable. -# CONFIG += mobility -# MOBILITY += - -# Speed up launching on MeeGo/Harmattan when using applauncherd daemon -# CONFIG += qdeclarative-boostable - -# The .cpp file which was generated for your project. Feel free to hack it. -SOURCES += main.cpp - -# Please do not modify the following two lines. Required for deployment. -desktopInstallPrefix=$$[QT_INSTALL_EXAMPLES]/qtquick1/demos/twitter -exists(qmlapplicationviewer/qmlapplicationviewer.pri):include(qmlapplicationviewer/qmlapplicationviewer.pri) -else:include(../../helper/qmlapplicationviewer/qmlapplicationviewer.pri) -qtcAddDeployment() diff --git a/examples/demos/twitter/twitter.qmlproject b/examples/demos/twitter/twitter.qmlproject deleted file mode 100644 index 3b360cf2..00000000 --- a/examples/demos/twitter/twitter.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "qml/twitter" - } - JavaScriptFiles { - directory: "qml/twitter" - } - ImageFiles { - directory: "qml/twitter" - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/demos/twitter/twitter.svg b/examples/demos/twitter/twitter.svg deleted file mode 100644 index 566acfad..00000000 --- a/examples/demos/twitter/twitter.svg +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/examples/demos/twitter/twitter64.png b/examples/demos/twitter/twitter64.png deleted file mode 100644 index 707d5c4e..00000000 Binary files a/examples/demos/twitter/twitter64.png and /dev/null differ diff --git a/examples/demos/twitter/twitter80.png b/examples/demos/twitter/twitter80.png deleted file mode 100644 index 6ad8096c..00000000 Binary files a/examples/demos/twitter/twitter80.png and /dev/null differ diff --git a/examples/demos/twitter/twitter_harmattan.desktop b/examples/demos/twitter/twitter_harmattan.desktop deleted file mode 100644 index 40a4a1bc..00000000 --- a/examples/demos/twitter/twitter_harmattan.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=twitter -Exec=/usr/bin/single-instance /opt/twitter/bin/twitter -Icon=/usr/share/icons/hicolor/80x80/apps/twitter80.png -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/examples.pro b/examples/examples.pro index 0d688669..baae4bb9 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,6 +1,4 @@ TEMPLATE = subdirs SUBDIRS += \ - declarative \ - demos \ - helper + declarative diff --git a/examples/helper/deployment.pri b/examples/helper/deployment.pri deleted file mode 100644 index 8dba8025..00000000 --- a/examples/helper/deployment.pri +++ /dev/null @@ -1,133 +0,0 @@ -# The code below handles deployment to Android and Maemo, aswell as copying -# of the application data to shadow build directories on desktop. -# It is recommended not to modify this file, since newer versions of Qt Creator -# may offer an updated version of it. - -defineTest(qtcAddDeployment) { -for(deploymentfolder, DEPLOYMENTFOLDERS) { - item = item$${deploymentfolder} - greaterThan(QT_MAJOR_VERSION, 4) { - itemsources = $${item}.files - } else { - itemsources = $${item}.sources - } - $$itemsources = $$eval($${deploymentfolder}.source) - itempath = $${item}.path - $$itempath= $$eval($${deploymentfolder}.target) - export($$itemsources) - export($$itempath) - DEPLOYMENT += $$item -} - -MAINPROFILEPWD = $$_PRO_FILE_PWD_ - -android { - installPrefix = /assets - x86 { - target.path = /libs/x86 - } else: armeabi-v7a { - target.path = /libs/armeabi-v7a - } else { - target.path = /libs/armeabi - } -} else:maemo5 { - installPrefix = /opt/$${TARGET} - target.path = $${installPrefix}/bin - desktopfile.files = $${TARGET}.desktop - desktopfile.path = /usr/share/applications/hildon - icon.files = $${TARGET}64.png - icon.path = /usr/share/icons/hicolor/64x64/apps -} else:!isEmpty(MEEGO_VERSION_MAJOR) { - installPrefix = /opt/$${TARGET} - target.path = $${installPrefix}/bin - desktopfile.files = $${TARGET}_harmattan.desktop - desktopfile.path = /usr/share/applications - icon.files = $${TARGET}80.png - icon.path = /usr/share/icons/hicolor/80x80/apps -} else { # Assumed to be a Desktop Unix, Windows, or Mac - installPrefix = $$desktopInstallPrefix - target.path = $${installPrefix} - sources.files = *.cpp *.h *.desktop *.png *.pro *.qml *.qmlproject *.svg *.qrc - sources.path = $$desktopInstallPrefix - export(sources.files) - export(sources.path) - INSTALLS += sources - copyCommand = - win32 { - for(deploymentfolder, DEPLOYMENTFOLDERS) { - source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) - source = $$replace(source, /, \\) - sourcePathSegments = $$split(source, \\) - target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments) - target = $$replace(target, /, \\) - target ~= s,\\\\\\.?\\\\,\\, - !isEqual(source,$$target) { - !isEmpty(copyCommand):copyCommand += && - isEqual(QMAKE_DIR_SEP, \\) { - copyCommand += $(COPY_DIR) \"$$source\" \"$$target\" - } else { - source = $$replace(source, \\\\, /) - target = $$OUT_PWD/$$eval($${deploymentfolder}.target) - target = $$replace(target, \\\\, /) - copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\" - } - } - } - } else { - for(deploymentfolder, DEPLOYMENTFOLDERS) { - source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) - source = $$replace(source, \\\\, /) - macx { - target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) - } else { - target = $$OUT_PWD/$$eval($${deploymentfolder}.target) - } - target = $$replace(target, \\\\, /) - sourcePathSegments = $$split(source, /) - targetFullPath = $$target/$$last(sourcePathSegments) - targetFullPath ~= s,/\\.?/,/, - !isEqual(source,$$targetFullPath) { - !isEmpty(copyCommand):copyCommand += && - copyCommand += $(MKDIR) \"$$target\" - copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\" - } - } - } - !isEmpty(copyCommand) { - copyCommand = @echo Copying application data... && $$copyCommand - copydeploymentfolders.commands = $$copyCommand - first.depends = $(first) copydeploymentfolders - export(first.depends) - export(copydeploymentfolders.commands) - QMAKE_EXTRA_TARGETS += first copydeploymentfolders - } -} - -for(deploymentfolder, DEPLOYMENTFOLDERS) { - item = item$${deploymentfolder} - itemfiles = $${item}.files - $$itemfiles = $$eval($${deploymentfolder}.source) - itempath = $${item}.path - $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target) - export($$itemfiles) - export($$itempath) - INSTALLS += $$item -} - -!isEmpty(desktopfile.path) { - export(icon.files) - export(icon.path) - export(desktopfile.files) - export(desktopfile.path) - INSTALLS += icon desktopfile -} - -export(target.path) -INSTALLS += target - -export (ICON) -export (INSTALLS) -export (DEPLOYMENT) -export (LIBS) -export (QMAKE_EXTRA_TARGETS) -} diff --git a/examples/helper/helper.pro b/examples/helper/helper.pro deleted file mode 100644 index 5b55497a..00000000 --- a/examples/helper/helper.pro +++ /dev/null @@ -1,9 +0,0 @@ -TEMPLATE = subdirs - -# the helpers simply need a make install target, but require no compilation -sources.files = \ - qmlapplicationviewer \ - deployment.pri \ - helper.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick1/helper -INSTALLS += sources diff --git a/examples/helper/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/helper/qmlapplicationviewer/qmlapplicationviewer.cpp deleted file mode 100644 index 05d481be..00000000 --- a/examples/helper/qmlapplicationviewer/qmlapplicationviewer.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlapplicationviewer.h" - -#include -#include -#include -#include -#include -#include - -#include // MEEGO_EDITION_HARMATTAN - -#ifdef HARMATTAN_BOOSTER -#include -#endif - -#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 - -#include - -#if !defined(NO_JSDEBUGGER) -#include -#endif -#if !defined(NO_QMLOBSERVER) -#include -#endif - -// Enable debugging before any QDeclarativeEngine is created -struct QmlJsDebuggingEnabler -{ - QmlJsDebuggingEnabler() - { - QDeclarativeDebugHelper::enableDebugging(); - } -}; - -// Execute code in constructor before first QDeclarativeEngine is instantiated -static QmlJsDebuggingEnabler enableDebuggingHelper; - -#endif // QMLJSDEBUGGER - -class QmlApplicationViewerPrivate -{ - QString mainQmlFile; - friend class QmlApplicationViewer; - static QString adjustPath(const QString &path); -}; - -QString QmlApplicationViewerPrivate::adjustPath(const QString &path) -{ -#ifdef Q_OS_MAC - if (!QDir::isAbsolutePath(path)) - return QString::fromLatin1("%1/../Resources/%2") - .arg(QCoreApplication::applicationDirPath(), path); -#elif defined(Q_OS_QNX) - if (!QDir::isAbsolutePath(path)) - return QString::fromLatin1("app/native/%1").arg(path); -#elif !defined(Q_OS_ANDROID) - QString pathInInstallDir = - QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; - pathInInstallDir = - QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; -#endif - return path; -} - -QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) - : QDeclarativeView(parent) - , d(new QmlApplicationViewerPrivate()) -{ - connect(engine(), SIGNAL(quit()), SLOT(close())); - setResizeMode(QDeclarativeView::SizeRootObjectToView); - - // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in -#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 -#if !defined(NO_JSDEBUGGER) - new QmlJSDebugger::JSDebuggerAgent(engine()); -#endif -#if !defined(NO_QMLOBSERVER) - new QmlJSDebugger::QDeclarativeViewObserver(this, this); -#endif -#endif -} - -QmlApplicationViewer::~QmlApplicationViewer() -{ - delete d; -} - -QmlApplicationViewer *QmlApplicationViewer::create() -{ - return new QmlApplicationViewer(); -} - -void QmlApplicationViewer::setMainQmlFile(const QString &file) -{ - d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); -#ifdef Q_OS_ANDROID - setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); -#else - setSource(QUrl::fromLocalFile(d->mainQmlFile)); -#endif -} - -void QmlApplicationViewer::addImportPath(const QString &path) -{ - engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); -} - -void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) -{ - // TODO: Needs a Qt5 implementation - Q_UNUSED(orientation) -} - -void QmlApplicationViewer::showExpanded() -{ -#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) - showFullScreen(); -#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) - showMaximized(); -#else - show(); -#endif -} - -QApplication *createApplication(int &argc, char **argv) -{ -#ifdef HARMATTAN_BOOSTER - return MDeclarativeCache::qApplication(argc, argv); -#else - return new QApplication(argc, argv); -#endif -} diff --git a/examples/helper/qmlapplicationviewer/qmlapplicationviewer.h b/examples/helper/qmlapplicationviewer/qmlapplicationviewer.h deleted file mode 100644 index be12f6a8..00000000 --- a/examples/helper/qmlapplicationviewer/qmlapplicationviewer.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLAPPLICATIONVIEWER_H -#define QMLAPPLICATIONVIEWER_H - -#include - -class QmlApplicationViewer : public QDeclarativeView -{ - Q_OBJECT - -public: - enum ScreenOrientation { - ScreenOrientationLockPortrait, - ScreenOrientationLockLandscape, - ScreenOrientationAuto - }; - - explicit QmlApplicationViewer(QWidget *parent = 0); - virtual ~QmlApplicationViewer(); - - static QmlApplicationViewer *create(); - - void setMainQmlFile(const QString &file); - void addImportPath(const QString &path); - - // Note that this will only have an effect on Fremantle. - void setOrientation(ScreenOrientation orientation); - - void showExpanded(); - -private: - class QmlApplicationViewerPrivate *d; -}; - -QApplication *createApplication(int &argc, char **argv); - -#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/helper/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/helper/qmlapplicationviewer/qmlapplicationviewer.pri deleted file mode 100644 index 3218a12d..00000000 --- a/examples/helper/qmlapplicationviewer/qmlapplicationviewer.pri +++ /dev/null @@ -1,24 +0,0 @@ -# This file was generated by the Qt Quick Application wizard of Qt Creator. -# The code below adds the QmlApplicationViewer to the project and handles the -# activation of QML debugging. -# It is recommended not to modify this file, since newer versions of Qt Creator -# may offer an updated version of it. - -QT += declarative - -SOURCES += $$PWD/qmlapplicationviewer.cpp -HEADERS += $$PWD/qmlapplicationviewer.h -INCLUDEPATH += $$PWD - -# Include JS debugger library if QMLJSDEBUGGER_PATH is set -!isEmpty(QMLJSDEBUGGER_PATH) { - include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) -} else { - DEFINES -= QMLJSDEBUGGER -} - -contains(CONFIG,qdeclarative-boostable):contains(MEEGO_EDITION,harmattan) { - DEFINES += HARMATTAN_BOOSTER -} - -include(../deployment.pri) diff --git a/examples/tutorials/gettingStarted/gsQml/core/button.qml b/examples/tutorials/gettingStarted/gsQml/core/button.qml deleted file mode 100644 index 1c31f661..00000000 --- a/examples/tutorials/gettingStarted/gsQml/core/button.qml +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -import QtQuick 1.0 - -Rectangle { - //identifier of the item - id: button - - //these properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - //attaches to the Text element's text content - property string label - property color textColor: buttonLabel.color - - //the color highlight when the mouse hovers on the rectangle - property color onHoverColor: "lightsteelblue" - property color borderColor: "transparent" - - //buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - property real labelSize: 14 - - //set appearance properties - radius: 6 - smooth: true - border { width: 2; color: borderColor } - width: buttonWidth; height: buttonHeight - - Text { - id: buttonLabel - anchors.centerIn: parent - text: label //bind the text to the parent's text - color: "#DCDCCC" - font.pointSize: labelSize - } - - //buttonClick() is callable and a signal handler, onButtonClick is automatically created - signal buttonClick() - - //define the clickable area to be the whole rectangle - MouseArea { - id: buttonMouseArea - anchors.fill: parent //stretch the area to the parent's dimension - onClicked: buttonClick() - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - } - - //change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor - //animate the color whenever the color property changes - Behavior on color { ColorAnimation{ duration: 55 } } - - //scale the button when pressed - scale: buttonMouseArea.pressed ? 1.1 : 1.00 - //Animate the scale property change - Behavior on scale { NumberAnimation{ duration: 55 } } - -} diff --git a/examples/tutorials/gettingStarted/gsQml/core/editMenu.qml b/examples/tutorials/gettingStarted/gsQml/core/editMenu.qml deleted file mode 100644 index 8dc7b246..00000000 --- a/examples/tutorials/gettingStarted/gsQml/core/editMenu.qml +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -import QtQuick 1.0 - -Rectangle { - id: editMenu - height: 480; width:1000 - color: "powderblue" - property color buttonBorderColor: "#7A8182" - property color buttonFillColor: "#61BDCACD" - property string menuName:"Edit" - gradient: Gradient { - GradientStop { position: 0.0; color: "#6A7570" } - GradientStop { position: 1.0; color: Qt.darker("#6A7570") } - } - - Rectangle { - id:actionContainer - color:"transparent" - anchors.centerIn: parent - width: parent.width; height: parent.height / 5 - Row { - anchors.centerIn: parent - spacing: parent.width/9 - Button { - id: loadButton - buttonColor: buttonFillColor - label: "Copy" - labelSize: 16 - borderColor: buttonBorderColor - height: actionContainer.height; width: actionContainer.width/6 - onButtonClick: textArea.copy() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button { - id: saveButton - height: actionContainer.height; width: actionContainer.width/6 - buttonColor: buttonFillColor - label: "Paste" - borderColor: buttonBorderColor - labelSize: 16 - onButtonClick: textArea.paste() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button { - id: exitButton - label: "Select All" - height: actionContainer.height; width: actionContainer.width/6 - labelSize: 16 - buttonColor: buttonFillColor - borderColor:buttonBorderColor - onButtonClick: textArea.selectAll() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/core/fileDialog.qml b/examples/tutorials/gettingStarted/gsQml/core/fileDialog.qml deleted file mode 100644 index b2f845c3..00000000 --- a/examples/tutorials/gettingStarted/gsQml/core/fileDialog.qml +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id:dialog - height: 200 * partition; width: 200 - color: "transparent" - - signal selectChanged() - signal notifyRefresh() - onNotifyRefresh:dirView.model = directory.files - - property string selectedFile - property int selectedIndex: 0 - - Rectangle { - id: dirBox - radius: 10 - anchors.centerIn:parent - height: parent.height -15; width: parent.width -30 - - Rectangle { - id:header - height: parent.height*0.1; width: parent.width - radius:3 - z:1 - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.98;color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#0e1B20" } - } - Text { - height: header.height; anchors.centerIn: header - text: "files:" - color: "lightblue" - font.weight: Font.Light - font.italic: true - } - } - GridView { - id:dirView - width:parent.width; height:parent.height*.9 - anchors.top: header.bottom - cellWidth: 100; cellHeight: 75 - model: directory.files - delegate: dirDelegate - clip: true - highlightMoveDuration: 40 - } - Component { - id: dirDelegate - Rectangle { - id:file - color: "transparent" - width: file.GridView.view.cellWidth; height: file.GridView.view.cellHeight - - Text { - id:fileName - width: parent.width - anchors.centerIn: parent - text: name - color: "#BDCACD" - font.weight: file.GridView.view.currentIndex == index ? Font.DemiBold : Font.Normal - font.pointSize: file.GridView.view.currentIndex == index ? 12 : 10 - elide: Text.ElideMiddle - horizontalAlignment: Text.AlignHCenter - } - Rectangle { - id: selection - width: parent.width; height: parent.height - anchors.centerIn: parent - radius: 10 - smooth: true - scale: file.GridView.view.currentIndex == index ? 1 : 0.5 - opacity: file.GridView.view.currentIndex == index ? 1 : 0 - Text { - id: overlay - width: parent.width - anchors.centerIn: parent - text: name - color: "#696167" - font.weight: Font.DemiBold - font.pointSize: 12 - smooth: true - elide: Text.ElideMiddle - horizontalAlignment: Text.AlignHCenter - } - Behavior on opacity { NumberAnimation{ duration: 45 } } - Behavior on scale { NumberAnimation{ duration: 45 } } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter("lightsteelblue",1.25) } - GradientStop { position: 0.67; color: Qt.darker("lightsteelblue",1.3) } - } - border.color: "lightsteelblue" - border.width: 1 - } - MouseArea { - id:fileMouseArea - anchors.fill:parent - hoverEnabled: true - - onClicked: { - file.GridView.view.currentIndex = index - selectedFile = directory.files[index].name - selectChanged() - } - onEntered: { - fileName.color = "lightsteelblue" - fileName.font.weight = Font.DemiBold - } - onExited: { - fileName.font.weight = Font.Normal - fileName.color = "#BDCACD" - } - } - } - } - gradient: Gradient { - GradientStop { position: 0.0; color: "#A5333333" } - GradientStop { position: 1.0; color: "#03333333" } - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/core/fileMenu.qml b/examples/tutorials/gettingStarted/gsQml/core/fileMenu.qml deleted file mode 100644 index 87391893..00000000 --- a/examples/tutorials/gettingStarted/gsQml/core/fileMenu.qml +++ /dev/null @@ -1,232 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: fileMenu - height: 480; width:1000 - property color buttonBorderColor: "#7F8487" - property color buttonFillColor: "#8FBDCACD" - property string fileContent:directory.fileContent - - //the menuName is accessible from outside this QML file - property string menuName: "File" - - //used to divide the screen into parts. - property real partition: 1/3 - - color: "#6C646A" - gradient: Gradient { - GradientStop { position: 0.0; color: "#6C646A" } - GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } - } - - Directory { - id:directory - filename: textInput.text - onDirectoryChanged:fileDialog.notifyRefresh() - } - - Rectangle { - id:actionContainer - - //make this rectangle invisible - color:"transparent" - anchors.left: parent.left - - //the height is a good proportion that creates more space at the top of - //the column of buttons - width: fileMenu.width * partition; height: fileMenu.height - - Column { - anchors.centerIn: parent - spacing: parent.height/32 - Button { - id: saveButton - label: "Save" - borderColor: buttonBorderColor - buttonColor: buttonFillColor - width: actionContainer.width/ 1.3 - height:actionContainer.height / 8 - labelSize:24 - onButtonClick: { - directory.fileContent = textArea.textContent - directory.filename = textInput.text - directory.saveFile() - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button { - id: loadButton - width: actionContainer.width/ 1.3 - height:actionContainer.height/ 8 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - label: "Load" - labelSize:24 - onButtonClick:{ - directory.filename = textInput.text - directory.loadFile() - textArea.textContent = directory.fileContent - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button { - id: newButton - width: actionContainer.width/ 1.3 - height: actionContainer.height/ 8 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - label: "New" - labelSize: 24 - onButtonClick:{ - textArea.textContent = "" - textInput.text = "" - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - - } - Rectangle { - id: space - width: actionContainer.width/ 1.3 - height: actionContainer.height / 16 - color: "transparent" - } - Button { - id: exitButton - width: actionContainer.width/ 1.3 - height: actionContainer.height/ 8 - label: "Exit" - labelSize: 24 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - onButtonClick: Qt.quit() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - } - } - Rectangle { - id:dialogContainer - - width: 2*fileMenu.width * partition; height: fileMenu.height - anchors.right:parent.right - color: "transparent" - - Column { - anchors.centerIn: parent - spacing: parent.height /640 - FileDialog { - id:fileDialog - height: 2*dialogContainer.height * partition - width: dialogContainer.width - onSelectChanged: textInput.text = selectedFile - } - - Rectangle { - id:lowerPartition - height: dialogContainer.height * partition; width: dialogContainer.width - color: "transparent" - - Rectangle { - id: nameField - gradient: Gradient { - GradientStop { position: 0.0; color: "#806F6F6F" } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - radius: 10 - anchors { centerIn:parent; leftMargin: 15; rightMargin: 15; topMargin: 15 } - height: parent.height-15 - width: parent.width -20 - border { color: "#4A4A4A"; width:1 } - - TextInput { - id: textInput - z:2 - anchors { bottom: parent.bottom; topMargin: 10; horizontalCenter: parent.horizontalCenter } - width: parent.width - 10 - height: parent.height -10 - font.pointSize: 40 - color: "lightsteelblue" - focus: true - } - Text { - id: textInstruction - anchors.centerIn: parent - text: "Select file name and press save or load" - font {pointSize: 11; weight: Font.Light; italic: true} - color: "lightblue" - z: 2 - opacity: (textInput.text == "") ? 1 : 0 - } - Text { - id:fieldLabel - anchors { top: parent.top; left: parent.left } - text: " file name: " - font { pointSize: 11; weight: Font.Light; italic: true } - color: "lightblue" - z:2 - } - MouseArea { - anchors.centerIn:parent - width: nameField.width; height: nameField.height - onClicked: { - textInput.text = "" - textInput.focus = true - textInput.forceFocus() - } - } - } - } - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/core/menuBar.qml b/examples/tutorials/gettingStarted/gsQml/core/menuBar.qml deleted file mode 100644 index 8ddb03ae..00000000 --- a/examples/tutorials/gettingStarted/gsQml/core/menuBar.qml +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: menuBar - width: 1000; height:300 - color:"transparent" - property color fileColor: "plum" - property color editColor: "powderblue" - - property real partition: 1/10 - - Column { - anchors.fill: parent - //container for the header and the buttons - z: 1 - Rectangle { - id: labelList - height:menuBar.height*partition - width: menuBar.width - color: "beige" - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.98;color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#0e1B20" } - } - Text { - height: parent.height - anchors { right: labelRow.left ; verticalCenter: parent.bottom } - text: "menu: " - color: "lightblue" - font { weight: Font.Light; italic: true } - smooth: true - } - //row displays its children in a vertical row - Row { - id: labelRow - anchors.centerIn: parent - spacing:40 - Button { - id: fileButton - height: 20; width: 50 - label: "File" - buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) - scale: menuListView.currentIndex == 0? 1.25: 1 - labelSize: menuListView.currentIndex == 0? 16:12 - radius: 1 - smooth:true - //on a button click, change the list's currently selected item to FileMenu - onButtonClick: menuListView.currentIndex = 0 - gradient: Gradient { - GradientStop { position: 0.0; color: fileColor } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - } - Button { - id: editButton - height: 20; width: 50 - buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9) - scale: menuListView.currentIndex == 1? 1.25: 1 - label: "Edit" - radius: 1 - labelSize: menuListView.currentIndex == 1? 16:12 - smooth:true - //on a button click, change the list's currently selected item to EditMenu - onButtonClick: menuListView.currentIndex = 1 - gradient: Gradient { - GradientStop { position: 0.0; color: editColor } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - } - } - } - - //list view will display a model according to a delegate - ListView { - id: menuListView - width:menuBar.width; height: 9*menuBar.height*partition - - //the model contains the data - model: menuListModel - - //control the movement of the menu switching - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 5000 - highlightFollowsCurrentItem: true - highlightMoveDuration:240 - highlightRangeMode: ListView.StrictlyEnforceRange - } - } - //a list of visual items already have delegates handling their display - VisualItemModel { - id: menuListModel - - FileMenu { - id:fileMenu - width: menuListView.width; height: menuListView.height - color: fileColor - } - EditMenu { - color: editColor - width: menuListView.width; height: menuListView.height - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/core/qmldir b/examples/tutorials/gettingStarted/gsQml/core/qmldir deleted file mode 100644 index 32dc8071..00000000 --- a/examples/tutorials/gettingStarted/gsQml/core/qmldir +++ /dev/null @@ -1,9 +0,0 @@ -Button ./button.qml -FileDialog ./fileDialog.qml -TextArea ./textArea.qml -TextEditor ./textEditor.qml -EditMenu ./editMenu.qml -MenuBar ./menuBar.qml -FileMenu ./fileMenu.qml - -plugin FileDialog ../plugins diff --git a/examples/tutorials/gettingStarted/gsQml/core/textArea.qml b/examples/tutorials/gettingStarted/gsQml/core/textArea.qml deleted file mode 100644 index 6e392ac9..00000000 --- a/examples/tutorials/gettingStarted/gsQml/core/textArea.qml +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id:textArea - - function paste() { textEdit.paste() } - function copy() { textEdit.copy() } - function selectAll() { textEdit.selectAll() } - - width :400; height:400 - - property color fontColor: "white" - property alias textContent: textEdit.text - Flickable { - id: flickArea - width: parent.width; height: parent.height - anchors.fill:parent - - boundsBehavior: Flickable.StopAtBounds - flickableDirection: Flickable.HorizontalFlick - interactive: true - //Will move the text Edit area to make the area visible when - //scrolled with keyboard strokes - function ensureVisible(r) { - if (contentX >= r.x) - contentX = r.x; - else if (contentX+width <= r.x+r.width) - contentX = r.x+r.width-width; - if (contentY >= r.y) - contentY = r.y; - else if (contentY+height <= r.y+r.height) - contentY = r.y+r.height-height; - } - - TextEdit { - id: textEdit - anchors.fill:parent - width:parent.width; height:parent.height - color:fontColor - focus: true - wrapMode: TextEdit.Wrap - font.pointSize:10 - onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) - selectByMouse: true - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp b/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp deleted file mode 100644 index bc711932..00000000 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "dialogPlugin.h" -#include "directory.h" -#include "file.h" -#include - -void DialogPlugin::registerTypes(const char *uri) -{ - //register the class Directory into QML as a "Directory" element version 1.0 - qmlRegisterType(uri, 1, 0, "Directory"); - qmlRegisterType(uri,1,0,"File"); -} diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h b/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h deleted file mode 100644 index e87b7e82..00000000 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DIALOGPLUGIN_H -#define DIALOGPLUGIN_H - -#include - -class DialogPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "filedialog.json") - - public: - //registerTypes is inherited from QDeclarativeExtensionPlugin - void registerTypes(const char *uri); - -}; - -#endif - diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp b/examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp deleted file mode 100644 index fe5018b1..00000000 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "directory.h" -#include - -/* -Directory constructor - -Initialize the saves directory and creates the file list -*/ -Directory::Directory(QObject *parent) : QObject(parent) -{ - m_dir.cd( QDir::currentPath() ); - - //go to the saved directory. if not found, create save directory - m_saveDir = "saves"; - if ( m_dir.cd(m_saveDir) == 0 ) { - m_dir.mkdir(m_saveDir); - m_dir.cd(m_saveDir); - } - m_filterList << "*.txt"; - refresh(); -} - -/* -Directory::filesNumber -Return the number of Files -*/ -int Directory::filesCount() const -{ - return m_fileList.size(); -} - -/* -Function called to append data onto list property -*/ -void appendFiles(QDeclarativeListProperty * property, File * file) -{ - Q_UNUSED(property); - Q_UNUSED(file); - //Do nothing. can't add to a directory using this method -} - -/* -Function called to retrieve file in the list using an index -*/ -File* fileAt(QDeclarativeListProperty * property, int index) -{ - return static_cast< QList *>(property->data)->at(index); -} - -/* -Returns the number of files in the list -*/ -int filesSize(QDeclarativeListProperty * property) -{ - return static_cast< QList *>(property->data)->size(); -} - -/* -Function called to empty the list property contents -*/ -void clearFilesPtr(QDeclarativeListProperty *property) -{ - return static_cast< QList *>(property->data)->clear(); -} - -/* -Returns the list of files as a QDeclarativeListProperty. -*/ -QDeclarativeListProperty Directory::files() -{ - refresh(); - return QDeclarativeListProperty( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr ); -} - -/* -Return the name of the currently selected file -*/ -QString Directory::filename() const -{ - return currentFile.name(); -} - -/* -Return the file's content as a string. -*/ -QString Directory::fileContent() const -{ - return m_fileContent; -} - -/* -Set the file name of the current file -*/ -void Directory::setFilename(const QString &str) -{ - if( str != currentFile.name() ) { - currentFile.setName(str); - emit filenameChanged(); - } -} - -/* -Set the content of the file as a string -*/ -void Directory::setFileContent(const QString &str) -{ - if(str != m_fileContent){ - m_fileContent = str; - emit fileContentChanged(); - } -} - -/* -Called from QML to save the file using the filename and file content. -Saving makes sure that the file has a .txt extension. -*/ -void Directory::saveFile() -{ - if(currentFile.name().size() == 0){ - qWarning()<< "Empty filename. no save"; - return; - } - QString extendedName = currentFile.name(); - if(!currentFile.name().endsWith(".txt")){ - extendedName.append(".txt"); - } - QFile file( m_dir.filePath(extendedName) ); - if ( file.open(QFile::WriteOnly | QFile::Truncate) ) { - QTextStream outStream(&file); - outStream << m_fileContent; - } - file.close(); - refresh(); - emit directoryChanged(); -} - -/* -Load the contents of a file. -Only loads files with a .txt extension -*/ -void Directory::loadFile() -{ - m_fileContent.clear(); - QString extendedName = currentFile.name(); - if( !currentFile.name().endsWith(".txt") ) { - extendedName.append(".txt"); - } - - QFile file( m_dir.filePath(extendedName) ); - if ( file.open(QFile::ReadOnly ) ) { - QTextStream inStream(&file); - - QString line; - do { - line = inStream.read(75); - m_fileContent.append(line); - } while ( !line.isNull() ) ; - } - file.close(); -} - -/* -Reloads the content of the files list. This is to ensure that the newly -created files are added onto the list. -*/ -void Directory::refresh() -{ - m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name); - m_fileList.clear(); - - File * file; - for(int i = 0; i < m_dirFiles.size() ; i ++) { - file = new File(); - - if( m_dirFiles.at(i).endsWith(".txt") ) { - QString name = m_dirFiles.at(i); - file->setName( name.remove(".txt",Qt::CaseSensitive) ); - } - else { - file->setName(m_dirFiles.at(i)); - } - m_fileList.append(file); - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/directory.h b/examples/tutorials/gettingStarted/gsQml/filedialog/directory.h deleted file mode 100644 index 90e15781..00000000 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/directory.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DIRECTORY_H -#define DIRECTORY_H - -#include "file.h" - -#include -#include -#include -#include -#include - -class Directory : public QObject { - - Q_OBJECT - - //number of files in the directory - Q_PROPERTY(int filesCount READ filesCount) - - //list property containing file names as QString - Q_PROPERTY(QDeclarativeListProperty files READ files CONSTANT ) - - //file name of the text file to read/write - Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) - - //text content of the file - Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) - - public: - Directory(QObject *parent = 0); - - //properties' read functions - int filesCount() const; - QString filename() const; - QString fileContent() const; - QDeclarativeListProperty files(); - - //properties' write functions - void setFilename(const QString &str); - void setFileContent(const QString &str); - - //accessible from QML - Q_INVOKABLE void saveFile(); - Q_INVOKABLE void loadFile(); - - signals: - void directoryChanged(); - void filenameChanged(); - void fileContentChanged(); - - private: - QDir m_dir; - QStringList m_dirFiles; - File currentFile; - QString m_saveDir; - QStringList m_filterList; - - //contains the file data in QString format - QString m_fileContent; - - //Registered to QML in a plugin. Accessible from QML as a property of Directory - QList m_fileList; - - //refresh content of the directory - void refresh(); -}; - -#endif diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp b/examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp deleted file mode 100644 index 7921489c..00000000 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include "file.h" - -File::File(QObject *parent) : QObject(parent) -{ - m_name = ""; -} - -QString File::name() const{ - return m_name; -} -void File::setName(const QString &str){ - if(str != m_name){ - m_name = str; - emit nameChanged(); - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/file.h b/examples/tutorials/gettingStarted/gsQml/filedialog/file.h deleted file mode 100644 index ee93aa2e..00000000 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/file.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef FILE_H -#define FILE_H - - -#include -#include - -class File : public QObject{ - - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - - public: - File(QObject *parent = 0); - - QString name() const; - void setName(const QString &str); - - signals: - void nameChanged(); - - private: - QString m_name; -}; - -#endif diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/filedialog.json b/examples/tutorials/gettingStarted/gsQml/filedialog/filedialog.json deleted file mode 100644 index 0967ef42..00000000 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/filedialog.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/filedialog.pro b/examples/tutorials/gettingStarted/gsQml/filedialog/filedialog.pro deleted file mode 100644 index d85787d0..00000000 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/filedialog.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = lib -CONFIG += qt plugin -QT += declarative - -DESTDIR += ../plugins -OBJECTS_DIR = tmp -MOC_DIR = tmp - -TARGET = FileDialog - -HEADERS += directory.h \ - file.h \ - dialogPlugin.h - -SOURCES += directory.cpp \ - file.cpp \ - dialogPlugin.cpp diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/qmldir b/examples/tutorials/gettingStarted/gsQml/filedialog/qmldir deleted file mode 100644 index c2b27dad..00000000 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin FileDialog plugins diff --git a/examples/tutorials/gettingStarted/gsQml/images/arrow.png b/examples/tutorials/gettingStarted/gsQml/images/arrow.png deleted file mode 100644 index 14978c2e..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/images/arrow.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml deleted file mode 100644 index 0794e8a2..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [document] -import QtQuick 1.0 - -Rectangle { - id: simplebutton - color: "grey" - width: 150; height: 75 - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: "button label" - } -} -//! [document] diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part1/Button.qml deleted file mode 100644 index 1048711a..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part1/Button.qml +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - - //identifier of the item - id: button - - property string label: "button label" - - //these properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - //the color highlight when the mouse hovers on the rectangle - property color onHoverColor: "gold" - property color borderColor: "white" - - //buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - //set appearance properties - radius: 10 - smooth: true - border{color: "white"; width: 3} - width: buttonWidth; height: buttonHeight - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: label - } - - //buttonClick() is callable and a signal handler, onButtonClick is automatically created - signal buttonClick() - onButtonClick: { - console.log(buttonLabel.text + " clicked" ) - } - - //define the clickable area to be the whole rectangle - MouseArea{ - id: buttonMouseArea - anchors.fill: parent //stretch the area to the parent's dimension - onClicked: buttonClick() - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - } - - //change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml deleted file mode 100644 index cf5e481d..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: editMenu - height: 480; width:1000 - color: "powderblue" - property string menuName:"Edit" - - Rectangle{ - id:actionContainer - color:"transparent" - anchors.centerIn: parent - - width: parent.width; height: parent.height / 5 - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Cut" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Paste" - } - Button{ - id: exitButton - label: "Select All" - buttonColor: "darkgrey" - } - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml deleted file mode 100644 index b74ea0e4..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: fileMenu - - //the menuName is accessible from outside this QML file - property string menuName: "File" - - //generous amount of screen space that will allow the buttons to fit - height: 480; width:1000 - - color: "#6C646A" - - //a sub-rectangle allows the flexibility of setting the row area - Rectangle{ - id:actionContainer - - //make this rectangle invisible - color:"transparent" - anchors.centerIn: parent - - //the height is a good proportion that creates more space at the top of the row of buttons - width: parent.width; height: parent.height / 5 - - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Load" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Save" - } - Button{ - id: exitButton - label: "Exit" - buttonColor: "darkgrey" - - //exit the application if the exitButton is clicked - onButtonClick:{ - Qt.quit() - } - } - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml b/examples/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml deleted file mode 100644 index a1512e0b..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - - //identifier of the item - id: simplebutton - - //the rectangle's fill color - color: "grey" - - //dimensions of the button - width: 150; height: 75 - - //A text element contains functionalities for creating texts - Text { - id: buttonLabel - - //center the text inside the parent - anchors.centerIn: parent - - //text property binds to the label displayed on the button - text: "button label" - } - - //define the clickable area to be the whole rectangle - MouseArea { - id: buttonMouseArea - anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors - - //onClicked handles valid mouse button clicks - onClicked: console.log(buttonLabel.text + " clicked" ) - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png deleted file mode 100644 index aab64bcf..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png deleted file mode 100644 index d3ff66f2..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png deleted file mode 100644 index f2e2b0d9..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png deleted file mode 100644 index 21ce5092..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject deleted file mode 100644 index d4909f86..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part2/Button.qml deleted file mode 100644 index 744d4bf4..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part2/Button.qml +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - - //identifier of the item - id: button - - property string label: "button label" - - //these properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - //the color highlight when the mouse hovers on the rectangle - property color onHoverColor: "gold" - property color borderColor: "white" - - //buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - //set appearance properties - radius:10 - smooth: true - border{color: "white"; width: 3} - width: buttonWidth; height: buttonHeight - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: label - } - - //buttonClick() is callable and a signal handler, onButtonClick is automatically created - signal buttonClick() - onButtonClick: { - console.log(buttonLabel.text + " clicked" ) - } - - //define the clickable area to be the whole rectangle - MouseArea{ - id: buttonMouseArea - anchors.fill: parent //stretch the area to the parent's dimension - onClicked: buttonClick() - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - - } - - //change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml deleted file mode 100644 index 20f88545..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: editMenu - height: 480; width:1000 - color: "powderblue" - property string menuName:"Edit" - - Rectangle{ - id:actionContainer - color:"transparent" - anchors.centerIn: parent - - width: parent.width; height: parent.height / 5 - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Cut" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Paste" - } - Button{ - id: exitButton - label: "Select All" - buttonColor: "darkgrey" - } - } - } - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml deleted file mode 100644 index 75aac68b..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: fileMenu - - //the menuName is accessible from outside this QML file - property string menuName: "File" - - //generous amount of screen space that will allow the buttons to fit - height: 480; width:1000 - - color: "#6C646A" - - //a sub-rectangle allows the flexibility of setting the row area - Rectangle{ - id:actionContainer - - //make this rectangle invisible - color:"transparent" - anchors.centerIn: parent - - //the height is a good proportion that creates more space at the top of the row of buttons - width: parent.width; height: parent.height / 5 - - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Load" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Save" - } - Button{ - id: exitButton - label: "Exit" - buttonColor: "darkgrey" - - //exit the application if the exitButton is clicked - onButtonClick:{ - Qt.quit() - } - } - } - } - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml deleted file mode 100644 index c53196a4..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: menuBar - width: 1000 - height:300 - - property color fileColor: "thistle" - property color editColor: "powderblue" - - //container for the header and the buttons - Rectangle{ - - id: labelList - height:parent.height/10 - width: parent.width - color: "steelblue" - - //default z is 0, items with higher z values are shown on top of items with lower z values - z: 1 - - //row displays its children in a vertical row - Row{ - anchors.centerIn: parent - spacing:40 - Button{ - height: 20 - width: 50 - label: "File" - id: fileButton - buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) - scale: menuListView.currentIndex == 0? 1.25: 1 - radius: 1 - - //on a button click, change the list's currently selected item to FileMenu - onButtonClick: { - menuListView.currentIndex = 0 - } - } - Button{ - height: 20 - width: 50 - id: editButton - buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) - scale: menuListView.currentIndex == 1? 1.25: 1 - label: "Edit" - radius: 1 - - //on a button click, change the list's currently selected item to EditMenu - onButtonClick: { - menuListView.currentIndex = 1 - } - - - } - - - } - } - - //a list of visual items already have delegates handling their display - VisualItemModel{ - id: menuListModel - - FileMenu{ - width: menuListView.width - height: menuBar.height - color: fileColor - } - EditMenu{ - color: editColor - width: menuListView.width - height: menuBar.height - - } - } - - //list view will display a model according to a delegate - ListView{ - id: menuListView - anchors.fill:parent - anchors.bottom: parent.bottom - width:parent.width - height: parent.height - - //the model contains the data - model: menuListModel - - //control the movement of the menu switching - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 5000 - highlightFollowsCurrentItem: true - highlightMoveDuration:240 - highlightRangeMode: ListView.StrictlyEnforceRange - } - - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png b/examples/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png deleted file mode 100644 index da959a34..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject deleted file mode 100644 index d4909f86..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/Button.qml deleted file mode 100644 index 744d4bf4..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part3/Button.qml +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - - //identifier of the item - id: button - - property string label: "button label" - - //these properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - //the color highlight when the mouse hovers on the rectangle - property color onHoverColor: "gold" - property color borderColor: "white" - - //buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - //set appearance properties - radius:10 - smooth: true - border{color: "white"; width: 3} - width: buttonWidth; height: buttonHeight - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: label - } - - //buttonClick() is callable and a signal handler, onButtonClick is automatically created - signal buttonClick() - onButtonClick: { - console.log(buttonLabel.text + " clicked" ) - } - - //define the clickable area to be the whole rectangle - MouseArea{ - id: buttonMouseArea - anchors.fill: parent //stretch the area to the parent's dimension - onClicked: buttonClick() - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - - } - - //change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml deleted file mode 100644 index 20f88545..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: editMenu - height: 480; width:1000 - color: "powderblue" - property string menuName:"Edit" - - Rectangle{ - id:actionContainer - color:"transparent" - anchors.centerIn: parent - - width: parent.width; height: parent.height / 5 - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Cut" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Paste" - } - Button{ - id: exitButton - label: "Select All" - buttonColor: "darkgrey" - } - } - } - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml deleted file mode 100644 index 75aac68b..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: fileMenu - - //the menuName is accessible from outside this QML file - property string menuName: "File" - - //generous amount of screen space that will allow the buttons to fit - height: 480; width:1000 - - color: "#6C646A" - - //a sub-rectangle allows the flexibility of setting the row area - Rectangle{ - id:actionContainer - - //make this rectangle invisible - color:"transparent" - anchors.centerIn: parent - - //the height is a good proportion that creates more space at the top of the row of buttons - width: parent.width; height: parent.height / 5 - - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Load" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Save" - } - Button{ - id: exitButton - label: "Exit" - buttonColor: "darkgrey" - - //exit the application if the exitButton is clicked - onButtonClick:{ - Qt.quit() - } - } - } - } - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml deleted file mode 100644 index c53196a4..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: menuBar - width: 1000 - height:300 - - property color fileColor: "thistle" - property color editColor: "powderblue" - - //container for the header and the buttons - Rectangle{ - - id: labelList - height:parent.height/10 - width: parent.width - color: "steelblue" - - //default z is 0, items with higher z values are shown on top of items with lower z values - z: 1 - - //row displays its children in a vertical row - Row{ - anchors.centerIn: parent - spacing:40 - Button{ - height: 20 - width: 50 - label: "File" - id: fileButton - buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) - scale: menuListView.currentIndex == 0? 1.25: 1 - radius: 1 - - //on a button click, change the list's currently selected item to FileMenu - onButtonClick: { - menuListView.currentIndex = 0 - } - } - Button{ - height: 20 - width: 50 - id: editButton - buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) - scale: menuListView.currentIndex == 1? 1.25: 1 - label: "Edit" - radius: 1 - - //on a button click, change the list's currently selected item to EditMenu - onButtonClick: { - menuListView.currentIndex = 1 - } - - - } - - - } - } - - //a list of visual items already have delegates handling their display - VisualItemModel{ - id: menuListModel - - FileMenu{ - width: menuListView.width - height: menuBar.height - color: fileColor - } - EditMenu{ - color: editColor - width: menuListView.width - height: menuBar.height - - } - } - - //list view will display a model according to a delegate - ListView{ - id: menuListView - anchors.fill:parent - anchors.bottom: parent.bottom - width:parent.width - height: parent.height - - //the model contains the data - model: menuListModel - - //control the movement of the menu switching - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 5000 - highlightFollowsCurrentItem: true - highlightMoveDuration:240 - highlightRangeMode: ListView.StrictlyEnforceRange - } - - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml deleted file mode 100644 index 4b09eff5..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id:textArea - - width :400 - height:400 - color: "white" - - Flickable{ - id: flickArea - - width: parent.width - height: parent.height - anchors.fill:parent - - function ensureVisible(r){ - if (contentX >= r.x) - contentX = r.x; - else if (contentX+width <= r.x+r.width) - contentX = r.x+r.width-width; - if (contentY >= r.y) - contentY = r.y; - else if (contentY+height <= r.y+r.height) - contentY = r.y+r.height-height; - } - - TextEdit{ - id: textEditor - anchors.fill:parent - width:parent.width; height:parent.height - color:"midnightblue" - focus: true - - wrapMode: TextEdit.Wrap - - onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml deleted file mode 100644 index 61beb1c6..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - - id: screen - width: 1000; height: 1000 - border.color:"black" - //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar - property int partition: height/3 - - MenuBar{ - id:menuBar - height: partition - width:parent.width - z: 1 - } - - - TextArea{ - id:textArea - anchors.bottom:parent.bottom - y: partition - color: "azure" - height: partition*2 - width:parent.width - } - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png b/examples/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png deleted file mode 100644 index 14978c2e..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png b/examples/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png deleted file mode 100644 index d0623b5a..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject deleted file mode 100644 index d4909f86..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/Button.qml deleted file mode 100644 index e0ba7ed7..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part4/Button.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - - //identifier of the item - id: button - - //these properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - //attaches to the Text element's text content - property string label - property color textColor: buttonLabel.color - - //the color highlight when the mouse hovers on the rectangle - property color onHoverColor: "gold" - property color borderColor: "white" - - //buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - //set appearance properties - radius:10 - smooth: true - border.color: "white" - border.width: 3 - width: buttonWidth; height: buttonHeight - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: label //"button label" //bind the text to the parent's text - } - - //buttonClick() is callable and a signal handler, onButtonClick is automatically created - signal buttonClick() - onButtonClick: { - console.log(buttonLabel.text + " clicked" ) - } - - //define the clickable area to be the whole rectangle - MouseArea{ - id: buttonMouseArea - anchors.fill: parent //stretch the area to the parent's dimension - onClicked: buttonClick() - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - - } - - //change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor - //animate the color whenever the color property changes - Behavior on color { ColorAnimation{ duration: 55} } - - //scale the button when pressed - scale: buttonMouseArea.pressed ? 1.1 : 1.00 - //Animate the scale property change - Behavior on scale { NumberAnimation{ duration: 55} } - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml deleted file mode 100644 index 7177ed25..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: editMenu - height: 480; width:1000 - color: "powderblue" - property string menuName:"Edit" - gradient: Gradient{ - GradientStop { position: 0.0; color: "#6A6F70" } - GradientStop { position: 1.0; color: Qt.darker("#6A6D67") } - } - - Rectangle{ - id:actionContainer - color:"transparent" - anchors.centerIn: parent - - width: parent.width; height: parent.height / 5 - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Cut" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Paste" - } - Button{ - id: exitButton - label: "Select All" - buttonColor: "darkgrey" - } - } - } - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml deleted file mode 100644 index f897be60..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: fileMenu - - //the menuName is accessible from outside this QML file - property string menuName: "File" - - //generous amount of screen space that will allow the buttons to fit - height: 480; width:1000 - - color: "#6C646A" - gradient: Gradient{ - GradientStop { position: 0.0; color: "#6C646A" } - GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } - } - - //a sub-rectangle allows the flexibility of setting the row area - Rectangle{ - id:actionContainer - - //make this rectangle invisible - color:"transparent" - anchors.centerIn: parent - - //the height is a good proportion that creates more space at the top of the row of buttons - width: parent.width; height: parent.height / 5 - - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Load" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Save" - } - Button{ - id: exitButton - label: "Exit" - buttonColor: "darkgrey" - - //exit the application if the exitButton is clicked - onButtonClick:{ - Qt.quit() - } - } - } - } - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml deleted file mode 100644 index 7dbb1c9a..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: menuBar - width: 1000 - height:300 - - property color fileColor: "plum" - property color editColor: "powderblue" - - //container for the header and the buttons - Rectangle{ - - id: labelList - height:parent.height/10 - width: parent.width - color: "beige" - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.98;color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#0e1B20" } - } - - //default z is 0, items with higher z values are shown on top of items with lower z values - z: 1 - - //row displays its children in a vertical row - Row{ - anchors.centerIn: parent - spacing:40 - Button{ - height: 20 - width: 50 - label: "File" - id: fileButton - buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) - scale: menuListView.currentIndex == 0? 1.25: 1 - radius: 1 - - //on a button click, change the list's currently selected item to FileMenu - onButtonClick: { - menuListView.currentIndex = 0 - } - } - Button{ - height: 20 - width: 50 - id: editButton - buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) - scale: menuListView.currentIndex == 1? 1.25: 1 - label: "Edit" - radius: 1 - - //on a button click, change the list's currently selected item to EditMenu - onButtonClick: { - menuListView.currentIndex = 1 - } - - - } - - - } - } - - //a list of visual items already have delegates handling their display - VisualItemModel{ - id: menuListModel - - FileMenu{ - width: menuListView.width - height: menuBar.height - color: fileColor - } - EditMenu{ - color: editColor - width: menuListView.width - height: menuBar.height - - } - } - - //list view will display a model according to a delegate - ListView{ - id: menuListView - anchors.fill:parent - anchors.bottom: parent.bottom - width:parent.width - height: parent.height - - //the model contains the data - model: menuListModel - - //control the movement of the menu switching - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 5000 - highlightFollowsCurrentItem: true - highlightMoveDuration:240 - highlightRangeMode: ListView.StrictlyEnforceRange - } - - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml deleted file mode 100644 index df28ba3f..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: simplebutton - color: "grey" - width: 150; height: 75 - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: "button label" - } - - MouseArea{ - id: buttonMouseArea - anchors.fill: parent - onClicked: console.log(buttonLabel.text + " clicked" ) - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml deleted file mode 100644 index f83e5d49..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id:textArea - - width :400 - height:400 - property color fontColor: "white" - - Flickable{ - id: flickArea - - width: parent.width - height: parent.height - anchors.fill:parent - - function ensureVisible(r){ - if (contentX >= r.x) - contentX = r.x; - else if (contentX+width <= r.x+r.width) - contentX = r.x+r.width-width; - if (contentY >= r.y) - contentY = r.y; - else if (contentY+height <= r.y+r.height) - contentY = r.y+r.height-height; - } - - TextEdit{ - id: textEditor - anchors.fill:parent - width:parent.width; height:parent.height - color:fontColor - focus: true - - wrapMode: TextEdit.Wrap - - onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml deleted file mode 100644 index 35d0e88c..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: screen - width: 1000; height: 1000 - property int partition: height/3 - state: "DRAWER_CLOSED" - - - //Item 1: MenuBar on the top portion of the screen - MenuBar{ - id:menuBar - height: partition - //anchors.top:parent.top - width:parent.width - z:1 - } - - - //Item 2: The editable text area - TextArea{ - id:textArea - y:drawer.height - border.color: Qt.darker(color, 1.4) - border.width: 2 - color: "#3F3F3F" - fontColor: "#DCDCCC" - height: partition*2 - width:parent.width - } - - //Item 3: The drawer handle - Rectangle{ - id:drawer - height:15 - width: parent.width - border.color : "#6A6D6A" - border.width: 1 - - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.77; color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#6A6D6A" } - } - - Image{ - id: arrowIcon - source: "images/arrow.png" - anchors.horizontalCenter: parent.horizontalCenter - - Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} - } - - MouseArea{ - id: drawerMouseArea - anchors.fill:parent - onClicked:{ - if (screen.state == "DRAWER_CLOSED"){ - screen.state = "DRAWER_OPEN" - console.log("drawer OPEN") - } - else if (screen.state == "DRAWER_OPEN"){ - screen.state = "DRAWER_CLOSED" - console.log("drawer closed") - } - } - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = Qt.lighter("#6A6D6A") - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = "#6A6D6A" - } - - } - states:[ - State{ - name: "DRAWER_OPEN" - PropertyChanges { target: menuBar; y:0} - PropertyChanges { target: textArea; y: partition + drawer.height} - PropertyChanges { target: drawer; y: partition} - PropertyChanges { target: arrowIcon; rotation: 180} - }, - State{ - name: "DRAWER_CLOSED" - PropertyChanges { target: menuBar; y:-partition} - PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} - PropertyChanges { target: drawer; y: 0} - PropertyChanges { target: arrowIcon; rotation: 0} - } - - ] - transitions: [ - Transition{ - to: "*" - NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } - NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } - NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } - } - - ] -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png b/examples/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png deleted file mode 100644 index 14978c2e..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png b/examples/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png deleted file mode 100644 index a195fb87..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject deleted file mode 100644 index d4909f86..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml deleted file mode 100644 index 84d8d874..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import "core" - -Rectangle { - id: screen - width: 1000; height: 1000 - property int partition: height/3 - state: "DRAWER_CLOSED" - - //Item 1: MenuBar on the top portion of the screen - MenuBar{ - id:menuBar - height: screen.partition; width: screen.width - z:1 - } - //Item 2: The editable text area - TextArea{ - id:textArea - y:drawer.height - color: "#3F3F3F" - fontColor: "#DCDCCC" - height: partition*2; width:parent.width - } - //Item 3: The drawer handle - Rectangle{ - id:drawer - height:15; width: parent.width - border.color : "#6A6D6A" - border.width: 1 - z:1 - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.77; color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#6A6D6A" } - } - Image{ - id: arrowIcon - source: "images/arrow.png" - anchors.horizontalCenter: parent.horizontalCenter - - Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} - } - - MouseArea{ - id: drawerMouseArea - anchors.fill:parent - hoverEnabled: true - onEntered: parent.border.color = Qt.lighter("#6A6D6A") - onExited: parent.border.color = "#6A6D6A" - onClicked:{ - if (screen.state == "DRAWER_CLOSED"){ - screen.state = "DRAWER_OPEN" - } - else if (screen.state == "DRAWER_OPEN"){ - screen.state = "DRAWER_CLOSED" - } - } - } - } - - states:[ - State{ - name: "DRAWER_OPEN" - PropertyChanges { target: menuBar; y: 0} - PropertyChanges { target: textArea; y: partition + drawer.height} - PropertyChanges { target: drawer; y: partition} - PropertyChanges { target: arrowIcon; rotation: 180} - }, - State{ - name: "DRAWER_CLOSED" - PropertyChanges { target: menuBar; y:-height; } - PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} - PropertyChanges { target: drawer; y: 0} - PropertyChanges { target: arrowIcon; rotation: 0} - } - ] - - transitions: [ - Transition{ - to: "*" - NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } - NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } - NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } - } - ] -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml deleted file mode 100644 index 9c15a1aa..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - - //identifier of the item - id: button - - //these properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - //attaches to the Text element's text content - property string label - property color textColor: buttonLabel.color - - //the color highlight when the mouse hovers on the rectangle - property color onHoverColor: "lightsteelblue" - property color borderColor: "transparent" - - //buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - property real labelSize: 14 - //set appearance properties - radius:6 - smooth: true - border.width: 2 - border.color: borderColor - width: buttonWidth; height: buttonHeight - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: label //bind the text to the parent's text - color: "#DCDCCC" - font.pointSize: labelSize - } - - //buttonClick() is callable and a signal handler, onButtonClick is automatically created - signal buttonClick() - - //define the clickable area to be the whole rectangle - MouseArea{ - id: buttonMouseArea - anchors.fill: parent //stretch the area to the parent's dimension - onClicked: buttonClick() - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - - } - - //change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor - //animate the color whenever the color property changes - Behavior on color { ColorAnimation{ duration: 55} } - - //scale the button when pressed - scale: buttonMouseArea.pressed ? 1.1 : 1.00 - //Animate the scale property change - Behavior on scale { NumberAnimation{ duration: 55} } - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml deleted file mode 100644 index 1677440f..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: editMenu - height: 480; width:1000 - color: "powderblue" - property color buttonBorderColor: "#7A8182" - property color buttonFillColor: "#61BDCACD" - property string menuName:"Edit" - - gradient: Gradient{ - GradientStop { position: 0.0; color: "#6A7570" } - GradientStop { position: 1.0; color: Qt.darker("#6A7570") } - } - - Rectangle{ - id:actionContainer - color:"transparent" - anchors.centerIn: parent - width: parent.width; height: parent.height / 5 - Row{ - anchors.centerIn: parent - spacing: parent.width/9 - Button{ - id: loadButton - buttonColor: buttonFillColor - label: "Copy" - labelSize:16 - borderColor:buttonBorderColor - height: actionContainer.height - width: actionContainer.width/6 - onButtonClick:textArea.copy() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - - Button{ - id: saveButton - height: actionContainer.height - width: actionContainer.width/6 - buttonColor: buttonFillColor - label: "Paste" - borderColor:buttonBorderColor - labelSize:16 - onButtonClick:textArea.paste() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button{ - id: exitButton - label: "Select All" - height: actionContainer.height - width: actionContainer.width/6 - labelSize:16 - buttonColor: buttonFillColor - borderColor:buttonBorderColor - onButtonClick:textArea.selectAll() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - } - } - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml deleted file mode 100644 index ca9e5c23..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id:dialog - height: 200 * partition; width: 200 - color: "transparent" - - signal selectChanged() - signal notifyRefresh() - onNotifyRefresh:dirView.model = directory.files - - property string selectedFile - property int selectedIndex: 0 - - Rectangle{ - id: dirBox - radius: 10 - anchors.centerIn:parent - height: parent.height -15; width: parent.width -30 - - Rectangle{ - id:header - height:parent.height*0.1 - width: parent.width - radius:3 - z:1 - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.98;color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#0e1B20" } - } - Text{ - height: header.height - anchors.centerIn: header - text: "files:" - color: "lightblue" - font.weight: Font.Light - font.italic: true - } - } - GridView{ - id:dirView - width:parent.width - height:parent.height*.9 - anchors.top: header.bottom - cellWidth: 100 - cellHeight: 75 -// highlight: Rectangle { width:cellWidth; height: cellHeight; color: "lightsteelblue" ;radius: 13} - model: directory.files - delegate: dirDelegate - clip: true - highlightMoveDuration:40 - } - - Component{ - id:dirDelegate - - Rectangle{ - id:file - color: "transparent" - width: file.GridView.view.cellWidth; height: file.GridView.view.cellHeight - - Text{ - id:fileName - width: parent.width - anchors.centerIn:parent - text: name - color: "#BDCACD" - font.weight: file.GridView.view.currentIndex == index ? Font.DemiBold : Font.Normal - font.pointSize: file.GridView.view.currentIndex == index ? 12 : 10 - elide: Text.ElideMiddle - horizontalAlignment: Text.AlignHCenter - } - Rectangle{ - id:selection - width:parent.width; height:parent.height - anchors.centerIn: parent - radius: 10 - smooth: true - scale: file.GridView.view.currentIndex == index ? 1 : 0.5 - opacity: file.GridView.view.currentIndex == index ? 1 : 0 - Text{ - id:overlay - width: parent.width - anchors.centerIn:parent - text: name - color: "#696167" - font.weight: Font.DemiBold - font.pointSize: 12 - smooth:true - elide: Text.ElideMiddle - horizontalAlignment: Text.AlignHCenter - } - Behavior on opacity{ NumberAnimation{ duration: 45} } - Behavior on scale { NumberAnimation{ duration: 45} } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter("lightsteelblue",1.25) } - GradientStop { position: 0.67; color: Qt.darker("lightsteelblue",1.3) } - } - border.color:"lightsteelblue" - border.width:1 - } - MouseArea{ - id:fileMouseArea - anchors.fill:parent - hoverEnabled: true - - onClicked:{ - file.GridView.view.currentIndex = index - selectedFile = directory.files[index].name - selectChanged() - } - onEntered:{ - fileName.color = "lightsteelblue" - fileName.font.weight = Font.DemiBold - } - onExited: { - fileName.font.weight = Font.Normal - fileName.color = "#BDCACD" - } - } - } - } - gradient: Gradient{ - GradientStop { position: 0.0; color: "#A5333333" } - GradientStop { position: 1.0; color: "#03333333" } - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml deleted file mode 100644 index c4bbad00..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml +++ /dev/null @@ -1,232 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: fileMenu - height: 480; width:1000 - property color buttonBorderColor: "#7F8487" - property color buttonFillColor: "#8FBDCACD" - property string fileContent:directory.fileContent - - //the menuName is accessible from outside this QML file - property string menuName: "File" - - //used to divide the screen into parts. - property real partition: 1/3 - - color: "#6C646A" - gradient: Gradient{ - GradientStop { position: 0.0; color: "#6C646A" } - GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } - } - - Directory{ - id:directory - filename: textInput.text - onDirectoryChanged:fileDialog.notifyRefresh() - } - - Rectangle{ - id:actionContainer - - //make this rectangle invisible - color:"transparent" - anchors.left: parent.left - - //the height is a good proportion that creates more space at the top of the column of buttons - width: fileMenu.width * partition; height: fileMenu.height - - Column{ - anchors.centerIn: parent - spacing: parent.height/32 - Button{ - id: saveButton - label: "Save" - borderColor: buttonBorderColor - buttonColor: buttonFillColor - width: actionContainer.width/ 1.3 - height:actionContainer.height / 8 - labelSize:24 - onButtonClick:{ - directory.fileContent = textArea.textContent - directory.filename = textInput.text - directory.saveFile() - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - - } - Button{ - id: loadButton - width: actionContainer.width/ 1.3 - height:actionContainer.height/ 8 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - label: "Load" - labelSize:24 - onButtonClick:{ - directory.filename = textInput.text - directory.loadFile() - textArea.textContent = directory.fileContent - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button{ - id: newButton - width: actionContainer.width/ 1.3 - height:actionContainer.height/ 8 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - label: "New" - labelSize:24 - onButtonClick:{ - textArea.textContent = "" - textInput.text = "" - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - - } - Rectangle{ - id: space - width: actionContainer.width/ 1.3 - height:actionContainer.height / 16 - color:"transparent" - } - Button{ - id: exitButton - width: actionContainer.width/ 1.3 - height:actionContainer.height/ 8 - label: "Exit" - labelSize:24 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - onButtonClick:Qt.quit() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - } - } - - Rectangle{ - id:dialogContainer - - width: 2*fileMenu.width * partition; height: fileMenu.height - anchors.right:parent.right - color:"transparent" - - Column { - anchors.centerIn: parent - spacing: parent.height /640 - FileDialog{ - id:fileDialog - height: 2*dialogContainer.height * partition; width: dialogContainer.width - onSelectChanged: textInput.text = selectedFile - } - - Rectangle{ - id:lowerPartition - height: dialogContainer.height * partition; width: dialogContainer.width - color: "transparent" - - Rectangle{ - id: nameField - gradient: Gradient{ - GradientStop { position: 0.0; color: "#806F6F6F" } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - - radius: 10 - anchors {centerIn:parent; leftMargin: 15; rightMargin: 15; topMargin: 15} - height: parent.height-15; width: parent.width -20 - border {color:"#4A4A4A"; width:1} - - TextInput{ - id: textInput - z:2 - anchors {bottom: parent.bottom; topMargin: 10; horizontalCenter:parent.horizontalCenter} - width: parent.width - 10 - height: parent.height -10 - font.pointSize: 40 - color:"lightsteelblue" - focus:true - } - Text{ - id: textInstruction - anchors.centerIn:parent - text: "Select file name and press save or load" - font {pointSize: 11; weight:Font.Light; italic: true} - color: "lightblue" - z:2 - opacity: (textInput.text == "") ? 1: 0 - } - Text{ - id:fieldLabel - anchors {top: parent.top; left: parent.left} - text: " file name: " - font {pointSize: 11; weight: Font.Light; italic: true} - color: "lightblue" - z:2 - } - MouseArea{ - anchors.centerIn:parent - width: nameField.width; height: nameField.height - onClicked:{ - textInput.text = "" - textInput.focus = true - textInput.forceFocus() - } - } - } - } - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml deleted file mode 100644 index db698518..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml +++ /dev/null @@ -1,148 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: menuBar - width: 1000; height:300 - color:"transparent" - property color fileColor: "plum" - property color editColor: "powderblue" - - property real partition: 1/10 - - Column{ - anchors.fill: parent - //container for the header and the buttons - z: 1 - Rectangle{ - id: labelList - height:menuBar.height*partition - width: menuBar.width - color: "beige" - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.98;color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#0e1B20" } - } - Text{ - height: parent.height - anchors {right: labelRow.left ; verticalCenter: parent.bottom} - text: "menu: " - color: "lightblue" - font {weight: Font.Light; italic: true} - smooth: true - } - - //row displays its children in a vertical row - Row{ - id: labelRow - anchors.centerIn: parent - spacing:40 - Button{ - id: fileButton - height: 20; width: 50 - label: "File" - buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) - scale: menuListView.currentIndex == 0? 1.25: 1 - labelSize: menuListView.currentIndex == 0? 16:12 - radius: 1 - smooth:true - //on a button click, change the list's currently selected item to FileMenu - onButtonClick: menuListView.currentIndex = 0 - gradient: Gradient{ - GradientStop { position: 0.0; color: fileColor } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - } - Button{ - id: editButton - height: 20; width: 50 - buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9) - scale: menuListView.currentIndex == 1? 1.25: 1 - label: "Edit" - radius: 1 - labelSize: menuListView.currentIndex == 1? 16:12 - smooth:true - //on a button click, change the list's currently selected item to EditMenu - onButtonClick: menuListView.currentIndex = 1 - gradient: Gradient{ - GradientStop { position: 0.0; color: editColor } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - } - } - } - - //list view will display a model according to a delegate - ListView{ - id: menuListView - width:menuBar.width; height: 9*menuBar.height*partition - - //the model contains the data - model: menuListModel - - //control the movement of the menu switching - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 5000 - highlightFollowsCurrentItem: true - highlightMoveDuration:240 - highlightRangeMode: ListView.StrictlyEnforceRange - } - } - //a list of visual items already have delegates handling their display - VisualItemModel{ - id: menuListModel - - FileMenu{ - id:fileMenu - width: menuListView.width; height: menuListView.height - color: fileColor - } - EditMenu{ - color: editColor - width: menuListView.width; height: menuListView.height - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml deleted file mode 100644 index 64a1bae6..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id:textArea - - function paste(){ textEdit.paste()} - function copy() { textEdit.copy() } - function selectAll() { textEdit.selectAll() } - - width :400; height:400 - - property color fontColor: "white" - property alias textContent: textEdit.text - Flickable{ - id: flickArea - width: parent.width; height: parent.height - anchors.fill:parent - - boundsBehavior: Flickable.StopAtBounds - flickableDirection: Flickable.HorizontalFlick - interactive: true - //Will move the text Edit area to make the area visible when scrolled with keyboard strokes - function ensureVisible(r){ - if (contentX >= r.x) - contentX = r.x; - else if (contentX+width <= r.x+r.width) - contentX = r.x+r.width-width; - if (contentY >= r.y) - contentY = r.y; - else if (contentY+height <= r.y+r.height) - contentY = r.y+r.height-height; - } - - TextEdit{ - id: textEdit - anchors.fill:parent - width:parent.width; height:parent.height - color:fontColor - focus: true - wrapMode: TextEdit.Wrap - font.pointSize:10 - onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) - selectByMouse: true - } - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir deleted file mode 100644 index 3f22778a..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir +++ /dev/null @@ -1,13 +0,0 @@ - -Button ./Button.qml -FileDialog ./FileDialog.qml -TextArea ./TextArea.qml -TextEditor ./TextEditor.qml -EditMenu ./EditMenu.qml -MenuBar ./MenuBar.qml - -plugin FileDialog ../plugins - - - - diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp deleted file mode 100644 index 286374d8..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "dialogPlugin.h" -#include "directory.h" -#include "file.h" -#include - -void DialogPlugin::registerTypes(const char *uri){ - - //register the class Directory into QML as a "Directory" element version 1.0 - qmlRegisterType(uri, 1, 0, "Directory"); - qmlRegisterType(uri,1,0,"File"); - - //qRegisterMetaType > ("QDeclarativeListProperty"); - -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h deleted file mode 100644 index ddcf82be..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DIALOGPLUGIN_H -#define DIALOGPLUGIN_H - -#include - -class DialogPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "filedialog.json") - - public: - //registerTypes is inherited from QDeclarativeExtensionPlugin - void registerTypes(const char *uri); - -}; - -#endif - diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp deleted file mode 100644 index c5f455c7..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "directory.h" -#include - -/* -Directory constructor - -Initialize the saves directory and creates the file list -*/ -Directory::Directory(QObject *parent) : QObject(parent) -{ - - - m_dir.cd( QDir::currentPath()); - - //go to the saved directory. if not found, create save directory - m_saveDir = "saves"; - if (m_dir.cd(m_saveDir) == 0){ - m_dir.mkdir(m_saveDir); - m_dir.cd(m_saveDir); - } - m_filterList << "*.txt"; - - refresh(); -} - -/* -Directory::filesNumber -Return the number of Files -*/ -int Directory:: filesCount() const{ - return m_fileList.size(); -} - -/* -Function called to append data onto list property -*/ -void appendFiles(QDeclarativeListProperty * property, File * file){ - //Do nothing. can't add to a directory using this method -} - -/* -Function called to retrieve file in the list using an index -*/ -File* fileAt(QDeclarativeListProperty * property, int index){ - return static_cast< QList *>(property->data)->at(index); -} - -/* -Returns the number of files in the list -*/ -int filesSize(QDeclarativeListProperty * property){ - return static_cast< QList *>(property->data)->size(); -} - -/* -Function called to empty the list property contents -*/ -void clearFilesPtr(QDeclarativeListProperty *property){ - return static_cast< QList *>(property->data)->clear(); -} - -/* -Returns the list of files as a QDeclarativeListProperty. -*/ -QDeclarativeListProperty Directory::files(){ - - refresh(); -// return QDeclarativeListProperty(this,m_filePtrList); //not recommended in the docs - return QDeclarativeListProperty( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr ); -} - -/* -Return te name of the currently selected file -*/ -QString Directory::filename() const{ - return currentFile.name(); -} - -/* -Return the file's content as a string. -*/ -QString Directory::fileContent() const{ - return m_fileContent; -} - -/* -Set the file name of the current file -*/ -void Directory::setFilename(const QString &str){ - if(str != currentFile.name()){ - currentFile.setName(str); - emit filenameChanged(); - } -} - -/* -Set the content of the file as a string -*/ -void Directory::setFileContent(const QString &str){ - if(str != m_fileContent){ - m_fileContent = str; - emit fileContentChanged(); - } -} - -/* -Called from QML to save the file using the filename and file content. -Saving makes sure that the file has a .txt extension. -*/ -void Directory::saveFile(){ - - if(currentFile.name().size() == 0){ - qWarning()<< "Empty filename. no save"; - return; - } - - QString extendedName = currentFile.name(); - if(!currentFile.name().endsWith(".txt")){ - extendedName.append(".txt"); - } - - QFile file( m_dir.filePath(extendedName) ); - if (file.open(QFile::WriteOnly | QFile::Truncate)){ - QTextStream outStream(&file); - outStream << m_fileContent; - } - file.close(); - refresh(); - emit directoryChanged(); -} - -/* -Load the contents of a file. -Only loads files with a .txt extension -*/ -void Directory::loadFile(){ - - m_fileContent.clear(); - QString extendedName = currentFile.name(); - if(!currentFile.name().endsWith(".txt")){ - extendedName.append(".txt"); - } - - QFile file( m_dir.filePath(extendedName) ); - if (file.open(QFile::ReadOnly )){ - QTextStream inStream(&file); - - QString line; - do{ - line = inStream.read(75); - m_fileContent.append(line); - }while (!line .isNull()); - } - file.close(); -} - -/* -Reloads the content of the files list. This is to ensure that the newly -created files are added onto the list. -*/ -void Directory::refresh(){ - m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name); - m_fileList.clear(); - - File * file; - for(int i = 0; i < m_dirFiles.size() ; i ++){ - - file = new File(); - - if(m_dirFiles.at(i).endsWith(".txt")){ - QString name = m_dirFiles.at(i); - file->setName( name.remove(".txt",Qt::CaseSensitive)); - } - else{ - file->setName(m_dirFiles.at(i)); - } - m_fileList.append(file); - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h deleted file mode 100644 index 1d01372e..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DIRECTORY_H -#define DIRECTORY_H - -#include "file.h" - -#include -#include -#include -#include -#include - -class Directory : public QObject{ - - Q_OBJECT - - //number of files in the directory - Q_PROPERTY(int filesCount READ filesCount) - - //list property containing file names as QString - Q_PROPERTY(QDeclarativeListProperty files READ files CONSTANT ) - - //file name of the text file to read/write - Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) - - //text content of the file - Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) - - public: - Directory(QObject *parent = 0); - - //properties' read functions - int filesCount() const; - QString filename() const; - QString fileContent() const; - QDeclarativeListProperty files(); - - //properties' write functions - void setFilename(const QString &str); - void setFileContent(const QString &str); - - //accessible from QML - Q_INVOKABLE void saveFile(); - Q_INVOKABLE void loadFile(); - - signals: - void directoryChanged(); - void filenameChanged(); - void fileContentChanged(); - - private: - QDir m_dir; - QStringList m_dirFiles; - File currentFile; - QString m_saveDir; - QStringList m_filterList; - - //contains the file data in QString format - QString m_fileContent; - - //Registered to QML in a plugin. Accessible from QML as a property of Directory - QList m_fileList; - - //refresh content of the directory - void refresh(); -}; - - -#endif diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp deleted file mode 100644 index 9da61921..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "file.h" - -File::File(QObject *parent) : QObject(parent) -{ - m_name = ""; -} - -QString File::name() const{ - return m_name; -} -void File::setName(const QString &str){ - if(str != m_name){ - m_name = str; - emit nameChanged(); - } -} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h deleted file mode 100644 index 76c192e3..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef FILE_H -#define FILE_H - - -#include -#include - -class File : public QObject{ - - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - - public: - File(QObject *parent = 0); - - QString name() const; - void setName(const QString &str); - - signals: - void nameChanged(); - - private: - QString m_name; -}; - -#endif diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.json b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.json deleted file mode 100644 index 0967ef42..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro deleted file mode 100644 index 62477470..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = lib -CONFIG += qt plugin -QT += declarative - -DESTDIR += ../plugins -OBJECTS_DIR = tmp -MOC_DIR = tmp - -TARGET = FileDialog - -HEADERS += directory.h \ - file.h \ - dialogPlugin.h - -SOURCES += directory.cpp \ - file.cpp \ - dialogPlugin.cpp diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir deleted file mode 100644 index c2b27dad..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin FileDialog plugins diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png b/examples/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png deleted file mode 100644 index 14978c2e..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png deleted file mode 100644 index 27feed5e..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png deleted file mode 100644 index 4d8f9f22..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png deleted file mode 100644 index 680acfe8..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject deleted file mode 100644 index ed034dff..00000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject +++ /dev/null @@ -1,18 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - directory: "core" - directory: "filedialog" - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - importPaths: [ " ./plugins " ] -} diff --git a/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_editmenu.png b/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_editmenu.png deleted file mode 100644 index 27feed5e..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_editmenu.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_filemenu.png b/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_filemenu.png deleted file mode 100644 index 4d8f9f22..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_filemenu.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_newfile.png b/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_newfile.png deleted file mode 100644 index 680acfe8..00000000 Binary files a/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_newfile.png and /dev/null differ diff --git a/examples/tutorials/gettingStarted/gsQml/texteditor.pro b/examples/tutorials/gettingStarted/gsQml/texteditor.pro deleted file mode 100644 index aa5306cc..00000000 --- a/examples/tutorials/gettingStarted/gsQml/texteditor.pro +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = \ - filedialog\ - diff --git a/examples/tutorials/gettingStarted/gsQml/texteditor.qml b/examples/tutorials/gettingStarted/gsQml/texteditor.qml deleted file mode 100644 index 84bb0c7d..00000000 --- a/examples/tutorials/gettingStarted/gsQml/texteditor.qml +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import "core" - -Rectangle { - id: screen - width: 1000; height: 1000 - property int partition: height/3 - border { width: 1; color: "#DCDCCC"} - state: "DRAWER_CLOSED" - - //Item 1: MenuBar on the top portion of the screen - MenuBar { - id:menuBar - height: screen.partition; width: screen.width - z: 1 - } - - //Item 2: The editable text area - TextArea { - id: textArea - y: drawer.height - color: "#3F3F3F" - fontColor: "#DCDCCC" - height: partition*2; width:parent.width - } - - //Item 3: The drawer handle - Rectangle { - id: drawer - height: 15; width: parent.width - border { color : "#6A6D6A"; width: 1 } - z: 1 - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.77; color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#6A6D6A" } - } - Image { - id: arrowIcon - source: "images/arrow.png" - anchors.horizontalCenter: parent.horizontalCenter - Behavior{ NumberAnimation { property: "rotation"; easing.type: Easing.OutExpo } } - } - - MouseArea { - id: drawerMouseArea - anchors.fill: parent - hoverEnabled: true - onEntered: parent.border.color = Qt.lighter("#6A6D6A") - onExited: parent.border.color = "#6A6D6A" - onClicked: { - if (screen.state == "DRAWER_CLOSED") { - screen.state = "DRAWER_OPEN" - } - else if (screen.state == "DRAWER_OPEN"){ - screen.state = "DRAWER_CLOSED" - } - } - } - } - -//! [states] - states:[ - State { - name: "DRAWER_OPEN" - PropertyChanges { target: menuBar; y: 0} - PropertyChanges { target: textArea; y: partition + drawer.height} - PropertyChanges { target: drawer; y: partition} - PropertyChanges { target: arrowIcon; rotation: 180} - }, - State { - name: "DRAWER_CLOSED" - PropertyChanges { target: menuBar; y:-height; } - PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height } - PropertyChanges { target: drawer; y: 0 } - PropertyChanges { target: arrowIcon; rotation: 0 } - } - ] -//! [states] - -//! [transitions] - transitions: [ - Transition { - to: "*" - NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } - NumberAnimation { target: menuBar; properties: "y"; duration: 100; easing.type: Easing.OutExpo } - NumberAnimation { target: drawer; properties: "y"; duration: 100; easing.type: Easing.OutExpo } - } - ] -//! [transitions] -} -- cgit v1.2.1